diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/MotionMaster.cpp | 3 | ||||
| -rw-r--r-- | src/game/PointMovementGenerator.cpp | 2 | ||||
| -rw-r--r-- | src/game/Spell.cpp | 38 | ||||
| -rw-r--r-- | src/game/Spell.h | 3 | ||||
| -rw-r--r-- | src/game/SpellEffects.cpp | 17 | ||||
| -rw-r--r-- | src/game/SpellMgr.cpp | 13 |
6 files changed, 45 insertions, 31 deletions
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index 51e684c5a6c..b31d3231a3b 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -333,7 +333,6 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee { uint32 moveFlag = MOVEFLAG_JUMP | MOVEFLAG_WALK; uint32 time = speedZ * 100; - i_owner->SendMonsterMove(x, y, z, moveFlag, time, speedZ); i_owner->addUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING); i_owner->m_TempSpeed = speedXY; @@ -348,6 +347,8 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z ); Mutate(new PointMovementGenerator<Creature>(0,x,y,z), MOTION_SLOT_CONTROLLED); } + + i_owner->SendMonsterMove(x, y, z, moveFlag, time, speedZ); } void diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp index 0c3758bfc5e..dedb4f0829c 100644 --- a/src/game/PointMovementGenerator.cpp +++ b/src/game/PointMovementGenerator.cpp @@ -28,7 +28,7 @@ template<class T> void PointMovementGenerator<T>::Initialize(T &unit) { - //unit.StopMoving(); + unit.StopMoving(); unit.clearUnitState(UNIT_STAT_MOVING); Traveller<T> traveller(unit); i_destinationHolder.SetDestination(traveller,i_x,i_y,i_z, !unit.hasUnitState(UNIT_STAT_JUMPING)); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 4c2fe39ee1b..85ff0274921 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -365,6 +365,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi m_delayAtDamageCount = 0; m_applyMultiplierMask = 0; + m_effectMask = 0; // Get data for type of attack switch (m_spellInfo->DmgClass) @@ -2450,7 +2451,21 @@ void Spell::cast(bool skipCheck) SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()... if(m_customAttr & SPELL_ATTR_CU_CHARGE) - EffectCharge(0); + { + for(uint32 i = 0; i < 3; ++i) + { + switch(m_spellInfo->Effect[i]) + { + case SPELL_EFFECT_CHARGE: + case SPELL_EFFECT_JUMP: + case SPELL_EFFECT_JUMP2: + case SPELL_EFFECT_138: + HandleEffects(NULL,NULL,NULL,i); + m_effectMask |= (1<<i); + break; + } + } + } // Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells if (m_spellInfo->speed > 0.0f && !IsChanneledSpell(m_spellInfo)) @@ -3660,8 +3675,12 @@ void Spell::HandleThreatSpells(uint32 spellId) DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threatSpell->threat); } -void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i, float /*DamageMultiplier*/) +void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i) { + //effect has been handled, skip it + if(m_effectMask & (1<<i)) + return; + unitTarget = pUnitTarget; itemTarget = pItemTarget; gameObjTarget = pGOTarget; @@ -3676,21 +3695,8 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar if(eff<TOTAL_SPELL_EFFECTS) { //sLog.outDebug( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff); - (*this.*SpellEffects[eff])(i); - } - /* - else - { - sLog.outDebug( "WORLD: Spell FX %d > TOTAL_SPELL_EFFECTS ", eff); - if (m_CastItem) - EffectEnchantItemTmp(i); - else - { - sLog.outError("SPELL: unknown effect %u spell id %u", - eff, m_spellInfo->Id); - } + (this->*SpellEffects[eff])(i); } - */ } void Spell::TriggerSpell() diff --git a/src/game/Spell.h b/src/game/Spell.h index b0ef28fd89d..9cbd7f666dd 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -428,7 +428,7 @@ class Spell void SendResurrectRequest(Player* target); void SendPlaySpellVisual(uint32 SpellID); - void HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i, float DamageMultiplier = 1.0); + void HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i); void HandleThreatSpells(uint32 spellId); //void HandleAddAura(Unit* Target); @@ -639,6 +639,7 @@ class Spell uint32 m_customAttr; bool m_skipCheck; + uint32 m_effectMask; }; namespace Trinity diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 3933db44367..dd3b844a36f 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2168,7 +2168,7 @@ void Spell::EffectJump(uint32 i) Unit* pTarget = NULL; if(m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster) pTarget = m_targets.getUnitTarget(); - else if(unitTarget->getVictim()) + else if(m_caster->getVictim()) pTarget = m_caster->getVictim(); else if(m_caster->GetTypeId() == TYPEID_PLAYER) pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection()); @@ -2178,14 +2178,14 @@ void Spell::EffectJump(uint32 i) else o = m_caster->GetOrientation(); } - else if(unitTarget) + else if(m_targets.getUnitTarget()) { - unitTarget->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE); + m_targets.getUnitTarget()->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE); o = m_caster->GetOrientation(); } - else if(gameObjTarget) + else if(m_targets.getGOTarget()) { - gameObjTarget->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE); + m_targets.getGOTarget()->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE); o = m_caster->GetOrientation(); } else @@ -5851,20 +5851,17 @@ void Spell::EffectKnockBack(uint32 i) void Spell::EffectJump2(uint32 i) { - if(!unitTarget) - return; - float speedxy = float(m_spellInfo->EffectMiscValue[i])/10; float speedz = float(damage/10); if(!speedxy) { if(m_targets.getUnitTarget()) - unitTarget->JumpTo(m_targets.getUnitTarget(), speedz); + m_caster->JumpTo(m_targets.getUnitTarget(), speedz); } else { //1891: Disengage - unitTarget->JumpTo(speedxy, speedz, m_spellInfo->SpellIconID != 1891); + m_caster->JumpTo(speedxy, speedz, m_spellInfo->SpellIconID != 1891); } } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index fde5d63631f..46b534905ca 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -64,7 +64,9 @@ SpellMgr::SpellMgr() case SPELL_EFFECT_ENCHANT_ITEM: case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY: case SPELL_EFFECT_DISENCHANT: - case SPELL_EFFECT_FEED_PET: + //in 243 this is 0, in 309 it is 1 + //so both item target and unit target is pushed, and cause crash + //case SPELL_EFFECT_FEED_PET: case SPELL_EFFECT_PROSPECTING: case SPELL_EFFECT_MILLING: case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC: @@ -76,7 +78,10 @@ SpellMgr::SpellMgr() case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: case SPELL_EFFECT_APPLY_AREA_AURA_PET: case SPELL_EFFECT_APPLY_AREA_AURA_OWNER: - case SPELL_EFFECT_JUMP2: //42 + case SPELL_EFFECT_CHARGE: + case SPELL_EFFECT_JUMP: + case SPELL_EFFECT_JUMP2: + case SPELL_EFFECT_138: EffectTargetType[i] = SPELL_REQUIRE_CASTER; break; default: @@ -2360,9 +2365,13 @@ void SpellMgr::LoadSpellCustomAttr() mSpellCustomAttr[i] |= SPELL_ATTR_CU_DIRECT_DAMAGE; break; case SPELL_EFFECT_CHARGE: + case SPELL_EFFECT_JUMP: + case SPELL_EFFECT_JUMP2: + case SPELL_EFFECT_138: if(!spellInfo->speed && !spellInfo->SpellFamilyName) spellInfo->speed = SPEED_CHARGE; mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE; + break; case SPELL_EFFECT_TRIGGER_SPELL: if (SpellTargetType[spellInfo->EffectImplicitTargetA[j]]== TARGET_TYPE_DEST_CASTER || SpellTargetType[spellInfo->EffectImplicitTargetA[j]]== TARGET_TYPE_DEST_TARGET || |
