按爆炸清除格子数结算爆破方块分数

This commit is contained in:
2026-04-24 21:01:02 +08:00
parent c4fe49ab44
commit f841b3b2e1
+27 -3
View File
@@ -346,20 +346,28 @@ static bool RollExplosivePiece()
return (rand() % 100) < chancePercent;
}
static void ClearExplosiveAreaAt(int centerY, int centerX)
static int ClearExplosiveAreaAt(int centerY, int centerX)
{
int clearedCellCount = 0;
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)
{
if (workRegion[y][x] != 0)
{
clearedCellCount++;
workRegion[y][x] = 0;
}
}
}
}
return clearedCellCount;
}
static void ResetNextQueue()
{
for (int i = 0; i < 3; i++)
@@ -893,11 +901,27 @@ void Fixing()
if (currentPieceIsExplosive)
{
int explosiveScoreGain = 0;
for (int i = 0; i < explosiveCellCount; i++)
{
ClearExplosiveAreaAt(explosiveCells[i].y, explosiveCells[i].x);
explosiveScoreGain += ClearExplosiveAreaAt(explosiveCells[i].y, explosiveCells[i].x);
}
SetFeedbackMessage(_T("\u7206\u7834\u65b9\u5757\u89e6\u53d1"), _T("\u843d\u5730\u540e\u5df2\u89e6\u53d1 3x3 \u8303\u56f4\u6e05\u9664\u3002"), 12);
if (currentMode == MODE_ROGUE && explosiveScoreGain > 0)
{
explosiveScoreGain = explosiveScoreGain * rogueStats.scoreMultiplierPercent / 100;
rogueStats.score += explosiveScoreGain;
tScore = rogueStats.score;
}
TCHAR explosiveDetail[128];
_stprintf_s(
explosiveDetail,
_T("\u6e05\u9664 %d \u4e2a\u683c\u5b50 +%d Score"),
explosiveScoreGain > 0 ? explosiveScoreGain * 100 / rogueStats.scoreMultiplierPercent : 0,
explosiveScoreGain);
SetFeedbackMessage(_T("\u7206\u7834\u65b9\u5757\u89e6\u53d1"), explosiveDetail, 12);
}
// 生成下一个活动方块