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

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
+8
View File
@@ -108,6 +108,7 @@ struct UpgradeOption
int id; int id;
int currentLevel; int currentLevel;
int targetPieceType; int targetPieceType;
int rarity;
bool cursed; bool cursed;
const TCHAR* name; const TCHAR* name;
const TCHAR* category; const TCHAR* category;
@@ -156,6 +157,13 @@ enum GameMode
MODE_ROGUE = 1 MODE_ROGUE = 1
}; };
enum UpgradeRarity
{
UPGRADE_RARITY_COMMON = 0,
UPGRADE_RARITY_UNCOMMON = 1,
UPGRADE_RARITY_RARE = 2
};
extern int nType; extern int nType;
extern int type; extern int type;
extern int state; extern int state;
+29 -9
View File
@@ -1640,18 +1640,40 @@ void TDrawScreen(HDC hdc, HWND hWnd)
COLORREF cardBorder = RGB(221, 197, 208); COLORREF cardBorder = RGB(221, 197, 208);
COLORREF descColor = RGB(108, 86, 99); COLORREF descColor = RGB(108, 86, 99);
COLORREF footerColor = RGB(128, 104, 118); COLORREF footerColor = RGB(128, 104, 118);
const TCHAR* synthesisPath = GetUpgradeSynthesisPath(upgradeUiState.options[i].id);
bool hasSynthesisPath = synthesisPath != nullptr && lstrlen(synthesisPath) > 0;
const TCHAR* rarityText = _T("\u7a00\u6709\u5ea6\uff1a\u666e\u901a");
if (upgradeUiState.options[i].cursed) if (upgradeUiState.options[i].cursed)
{ {
cardFill = isSelected ? RGB(255, 233, 233) : RGB(255, 243, 243); cardFill = isSelected ? RGB(238, 232, 238) : RGB(250, 245, 248);
cardBorder = isSelected ? RGB(210, 92, 92) : RGB(224, 156, 156); cardBorder = RGB(38, 34, 42);
descColor = RGB(120, 74, 74); descColor = RGB(72, 62, 72);
footerColor = RGB(150, 70, 70); footerColor = RGB(48, 42, 50);
rarityText = _T("\u7a00\u6709\u5ea6\uff1a\u8bc5\u5492");
} }
else if (isSelected) else if (hasSynthesisPath)
{
cardBorder = RGB(208, 74, 78);
footerColor = RGB(164, 58, 64);
rarityText = _T("\u7a00\u6709\u5ea6\uff1a\u8fdb\u9636");
}
else if (upgradeUiState.options[i].rarity == UPGRADE_RARITY_RARE)
{
cardBorder = RGB(218, 172, 72);
footerColor = RGB(150, 111, 40);
rarityText = _T("\u7a00\u6709\u5ea6\uff1a\u73cd\u7a00");
}
else if (upgradeUiState.options[i].rarity == UPGRADE_RARITY_UNCOMMON)
{
cardBorder = RGB(92, 152, 218);
footerColor = RGB(68, 112, 166);
rarityText = _T("\u7a00\u6709\u5ea6\uff1a\u7f55\u89c1");
}
if (isSelected && !upgradeUiState.options[i].cursed)
{ {
cardFill = RGB(255, 235, 242); cardFill = RGB(255, 235, 242);
cardBorder = accentColor;
} }
DrawPanelCardAlpha(cardRect, cardFill, cardBorder, 24, isSelected ? 238 : 226); DrawPanelCardAlpha(cardRect, cardFill, cardBorder, 24, isSelected ? 238 : 226);
@@ -1692,8 +1714,6 @@ void TDrawScreen(HDC hdc, HWND hWnd)
SelectObject(hdc, bodyFont); SelectObject(hdc, bodyFont);
SetTextColor(hdc, descColor); SetTextColor(hdc, descColor);
const TCHAR* synthesisPath = GetUpgradeSynthesisPath(upgradeUiState.options[i].id);
bool hasSynthesisPath = synthesisPath != nullptr && lstrlen(synthesisPath) > 0;
RECT descRect = RECT descRect =
{ {
cardRect.left + SS(20), cardRect.left + SS(20),
@@ -1727,7 +1747,7 @@ void TDrawScreen(HDC hdc, HWND hWnd)
SetTextColor(hdc, footerColor); SetTextColor(hdc, footerColor);
DrawText( DrawText(
hdc, hdc,
upgradeUiState.options[i].cursed ? _T("\u7a00\u6709\u5ea6\uff1a\u8bc5\u5492") : _T("\u7a00\u6709\u5ea6\uff1a\u5360\u4f4d"), rarityText,
-1, -1,
&footerRect, &footerRect,
DT_LEFT | DT_VCENTER | DT_SINGLELINE); DT_LEFT | DT_VCENTER | DT_SINGLELINE);
+56
View File
@@ -97,6 +97,7 @@ static constexpr int kDifficultyLevelsPerLockedRow = 3;
static int GetUpgradeCurrentLevel(int upgradeId); static int GetUpgradeCurrentLevel(int upgradeId);
static bool IsUpgradePrerequisiteConsumed(int upgradeId); static bool IsUpgradePrerequisiteConsumed(int upgradeId);
static int GetUpgradeBaseRarity(int upgradeId);
static int GetUpgradeDynamicWeight(const UpgradeEntry& entry); static int GetUpgradeDynamicWeight(const UpgradeEntry& entry);
static const TCHAR* GetPieceShortName(int pieceType); static const TCHAR* GetPieceShortName(int pieceType);
static bool IsUpgradeSelectable(const UpgradeEntry& entry); 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) static bool IsUpgradePrerequisiteConsumed(int upgradeId)
{ {
switch (upgradeId) switch (upgradeId)
@@ -418,6 +463,16 @@ static int GetUpgradeDynamicWeight(const UpgradeEntry& entry)
weight += 20; 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; return weight < 1 ? 1 : weight;
} }
@@ -1131,6 +1186,7 @@ static void FillUpgradeOptions()
upgradeUiState.options[i].id = pickedEntry.id; upgradeUiState.options[i].id = pickedEntry.id;
upgradeUiState.options[i].currentLevel = GetUpgradeCurrentLevel(pickedEntry.id); upgradeUiState.options[i].currentLevel = GetUpgradeCurrentLevel(pickedEntry.id);
upgradeUiState.options[i].targetPieceType = -1; upgradeUiState.options[i].targetPieceType = -1;
upgradeUiState.options[i].rarity = GetUpgradeBaseRarity(pickedEntry.id);
upgradeUiState.options[i].cursed = false; upgradeUiState.options[i].cursed = false;
upgradeUiState.options[i].name = pickedEntry.name; upgradeUiState.options[i].name = pickedEntry.name;
upgradeUiState.options[i].category = pickedEntry.category; upgradeUiState.options[i].category = pickedEntry.category;