新增可解锁Hold机制并补全特殊强化提示

This commit is contained in:
2026-04-24 20:17:52 +08:00
parent 8ee470b059
commit c185530e5f
5 changed files with 182 additions and 10 deletions
+89 -2
View File
@@ -20,6 +20,8 @@ int currentScreen = SCREEN_MENU;
int currentMode = MODE_CLASSIC;
int currentFallInterval = 500;
int nextTypes[3] = { 0, 0, 0 };
int holdType = -1;
bool holdUsedThisTurn = false;
enum UpgradeId
{
@@ -28,7 +30,8 @@ enum UpgradeId
UPGRADE_SLOW_FALL = 2,
UPGRADE_COMBO_BONUS = 3,
UPGRADE_PREVIEW_PLUS_ONE = 4,
UPGRADE_LAST_CHANCE = 5
UPGRADE_LAST_CHANCE = 5,
UPGRADE_HOLD_UNLOCK = 6
};
static const UpgradeEntry kUpgradePool[] =
@@ -38,7 +41,8 @@ static const UpgradeEntry kUpgradePool[] =
{ UPGRADE_SLOW_FALL, -1, true, _T("\u6162\u901f\u4e0b\u843d"), _T("\u64cd\u4f5c"), _T("\u81ea\u7136\u4e0b\u843d\u53d8\u6162\uff0c\u6bcf\u6b21\u63d0\u9ad8 80ms\u3002") },
{ UPGRADE_PREVIEW_PLUS_ONE, 3, false, _T("\u989d\u5916\u9884\u89c8"), _T("\u89c6\u91ce"), _T("\u4e0b\u4e00\u4e2a\u65b9\u5757\u9884\u89c8 +1\uff0c\u6700\u591a 3 \u4e2a\u3002") },
{ UPGRADE_EXP_MULTIPLIER, -1, true, _T("\u7ecf\u9a8c\u5f3a\u5316"), _T("\u6210\u957f"), _T("\u540e\u7eed\u6d88\u884c\u83b7\u5f97 EXP \u63d0\u9ad8 25%\u3002") },
{ UPGRADE_LAST_CHANCE, 1, false, _T("\u6700\u540e\u4e00\u640f"), _T("\u4fdd\u547d"), _T("\u9996\u6b21\u9876\u6b7b\u65f6\u81ea\u52a8\u6e05\u9664\u5e95\u90e8 3 \u884c\u5e76\u7ee7\u7eed\u6e38\u620f\u3002") }
{ UPGRADE_LAST_CHANCE, 1, false, _T("\u6700\u540e\u4e00\u640f"), _T("\u4fdd\u547d"), _T("\u9996\u6b21\u9876\u6b7b\u65f6\u81ea\u52a8\u6e05\u9664\u5e95\u90e8 3 \u884c\u5e76\u7ee7\u7eed\u6e38\u620f\u3002") },
{ UPGRADE_HOLD_UNLOCK, 1, false, _T("Hold \u89e3\u9501"), _T("\u7279\u6b8a"), _T("\u89e3\u9501 Hold \u69fd\uff0c\u5bf9\u5c40\u4e2d\u53ef\u7528 C \u6216 Shift \u6682\u5b58\u65b9\u5757\u3002") }
};
static constexpr int kUpgradePoolSize = sizeof(kUpgradePool) / sizeof(kUpgradePool[0]);
@@ -189,6 +193,7 @@ static void ResetPlayerStats(PlayerStats& stats, bool useRogueRules)
stats.expUpgradeLevel = 0;
stats.previewUpgradeLevel = 0;
stats.lastChanceUpgradeLevel = 0;
stats.holdUnlocked = 0;
}
static int GetNextPreviewLimit()
@@ -227,6 +232,8 @@ static int GetUpgradeCurrentLevel(int upgradeId)
return rogueStats.previewUpgradeLevel;
case UPGRADE_LAST_CHANCE:
return rogueStats.lastChanceUpgradeLevel;
case UPGRADE_HOLD_UNLOCK:
return rogueStats.holdUnlocked;
default:
return 0;
}
@@ -254,6 +261,35 @@ static void SetFeedbackMessage(const TCHAR* title, const TCHAR* detail, int tick
lstrcpyn(feedbackState.detail, detail, sizeof(feedbackState.detail) / sizeof(TCHAR));
}
static bool IsPiecePlacementValid(int pieceType, int pieceState, Point position)
{
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if (bricks[pieceType][pieceState][i][j] == 0)
{
continue;
}
int checkY = position.y + i;
int checkX = position.x + j;
if (checkX < 0 || checkX >= nGameWidth || checkY >= nGameHeight)
{
return false;
}
if (checkY >= 0 && workRegion[checkY][checkX] != 0)
{
return false;
}
}
}
return true;
}
static void ResetNextQueue()
{
for (int i = 0; i < 3; i++)
@@ -379,6 +415,9 @@ static void ApplyUpgradeById(int upgradeId)
rogueStats.lastChanceCount = 1;
rogueStats.lastChanceUpgradeLevel = 1;
break;
case UPGRADE_HOLD_UNLOCK:
rogueStats.holdUnlocked = 1;
break;
default:
break;
}
@@ -716,6 +755,7 @@ void Fixing()
type = ConsumeNextType();
nType = nextTypes[0];
state = 0;
holdUsedThisTurn = false;
point = GetSpawnPoint(type);
target = point;
ComputeTarget();
@@ -840,12 +880,15 @@ void Restart()
feedbackState.visibleTicks = 0;
feedbackState.title[0] = _T('\0');
feedbackState.detail[0] = _T('\0');
holdType = -1;
holdUsedThisTurn = false;
tScore = 0;
ResetNextQueue();
type = ConsumeNextType();
nType = nextTypes[0];
state = 0;
holdUsedThisTurn = false;
point = GetSpawnPoint(type);
target = point;
@@ -922,3 +965,47 @@ void ConfirmUpgradeSelection()
currentScreen = SCREEN_PLAYING;
}
void HoldCurrentPiece()
{
if (currentMode != MODE_ROGUE || rogueStats.holdUnlocked == 0 || holdUsedThisTurn || gameOverFlag)
{
return;
}
int previousHoldType = holdType;
holdType = type;
state = 0;
holdUsedThisTurn = true;
if (previousHoldType < 0)
{
type = ConsumeNextType();
nType = nextTypes[0];
}
else
{
type = previousHoldType;
}
point = GetSpawnPoint(type);
target = point;
if (!IsPiecePlacementValid(type, state, point))
{
gameOverFlag = true;
SetFeedbackMessage(_T("Hold \u5931\u8d25"), _T("\u6362\u51fa\u7684\u65b9\u5757\u65e0\u6cd5\u653e\u7f6e\uff0c\u5bf9\u5c40\u7ed3\u675f\u3002"), 12);
return;
}
ComputeTarget();
if (previousHoldType < 0)
{
SetFeedbackMessage(_T("Hold \u5df2\u5b58\u5165"), _T("\u5f53\u524d\u65b9\u5757\u5df2\u8fdb\u5165 Hold \u69fd\u3002"), 10);
}
else
{
SetFeedbackMessage(_T("Hold \u5df2\u4ea4\u6362"), _T("\u5df2\u4e0e Hold \u69fd\u4e2d\u7684\u65b9\u5757\u4ea4\u6362\u3002"), 10);
}
}