新增稳定结构强化并接入自动补洞机制

This commit is contained in:
2026-04-24 21:06:53 +08:00
parent f841b3b2e1
commit 07697777ff
4 changed files with 70 additions and 4 deletions
+1
View File
@@ -54,6 +54,7 @@ struct PlayerStats
int sweeperLevel;
int sweeperCharge;
int explosiveLevel;
int stableStructureLevel;
};
struct UpgradeOption
+63 -2
View File
@@ -35,7 +35,8 @@ enum UpgradeId
UPGRADE_HOLD_UNLOCK = 6,
UPGRADE_PRESSURE_RELIEF = 7,
UPGRADE_SWEEPER = 8,
UPGRADE_EXPLOSIVE_PIECE = 9
UPGRADE_EXPLOSIVE_PIECE = 9,
UPGRADE_STABLE_STRUCTURE = 10
};
static const UpgradeEntry kUpgradePool[] =
@@ -49,7 +50,8 @@ static const UpgradeEntry kUpgradePool[] =
{ 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") },
{ 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_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_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") }
};
static constexpr int kUpgradePoolSize = sizeof(kUpgradePool) / sizeof(kUpgradePool[0]);
@@ -205,6 +207,7 @@ static void ResetPlayerStats(PlayerStats& stats, bool useRogueRules)
stats.sweeperLevel = 0;
stats.sweeperCharge = 0;
stats.explosiveLevel = 0;
stats.stableStructureLevel = 0;
}
static int GetNextPreviewLimit()
@@ -251,6 +254,8 @@ static int GetUpgradeCurrentLevel(int upgradeId)
return rogueStats.sweeperLevel;
case UPGRADE_EXPLOSIVE_PIECE:
return rogueStats.explosiveLevel;
case UPGRADE_STABLE_STRUCTURE:
return rogueStats.stableStructureLevel;
default:
return 0;
}
@@ -368,6 +373,53 @@ static int ClearExplosiveAreaAt(int centerY, int centerX)
return clearedCellCount;
}
static int TryStabilizeBoard()
{
if (currentMode != MODE_ROGUE || rogueStats.stableStructureLevel <= 0)
{
return 0;
}
int triggerChance = 15 + (rogueStats.stableStructureLevel - 1) * 10;
if (triggerChance > 50)
{
triggerChance = 50;
}
if ((rand() % 100) >= triggerChance)
{
return 0;
}
for (int y = nGameHeight - 2; y >= 1; y--)
{
for (int x = 1; x < nGameWidth - 1; x++)
{
if (workRegion[y][x] != 0)
{
continue;
}
bool hasSupportBelow = workRegion[y + 1][x] != 0;
bool hasLeftNeighbor = workRegion[y][x - 1] != 0;
bool hasRightNeighbor = workRegion[y][x + 1] != 0;
if (hasSupportBelow && hasLeftNeighbor && hasRightNeighbor)
{
int fillValue = workRegion[y + 1][x];
if (fillValue == 0)
{
fillValue = hasLeftNeighbor ? workRegion[y][x - 1] : workRegion[y][x + 1];
}
workRegion[y][x] = fillValue;
return 1;
}
}
}
return 0;
}
static void ResetNextQueue()
{
for (int i = 0; i < 3; i++)
@@ -519,6 +571,10 @@ static void ApplyUpgradeById(int upgradeId)
rogueStats.explosiveLevel++;
SetFeedbackMessage(_T("\u7206\u7834\u65b9\u5757\u5df2\u5f3a\u5316"), _T("\u540e\u7eed\u5c06\u6709\u66f4\u9ad8\u6982\u7387\u51fa\u73b0\u7206\u7834\u65b9\u5757\u3002"), 12);
break;
case UPGRADE_STABLE_STRUCTURE:
rogueStats.stableStructureLevel++;
SetFeedbackMessage(_T("\u7a33\u5b9a\u7ed3\u6784\u5df2\u5f3a\u5316"), _T("\u540e\u7eed\u843d\u5730\u7ed3\u7b97\u65f6\u5c06\u6709\u6982\u7387\u81ea\u52a8\u8865\u6d1e\u3002"), 12);
break;
default:
break;
}
@@ -924,6 +980,11 @@ void Fixing()
SetFeedbackMessage(_T("\u7206\u7834\u65b9\u5757\u89e6\u53d1"), explosiveDetail, 12);
}
if (TryStabilizeBoard() > 0)
{
SetFeedbackMessage(_T("\u7a33\u5b9a\u7ed3\u6784\u751f\u6548"), _T("\u81ea\u52a8\u586b\u8865\u4e86\u4e00\u4e2a\u90bb\u8fd1\u7a7a\u6d1e\u3002"), 10);
}
// 生成下一个活动方块
type = ConsumeNextType();
nType = nextTypes[0];
+5 -1
View File
@@ -362,7 +362,7 @@ void TDrawScreen(HDC hdc, HWND hWnd)
hdc,
_T("\u7ecf\u5178\u6a21\u5f0f\uff1a\u4fdd\u6301\u539f\u7248\u4fc4\u7f57\u65af\u65b9\u5757\u73a9\u6cd5\uff0c\u4ee5\u6d88\u884c\u548c\u751f\u5b58\u4e3a\u4e3b\u3002\r\n\r\n")
_T("Rogue \u6a21\u5f0f\uff1a\u6d88\u884c\u540e\u9664\u4e86\u83b7\u5f97\u5206\u6570\uff0c\u8fd8\u4f1a\u83b7\u5f97 EXP\u3002EXP \u8fbe\u5230\u9608\u503c\u540e\u89e6\u53d1\u5347\u7ea7\uff0c\u4ece\u4e09\u4e2a\u5f3a\u5316\u4e2d\u9009\u4e00\u4e2a\u3002\r\n\r\n")
_T("\u5f53\u524d\u5df2\u63a5\u5165\uff1a\u5206\u6570\u500d\u7387\u3001EXP \u500d\u7387\u3001\u6162\u901f\u4e0b\u843d\u3001Hold \u89e3\u9501\u3001\u51cf\u538b\u3001\u6e05\u626b\u8005\u3001\u7206\u7834\u65b9\u5757\u3002\r\n\r\n")
_T("\u5f53\u524d\u5df2\u63a5\u5165\uff1a\u5206\u6570\u500d\u7387\u3001EXP \u500d\u7387\u3001\u6162\u901f\u4e0b\u843d\u3001Hold \u89e3\u9501\u3001\u51cf\u538b\u3001\u6e05\u626b\u8005\u3001\u7206\u7834\u65b9\u5757\u3001\u7a33\u5b9a\u7ed3\u6784\u3002\r\n\r\n")
_T("\u63d0\u793a\uff1a\u6682\u505c\u3001\u5931\u8d25\u548c\u5347\u7ea7\u4f1a\u8fdb\u5165\u4e0d\u540c\u754c\u9762\uff0c\u8bf7\u6839\u636e\u5c4f\u5e55\u63d0\u793a\u64cd\u4f5c\u3002"),
-1,
&rulesBody,
@@ -754,6 +754,10 @@ void TDrawScreen(HDC hdc, HWND hWnd)
{
_stprintf_s(upgradeSummary + lstrlen(upgradeSummary), 512 - lstrlen(upgradeSummary), _T("\u7206\u7834\u65b9\u5757 Lv.%d\r\n"), rogueStats.explosiveLevel);
}
if (rogueStats.stableStructureLevel > 0)
{
_stprintf_s(upgradeSummary + lstrlen(upgradeSummary), 512 - lstrlen(upgradeSummary), _T("\u7a33\u5b9a\u7ed3\u6784 Lv.%d\r\n"), rogueStats.stableStructureLevel);
}
if (lstrlen(upgradeSummary) == 0)
{
_stprintf_s(upgradeSummary, _T("\u6682\u672a\u9009\u62e9\u4efb\u4f55\u5f3a\u5316\u3002\r\n\u5347\u7ea7\u540e\u4f1a\u5728\u8fd9\u91cc\u7d2f\u79ef\u663e\u793a\u3002"));