mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Use clearAffected flag
This commit is contained in:
parent
9f983c67c0
commit
9e8b09d747
@ -1553,8 +1553,12 @@ void CBattleInterface::castThisSpell(int spellID)
|
||||
|
||||
const CSpell::TargetInfo ti = sp->getTargetInfo(castingHero->getSpellSchoolLevel(sp));
|
||||
|
||||
if(ti.massive)
|
||||
if(ti.massive || ti.type == CSpell::NO_TARGET)
|
||||
spellSelMode = NO_LOCATION;
|
||||
else if(ti.type == CSpell::LOCATION && ti.clearAffected)
|
||||
{
|
||||
spellSelMode = FREE_LOCATION;
|
||||
}
|
||||
else if(ti.type == CSpell::CREATURE)
|
||||
{
|
||||
if(ti.smart)
|
||||
@ -1566,11 +1570,6 @@ void CBattleInterface::castThisSpell(int spellID)
|
||||
{
|
||||
spellSelMode = OBSTACLE;
|
||||
}
|
||||
//todo: move to JSON config
|
||||
if(spellID == SpellID::FIRE_WALL || spellID == SpellID::FORCE_FIELD)
|
||||
{
|
||||
spellSelMode = FREE_LOCATION;
|
||||
}
|
||||
|
||||
if (spellSelMode == NO_LOCATION) //user does not have to select location
|
||||
{
|
||||
|
@ -504,6 +504,8 @@ void CSpell::TargetInfo::init(const CSpell * spell, const int level)
|
||||
massive = levelInfo.range == "X";
|
||||
onlyAlive = !spell->isRisingSpell();
|
||||
alwaysHitDirectly = false;
|
||||
clearAffected = levelInfo.clearAffected;
|
||||
clearTarget = levelInfo.clearTarget;
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,6 +139,9 @@ public:
|
||||
///no immunity on primary target (mostly spell-like attack)
|
||||
bool alwaysHitDirectly;
|
||||
|
||||
bool clearTarget;
|
||||
bool clearAffected;
|
||||
|
||||
TargetInfo(const CSpell * spell, const int level);
|
||||
TargetInfo(const CSpell * spell, const int level, ECastingMode::ECastingMode mode);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user