diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/DestinationHolderImp.h | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 22 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 12 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 5 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 1 | ||||
-rw-r--r-- | src/game/Unit.h | 2 |
6 files changed, 35 insertions, 9 deletions
diff --git a/src/game/DestinationHolderImp.h b/src/game/DestinationHolderImp.h index f30768e7993..984b643538a 100644 --- a/src/game/DestinationHolderImp.h +++ b/src/game/DestinationHolderImp.h @@ -98,7 +98,7 @@ DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove) float speed; if(traveller.GetTraveller().hasUnitState(UNIT_STAT_CHARGING)) - speed = 0.025f; // assume it is 25 yard per second + speed = SPEED_CHARGE * 0.001f; else speed = traveller.Speed() * 0.001f; // speed is in seconds so convert from second to millisecond i_totalTravelTime = static_cast<uint32>(dist/speed); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6f3f60a817a..3cdef148230 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -425,7 +425,7 @@ void Spell::FillTargetMap() { if(effectTargetType == SPELL_REQUIRE_CASTER) AddUnitTarget(m_caster, i); - if(effectTargetType == SPELL_REQUIRE_DEST) + /*else if(effectTargetType == SPELL_REQUIRE_DEST) { if(m_targets.HasDest() && m_spellInfo->speed > 0.0f) { @@ -433,7 +433,7 @@ void Spell::FillTargetMap() if (dist < 5.0f) dist = 5.0f; m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f); } - } + }*/ else if(effectTargetType == SPELL_REQUIRE_ITEM) { if(m_targets.getItemTarget()) @@ -613,6 +613,16 @@ void Spell::FillTargetMap() for(std::list<Unit*>::iterator iunit= tmpUnitMap.begin();iunit != tmpUnitMap.end();++iunit) AddUnitTarget((*iunit), i); } + + if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + { + if(m_spellInfo->speed > 0.0f && m_targets.HasDest()) + { + float dist = m_caster->GetDistance(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ); + if (dist < 5.0f) dist = 5.0f; + m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f); + } + } } void Spell::prepareDataForTriggerSystem() @@ -2209,6 +2219,8 @@ void Spell::cast(bool skipCheck) // Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells if (m_spellInfo->speed > 0.0f && !IsChanneledSpell(m_spellInfo)) { + if(m_customAttr & SPELL_ATTR_CU_CHARGE) + EffectCharge(0); // Remove used for cast item if need (it can be already NULL after TakeReagents call // in case delayed spell remove item at cast delay start @@ -2284,12 +2296,14 @@ uint64 Spell::handle_delayed(uint64 t_offset) m_immediateHandled = true; } + bool single_missile = (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION); + // now recheck units targeting correctness (need before any effects apply to prevent adding immunity at first effect not allow apply second spell effect and similar cases) for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end();++ihit) { if (ihit->processed == false) { - if ( ihit->timeDelay <= t_offset ) + if ( single_missile || ihit->timeDelay <= t_offset ) DoAllEffectOnTarget(&(*ihit)); else if( next_time == 0 || ihit->timeDelay < next_time ) next_time = ihit->timeDelay; @@ -2301,7 +2315,7 @@ uint64 Spell::handle_delayed(uint64 t_offset) { if (ighit->processed == false) { - if ( ighit->timeDelay <= t_offset ) + if ( single_missile || ighit->timeDelay <= t_offset ) DoAllEffectOnTarget(&(*ighit)); else if( next_time == 0 || ighit->timeDelay < next_time ) next_time = ighit->timeDelay; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2141c95a21b..047637e00f8 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -159,7 +159,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectUnused, // 93 SPELL_EFFECT_SUMMON_PHANTASM &Spell::EffectSelfResurrect, // 94 SPELL_EFFECT_SELF_RESURRECT &Spell::EffectSkinning, // 95 SPELL_EFFECT_SKINNING - &Spell::EffectCharge, // 96 SPELL_EFFECT_CHARGE + &Spell::EffectUnused, // 96 SPELL_EFFECT_CHARGE &Spell::EffectSummonCritter, // 97 SPELL_EFFECT_SUMMON_CRITTER &Spell::EffectKnockBack, // 98 SPELL_EFFECT_KNOCK_BACK &Spell::EffectDisEnchant, // 99 SPELL_EFFECT_DISENCHANT @@ -5734,16 +5734,20 @@ void Spell::EffectSkinning(uint32 /*i*/) void Spell::EffectCharge(uint32 /*i*/) { - if(!unitTarget || !m_caster) + if(!m_caster) + return; + + Unit *target = m_targets.getUnitTarget(); + if(!target) return; float x, y, z; - unitTarget->GetContactPoint(m_caster, x, y, z); + target->GetContactPoint(m_caster, x, y, z); m_caster->GetMotionMaster()->MoveCharge(x, y, z); // not all charge effects used in negative spells if ( !IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->Attack(unitTarget,true); + m_caster->Attack(target, true); } void Spell::EffectSummonCritter(uint32 i) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 6327a2dbe62..85cfe5c6e96 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2148,6 +2148,11 @@ void SpellMgr::LoadSpellCustomAttr() case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: case SPELL_EFFECT_HEAL: mSpellCustomAttr[i] |= SPELL_ATTR_CU_DIRECT_DAMAGE; + break; + case SPELL_EFFECT_CHARGE: + spellInfo->speed = SPEED_CHARGE; + mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE; + break; } } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 0c73bd24c44..babad470d5f 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -702,6 +702,7 @@ inline bool IsProfessionSkill(uint32 skill) #define SPELL_ATTR_CU_AURA_CC 0x00000040 #define SPELL_ATTR_CU_AURA_SPELL 0x00000080 #define SPELL_ATTR_CU_DIRECT_DAMAGE 0x00000100 +#define SPELL_ATTR_CU_CHARGE 0x00000200 typedef std::vector<uint32> SpellCustomAttribute; diff --git a/src/game/Unit.h b/src/game/Unit.h index 69c10400a4c..b1ca703007c 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -390,6 +390,8 @@ enum UnitMoveType #define MAX_MOVE_TYPE 8 extern float baseMoveSpeed[MAX_MOVE_TYPE]; +// assume it is 25 yard per 0.6 second +#define SPEED_CHARGE 42.0f enum WeaponAttackType { |