新增爆破方块强化并接入3x3范围清除
This commit is contained in:
@@ -22,6 +22,7 @@ int currentFallInterval = 500;
|
||||
int nextTypes[3] = { 0, 0, 0 };
|
||||
int holdType = -1;
|
||||
bool holdUsedThisTurn = false;
|
||||
bool currentPieceIsExplosive = false;
|
||||
|
||||
enum UpgradeId
|
||||
{
|
||||
@@ -33,7 +34,8 @@ enum UpgradeId
|
||||
UPGRADE_LAST_CHANCE = 5,
|
||||
UPGRADE_HOLD_UNLOCK = 6,
|
||||
UPGRADE_PRESSURE_RELIEF = 7,
|
||||
UPGRADE_SWEEPER = 8
|
||||
UPGRADE_SWEEPER = 8,
|
||||
UPGRADE_EXPLOSIVE_PIECE = 9
|
||||
};
|
||||
|
||||
static const UpgradeEntry kUpgradePool[] =
|
||||
@@ -46,7 +48,8 @@ static const UpgradeEntry kUpgradePool[] =
|
||||
{ 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") },
|
||||
{ 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_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") }
|
||||
};
|
||||
|
||||
static constexpr int kUpgradePoolSize = sizeof(kUpgradePool) / sizeof(kUpgradePool[0]);
|
||||
@@ -201,6 +204,7 @@ static void ResetPlayerStats(PlayerStats& stats, bool useRogueRules)
|
||||
stats.pressureReliefLevel = 0;
|
||||
stats.sweeperLevel = 0;
|
||||
stats.sweeperCharge = 0;
|
||||
stats.explosiveLevel = 0;
|
||||
}
|
||||
|
||||
static int GetNextPreviewLimit()
|
||||
@@ -245,6 +249,8 @@ static int GetUpgradeCurrentLevel(int upgradeId)
|
||||
return rogueStats.pressureReliefLevel;
|
||||
case UPGRADE_SWEEPER:
|
||||
return rogueStats.sweeperLevel;
|
||||
case UPGRADE_EXPLOSIVE_PIECE:
|
||||
return rogueStats.explosiveLevel;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -324,6 +330,36 @@ static int GetSweeperThreshold()
|
||||
return threshold < 3 ? 3 : threshold;
|
||||
}
|
||||
|
||||
static bool RollExplosivePiece()
|
||||
{
|
||||
if (currentMode != MODE_ROGUE || rogueStats.explosiveLevel <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int chancePercent = 12 + (rogueStats.explosiveLevel - 1) * 8;
|
||||
if (chancePercent > 40)
|
||||
{
|
||||
chancePercent = 40;
|
||||
}
|
||||
|
||||
return (rand() % 100) < chancePercent;
|
||||
}
|
||||
|
||||
static void ClearExplosiveAreaAt(int centerY, int centerX)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ResetNextQueue()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
@@ -471,6 +507,10 @@ static void ApplyUpgradeById(int upgradeId)
|
||||
rogueStats.sweeperLevel++;
|
||||
SetFeedbackMessage(_T("\u6e05\u626b\u8005\u5df2\u52a0\u5165"), _T("\u7d2f\u8ba1\u6d88\u884c\u540e\u5c06\u81ea\u52a8\u6e05\u7406\u5e95\u90e8\u79ef\u538b\u3002"), 12);
|
||||
break;
|
||||
case UPGRADE_EXPLOSIVE_PIECE:
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -795,6 +835,8 @@ void DropDown()
|
||||
void Fixing()
|
||||
{
|
||||
bool overflowTop = false;
|
||||
Point explosiveCells[4] = {};
|
||||
int explosiveCellCount = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -815,6 +857,12 @@ void Fixing()
|
||||
if (fixY >= 0 && fixY < nGameHeight && fixX >= 0 && fixX < nGameWidth)
|
||||
{
|
||||
workRegion[fixY][fixX] = bricks[type][state][i][j];
|
||||
if (currentPieceIsExplosive && explosiveCellCount < 4)
|
||||
{
|
||||
explosiveCells[explosiveCellCount].x = fixX;
|
||||
explosiveCells[explosiveCellCount].y = fixY;
|
||||
explosiveCellCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -843,11 +891,21 @@ void Fixing()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPieceIsExplosive)
|
||||
{
|
||||
for (int i = 0; i < explosiveCellCount; i++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
// 生成下一个活动方块
|
||||
type = ConsumeNextType();
|
||||
nType = nextTypes[0];
|
||||
state = 0;
|
||||
holdUsedThisTurn = false;
|
||||
currentPieceIsExplosive = RollExplosivePiece();
|
||||
point = GetSpawnPoint(type);
|
||||
target = point;
|
||||
ComputeTarget();
|
||||
@@ -974,6 +1032,7 @@ void Restart()
|
||||
feedbackState.detail[0] = _T('\0');
|
||||
holdType = -1;
|
||||
holdUsedThisTurn = false;
|
||||
currentPieceIsExplosive = false;
|
||||
tScore = 0;
|
||||
|
||||
ResetNextQueue();
|
||||
@@ -981,6 +1040,7 @@ void Restart()
|
||||
nType = nextTypes[0];
|
||||
state = 0;
|
||||
holdUsedThisTurn = false;
|
||||
currentPieceIsExplosive = RollExplosivePiece();
|
||||
point = GetSpawnPoint(type);
|
||||
target = point;
|
||||
|
||||
@@ -1074,10 +1134,12 @@ void HoldCurrentPiece()
|
||||
{
|
||||
type = ConsumeNextType();
|
||||
nType = nextTypes[0];
|
||||
currentPieceIsExplosive = RollExplosivePiece();
|
||||
}
|
||||
else
|
||||
{
|
||||
type = previousHoldType;
|
||||
currentPieceIsExplosive = false;
|
||||
}
|
||||
|
||||
point = GetSpawnPoint(type);
|
||||
|
||||
Reference in New Issue
Block a user