Implemented broad support for fields min_dist, min_dist_mod, max_dist, max_dist_mod -

Scales spell power based on targets distance from caster.
This implemented in a broad way to function with spells
that would make sense to scale. Some work will still be needed on this.

Be aware if making custom
spells not everything will work and certain effects just
should not be included (use common sense).
This commit is contained in:
KayenEQ
2014-08-02 21:10:44 -04:00
parent e0e473ce06
commit 52d92b7181
10 changed files with 68 additions and 6 deletions
+6 -1
View File
@@ -740,6 +740,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
float dist = caster->GetAOERange(spell_id);
float dist2 = dist * dist;
float dist_targ = 0;
bool bad = IsDetrimentalSpell(spell_id);
bool isnpc = caster->IsNPC();
@@ -755,7 +756,9 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
continue;
if (curmob == caster && !affect_caster) //watch for caster too
continue;
if (center->DistNoRoot(*curmob) > dist2) //make sure they are in range
dist_targ = center->DistNoRoot(*curmob);
if (dist_targ > dist2) //make sure they are in range
continue;
if (isnpc && curmob->IsNPC()) { //check npc->npc casting
FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
@@ -786,6 +789,8 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
continue;
}
curmob->CalcSpellPowerDistanceMod(spell_id, dist_targ);
//if we get here... cast the spell.
if (IsTargetableAESpell(spell_id) && bad) {
if (iCounter < MAX_TARGETS_ALLOWED) {