加入连锁爆破与连环炸弹进化路线

This commit is contained in:
2026-04-25 12:39:31 +08:00
parent 332573a28c
commit 34c8f73d0c
3 changed files with 167 additions and 4 deletions
+146 -3
View File
@@ -23,6 +23,8 @@ int nextTypes[3] = { 0, 0, 0 };
int holdType = -1;
bool holdUsedThisTurn = false;
bool currentPieceIsExplosive = false;
Point pendingChainBombCenter = { 0, 0 };
bool pendingChainBombFollowup = false;
enum UpgradeId
{
@@ -39,7 +41,9 @@ enum UpgradeId
UPGRADE_STABLE_STRUCTURE = 10,
UPGRADE_DOUBLE_GROWTH = 11,
UPGRADE_PIECE_TUNING = 12,
UPGRADE_GAMBLER = 13
UPGRADE_GAMBLER = 13,
UPGRADE_CHAIN_BLAST = 14,
UPGRADE_CHAIN_BOMB = 15
};
static const UpgradeEntry kUpgradePool[] =
@@ -54,6 +58,8 @@ static const UpgradeEntry kUpgradePool[] =
{ UPGRADE_PRESSURE_RELIEF, -1, true, _T("\u51cf\u538b"), _T("\u7279\u6b8a"), _T("\u7acb\u5373\u6e05\u9664\u5f53\u524d\u6700\u9ad8\u5360\u7528\u884c\uff0c\u4e3a\u76d8\u9762\u817e\u51fa\u547c\u5438\u7a7a\u95f4\u3002") },
{ UPGRADE_SWEEPER, -1, true, _T("\u6e05\u626b\u8005"), _T("\u7279\u6b8a"), _T("\u7d2f\u8ba1\u6d88\u884c\u5145\u80fd\uff0c\u6536\u6ee1\u540e\u81ea\u52a8\u6e05\u9664\u5e95\u90e8 1 \u884c\u3002") },
{ UPGRADE_EXPLOSIVE_PIECE, -1, true, _T("\u7206\u7834\u65b9\u5757"), _T("\u7279\u6b8a"), _T("\u63d0\u9ad8\u7206\u7834\u65b9\u5757\u51fa\u73b0\u6982\u7387\uff0c\u843d\u5730\u65f6\u89e6\u53d1 3x3 \u6e05\u9664\u3002") },
{ UPGRADE_CHAIN_BLAST, 1, false, _T("\u8fde\u9501\u7206\u7834"), _T("\u8fdb\u9636"), _T("\u6d88\u884c\u540e\u5bf9\u88ab\u6e05\u9664\u884c\u9644\u8fd1\u968f\u673a\u6e05\u6389\u51e0\u683c\u3002") },
{ UPGRADE_CHAIN_BOMB, 1, false, _T("\u8fde\u73af\u70b8\u5f39"), _T("\u8fdb\u5316"), _T("\u7206\u7834\u8303\u56f4\u63d0\u5347\u4e3a 5x5\uff0c\u82e5\u5f15\u53d1\u6d88\u884c\u5219\u8ffd\u52a0\u4e00\u6b21\u5c0f\u7206\u70b8\u3002") },
{ UPGRADE_STABLE_STRUCTURE, -1, true, _T("\u7a33\u5b9a\u7ed3\u6784"), _T("\u7279\u6b8a"), _T("\u843d\u5730\u540e\u5c0f\u6982\u7387\u81ea\u52a8\u586b\u8865\u90bb\u8fd1\u7a7a\u6d1e\uff0c\u63d0\u9ad8\u76d8\u9762\u7ed3\u6784\u7a33\u5b9a\u6027\u3002") },
{ UPGRADE_DOUBLE_GROWTH, -1, true, _T("\u53cc\u500d\u6210\u957f"), _T("\u7279\u6b8a"), _T("\u989d\u5916\u63d0\u9ad8\u6d88\u884c\u5f97\u5206\u4e0e EXP \u6536\u76ca\uff0c\u6bcf\u5c42\u518d\u8ffd\u52a0 15%\u3002") },
{ UPGRADE_PIECE_TUNING, -1, true, _T("\u65b9\u5757\u6539\u9020"), _T("\u7279\u6b8a"), _T("\u9009\u62e9\u4e00\u79cd\u65b9\u5757\uff0c\u964d\u4f4e\u5176\u540e\u7eed\u51fa\u73b0\u6982\u7387\u3002") },
@@ -213,6 +219,8 @@ static void ResetPlayerStats(PlayerStats& stats, bool useRogueRules)
stats.sweeperLevel = 0;
stats.sweeperCharge = 0;
stats.explosiveLevel = 0;
stats.chainBlastLevel = 0;
stats.chainBombLevel = 0;
stats.stableStructureLevel = 0;
stats.doubleGrowthLevel = 0;
stats.gamblerLevel = 0;
@@ -266,6 +274,10 @@ static int GetUpgradeCurrentLevel(int upgradeId)
return rogueStats.sweeperLevel;
case UPGRADE_EXPLOSIVE_PIECE:
return rogueStats.explosiveLevel;
case UPGRADE_CHAIN_BLAST:
return rogueStats.chainBlastLevel;
case UPGRADE_CHAIN_BOMB:
return rogueStats.chainBombLevel;
case UPGRADE_STABLE_STRUCTURE:
return rogueStats.stableStructureLevel;
case UPGRADE_DOUBLE_GROWTH:
@@ -300,6 +312,16 @@ static const TCHAR* GetPieceShortName(int pieceType)
static bool IsUpgradeSelectable(const UpgradeEntry& entry)
{
if (entry.id == UPGRADE_CHAIN_BLAST)
{
return rogueStats.explosiveLevel > 0 && rogueStats.chainBlastLevel == 0;
}
if (entry.id == UPGRADE_CHAIN_BOMB)
{
return rogueStats.explosiveLevel > 0 && rogueStats.chainBlastLevel > 0 && rogueStats.chainBombLevel == 0;
}
if (entry.repeatable)
{
return true;
@@ -390,11 +412,12 @@ static bool RollExplosivePiece()
static int ClearExplosiveAreaAt(int centerY, int centerX)
{
int radius = (currentMode == MODE_ROGUE && rogueStats.chainBombLevel > 0) ? 2 : 1;
int clearedCellCount = 0;
for (int y = centerY - 1; y <= centerY + 1; y++)
for (int y = centerY - radius; y <= centerY + radius; y++)
{
for (int x = centerX - 1; x <= centerX + 1; x++)
for (int x = centerX - radius; x <= centerX + radius; x++)
{
if (y >= 0 && y < nGameHeight && x >= 0 && x < nGameWidth)
{
@@ -410,6 +433,40 @@ static int ClearExplosiveAreaAt(int centerY, int centerX)
return clearedCellCount;
}
static int TriggerChainBlast(int lineAnchor)
{
if (currentMode != MODE_ROGUE || rogueStats.chainBlastLevel <= 0)
{
return 0;
}
int clearedCellCount = 0;
int blastCount = 2 + rogueStats.chainBlastLevel;
for (int blastIndex = 0; blastIndex < blastCount; blastIndex++)
{
int randomY = lineAnchor + (rand() % 3) - 1;
int randomX = rand() % nGameWidth;
if (randomY < 0)
{
randomY = 0;
}
if (randomY >= nGameHeight)
{
randomY = nGameHeight - 1;
}
if (workRegion[randomY][randomX] != 0)
{
workRegion[randomY][randomX] = 0;
clearedCellCount++;
}
}
return clearedCellCount;
}
static int RollNextPieceType()
{
int weights[7] = { 100, 100, 100, 100, 100, 100, 100 };
@@ -682,6 +739,12 @@ static void ApplyUpgradeById(int upgradeId, int targetPieceType, int applyCount)
case UPGRADE_EXPLOSIVE_PIECE:
rogueStats.explosiveLevel += applyCount;
break;
case UPGRADE_CHAIN_BLAST:
rogueStats.chainBlastLevel = 1;
break;
case UPGRADE_CHAIN_BOMB:
rogueStats.chainBombLevel = 1;
break;
case UPGRADE_STABLE_STRUCTURE:
rogueStats.stableStructureLevel += applyCount;
break;
@@ -758,6 +821,34 @@ static void ApplyLineClearResult(int linesCleared)
rogueStats.score += scoreGain;
rogueStats.exp += expGain;
if (rogueStats.chainBlastLevel > 0)
{
int chainBlastCells = 0;
for (int i = 0; i < linesCleared; i++)
{
chainBlastCells += TriggerChainBlast(nGameHeight - 1 - i);
}
if (chainBlastCells > 0)
{
int chainBlastScore = chainBlastCells * rogueStats.scoreMultiplierPercent / 100;
if (chainBlastScore < chainBlastCells)
{
chainBlastScore = chainBlastCells;
}
rogueStats.score += chainBlastScore;
tScore = rogueStats.score;
TCHAR blastDetail[128];
_stprintf_s(
blastDetail,
_T("\u989d\u5916\u6e05\u9664 %d \u683c +%d Score"),
chainBlastCells,
chainBlastScore);
SetFeedbackMessage(_T("\u8fde\u9501\u7206\u7834\u89e6\u53d1"), blastDetail, 12);
}
}
if (rogueStats.sweeperLevel > 0)
{
rogueStats.sweeperCharge += linesCleared;
@@ -1048,6 +1139,7 @@ void Fixing()
bool overflowTop = false;
Point explosiveCells[4] = {};
int explosiveCellCount = 0;
pendingChainBombFollowup = false;
for (int i = 0; i < 4; i++)
{
@@ -1125,6 +1217,12 @@ void Fixing()
explosiveScoreGain > 0 ? explosiveScoreGain * 100 / rogueStats.scoreMultiplierPercent : 0,
explosiveScoreGain);
SetFeedbackMessage(_T("\u7206\u7834\u65b9\u5757\u89e6\u53d1"), explosiveDetail, 12);
if (rogueStats.chainBombLevel > 0 && explosiveCellCount > 0)
{
pendingChainBombCenter = explosiveCells[0];
pendingChainBombFollowup = true;
}
}
if (TryStabilizeBoard() > 0)
@@ -1202,6 +1300,51 @@ int DeleteLines()
}
ApplyLineClearResult(clearedLines);
if (pendingChainBombFollowup && clearedLines > 0)
{
pendingChainBombFollowup = false;
int followupCleared = 0;
int centerY = pendingChainBombCenter.y;
int centerX = pendingChainBombCenter.x;
for (int y = centerY - 1; y <= centerY + 1; y++)
{
for (int x = centerX - 1; x <= centerX + 1; x++)
{
if (y >= 0 && y < nGameHeight && x >= 0 && x < nGameWidth && workRegion[y][x] != 0)
{
workRegion[y][x] = 0;
followupCleared++;
}
}
}
if (currentMode == MODE_ROGUE && followupCleared > 0)
{
int followupScore = followupCleared * rogueStats.scoreMultiplierPercent / 100;
if (followupScore < followupCleared)
{
followupScore = followupCleared;
}
rogueStats.score += followupScore;
tScore = rogueStats.score;
TCHAR followupDetail[128];
_stprintf_s(
followupDetail,
_T("\u8ffd\u52a0\u5c0f\u7206\u70b8\u6e05\u9664 %d \u683c +%d Score"),
followupCleared,
followupScore);
SetFeedbackMessage(_T("\u8fde\u73af\u70b8\u5f39\u89e6\u53d1"), followupDetail, 12);
}
}
else
{
pendingChainBombFollowup = false;
}
return clearedLines;
}