mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +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:
parent
ae535384f7
commit
ebbc8cf208
@ -398,12 +398,6 @@ void MoraleLuckBox::set(const IBonusBearer * node)
|
||||
text += CGI->generaltexth->arraytxt[113]; //unaffected by morale
|
||||
bonusValue = 0;
|
||||
}
|
||||
else if(!morale && node && node->hasBonusOfType(Bonus::BLOCK_LUCK))
|
||||
{
|
||||
// TODO: there is no text like "Unaffected by luck" so probably we need own text
|
||||
text += CGI->generaltexth->arraytxt[noneTxtId];
|
||||
bonusValue = 0;
|
||||
}
|
||||
else if(morale && node && node->hasBonusOfType(Bonus::NO_MORALE))
|
||||
{
|
||||
auto noMorale = node->getBonus(Selector::type()(Bonus::NO_MORALE));
|
||||
|
@ -112,6 +112,7 @@ const std::set<std::string> deprecatedBonusSet = {
|
||||
"KING2",
|
||||
"KING3",
|
||||
"BLOCK_MORALE",
|
||||
"BLOCK_LUCK",
|
||||
};
|
||||
|
||||
///CBonusProxy
|
||||
|
@ -190,7 +190,6 @@ public:
|
||||
BONUS_NAME(WATER_WALKING) /*value - penalty percentage*/ \
|
||||
BONUS_NAME(NEGATE_ALL_NATURAL_IMMUNITIES) \
|
||||
BONUS_NAME(STACK_HEALTH) \
|
||||
BONUS_NAME(BLOCK_LUCK) \
|
||||
BONUS_NAME(FIRE_SPELLS) \
|
||||
BONUS_NAME(AIR_SPELLS) \
|
||||
BONUS_NAME(WATER_SPELLS) \
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user