mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
Fixed #1207. Some tweaks.
This commit is contained in:
parent
b22d8a007f
commit
111312636a
@ -1700,6 +1700,11 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
|
|||||||
break;
|
break;
|
||||||
} //switch(sc->id)
|
} //switch(sc->id)
|
||||||
|
|
||||||
|
if (spell.isDamageSpell() && sc->affectedCres.empty()) //for example Inferno that causes no BattleStackAttacked
|
||||||
|
{
|
||||||
|
displayEffect (spell.mainEffectAnim, sc->tile);
|
||||||
|
}
|
||||||
|
|
||||||
//support for resistance
|
//support for resistance
|
||||||
for(size_t j = 0; j < sc->resisted.size(); ++j)
|
for(size_t j = 0; j < sc->resisted.size(); ++j)
|
||||||
{
|
{
|
||||||
|
@ -393,7 +393,7 @@ void CCampaignScenario::prepareCrossoverHeroes( std::vector<CGHeroInstance *> he
|
|||||||
//trimming creatures
|
//trimming creatures
|
||||||
BOOST_FOREACH(CGHeroInstance * cgh, crossoverHeroes)
|
BOOST_FOREACH(CGHeroInstance * cgh, crossoverHeroes)
|
||||||
{
|
{
|
||||||
vstd::erase_if(cgh->stacks, [&](const std::pair<SlotID, CStackInstance *> & j)
|
vstd::erase_if(cgh->stacks, [&](const std::pair<SlotID, CStackInstance *> & j) -> bool
|
||||||
{
|
{
|
||||||
CreatureID::ECreatureID crid = j.second->getCreatureID().toEnum();
|
CreatureID::ECreatureID crid = j.second->getCreatureID().toEnum();
|
||||||
return !(travelOptions.monstersKeptByHero[crid / 8] & (1 << (crid % 8)) );
|
return !(travelOptions.monstersKeptByHero[crid / 8] & (1 << (crid % 8)) );
|
||||||
|
@ -3994,14 +3994,10 @@ 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;
|
std::set<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);
|
attackedCres = gs->curB->getAffectedCreatures(spell, spellLvl, casterColor, destination);
|
||||||
for(std::set<const CStack*>::const_iterator it = attackedCres.begin(); it != attackedCres.end(); ++it)
|
|
||||||
{
|
|
||||||
sc.affectedCres.insert((*it)->ID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else //enchanter - hit all possible stacks
|
else //enchanter - hit all possible stacks
|
||||||
{
|
{
|
||||||
@ -4018,16 +4014,20 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BOOST_FOREACH (auto cre, attackedCres)
|
||||||
|
{
|
||||||
|
sc.affectedCres.insert (cre->ID);
|
||||||
|
}
|
||||||
|
|
||||||
//checking if creatures resist
|
//checking if creatures resist
|
||||||
sc.resisted = gs->curB->calculateResistedStacks(spell, caster, secHero, attackedCres, casterColor, mode, usedSpellPower, spellLvl);
|
sc.resisted = gs->curB->calculateResistedStacks(spell, caster, secHero, attackedCres, casterColor, mode, usedSpellPower, spellLvl);
|
||||||
|
|
||||||
//calculating dmg to display
|
//calculating dmg to display
|
||||||
for(std::set<const CStack*>::iterator it = attackedCres.begin(); it != attackedCres.end(); ++it)
|
BOOST_FOREACH (auto cre, attackedCres)
|
||||||
{
|
{
|
||||||
if(vstd::contains(sc.resisted, (*it)->ID)) //this creature resisted the spell
|
if(vstd::contains(sc.resisted, cre->ID)) //this creature resisted the spell
|
||||||
continue;
|
continue;
|
||||||
sc.dmgToDisplay += gs->curB->calculateSpellDmg(spell, caster, *it, spellLvl, usedSpellPower);
|
sc.dmgToDisplay += gs->curB->calculateSpellDmg(spell, caster, cre, spellLvl, usedSpellPower);
|
||||||
}
|
}
|
||||||
if (spellID == SpellID::DEATH_STARE || spellID == SpellID::ACID_BREATH_DAMAGE)
|
if (spellID == SpellID::DEATH_STARE || spellID == SpellID::ACID_BREATH_DAMAGE)
|
||||||
{
|
{
|
||||||
@ -4062,6 +4062,7 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
|
|||||||
BattleStackAttacked bsa;
|
BattleStackAttacked bsa;
|
||||||
if ((destination > -1 && (*it)->coversPos(destination)) || (spell->range[spellLvl] == "X" || mode == ECastingMode::ENCHANTER_CASTING))
|
if ((destination > -1 && (*it)->coversPos(destination)) || (spell->range[spellLvl] == "X" || mode == ECastingMode::ENCHANTER_CASTING))
|
||||||
//display effect only upon primary target of area spell
|
//display effect only upon primary target of area spell
|
||||||
|
//FIXME: if no stack is attacked, ther eis no animation and interface freezes
|
||||||
{
|
{
|
||||||
bsa.flags |= BattleStackAttacked::EFFECT;
|
bsa.flags |= BattleStackAttacked::EFFECT;
|
||||||
bsa.effect = spell->mainEffectAnim;
|
bsa.effect = spell->mainEffectAnim;
|
||||||
|
Loading…
Reference in New Issue
Block a user