mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-17 23:55:21 +01:00
Change references from tetris to quad for 4-line clears
This commit is contained in:
parent
38163c33a3
commit
22fd887037
5 changed files with 27 additions and 36 deletions
|
@ -301,7 +301,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
statsManager.updateSessionStats(finalScore, gameBoard.lines, piecesPlaced, timePlayedMs, currentLevel)
|
statsManager.updateSessionStats(finalScore, gameBoard.lines, piecesPlaced, timePlayedMs, currentLevel)
|
||||||
|
|
||||||
// Handle progression - XP earned, potential level up
|
// Handle progression - XP earned, potential level up
|
||||||
val xpGained = progressionManager.calculateGameXP(finalScore, gameBoard.lines, currentLevel, timePlayedMs, statsManager.getSessionTetrises(), 0)
|
val xpGained = progressionManager.calculateGameXP(finalScore, gameBoard.lines, currentLevel, timePlayedMs, statsManager.getSessionQuads(), 0)
|
||||||
val newRewards = progressionManager.addXP(xpGained)
|
val newRewards = progressionManager.addXP(xpGained)
|
||||||
|
|
||||||
// Show progression screen if player earned XP
|
// Show progression screen if player earned XP
|
||||||
|
@ -472,7 +472,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
lines = gameBoard.lines,
|
lines = gameBoard.lines,
|
||||||
level = currentLevel,
|
level = currentLevel,
|
||||||
gameTime = gameTime,
|
gameTime = gameTime,
|
||||||
tetrisCount = statsManager.getSessionTetrises(),
|
quadCount = statsManager.getSessionQuads(),
|
||||||
perfectClearCount = 0 // Implement perfect clear tracking if needed
|
perfectClearCount = 0 // Implement perfect clear tracking if needed
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
binding.sessionSinglesText.text = getString(R.string.singles, statsManager.getSessionSingles())
|
binding.sessionSinglesText.text = getString(R.string.singles, statsManager.getSessionSingles())
|
||||||
binding.sessionDoublesText.text = getString(R.string.doubles, statsManager.getSessionDoubles())
|
binding.sessionDoublesText.text = getString(R.string.doubles, statsManager.getSessionDoubles())
|
||||||
binding.sessionTriplesText.text = getString(R.string.triples, statsManager.getSessionTriples())
|
binding.sessionTriplesText.text = getString(R.string.triples, statsManager.getSessionTriples())
|
||||||
binding.sessionTetrisesText.text = getString(R.string.tetrises, statsManager.getSessionTetrises())
|
binding.sessionQuadsText.text = getString(R.string.quads, statsManager.getSessionQuads())
|
||||||
|
|
||||||
// Flag to track if high score screen will be shown
|
// Flag to track if high score screen will be shown
|
||||||
var showingHighScore = false
|
var showingHighScore = false
|
||||||
|
@ -911,7 +911,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
statsManager.updateSessionStats(finalScore, gameBoard.lines, piecesPlaced, timePlayedMs, currentLevel)
|
statsManager.updateSessionStats(finalScore, gameBoard.lines, piecesPlaced, timePlayedMs, currentLevel)
|
||||||
|
|
||||||
// Handle progression - XP earned, potential level up
|
// Handle progression - XP earned, potential level up
|
||||||
val xpGained = progressionManager.calculateGameXP(finalScore, gameBoard.lines, currentLevel, timePlayedMs, statsManager.getSessionTetrises(), 0)
|
val xpGained = progressionManager.calculateGameXP(finalScore, gameBoard.lines, currentLevel, timePlayedMs, statsManager.getSessionQuads(), 0)
|
||||||
val newRewards = progressionManager.addXP(xpGained)
|
val newRewards = progressionManager.addXP(xpGained)
|
||||||
|
|
||||||
// Show progression screen if player earned XP
|
// Show progression screen if player earned XP
|
||||||
|
|
|
@ -78,7 +78,7 @@ class StatsActivity : AppCompatActivity() {
|
||||||
binding.totalSinglesText.setTextColor(textColor)
|
binding.totalSinglesText.setTextColor(textColor)
|
||||||
binding.totalDoublesText.setTextColor(textColor)
|
binding.totalDoublesText.setTextColor(textColor)
|
||||||
binding.totalTriplesText.setTextColor(textColor)
|
binding.totalTriplesText.setTextColor(textColor)
|
||||||
binding.totalTetrisesText.setTextColor(textColor)
|
binding.totalQuadsText.setTextColor(textColor)
|
||||||
binding.maxLevelText.setTextColor(textColor)
|
binding.maxLevelText.setTextColor(textColor)
|
||||||
binding.maxScoreText.setTextColor(textColor)
|
binding.maxScoreText.setTextColor(textColor)
|
||||||
binding.maxLinesText.setTextColor(textColor)
|
binding.maxLinesText.setTextColor(textColor)
|
||||||
|
@ -116,7 +116,7 @@ class StatsActivity : AppCompatActivity() {
|
||||||
binding.totalSinglesText.text = getString(R.string.singles, statsManager.getTotalSingles())
|
binding.totalSinglesText.text = getString(R.string.singles, statsManager.getTotalSingles())
|
||||||
binding.totalDoublesText.text = getString(R.string.doubles, statsManager.getTotalDoubles())
|
binding.totalDoublesText.text = getString(R.string.doubles, statsManager.getTotalDoubles())
|
||||||
binding.totalTriplesText.text = getString(R.string.triples, statsManager.getTotalTriples())
|
binding.totalTriplesText.text = getString(R.string.triples, statsManager.getTotalTriples())
|
||||||
binding.totalTetrisesText.text = getString(R.string.tetrises, statsManager.getTotalTetrises())
|
binding.totalQuadsText.text = getString(R.string.quads, statsManager.getTotalQuads())
|
||||||
|
|
||||||
// Update best performance stats
|
// Update best performance stats
|
||||||
binding.maxLevelText.text = getString(R.string.max_level, statsManager.getMaxLevel())
|
binding.maxLevelText.text = getString(R.string.max_level, statsManager.getMaxLevel())
|
||||||
|
|
|
@ -93,24 +93,15 @@ class PlayerProgressionManager(context: Context) {
|
||||||
/**
|
/**
|
||||||
* Calculate XP from a game session based on score, lines, level, etc.
|
* Calculate XP from a game session based on score, lines, level, etc.
|
||||||
*/
|
*/
|
||||||
fun calculateGameXP(score: Int, lines: Int, level: Int, gameTime: Long,
|
fun calculateGameXP(score: Int, lines: Int, level: Int, timePlayedMs: Long,
|
||||||
tetrisCount: Int, perfectClearCount: Int): Long {
|
quadCount: Int, perfectClearCount: Int): Long {
|
||||||
// Base XP from score with level multiplier (capped at level 10)
|
val scoreXP = score * SCORE_XP_MULTIPLIER
|
||||||
val cappedLevel = min(level, 10)
|
val linesXP = lines * LINES_XP_MULTIPLIER * level
|
||||||
val scoreXP = (score * (1 + LEVEL_MULTIPLIER * cappedLevel)).toLong()
|
val quadBonus = quadCount * QUAD_XP_BONUS * (1 - (level - 1) * 0.05).coerceAtLeast(0.5)
|
||||||
|
val perfectClearBonus = perfectClearCount * PERFECT_CLEAR_XP_BONUS
|
||||||
// XP from lines cleared (reduced for higher levels)
|
val timeBonus = (timePlayedMs / 1000) * TIME_XP_MULTIPLIER
|
||||||
val linesXP = lines * XP_PER_LINE * (1 - (level - 1) * 0.05).coerceAtLeast(0.5)
|
|
||||||
|
return (scoreXP + linesXP + quadBonus + perfectClearBonus + timeBonus).toLong()
|
||||||
// XP from special moves (reduced for higher levels)
|
|
||||||
val tetrisBonus = tetrisCount * TETRIS_XP_BONUS * (1 - (level - 1) * 0.05).coerceAtLeast(0.5)
|
|
||||||
val perfectClearBonus = perfectClearCount * PERFECT_CLEAR_XP_BONUS * (1 - (level - 1) * 0.05).coerceAtLeast(0.5)
|
|
||||||
|
|
||||||
// Time bonus (reduced for longer games)
|
|
||||||
val timeBonus = (gameTime / 60000) * TIME_XP_PER_MINUTE * (1 - (gameTime / 3600000) * 0.1).coerceAtLeast(0.5)
|
|
||||||
|
|
||||||
// Calculate total XP
|
|
||||||
return (scoreXP + linesXP + tetrisBonus + perfectClearBonus + timeBonus).toLong()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ class StatsManager(context: Context) {
|
||||||
private var totalSingles: Int = 0
|
private var totalSingles: Int = 0
|
||||||
private var totalDoubles: Int = 0
|
private var totalDoubles: Int = 0
|
||||||
private var totalTriples: Int = 0
|
private var totalTriples: Int = 0
|
||||||
private var totalTetrises: Int = 0
|
private var totalQuads: Int = 0
|
||||||
|
|
||||||
// Session stats
|
// Session stats
|
||||||
private var sessionScore: Int = 0
|
private var sessionScore: Int = 0
|
||||||
|
@ -33,7 +33,7 @@ class StatsManager(context: Context) {
|
||||||
private var sessionSingles: Int = 0
|
private var sessionSingles: Int = 0
|
||||||
private var sessionDoubles: Int = 0
|
private var sessionDoubles: Int = 0
|
||||||
private var sessionTriples: Int = 0
|
private var sessionTriples: Int = 0
|
||||||
private var sessionTetrises: Int = 0
|
private var sessionQuads: Int = 0
|
||||||
|
|
||||||
init {
|
init {
|
||||||
loadStats()
|
loadStats()
|
||||||
|
@ -53,7 +53,7 @@ class StatsManager(context: Context) {
|
||||||
totalSingles = prefs.getInt(KEY_TOTAL_SINGLES, 0)
|
totalSingles = prefs.getInt(KEY_TOTAL_SINGLES, 0)
|
||||||
totalDoubles = prefs.getInt(KEY_TOTAL_DOUBLES, 0)
|
totalDoubles = prefs.getInt(KEY_TOTAL_DOUBLES, 0)
|
||||||
totalTriples = prefs.getInt(KEY_TOTAL_TRIPLES, 0)
|
totalTriples = prefs.getInt(KEY_TOTAL_TRIPLES, 0)
|
||||||
totalTetrises = prefs.getInt(KEY_TOTAL_TETRISES, 0)
|
totalQuads = prefs.getInt(KEY_TOTAL_QUADS, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveStats() {
|
private fun saveStats() {
|
||||||
|
@ -69,7 +69,7 @@ class StatsManager(context: Context) {
|
||||||
.putInt(KEY_TOTAL_SINGLES, totalSingles)
|
.putInt(KEY_TOTAL_SINGLES, totalSingles)
|
||||||
.putInt(KEY_TOTAL_DOUBLES, totalDoubles)
|
.putInt(KEY_TOTAL_DOUBLES, totalDoubles)
|
||||||
.putInt(KEY_TOTAL_TRIPLES, totalTriples)
|
.putInt(KEY_TOTAL_TRIPLES, totalTriples)
|
||||||
.putInt(KEY_TOTAL_TETRISES, totalTetrises)
|
.putInt(KEY_TOTAL_QUADS, totalQuads)
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class StatsManager(context: Context) {
|
||||||
sessionSingles = 0
|
sessionSingles = 0
|
||||||
sessionDoubles = 0
|
sessionDoubles = 0
|
||||||
sessionTriples = 0
|
sessionTriples = 0
|
||||||
sessionTetrises = 0
|
sessionQuads = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateSessionStats(score: Int, lines: Int, pieces: Int, time: Long, level: Int) {
|
fun updateSessionStats(score: Int, lines: Int, pieces: Int, time: Long, level: Int) {
|
||||||
|
@ -108,8 +108,8 @@ class StatsManager(context: Context) {
|
||||||
totalTriples++
|
totalTriples++
|
||||||
}
|
}
|
||||||
4 -> {
|
4 -> {
|
||||||
sessionTetrises++
|
sessionQuads++
|
||||||
totalTetrises++
|
totalQuads++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class StatsManager(context: Context) {
|
||||||
fun getTotalSingles(): Int = totalSingles
|
fun getTotalSingles(): Int = totalSingles
|
||||||
fun getTotalDoubles(): Int = totalDoubles
|
fun getTotalDoubles(): Int = totalDoubles
|
||||||
fun getTotalTriples(): Int = totalTriples
|
fun getTotalTriples(): Int = totalTriples
|
||||||
fun getTotalTetrises(): Int = totalTetrises
|
fun getTotalQuads(): Int = totalQuads
|
||||||
|
|
||||||
// Getters for session stats
|
// Getters for session stats
|
||||||
fun getSessionScore(): Int = sessionScore
|
fun getSessionScore(): Int = sessionScore
|
||||||
|
@ -155,7 +155,7 @@ class StatsManager(context: Context) {
|
||||||
fun getSessionSingles(): Int = sessionSingles
|
fun getSessionSingles(): Int = sessionSingles
|
||||||
fun getSessionDoubles(): Int = sessionDoubles
|
fun getSessionDoubles(): Int = sessionDoubles
|
||||||
fun getSessionTriples(): Int = sessionTriples
|
fun getSessionTriples(): Int = sessionTriples
|
||||||
fun getSessionTetrises(): Int = sessionTetrises
|
fun getSessionQuads(): Int = sessionQuads
|
||||||
|
|
||||||
fun resetStats() {
|
fun resetStats() {
|
||||||
// Reset all lifetime stats
|
// Reset all lifetime stats
|
||||||
|
@ -172,7 +172,7 @@ class StatsManager(context: Context) {
|
||||||
totalSingles = 0
|
totalSingles = 0
|
||||||
totalDoubles = 0
|
totalDoubles = 0
|
||||||
totalTriples = 0
|
totalTriples = 0
|
||||||
totalTetrises = 0
|
totalQuads = 0
|
||||||
|
|
||||||
// Save the reset stats
|
// Save the reset stats
|
||||||
saveStats()
|
saveStats()
|
||||||
|
@ -191,6 +191,6 @@ class StatsManager(context: Context) {
|
||||||
private const val KEY_TOTAL_SINGLES = "total_singles"
|
private const val KEY_TOTAL_SINGLES = "total_singles"
|
||||||
private const val KEY_TOTAL_DOUBLES = "total_doubles"
|
private const val KEY_TOTAL_DOUBLES = "total_doubles"
|
||||||
private const val KEY_TOTAL_TRIPLES = "total_triples"
|
private const val KEY_TOTAL_TRIPLES = "total_triples"
|
||||||
private const val KEY_TOTAL_TETRISES = "total_tetrises"
|
private const val KEY_TOTAL_QUADS = "total_quads"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@
|
||||||
<string name="singles">singles: %d</string>
|
<string name="singles">singles: %d</string>
|
||||||
<string name="doubles">doubles: %d</string>
|
<string name="doubles">doubles: %d</string>
|
||||||
<string name="triples">triples: %d</string>
|
<string name="triples">triples: %d</string>
|
||||||
<string name="tetrises">tetrises: %d</string>
|
<string name="quads">quads: %d</string>
|
||||||
<string name="reset_stats">reset stats</string>
|
<string name="reset_stats">reset stats</string>
|
||||||
<string name="music">music</string>
|
<string name="music">music</string>
|
||||||
<string name="customization">Customization</string>
|
<string name="customization">Customization</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue