mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
fix mantiss #2210
This commit is contained in:
@ -4213,12 +4213,17 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
|
||||
}
|
||||
BonusList bl = *(st->getBonuses(Selector::type(Bonus::ENCHANTER)));
|
||||
int side = gs->curB->whatSide(st->owner);
|
||||
if (bl.size() && st->casts && !gs->curB->sides.at(side).enchanterCounter)
|
||||
if (st->casts && !gs->curB->sides.at(side).enchanterCounter)
|
||||
{
|
||||
bool casted = false;
|
||||
while (!bl.empty() and !casted)
|
||||
{
|
||||
auto bonus = *RandomGeneratorUtil::nextItem(bl, gs->getRandomGenerator());
|
||||
auto spellID = SpellID(bonus->subtype);
|
||||
const CSpell * spell = SpellID(spellID).toSpell();
|
||||
if (gs->curB->battleCanCastThisSpell(st->owner, spell, ECastingMode::ENCHANTER_CASTING) == ESpellCastProblem::OK) //TODO: select another available?
|
||||
bl.remove_if([&bonus](Bonus * b){return b==bonus;});
|
||||
|
||||
if (gs->curB->battleCanCastThisSpell(st->owner, spell, ECastingMode::ENCHANTER_CASTING) == ESpellCastProblem::OK)
|
||||
{
|
||||
BattleSpellCastParameters parameters(gs->curB);
|
||||
parameters.spellLvl = bonus->val;
|
||||
@ -4240,7 +4245,10 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
|
||||
ssp.val = bonus->additionalInfo; //increase cooldown counter
|
||||
ssp.stackID = st->ID;
|
||||
sendAndApply(&ssp);
|
||||
|
||||
casted = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
bl = *(st->getBonuses(Selector::type(Bonus::ENCHANTED)));
|
||||
for (auto b : bl)
|
||||
|
Reference in New Issue
Block a user