diff options
author | megamage <none@none> | 2009-05-25 13:03:11 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-25 13:03:11 -0500 |
commit | a2f8a735aeec5517a1e28dd9202f241966be7691 (patch) | |
tree | 5ecbe5623f48efd7b0102bfb39f1dfb404d17b49 /src | |
parent | 00f50798d365c0318b10a012c8985edb3c1f87c7 (diff) | |
parent | 9fda5c57e18ceb130850b55411d40c44bbb3ad81 (diff) |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 17 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 80 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 2 |
3 files changed, 43 insertions, 56 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 14f5a1d3319..88085bd99fe 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1734,7 +1734,7 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) break; case TARGET_UNIT_CASTER_FISHING: { - AddUnitTarget(m_caster, i); + //AddUnitTarget(m_caster, i); float min_dis = GetSpellMinRange(m_spellInfo, true); float max_dis = GetSpellMaxRange(m_spellInfo, true); float dis = rand_norm() * (max_dis - min_dis) + min_dis; @@ -4601,20 +4601,7 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_LEAP: case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER: { - float dis = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); - float fx = m_caster->GetPositionX() + dis * cos(m_caster->GetOrientation()); - float fy = m_caster->GetPositionY() + dis * sin(m_caster->GetOrientation()); - // teleport a bit above terrain level to avoid falling below it - float fz = MapManager::Instance().GetBaseMap(m_caster->GetMapId())->GetHeight(fx,fy,m_caster->GetPositionZ(),true); - if(fz <= INVALID_HEIGHT) // note: this also will prevent use effect in instances without vmaps height enabled - return SPELL_FAILED_TRY_AGAIN; - - float caster_pos_z = m_caster->GetPositionZ(); - // Control the caster to not climb or drop when +-fz > 8 - if(!(fz<=caster_pos_z+8 && fz>=caster_pos_z-8)) - return SPELL_FAILED_TRY_AGAIN; - - // not allow use this effect at battleground until battleground start + //Do not allow to cast it before BG starts. if(m_caster->GetTypeId()==TYPEID_PLAYER) if(BattleGround const *bg = ((Player*)m_caster)->GetBattleGround()) if(bg->GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 29d06ba4d20..b5f0fe6ef47 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5783,47 +5783,47 @@ void Spell::EffectMomentMove(uint32 i) return; uint32 mapid = m_caster->GetMapId(); - float dis = m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); - - // src point - float *fx = new float[11], *fy = new float[11], *fz = new float[11]; - unitTarget->GetPosition(fx[0], fy[0], fz[0]); - - float orientation = unitTarget->GetOrientation(), itr_i, step = dis / 10.0, fx2, fy2, fz2, ground, floor; - int itr_j = 1, last_valid = 0; - bool hit = false; - - for (itr_i = step; itr_i <= dis; itr_i += step) - { - fx[itr_j] = fx[0] + itr_i * cos(orientation); - fy[itr_j] = fy[0] + itr_i * sin(orientation); - ground = MapManager::Instance().GetMap(mapid, unitTarget)->GetHeight(fx[itr_j], fy[itr_j], MAX_HEIGHT, true); - floor = MapManager::Instance().GetMap(mapid, unitTarget)->GetHeight(fx[itr_j], fy[itr_j], fz[last_valid], true); - fz[itr_j] = fabs(ground - fz[last_valid]) <= fabs(floor - fz[last_valid]) ? ground : floor; - if (fabs(fz[itr_j] - fz[0]) <= 6.0) - { - if (VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(mapid, fx[last_valid], fy[last_valid], fz[last_valid] + 0.5, fx[itr_j], fy[itr_j], fz[itr_j] + 0.5, fx2, fy2, fz2, -0.5)) - { - hit = true; - fx[itr_j] = fx2 - 0.6 * cos(orientation); - fy[itr_j] = fy2 - 0.6 * sin(orientation); - ground = MapManager::Instance().GetMap(mapid, unitTarget)->GetHeight(fx[itr_j], fy[itr_j], MAX_HEIGHT, true); - floor = MapManager::Instance().GetMap(mapid, unitTarget)->GetHeight(fx[itr_j], fy[itr_j], fz[last_valid], true); - float tempz = fabs(ground - fz[last_valid]) <= fabs(floor - fz[last_valid]) ? ground : floor; - fz[itr_j] = fabs(tempz - fz[last_valid]) <= fabs(fz2 - fz[last_valid]) ? tempz : fz2; - break; - } - else - last_valid = itr_j; - } - itr_j++; - } - if (hit == false) - itr_j = last_valid; - - unitTarget->NearTeleportTo(fx[itr_j], fy[itr_j], fz[itr_j] + 0.07531, orientation, unitTarget==m_caster); + float dist = m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + float x,y,z; + float destx,desty,destz,ground,floor; + float orientation = unitTarget->GetOrientation(), step = dist/10.0f; + + unitTarget->GetPosition(x,y,z); + destx = x + dist * cos(orientation); + desty = y + dist * sin(orientation); + ground = unitTarget->GetMap()->GetHeight(destx,desty,MAX_HEIGHT,true); + floor = unitTarget->GetMap()->GetHeight(destx,desty,z, true); + destz = fabs(ground - z) <= fabs(floor - z) ? ground:floor; + + bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(mapid,x,y,z+0.5f,destx,desty,destz+0.5f,destx,desty,destz,-0.5f); + + if(col) // We had a collision! + { + destx -= 0.6 * cos(orientation); + desty -= 0.6 * sin(orientation); + dist = sqrt((x-destx)*(x-destx) + (y-desty)*(y-desty)); + step = dist/10.0f; + } + + int j = 0; + for(j; j<10 ;j++) + { + if(fabs(z - destz) > 6) + { + destx -= step * cos(orientation); + desty -= step * sin(orientation); + ground = unitTarget->GetMap()->GetHeight(destx,desty,MAX_HEIGHT,true); + floor = unitTarget->GetMap()->GetHeight(destx,desty,z, true); + destz = fabs(ground - z) <= fabs(floor - z) ? ground:floor; + }else + break; + } + if(j == 9) + { + return; + } + unitTarget->NearTeleportTo(destx, desty, destz + 0.07531, orientation, unitTarget==m_caster); - delete [] fx; delete [] fy; delete [] fz; } void Spell::EffectReputation(uint32 i) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 4ffb3ac21e9..14aa7ea3787 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -3367,7 +3367,7 @@ void SpellMgr::LoadSpellCustomAttr() case 42005: // Bloodboil case 38296: // Spitfire Totem case 37676: // Insidious Whisper - case 46009: // Negative Energy + case 46008: // Negative Energy case 45641: // Fire Bloom case 55665: // Life Drain - Sapphiron (H) case 28796: // Poison Bolt Volly - Faerlina |