mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fix assert and condition for counting spell hexes
This commit is contained in:
parent
bf9a9283a4
commit
bb69ab1a1a
@ -937,7 +937,7 @@ void CPlayerInterface::battleAttack(const BattleID & battleID, const BattleAttac
|
||||
info.secondaryDefender.push_back(cb->getBattle(battleID)->battleGetStackByID(elem.stackAttacked));
|
||||
}
|
||||
}
|
||||
assert(info.defender != nullptr);
|
||||
assert(info.defender != nullptr || (info.spellEffect != SpellID::NONE && info.indirectAttack));
|
||||
assert(info.attacker != nullptr);
|
||||
|
||||
battleInt->stackAttacking(info);
|
||||
|
@ -532,7 +532,7 @@ std::string BattleActionsController::actionGetStatusMessage(PossiblePlayerBattle
|
||||
if(targetStack == nullptr) //should be true only for spell-like attack
|
||||
{
|
||||
auto spellLikeAttackBonus = owner.stacksController->getActiveStack()->getBonus(Selector::type()(BonusType::SPELL_LIKE_ATTACK));
|
||||
assert(bonus != nullptr);
|
||||
assert(spellLikeAttackBonus != nullptr);
|
||||
return boost::str(boost::format(CGI->generaltexth->allTexts[26]) % spellLikeAttackBonus->subtype.as<SpellID>().toSpell()->getNameTranslated());
|
||||
}
|
||||
|
||||
|
@ -740,8 +740,8 @@ bool CBattleInfoCallback::battleCanTargetEmptyHex(const battle::Unit * attacker)
|
||||
if(spell->isDamage())
|
||||
{
|
||||
spells::BattleCast cast(this, attacker, spells::Mode::SPELL_LIKE_ATTACK, spell);
|
||||
|
||||
if(vstd::find(spell->battleMechanics(&cast)->getTargetTypes(), spells::AimType::LOCATION) != spell->battleMechanics(&cast)->getTargetTypes().end())
|
||||
BattleHex dummySpellTarget = BattleHex(50); //check arbitrary hex for general spell range since currently there is no general way to access amount of hexes
|
||||
if(spell->battleMechanics(&cast)->rangeInHexes(dummySpellTarget).size() > 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -164,6 +164,7 @@ EffectTarget UnitEffect::transformTargetByRange(const Mechanics * m, const Targe
|
||||
|
||||
if(m->alwaysHitFirstTarget())
|
||||
{
|
||||
//TODO: examine if adjustments needed related to INVINCIBLE bonus
|
||||
if(!aimPoint.empty() && aimPoint.front().unitValue)
|
||||
targets.insert(aimPoint.front().unitValue);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user