From f841b3b2e18eec5774fc2e09fb8aaaef537072a5 Mon Sep 17 00:00:00 2001 From: Qi-huanye <2728290997@qq.com> Date: Fri, 24 Apr 2026 21:01:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E7=88=86=E7=82=B8=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E6=A0=BC=E5=AD=90=E6=95=B0=E7=BB=93=E7=AE=97=E7=88=86=E7=A0=B4?= =?UTF-8?q?=E6=96=B9=E5=9D=97=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/source/TetrisLogic.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/source/TetrisLogic.cpp b/src/source/TetrisLogic.cpp index 68b9869..708f8a1 100644 --- a/src/source/TetrisLogic.cpp +++ b/src/source/TetrisLogic.cpp @@ -346,18 +346,26 @@ 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) { - workRegion[y][x] = 0; + if (workRegion[y][x] != 0) + { + clearedCellCount++; + workRegion[y][x] = 0; + } } } } + + return clearedCellCount; } static void ResetNextQueue() @@ -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); } // 生成下一个活动方块