1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

vcmi: remove BLOCK_LUCK bonus

To block a luck, just set both INDEPENDENT_MAX and INDEPENDENT_MIN
to 0 of LUCK bonus
This commit is contained in:
Konstantin
2023-03-09 12:08:32 +03:00
parent ae535384f7
commit ebbc8cf208
4 changed files with 8 additions and 19 deletions

View File

@@ -1025,20 +1025,15 @@ void CGameHandler::makeAttack(const CStack * attacker, const CStack * defender,
const int attackerLuck = attacker->LuckVal();
auto sideHeroBlocksLuck = [](const SideInBattle &side){ return NBonus::hasOfType(side.hero, Bonus::BLOCK_LUCK); };
if (!vstd::contains_if (gs->curB->sides, sideHeroBlocksLuck))
if (attackerLuck > 0 && getRandomGenerator().nextInt(23) < attackerLuck)
{
if (attackerLuck > 0 && getRandomGenerator().nextInt(23) < attackerLuck)
bat.flags |= BattleAttack::LUCKY;
}
if (VLC->modh->settings.data["hardcodedFeatures"]["NEGATIVE_LUCK"].Bool()) // negative luck enabled
{
if (attackerLuck < 0 && getRandomGenerator().nextInt(23) < abs(attackerLuck))
{
bat.flags |= BattleAttack::LUCKY;
}
if (VLC->modh->settings.data["hardcodedFeatures"]["NEGATIVE_LUCK"].Bool()) // negative luck enabled
{
if (attackerLuck < 0 && getRandomGenerator().nextInt(23) < abs(attackerLuck))
{
bat.flags |= BattleAttack::UNLUCKY;
}
bat.flags |= BattleAttack::UNLUCKY;
}
}