mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fixed #1361.
This commit is contained in:
@@ -716,7 +716,7 @@ const CGHeroInstance * BattleInfo::getHero( PlayerColor player ) const
|
|||||||
return heroes[1];
|
return heroes[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ui32> BattleInfo::calculateResistedStacks(const CSpell * sp, const CGHeroInstance * caster, const CGHeroInstance * hero2, const std::set<const CStack*> affectedCreatures, PlayerColor casterSideOwner, ECastingMode::ECastingMode mode, int usedSpellPower, int spellLevel) const
|
std::vector<ui32> BattleInfo::calculateResistedStacks(const CSpell * sp, const CGHeroInstance * caster, const CGHeroInstance * hero2, const std::vector<const CStack*> affectedCreatures, PlayerColor casterSideOwner, ECastingMode::ECastingMode mode, int usedSpellPower, int spellLevel) const
|
||||||
{
|
{
|
||||||
std::vector<ui32> ret;
|
std::vector<ui32> ret;
|
||||||
for(auto & affectedCreature : affectedCreatures)
|
for(auto & affectedCreature : affectedCreatures)
|
||||||
|
@@ -116,7 +116,7 @@ struct DLL_LINKAGE BattleInfo : public CBonusSystemNode, public CBattleInfoCallb
|
|||||||
const CGHeroInstance * getHero(PlayerColor player) const; //returns fighting hero that belongs to given player
|
const CGHeroInstance * getHero(PlayerColor player) const; //returns fighting hero that belongs to given player
|
||||||
|
|
||||||
|
|
||||||
std::vector<ui32> calculateResistedStacks(const CSpell * sp, const CGHeroInstance * caster, const CGHeroInstance * hero2, const std::set<const CStack*> affectedCreatures, PlayerColor casterSideOwner, ECastingMode::ECastingMode mode, int usedSpellPower, int spellLevel) const;
|
std::vector<ui32> calculateResistedStacks(const CSpell * sp, const CGHeroInstance * caster, const CGHeroInstance * hero2, const std::vector<const CStack*> affectedCreatures, PlayerColor casterSideOwner, ECastingMode::ECastingMode mode, int usedSpellPower, int spellLevel) const;
|
||||||
|
|
||||||
const CStack * battleGetStack(BattleHex pos, bool onlyAlive); //returns stack at given tile
|
const CStack * battleGetStack(BattleHex pos, bool onlyAlive); //returns stack at given tile
|
||||||
const CGHeroInstance * battleGetOwner(const CStack * stack) const; //returns hero that owns given stack; nullptr if none
|
const CGHeroInstance * battleGetOwner(const CStack * stack) const; //returns hero that owns given stack; nullptr if none
|
||||||
|
@@ -3967,10 +3967,12 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
|
|||||||
}
|
}
|
||||||
|
|
||||||
//calculating affected creatures for all spells
|
//calculating affected creatures for all spells
|
||||||
std::set<const CStack*> attackedCres; //what is that and what is sc.afectedCres?
|
//must be vector, as in Chain Lightning order matters
|
||||||
|
std::vector<const CStack*> attackedCres; //what is that and what is sc.afectedCres?
|
||||||
if (mode != ECastingMode::ENCHANTER_CASTING)
|
if (mode != ECastingMode::ENCHANTER_CASTING)
|
||||||
{
|
{
|
||||||
attackedCres = gs->curB->getAffectedCreatures(spell, spellLvl, casterColor, destination);
|
auto creatures = gs->curB->getAffectedCreatures(spell, spellLvl, casterColor, destination);
|
||||||
|
std::copy(creatures.begin(), creatures.end(), std::back_inserter(attackedCres));
|
||||||
}
|
}
|
||||||
else //enchanter - hit all possible stacks
|
else //enchanter - hit all possible stacks
|
||||||
{
|
{
|
||||||
@@ -3982,11 +3984,12 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
|
|||||||
{
|
{
|
||||||
if(stack->isValidTarget()) //TODO: allow dead targets somewhere in the future
|
if(stack->isValidTarget()) //TODO: allow dead targets somewhere in the future
|
||||||
{
|
{
|
||||||
attackedCres.insert(stack);
|
attackedCres.push_back(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto cre : attackedCres)
|
for (auto cre : attackedCres)
|
||||||
{
|
{
|
||||||
sc.affectedCres.insert (cre->ID);
|
sc.affectedCres.insert (cre->ID);
|
||||||
|
Reference in New Issue
Block a user