aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-07-01 17:36:34 -0500
committermegamage <none@none>2009-07-01 17:36:34 -0500
commit9c9c9f507895e551c8c7dc941e06e44b2b35b9a9 (patch)
tree8ad5c6f7753b941832d2833f4ea757711dbdd106 /src
parent255d21b52b9d68dc347dedeee8dc8706094ddbde (diff)
[8089] Implement SPELL_EFFECT_CHARGE2(149), more correct monster flags use in charge effects. Author: VladimirMangos
Last fix let for example correct charge for flight creatures... --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/SpellEffects.cpp49
2 files changed, 41 insertions, 9 deletions
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 21a73b2597a..51a2b91e63e 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -319,6 +319,7 @@ class Spell
void EffectSelfResurrect(uint32 i);
void EffectSkinning(uint32 i);
void EffectCharge(uint32 i);
+ void EffectCharge2(uint32 i);
void EffectProspecting(uint32 i);
void EffectMilling(uint32 i);
void EffectRenamePet(uint32 i);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 5ad53f55e6f..2adf074f8a7 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -213,7 +213,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectActivateRune, //146 SPELL_EFFECT_ACTIVATE_RUNE
&Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail
&Spell::EffectUnused, //148 SPELL_EFFECT_148 unused
- &Spell::EffectNULL, //149 SPELL_EFFECT_149 swoop
+ &Spell::EffectCharge2, //149 SPELL_EFFECT_CHARGE2 swoop
&Spell::EffectUnused, //150 SPELL_EFFECT_150 unused
&Spell::EffectTriggerRitualOfSummoning, //151 SPELL_EFFECT_TRIGGER_SPELL_2
&Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend
@@ -6130,20 +6130,51 @@ void Spell::EffectSkinning(uint32 /*i*/)
void Spell::EffectCharge(uint32 /*i*/)
{
- if(!m_caster)
+ if (!unitTarget)
return;
- Unit *target = m_targets.getUnitTarget();
- if(!target)
- return;
+ float x, y, z;
+ unitTarget->GetContactPoint(m_caster, x, y, z);
+ if (unitTarget->GetTypeId() != TYPEID_PLAYER)
+ ((Creature *)unitTarget)->StopMoving();
+
+ // Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags
+ m_caster->SendMonsterMove(x, y, z, 0, m_caster->GetTypeId()==TYPEID_PLAYER ? MONSTER_MOVE_WALK : ((Creature*)m_caster)->GetMonsterMoveFlags(), 1);
+
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
+ m_caster->GetMap()->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation());
+ // not all charge effects used in negative spells
+ if (unitTarget != m_caster && !IsPositiveSpell(m_spellInfo->Id))
+ m_caster->Attack(unitTarget,true);
+}
+
+void Spell::EffectCharge2(uint32 /*i*/)
+{
float x, y, z;
- target->GetContactPoint(m_caster, x, y, z);
- m_caster->GetMotionMaster()->MoveCharge(x, y, z);
+ if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
+ {
+ x = m_targets.m_destX;
+ y = m_targets.m_destY;
+ z = m_targets.m_destZ;
+
+ if (unitTarget->GetTypeId() != TYPEID_PLAYER)
+ ((Creature *)unitTarget)->StopMoving();
+ }
+ else if (unitTarget && unitTarget != m_caster)
+ unitTarget->GetContactPoint(m_caster, x, y, z);
+ else
+ return;
+
+ // Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags
+ m_caster->SendMonsterMove(x, y, z, 0, m_caster->GetTypeId()==TYPEID_PLAYER ? MONSTER_MOVE_WALK : ((Creature*)m_caster)->GetMonsterMoveFlags(), 1);
+
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
+ m_caster->GetMap()->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation());
// not all charge effects used in negative spells
- if ( !IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER)
- m_caster->Attack(target, true);
+ if (unitTarget && unitTarget != m_caster && !IsPositiveSpell(m_spellInfo->Id))
+ m_caster->Attack(unitTarget,true);
}
void Spell::EffectKnockBack(uint32 i)