Skip to content

Commit

Permalink
Revert "recheck distance for delayed spells at hit v0.4, related to #873
Browse files Browse the repository at this point in the history
"

This reverts commit df6fef0.
  • Loading branch information
rsa committed Apr 11, 2012
1 parent d09f3cb commit 8935a69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
32 changes: 9 additions & 23 deletions src/game/Spell.cpp
Expand Up @@ -1109,11 +1109,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
m_damage += target->damage;
}

// recheck for availability/visibility of target
if (((m_spellInfo->speed > 0.0f ||
(m_spellInfo->EffectImplicitTargetA[0] == TARGET_CHAIN_DAMAGE &&
GetSpellCastTime(m_spellInfo, this) > 0)) &&
(!unit->isVisibleForOrDetect(m_caster, m_caster, false) && !m_IsTriggeredSpell)))
// recheck for visibility of target
if ((m_spellInfo->speed > 0.0f ||
(m_spellInfo->EffectImplicitTargetA[0] == TARGET_CHAIN_DAMAGE && GetSpellCastTime(m_spellInfo, this) > 0)) &&
(!unit->isVisibleForOrDetect(m_caster, m_caster, false) && !m_IsTriggeredSpell))
{
caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
missInfo = SPELL_MISS_EVADE;
Expand Down Expand Up @@ -4072,18 +4071,6 @@ void Spell::update(uint32 difftime)
cancel();
}

// check if all targets away range
if (!m_IsTriggeredSpell && (difftime >= m_timer) && !(m_spellInfo->AttributesEx7 & SPELL_ATTR_EX7_HAS_CHARGE_EFFECT))
{
SpellCastResult result = CheckRange(true, m_targets.getUnitTarget());
if (result != SPELL_CAST_OK)
{
SendCastResult(result);
cancel();
return;
}
}

switch(m_spellState)
{
case SPELL_STATE_PREPARING:
Expand Down Expand Up @@ -6893,17 +6880,16 @@ SpellCastResult Spell::CanAutoCast(Unit* target)
return result; //target invalid
}

SpellCastResult Spell::CheckRange(bool strict, WorldObject* checkTarget)
SpellCastResult Spell::CheckRange(bool strict)
{
Unit* target = (checkTarget && checkTarget->GetObjectGuid().IsUnit()) ? (Unit*)checkTarget : m_targets.getUnitTarget();
GameObject* pGoTarget = (checkTarget && checkTarget->GetObjectGuid().IsGameObject()) ? (GameObject*)checkTarget : m_targets.getGOTarget();
Unit *target = m_targets.getUnitTarget();
GameObject *pGoTarget = m_targets.getGOTarget();

SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);

bool friendly = target ? target->IsFriendlyTo(m_caster) : false;
float max_range = GetSpellMaxRange(srange, friendly);
float min_range = GetSpellMinRange(srange, friendly);
float add_range = checkTarget ? 0.0f : (strict ? 1.25f : 6.25f);

// special range cases
switch(m_spellInfo->rangeIndex)
Expand All @@ -6927,7 +6913,7 @@ SpellCastResult Spell::CheckRange(bool strict, WorldObject* checkTarget)

float combat_range = m_caster->GetMeleeAttackDistance(target);

float range_mod = combat_range + add_range;
float range_mod = combat_range + (strict ? 1.25f : 6.25f);

if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range_mod, this);
Expand All @@ -6941,7 +6927,7 @@ SpellCastResult Spell::CheckRange(bool strict, WorldObject* checkTarget)
}
default:
//add radius of caster and ~5 yds "give" for non stricred (landing) check
max_range += add_range;
max_range += (strict ? 1.25f : 6.25f);
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/Spell.h
Expand Up @@ -398,7 +398,7 @@ class Spell
void _handle_finish_phase();

SpellCastResult CheckItems();
SpellCastResult CheckRange(bool strict, WorldObject* target = NULL);
SpellCastResult CheckRange(bool strict);
SpellCastResult CheckPower();
SpellCastResult CheckOrTakeRunePower(bool take);
SpellCastResult CheckCasterAuras() const;
Expand Down

0 comments on commit 8935a69

Please sign in to comment.