mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Removed hardcoded checks for Summon Boat spell
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "../../Engine/Nullkiller.h"
|
||||
#include "../../../../lib/pathfinder/CPathfinder.h"
|
||||
#include "../../../../lib/pathfinder/TurnInfo.h"
|
||||
#include "../../../../lib/spells/ISpellMechanics.h"
|
||||
#include "../../../../lib/spells/adventure/SummonBoatEffect.h"
|
||||
|
||||
namespace NKAI
|
||||
{
|
||||
@@ -159,13 +161,21 @@ namespace AIPathfinding
|
||||
|
||||
for(const CGHeroInstance * hero : nodeStorage->getAllHeroes())
|
||||
{
|
||||
auto summonBoatSpell = SpellID(SpellID::SUMMON_BOAT).toSpell();
|
||||
|
||||
if(hero->canCastThisSpell(summonBoatSpell)
|
||||
&& hero->getSpellSchoolLevel(summonBoatSpell) >= MasteryLevel::ADVANCED)
|
||||
for (const auto & spell : LIBRARY->spellh->objects)
|
||||
{
|
||||
// TODO: For lower school level we might need to check the existence of some boat
|
||||
summonableVirtualBoats[hero] = std::make_shared<SummonBoatAction>();
|
||||
if (!spell || !spell->isAdventure())
|
||||
continue;
|
||||
|
||||
auto effect = spell->getAdventureMechanics().getEffectAs<SummonBoatEffect>(hero);
|
||||
|
||||
if (!effect || !hero->canCastThisSpell(spell.get()))
|
||||
continue;
|
||||
|
||||
if (effect->canCreateNewBoat() && effect->getSuccessChance(hero) == 100)
|
||||
{
|
||||
// TODO: For lower school level we might need to check the existence of some boat
|
||||
summonableVirtualBoats[hero] = std::make_shared<SummonBoatAction>(spell->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user