添加稀有度机制 添加背景音乐素材

This commit is contained in:
2026-04-26 10:54:21 +08:00
parent 69379b43a3
commit 2598cf0945
4 changed files with 93 additions and 9 deletions
+56
View File
@@ -97,6 +97,7 @@ static constexpr int kDifficultyLevelsPerLockedRow = 3;
static int GetUpgradeCurrentLevel(int upgradeId);
static bool IsUpgradePrerequisiteConsumed(int upgradeId);
static int GetUpgradeBaseRarity(int upgradeId);
static int GetUpgradeDynamicWeight(const UpgradeEntry& entry);
static const TCHAR* GetPieceShortName(int pieceType);
static bool IsUpgradeSelectable(const UpgradeEntry& entry);
@@ -337,6 +338,50 @@ const TCHAR* GetUpgradeSynthesisPath(int upgradeId)
}
}
static int GetUpgradeBaseRarity(int upgradeId)
{
switch (upgradeId)
{
case UPGRADE_SCORE_MULTIPLIER:
case UPGRADE_EXP_MULTIPLIER:
case UPGRADE_SLOW_FALL:
case UPGRADE_COMBO_BONUS:
case UPGRADE_PRESSURE_RELIEF:
case UPGRADE_SWEEPER:
case UPGRADE_PIECE_TUNING:
return UPGRADE_RARITY_COMMON;
case UPGRADE_PREVIEW_PLUS_ONE:
case UPGRADE_LAST_CHANCE:
case UPGRADE_HOLD_UNLOCK:
case UPGRADE_EXPLOSIVE_PIECE:
case UPGRADE_CHAIN_BLAST:
case UPGRADE_LASER_PIECE:
case UPGRADE_THUNDER_TETRIS:
case UPGRADE_FEVER_MODE:
case UPGRADE_RAGE_STACK:
case UPGRADE_SCREEN_BOMB:
case UPGRADE_PERFECT_ROTATE:
case UPGRADE_TIME_DILATION:
case UPGRADE_HIGH_PRESSURE:
case UPGRADE_TETRIS_GAMBLE:
case UPGRADE_BLOCK_STORM:
case UPGRADE_CROSS_PIECE:
case UPGRADE_BLACK_HOLE:
case UPGRADE_AIR_RESHAPE:
case UPGRADE_STABLE_STRUCTURE:
case UPGRADE_DOUBLE_GROWTH:
return UPGRADE_RARITY_UNCOMMON;
case UPGRADE_RAINBOW_PIECE:
case UPGRADE_GAMBLER:
return UPGRADE_RARITY_RARE;
default:
return UPGRADE_RARITY_RARE;
}
}
static bool IsUpgradePrerequisiteConsumed(int upgradeId)
{
switch (upgradeId)
@@ -418,6 +463,16 @@ static int GetUpgradeDynamicWeight(const UpgradeEntry& entry)
weight += 20;
}
int rarity = GetUpgradeBaseRarity(entry.id);
if (rarity == UPGRADE_RARITY_UNCOMMON)
{
weight = weight * 65 / 100;
}
else if (rarity == UPGRADE_RARITY_RARE)
{
weight = weight * 40 / 100;
}
return weight < 1 ? 1 : weight;
}
@@ -1131,6 +1186,7 @@ static void FillUpgradeOptions()
upgradeUiState.options[i].id = pickedEntry.id;
upgradeUiState.options[i].currentLevel = GetUpgradeCurrentLevel(pickedEntry.id);
upgradeUiState.options[i].targetPieceType = -1;
upgradeUiState.options[i].rarity = GetUpgradeBaseRarity(pickedEntry.id);
upgradeUiState.options[i].cursed = false;
upgradeUiState.options[i].name = pickedEntry.name;
upgradeUiState.options[i].category = pickedEntry.category;