调整赌徒强化
This commit is contained in:
+58
-45
@@ -94,7 +94,7 @@ static const UpgradeEntry kUpgradePool[] =
|
||||
{ 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 方块的生成概率。") },
|
||||
{ UPGRADE_GAMBLER, -1, 64, true, _T("赌徒契约"), _T("特殊"), _T("选择强化时,有概率效果翻倍,也有概率本次落空。") }
|
||||
{ UPGRADE_GAMBLER, -1, 64, true, _T("赌徒契约"), _T("风险"), _T("后续强化 20% 翻倍 / 20% 落空,每级+5%;消行收益随机波动。") }
|
||||
};
|
||||
|
||||
static constexpr int kUpgradePoolSize = sizeof(kUpgradePool) / sizeof(kUpgradePool[0]);
|
||||
@@ -116,6 +116,8 @@ static int GetUpgradeBaseRarity(int upgradeId);
|
||||
static int GetUpgradeDynamicWeight(const UpgradeEntry& entry);
|
||||
static const TCHAR* GetPieceShortName(int pieceType);
|
||||
static bool IsUpgradeSelectable(const UpgradeEntry& entry);
|
||||
static int GetGamblerRollChancePercent();
|
||||
static int RollGamblerApplyCount(TCHAR* suffix, int suffixCapacity, bool compactText);
|
||||
static int GetTopOccupiedRow();
|
||||
static int GetSweeperThreshold();
|
||||
static bool RollExplosivePiece();
|
||||
@@ -624,6 +626,58 @@ static bool IsUpgradeSelectable(const UpgradeEntry& entry)
|
||||
return GetUpgradeCurrentLevel(entry.id) < entry.maxLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 计算赌徒契约触发翻倍或落空的单边概率。
|
||||
*/
|
||||
static int GetGamblerRollChancePercent()
|
||||
{
|
||||
if (currentMode != MODE_ROGUE || rogueStats.gamblerLevel <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gamblerChance = 20 + (rogueStats.gamblerLevel - 1) * 5;
|
||||
return gamblerChance > 40 ? 40 : gamblerChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 根据赌徒契约掷骰决定本次强化应用次数。
|
||||
*/
|
||||
static int RollGamblerApplyCount(TCHAR* suffix, int suffixCapacity, bool compactText)
|
||||
{
|
||||
if (suffix != nullptr && suffixCapacity > 0)
|
||||
{
|
||||
suffix[0] = _T('\0');
|
||||
}
|
||||
|
||||
int gamblerChance = GetGamblerRollChancePercent();
|
||||
if (gamblerChance <= 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int roll = rand() % 100;
|
||||
if (roll < gamblerChance)
|
||||
{
|
||||
if (suffix != nullptr && suffixCapacity > 0)
|
||||
{
|
||||
_stprintf_s(suffix, suffixCapacity, compactText ? _T("(赌徒翻倍)") : _T(" 赌徒命中:效果翻倍"));
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (roll >= 100 - gamblerChance)
|
||||
{
|
||||
if (suffix != nullptr && suffixCapacity > 0)
|
||||
{
|
||||
_stprintf_s(suffix, suffixCapacity, compactText ? _T("(赌徒落空)") : _T(" 赌徒失手:本次落空"));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 查找棋盘中最高的已占用行,用于评估局势压力。
|
||||
*/
|
||||
@@ -1580,6 +1634,7 @@ static void ApplyUpgradeById(int upgradeId, int targetPieceType, int applyCount)
|
||||
break;
|
||||
case UPGRADE_HOLD_UNLOCK:
|
||||
rogueStats.holdUnlocked = 1;
|
||||
holdUsedThisTurn = false;
|
||||
break;
|
||||
case UPGRADE_PRESSURE_RELIEF:
|
||||
{
|
||||
@@ -2258,29 +2313,8 @@ void ConfirmUpgradeSelection()
|
||||
}
|
||||
|
||||
UpgradeOption selectedOption = upgradeUiState.options[optionIndex];
|
||||
int applyCount = 1;
|
||||
TCHAR gamblerSuffix[64] = _T("");
|
||||
|
||||
if (currentMode == MODE_ROGUE && rogueStats.gamblerLevel > 0)
|
||||
{
|
||||
int gamblerChance = 20 + (rogueStats.gamblerLevel - 1) * 5;
|
||||
if (gamblerChance > 40)
|
||||
{
|
||||
gamblerChance = 40;
|
||||
}
|
||||
|
||||
int roll = rand() % 100;
|
||||
if (roll < gamblerChance)
|
||||
{
|
||||
applyCount = 2;
|
||||
_stprintf_s(gamblerSuffix, _T("(翻倍)"));
|
||||
}
|
||||
else if (roll >= 100 - gamblerChance)
|
||||
{
|
||||
applyCount = 0;
|
||||
_stprintf_s(gamblerSuffix, _T("(落空)"));
|
||||
}
|
||||
}
|
||||
int applyCount = RollGamblerApplyCount(gamblerSuffix, 64, true);
|
||||
|
||||
ApplyUpgradeById(selectedOption.id, selectedOption.targetPieceType, applyCount);
|
||||
upgradeUiState.totalChosenCount++;
|
||||
@@ -2336,29 +2370,8 @@ void ConfirmUpgradeSelection()
|
||||
}
|
||||
|
||||
UpgradeOption selectedOption = upgradeUiState.options[upgradeUiState.selectedIndex];
|
||||
int applyCount = 1;
|
||||
TCHAR gamblerSuffix[64] = _T("");
|
||||
|
||||
if (currentMode == MODE_ROGUE && rogueStats.gamblerLevel > 0)
|
||||
{
|
||||
int gamblerChance = 20 + (rogueStats.gamblerLevel - 1) * 5;
|
||||
if (gamblerChance > 40)
|
||||
{
|
||||
gamblerChance = 40;
|
||||
}
|
||||
|
||||
int roll = rand() % 100;
|
||||
if (roll < gamblerChance)
|
||||
{
|
||||
applyCount = 2;
|
||||
_stprintf_s(gamblerSuffix, _T(" 赌徒命中:效果翻倍"));
|
||||
}
|
||||
else if (roll >= 100 - gamblerChance)
|
||||
{
|
||||
applyCount = 0;
|
||||
_stprintf_s(gamblerSuffix, _T(" 赌徒失手:本次落空"));
|
||||
}
|
||||
}
|
||||
int applyCount = RollGamblerApplyCount(gamblerSuffix, 64, false);
|
||||
|
||||
ApplyUpgradeById(selectedOption.id, selectedOption.targetPieceType, applyCount);
|
||||
upgradeUiState.totalChosenCount++;
|
||||
|
||||
Reference in New Issue
Block a user