mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-23 12:08:45 +02:00
Fixed creature`s aimed spell targeting.
This commit is contained in:
parent
f36b40e311
commit
8eca149eb3
@ -1586,7 +1586,7 @@ void CBattleInterface::activateStack()
|
|||||||
stackCanCastSpell = true;
|
stackCanCastSpell = true;
|
||||||
if(randomSpellcaster)
|
if(randomSpellcaster)
|
||||||
creatureSpellToCast = -1; //spell will be set later on cast
|
creatureSpellToCast = -1; //spell will be set later on cast
|
||||||
|
else
|
||||||
creatureSpellToCast = curInt->cb->battleGetRandomStackSpell(s, CBattleInfoCallback::RANDOM_AIMED); //faerie dragon can cast only one spell until their next move
|
creatureSpellToCast = curInt->cb->battleGetRandomStackSpell(s, CBattleInfoCallback::RANDOM_AIMED); //faerie dragon can cast only one spell until their next move
|
||||||
//TODO: what if creature can cast BOTH random genie spell and aimed spell?
|
//TODO: what if creature can cast BOTH random genie spell and aimed spell?
|
||||||
}
|
}
|
||||||
@ -1633,23 +1633,16 @@ void CBattleInterface::getPossibleActionsForStack(const CStack * stack)
|
|||||||
{
|
{
|
||||||
if (stack->hasBonusOfType (Bonus::SPELLCASTER))
|
if (stack->hasBonusOfType (Bonus::SPELLCASTER))
|
||||||
{
|
{
|
||||||
//TODO: poll possible spells
|
if(creatureSpellToCast != -1)
|
||||||
const CSpell * spell;
|
|
||||||
BonusList spellBonuses = *stack->getBonuses (Selector::type(Bonus::SPELLCASTER));
|
|
||||||
for (Bonus * spellBonus : spellBonuses)
|
|
||||||
{
|
{
|
||||||
spell = SpellID(spellBonus->subtype).toSpell();
|
const CSpell * spell = SpellID(creatureSpellToCast).toSpell();
|
||||||
|
|
||||||
PossibleActions act = getCasterAction(spell, stack);
|
PossibleActions act = getCasterAction(spell, stack);
|
||||||
|
|
||||||
if(act == NO_LOCATION)
|
if(act == NO_LOCATION)
|
||||||
logGlobal->error("NO_LOCATION action target is not yet supported for creatures");
|
logGlobal->error("NO_LOCATION action target is not yet supported for creatures");
|
||||||
else
|
else
|
||||||
possibleActions.push_back(act);
|
possibleActions.push_back(act);
|
||||||
|
|
||||||
}
|
}
|
||||||
std::sort(possibleActions.begin(), possibleActions.end());
|
|
||||||
auto it = std::unique (possibleActions.begin(), possibleActions.end());
|
|
||||||
possibleActions.erase (it, possibleActions.end());
|
|
||||||
}
|
}
|
||||||
if (stack->hasBonusOfType (Bonus::RANDOM_SPELLCASTER))
|
if (stack->hasBonusOfType (Bonus::RANDOM_SPELLCASTER))
|
||||||
possibleActions.push_back (RANDOM_GENIE_SPELL);
|
possibleActions.push_back (RANDOM_GENIE_SPELL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user