PDA

Просмотр полной версии : [patch] Check cast melee spell


Den
30.03.2013, 19:17
Hi.

Melee spell cast to in front target and laterally.

Constant M_PI_F not fit, rather, its value is not correct.

Ближние спелы кастуются перед целью и сбоку. А, у нас стоя спиной к цели, можно бить ее любым ближним спелам.

Константа M_PI_F не подходит, скорее ее значение не верно.

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 9d72290..89763ae 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -5048,6 +5048,14 @@ SpellCastResult Spell::CheckCast(bool strict)
// check if target is in combat
if (non_caster_target && m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET) && target->isInCombat())
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+
+ // check that the target was in front caster
+ if (m_caster->IsNonMeleeSpellCasted(false))
+ {
+ float orientationCaster = 3.3f;
+ if (!m_caster->HasInArc(orientationCaster, target))
+ return SPELL_FAILED_UNIT_NOT_INFRONT;
+ }
}
// zone check
uint32 zone, area;

schmoozerd
30.03.2013, 20:00
hmm, you suggest a diff to the (rather natural PI) by 0.15, this is roughly 1/40 of a circle, so a _very_ small glitch (2 degrees on each side of the cone)

This appears strange to me :)

And isn't there already an IsInFront check in another place that might need replacement/ adjustment?

Also a small note:
I think HasInArc should not work on point-to-point, but rather on box-to-box mechanic (which would autoamatically work as a bigger angle would)

schmoozerd
31.03.2013, 04:30
the related place of this check is at this line:

if ((m_spellInfo->Attributes == (SPELL_ATTR_UNK4 | SPELL_ATTR_NOT_SHAPESHIFT | SPELL_ATTR_UNK18 | SPELL_ATTR_STOP_ATTACK_TARGET)) && !target->HasInArc(M_PI_F, m_caster))

Den
03.04.2013, 10:37
the related place of this check is at this line:

if ((m_spellInfo->Attributes == (SPELL_ATTR_UNK4 | SPELL_ATTR_NOT_SHAPESHIFT | SPELL_ATTR_UNK18 | SPELL_ATTR_STOP_ATTACK_TARGET)) && !target->HasInArc(M_PI_F, m_caster))


Works not for all spells :)

Den
28.12.2013, 19:44
Очень хорошо для проверки нужных спелов подходит атрибут SPELL_ATTR_EX_UNK27

@@ -4420,11 +4420,19 @@ SpellCastResult Spell::CheckCast(bool strict)
}

// check if target is in combat
if (non_caster_target && m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET) && target->isInCombat())
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+
+ // check melee spell that the target was in front caster
+ if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_UNK9) || m_spellInfo->HasAttribute(SPELL_ATTR_EX_UNK27))
+ {
+ if (!m_caster->HasInArc(M_PI_F, target))
+ return SPELL_FAILED_UNIT_NOT_INFRONT;
+ }
}
+
// zone check
uint32 zone, area;
m_caster->GetZoneAndAreaId(zone, area);

SpellCastResult locRes = sSpellMgr.GetSpellAllowedInLocationError(m_spellIn fo, m_caster->GetMapId(), zone, area,