1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Merge pull request #5726 from IvanSavenko/breath

Configurable multi-hex attacks
This commit is contained in:
Ivan Savenko
2025-05-21 17:10:59 +03:00
committed by GitHub
15 changed files with 408 additions and 191 deletions

View File

@@ -965,13 +965,16 @@ void BattleActionProcessor::makeAttack(const CBattleInfoCallback & battle, const
applyBattleEffects(battle, bat, attackerState, fireShield, defender, healInfo, distance, false);
//multiple-hex normal attack
std::set<const CStack*> attackedCreatures = battle.getAttackedCreatures(attacker, targetHex, bat.shot()); //creatures other than primary target
const auto & [attackedCreatures, useCustomAnimation] = battle.getAttackedCreatures(attacker, targetHex, bat.shot()); //creatures other than primary target
for(const CStack * stack : attackedCreatures)
{
if(stack != defender && stack->alive()) //do not hit same stack twice
applyBattleEffects(battle, bat, attackerState, fireShield, stack, healInfo, distance, true);
}
if (useCustomAnimation)
bat.flags |= BattleAttack::CUSTOM_ANIMATION;
std::shared_ptr<const Bonus> bonus = attacker->getFirstBonus(Selector::type()(BonusType::SPELL_LIKE_ATTACK));
if(bonus && ranged && bonus->subtype.hasValue()) //TODO: make it work in melee?
{