diff --git a/src/include/TetrisLogicInternal.h b/src/include/TetrisLogicInternal.h index 4a73210..7276b33 100644 --- a/src/include/TetrisLogicInternal.h +++ b/src/include/TetrisLogicInternal.h @@ -40,9 +40,9 @@ bool IsRainbowBoardCell(int cellValue); int TriggerMiniBlackHole(int maxCellsToClear); /** - * @brief 触发彩虹方块棱彩爆发效果并返回清除格数。 + * @brief 触发彩虹方块行清除与覆盖行染色效果。 */ -int TriggerRainbowPrismBurst(int minRow, int maxRow); +int TriggerRainbowColorShift(int anchorRow, int minRow, int maxRow, int& recoloredCount); /** * @brief 引爆清屏炸弹并返回清除格数。 diff --git a/src/source/TetrisLogic.cpp b/src/source/TetrisLogic.cpp index 4d00d73..161913f 100644 --- a/src/source/TetrisLogic.cpp +++ b/src/source/TetrisLogic.cpp @@ -386,7 +386,6 @@ void Fixing() int fixedCellCount = 0; Point explosiveCells[4] = {}; int explosiveCellCount = 0; - int rainbowClearedCount = 0; pendingChainBombFollowup = false; for (int i = 0; i < 4; i++) @@ -427,23 +426,62 @@ void Fixing() if (!overflowTop && currentPieceIsRainbow) { - rainbowClearedCount = TriggerRainbowPrismBurst(point.y, point.y + 3); + int rainbowAnchorRow = point.y + 1; + if (fixedCellCount > 0) + { + int ySum = 0; + for (int i = 0; i < fixedCellCount; i++) + { + ySum += fixedCells[i].y; + } + rainbowAnchorRow = (ySum + fixedCellCount / 2) / fixedCellCount; + } + if (rainbowAnchorRow < 0) + { + rainbowAnchorRow = 0; + } + if (rainbowAnchorRow >= GetRoguePlayableHeight()) + { + rainbowAnchorRow = GetRoguePlayableHeight() - 1; + } + + int rainbowRecoloredCount = 0; + int rainbowClearedCount = TriggerRainbowColorShift(rainbowAnchorRow, point.y, point.y + 3, rainbowRecoloredCount); int rainbowScore = 0; int rainbowExp = 0; + int voidClearedCount = 0; + int voidScore = 0; + int voidExp = 0; if (currentMode == MODE_ROGUE && rainbowClearedCount > 0) { AwardRogueSkillClearRewards(rainbowClearedCount, rainbowScore, rainbowExp, false); + if (rogueStats.voidCoreLevel > 0) + { + voidClearedCount = TriggerMiniBlackHole(5); + AwardRogueSkillClearRewards(voidClearedCount, voidScore, voidExp, false); + } ApplyBoardGravity(); } TCHAR rainbowDetail[128]; - if (rainbowClearedCount > 0) + if (voidClearedCount > 0) { - _stprintf_s(rainbowDetail, _T("棱彩爆发清除覆盖行主色 %d 格 +%d 分 +%d EXP"), rainbowClearedCount, rainbowScore, rainbowExp); + _stprintf_s( + rainbowDetail, + _T("第 %d 行清 %d 格,染色 %d 格,虚空追加 %d 格"), + rainbowAnchorRow + 1, + rainbowClearedCount, + rainbowRecoloredCount, + voidClearedCount); } else { - _stprintf_s(rainbowDetail, _T("覆盖行没有可爆发的主色,彩虹能量保留为特殊固定块。")); + _stprintf_s( + rainbowDetail, + _T("第 %d 行清除主色 %d 格,覆盖行染色 %d 格。"), + rainbowAnchorRow + 1, + rainbowClearedCount, + rainbowRecoloredCount); } SetFeedbackMessage(_T("彩虹方块"), rainbowDetail, 10); } @@ -666,7 +704,6 @@ void DeleteOneLine(int number) int DeleteLines() { int clearedLines = 0; - bool clearedWithRainbow = false; int clearedRows[8] = {}; int clearedRowCount = 0; @@ -692,14 +729,6 @@ int DeleteLines() clearedRowCount++; } - for (int j = 0; j < nGameWidth; j++) - { - if (IsRainbowBoardCell(workRegion[i][j])) - { - clearedWithRainbow = true; - break; - } - } DeleteOneLine(i); clearedLines++; i++; @@ -770,22 +799,6 @@ int DeleteLines() pendingChainBombFollowup = false; } - if (currentMode == MODE_ROGUE && clearedWithRainbow && rogueStats.voidCoreLevel > 0) - { - int miniBlackHoleCleared = TriggerMiniBlackHole(5); - if (miniBlackHoleCleared > 0) - { - int miniScore = 0; - int miniExp = 0; - AwardRogueSkillClearRewards(miniBlackHoleCleared, miniScore, miniExp, false); - ApplyBoardGravity(); - - TCHAR miniDetail[128]; - _stprintf_s(miniDetail, _T("彩虹消行撕开小型黑洞,清除 %d 格 +%d 分 +%d EXP"), miniBlackHoleCleared, miniScore, miniExp); - SetFeedbackMessage(_T("虚空核心"), miniDetail, 12); - } - } - return clearedLines; } diff --git a/src/source/TetrisRender.cpp b/src/source/TetrisRender.cpp index 4f41142..c4db528 100644 --- a/src/source/TetrisRender.cpp +++ b/src/source/TetrisRender.cpp @@ -698,11 +698,11 @@ void TDrawScreen(HDC hdc, HWND hWnd) _T("赏金纹章:得分+20%,可叠加\r\n成长印记:EXP+25%,可叠加\r\n缓坠羽翼:自然下落变慢\r\n连击律动:连续消行追加奖励\r\n先见之眼:下一方块预览+1"), _T("最后一搏:首次濒死清底3行\r\n备用仓:C / Shift 暂存方块\r\n完美旋转:旋转受阻时左右修正\r\n时间缓流:高堆叠自动减速\r\n空中换形:V 将当前方块变 I"), _T("卸压清场:立刻清最高占用行\r\n底线清道夫:消行充能后清底\r\n清屏炸弹:X 清底5行,消行充能\r\n黑洞奇点:Z 吞噬数量最多的方块"), - _T("爆破核心:橙红边框,落地清 3x3\r\n棱镜激光:青色边框,按落地中心清整列\r\n十字方块:绿色边框,按落地中心清行列\r\n彩虹方块:紫色边框,清覆盖行主色\r\n方块改造:提高 I 块生成概率"), + _T("爆破核心:橙红边框,落地清 3x3\r\n棱镜激光:青色边框,按落地中心清整列\r\n十字方块:绿色边框,按落地中心清行列\r\n彩虹方块:清中心行主色,覆盖行染为场上主色\r\n方块改造:提高 I 块生成概率"), _T("连锁火花:消行后追加随机破坏\r\n连环炸弹:爆破扩大为 5x5\r\n雷霆四消:三消/四消额外轰击\r\n雷霆棱镜:三消/四消追加激光"), _T("狂热节拍:累计12行进入狂热\r\n怒火连段:连击越高倍率越高\r\n无尽狂热:狂热中消行延时\r\n高压悬赏:更快但收益更高\r\n豪赌四消 / 极限玩家:偏向四消爆发"), _T("双重抉择:升级可多选1个\r\n命运轮盘:6选2但含诅咒\r\n升级冲击波:升级后清底2行\r\n进化冲击:升级后清底3行\r\n成长核心:永久得分/EXP +15%"), - _T("操控大师:Hold 后减速并预览+1\r\n方块风暴:接下来5个全 I 块\r\n稳定结构:概率填局部小洞\r\n虚空核心:黑洞生成彩虹,彩虹消行触发小黑洞\r\n赌徒契约:强化可能翻倍或落空") + _T("操控大师:Hold 后减速并预览+1\r\n方块风暴:接下来5个全 I 块\r\n稳定结构:概率填局部小洞\r\n虚空核心:黑洞生成彩虹,彩虹生效追加小黑洞\r\n赌徒契约:强化可能翻倍或落空") }; int columnGap = SS(18); diff --git a/src/source/TetrisRogue.cpp b/src/source/TetrisRogue.cpp index c14b337..d6a7323 100644 --- a/src/source/TetrisRogue.cpp +++ b/src/source/TetrisRogue.cpp @@ -89,8 +89,8 @@ static const UpgradeEntry kUpgradePool[] = { UPGRADE_CROSS_PIECE, -1, 84, true, _T("十字方块"), _T("爆发"), _T("大幅提高十字方块出现率。十字方块落地后清除所在行与所在列。") }, { UPGRADE_BLACK_HOLE, 1, 88, false, _T("黑洞奇点"), _T("特殊"), _T("获得 2 次黑洞。按 Z 吞噬棋盘上数量最多的一种固定方块。") }, { UPGRADE_AIR_RESHAPE, 1, 82, false, _T("空中换形"), _T("操作"), _T("获得 2 次换形。按 V 将正在下落的方块重塑为 I 块。") }, - { UPGRADE_RAINBOW_PIECE, 1, 84, false, _T("彩虹方块"), _T("爆发"), _T("更高概率生成彩虹方块。落地后在覆盖行中清除数量最多的一种颜色,形成棱彩爆发。") }, - { UPGRADE_VOID_CORE, 1, 112, false, _T("虚空核心"), _T("进化"), _T("黑洞后额外生成 1 个彩虹方块;彩虹消行时撕开小型黑洞。") }, + { UPGRADE_RAINBOW_PIECE, 1, 84, false, _T("彩虹方块"), _T("爆发"), _T("更高概率生成彩虹方块。落地后清除自身中心行最多的颜色,并把覆盖行染成场上最多的颜色。") }, + { UPGRADE_VOID_CORE, 1, 112, false, _T("虚空核心"), _T("进化"), _T("黑洞后额外生成 1 个彩虹方块;彩虹生效后追加一次小型黑洞。") }, { UPGRADE_STABLE_STRUCTURE, -1, 72, true, _T("稳定结构"), _T("特殊"), _T("落地后有小概率填补邻近空洞,让阵型更加稳固。") }, { UPGRADE_DOUBLE_GROWTH, 1, 84, false, _T("成长核心"), _T("成长"), _T("永久获得 +15% 得分与 +15% EXP;每局只能选择一次。") }, { UPGRADE_PIECE_TUNING, -1, 64, true, _T("方块改造"), _T("特殊"), _T("固定提高 I 方块的生成概率。") }, @@ -746,7 +746,7 @@ static bool RollCrossPiece() } /** - * @brief 根据彩虹强化等级随机判定当前方块是否获得棱彩爆发特性。 + * @brief 根据彩虹强化等级随机判定当前方块是否获得行清除与染色特性。 */ static bool RollRainbowPiece() { @@ -963,14 +963,23 @@ int ClearRowAt(int row) } /** - * @brief 让彩虹方块清除覆盖行内最常见的固定方块颜色。 + * @brief 触发彩虹方块行清除与覆盖行染色效果。 */ -int TriggerRainbowPrismBurst(int minRow, int maxRow) +int TriggerRainbowColorShift(int anchorRow, int minRow, int maxRow, int& recoloredCount) { - int colorCounts[8] = {}; + recoloredCount = 0; int clearedCellCount = 0; - Point clearedCells[40] = {}; + Point clearedCells[10] = {}; + Point recoloredCells[40] = {}; + if (anchorRow < 0) + { + anchorRow = 0; + } + if (anchorRow >= GetRoguePlayableHeight()) + { + anchorRow = GetRoguePlayableHeight() - 1; + } if (minRow < 0) { minRow = 0; @@ -980,52 +989,92 @@ int TriggerRainbowPrismBurst(int minRow, int maxRow) maxRow = GetRoguePlayableHeight() - 1; } - for (int row = minRow; row <= maxRow; row++) + int rowColorCounts[8] = {}; + for (int x = 0; x < nGameWidth; x++) { - for (int x = 0; x < nGameWidth; x++) + int cell = workRegion[anchorRow][x]; + if (cell >= 1 && cell <= 7) { - int cell = workRegion[row][x]; - if (cell >= 1 && cell <= 7) - { - colorCounts[cell]++; - } + rowColorCounts[cell]++; } } - int targetColor = 0; - int targetColorCount = 0; + int rowTargetColor = 0; + int rowTargetCount = 0; for (int cell = 1; cell <= 7; cell++) { - if (colorCounts[cell] > targetColorCount) + if (rowColorCounts[cell] > rowTargetCount) { - targetColor = cell; - targetColorCount = colorCounts[cell]; + rowTargetColor = cell; + rowTargetCount = rowColorCounts[cell]; } } - if (targetColor == 0) - { - return 0; - } - - for (int row = minRow; row <= maxRow; row++) + if (rowTargetColor > 0) { for (int x = 0; x < nGameWidth; x++) { - if (workRegion[row][x] == targetColor) + if (workRegion[anchorRow][x] == rowTargetColor) { - if (clearedCellCount < 40) + if (clearedCellCount < 10) { clearedCells[clearedCellCount].x = x; - clearedCells[clearedCellCount].y = row; + clearedCells[clearedCellCount].y = anchorRow; } - workRegion[row][x] = 0; + workRegion[anchorRow][x] = 0; clearedCellCount++; } } } - TriggerColoredCellClearEffect(clearedCells, clearedCellCount < 40 ? clearedCellCount : 40, RGB(186, 126, 255), true); + int boardColorCounts[8] = {}; + for (int y = 0; y < GetRoguePlayableHeight(); y++) + { + for (int x = 0; x < nGameWidth; x++) + { + int cell = workRegion[y][x]; + if (cell >= 1 && cell <= 7) + { + boardColorCounts[cell]++; + } + } + } + + int boardTargetColor = 0; + int boardTargetCount = 0; + for (int cell = 1; cell <= 7; cell++) + { + if (boardColorCounts[cell] > boardTargetCount) + { + boardTargetColor = cell; + boardTargetCount = boardColorCounts[cell]; + } + } + + if (boardTargetColor == 0) + { + boardTargetColor = rowTargetColor > 0 ? rowTargetColor : 1; + } + + for (int y = minRow; y <= maxRow; y++) + { + for (int x = 0; x < nGameWidth; x++) + { + if (workRegion[y][x] != 0 && workRegion[y][x] != boardTargetColor) + { + workRegion[y][x] = boardTargetColor; + if (recoloredCount < 40) + { + recoloredCells[recoloredCount].x = x; + recoloredCells[recoloredCount].y = y; + } + recoloredCount++; + } + } + } + + TriggerColoredCellClearEffect(clearedCells, clearedCellCount, RGB(186, 126, 255), true); + TriggerColoredCellClearEffect(recoloredCells, recoloredCount < 40 ? recoloredCount : 40, RGB(218, 178, 255), false); return clearedCellCount; }