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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user