mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Explicit use of limit selector in CBattleInfoCallback::getRandomBeneficialSpell
* reverted changes in IBonusBearer::hasBonusFrom just in case
This commit is contained in:
parent
902117d812
commit
730e3b6d0f
@ -1847,7 +1847,10 @@ SpellID CBattleInfoCallback::getRandomBeneficialSpell(CRandomGenerator & rand, c
|
||||
|
||||
for(const SpellID spellID : allPossibleSpells)
|
||||
{
|
||||
if (subject->hasBonusFrom(Bonus::SPELL_EFFECT, spellID)
|
||||
std::stringstream cachingStr;
|
||||
cachingStr << "source_" << Bonus::SPELL_EFFECT << "id_" << spellID.num;
|
||||
|
||||
if(subject->hasBonus(Selector::source(Bonus::SPELL_EFFECT, spellID), Selector::all, cachingStr.str())
|
||||
//TODO: this ability has special limitations
|
||||
|| battleCanCastThisSpellHere(subject, spellID.toSpell(), ECastingMode::CREATURE_ACTIVE_CASTING, subject->position) != ESpellCastProblem::OK)
|
||||
continue;
|
||||
|
@ -362,7 +362,7 @@ bool IBonusBearer::hasBonusFrom(Bonus::BonusSource source, ui32 sourceID) const
|
||||
{
|
||||
std::stringstream cachingStr;
|
||||
cachingStr << "source_" << source << "id_" << sourceID;
|
||||
return hasBonus(Selector::source(source,sourceID), Selector::all, cachingStr.str());
|
||||
return hasBonus(Selector::source(source,sourceID), cachingStr.str());
|
||||
}
|
||||
|
||||
int IBonusBearer::MoraleVal() const
|
||||
|
Loading…
Reference in New Issue
Block a user