From 8ca8b691b8e96f9c75200080046cd517f0e6b592 Mon Sep 17 00:00:00 2001 From: krz Date: Fri, 22 May 2009 19:51:48 +0200 Subject: [PATCH 1/5] Target selection for fishing spells. --HG-- branch : trunk --- src/game/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 9c4681d2f1..6aca2ae028 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1598,7 +1598,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(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float dis = m_caster->GetMap()->rand_norm() * (max_dis - min_dis) + min_dis; From 08e1ec8a8a5d626cdfee6e8274e903f608bab769 Mon Sep 17 00:00:00 2001 From: Anubisss Date: Sat, 23 May 2009 00:18:24 +0200 Subject: [PATCH 2/5] *Correct spell id for Muru's Negative Energy's MaxAffectedTargets by Alyen. Thank you. --HG-- branch : trunk --- src/game/SpellMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 48bae52983..23a85246a1 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2365,7 +2365,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 spellInfo->MaxAffectedTargets = 5; break; From f5f1caf6b67f53a4a2533fdd6ac260000fcb2bcc Mon Sep 17 00:00:00 2001 From: raczman Date: Sat, 23 May 2009 13:22:44 +0200 Subject: [PATCH 3/5] Rewrite of EffectMomentMove, this should finally fix blink. * Even when player cannot move, only effect will fail, which means other spelleffects will work. * Vmaps are required for proper work (as expected) Please test and report bugs. --HG-- branch : trunk --- src/game/Spell.cpp | 15 +------ src/game/SpellEffects.cpp | 87 +++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 64 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6aca2ae028..9d548da4ed 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4116,20 +4116,7 @@ uint8 Spell::CanCast(bool strict) case SPELL_EFFECT_LEAP: case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER: { - float dis = GetSpellRadius(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 89b92ccdc6..537087480a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5482,64 +5482,51 @@ void Spell::EffectMomentMove(uint32 i) return; uint32 mapid = m_caster->GetMapId(); - float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + float dist = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + float x,y,z; + float destx,desty,destz,ground,floor; + float orientation = unitTarget->GetOrientation(), step = dist/10.0f; - // src point - float *fx = new float[11], *fy = new float[11], *fz = new float[11]; - unitTarget->GetPosition(fx[0], fy[0], fz[0]); + 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; - 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; + bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(mapid,x,y,z+0.5f,destx,desty,destz+0.5f,destx,desty,destz,-0.5f); - for (itr_i = step; itr_i <= dis; itr_i += step) + if(col) // We had a collision! { - 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++; + destx -= 0.6 * cos(orientation); + desty -= 0.6 * sin(orientation); + dist = sqrt((x-destx)*(x-destx) + (y-desty)*(y-desty)); + step = dist/10.0f; } - if (hit == false) - itr_j = last_valid; - - - if (unitTarget->GetTypeId() == TYPEID_PLAYER) - ((Player*)unitTarget)->TeleportTo(mapid, fx[itr_j], fy[itr_j], fz[itr_j] + 0.07531, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget == m_caster ? TELE_TO_SPELL : 0)); - else - MapManager::Instance().GetMap(mapid, unitTarget)->CreatureRelocation((Creature*)unitTarget, fx[itr_j], fy[itr_j], fz[itr_j] + 0.07531, orientation); - - delete [] fx; delete [] fy; delete [] fz; - -/* uint32 mapid = unitTarget->GetMapId(); - float ox,oy,oz; - unitTarget->GetPosition(ox,oy,oz); - - float fx,fy,fz; // getObjectHitPos overwrite last args in any result case - if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(mapid, ox,oy,oz+0.5, m_targets.m_destX,m_targets.m_destY,oz+0.5,fx,fy,fz, -0.5)) - unitTarget->UpdateGroundPositionZ(fx,fy,fz); + + + for(int i = 0;i<10;i++) + { + 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(i == 9) + { + return; + } if(unitTarget->GetTypeId() == TYPEID_PLAYER) - ((Player*)unitTarget)->TeleportTo(mapid, fx, fy, fz, unitTarget->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); + ((Player*)unitTarget)->TeleportTo(mapid, destx, desty, destz+0.07531f, unitTarget->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); else - MapManager::Instance().GetMap(mapid, unitTarget)->CreatureRelocation((Creature*)unitTarget, fx, fy, fz, unitTarget->GetOrientation());*/ + unitTarget->GetMap()->CreatureRelocation((Creature*)unitTarget, destx, desty, destz,unitTarget->GetOrientation()); + } void Spell::EffectReputation(uint32 i) From ed8691ebad87ca8c844cbd0fe752a2010f1f4206 Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 23 May 2009 14:06:07 +0200 Subject: [PATCH 4/5] *Fix a typo which disallows ADD_TARGET_TRIGGER auras to proc from selfcast. --HG-- branch : trunk --- src/game/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 9d548da4ed..5a7c557805 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1223,7 +1223,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); // spells with this flag can trigger only if not selfcast (eviscerate for example) - if (m_ChanceTriggerSpells.size() && (!(m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST | SPELL_ATTR_EX4_UNK4) || unit!=m_caster)) + if (m_ChanceTriggerSpells.size() && (!(m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST | SPELL_ATTR_EX4_UNK4) && unit==m_caster)) { int _duration=0; for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i) From 1b5f45cf0f59a127522356969ac7b7167a68cb65 Mon Sep 17 00:00:00 2001 From: raczman Date: Sat, 23 May 2009 16:06:02 +0200 Subject: [PATCH 5/5] Fixed windows build. By the way, isnt it ironic that biggest software vendor cant get name scopes right? --HG-- branch : trunk --- src/game/SpellEffects.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 537087480a..b75b388a7c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5504,8 +5504,8 @@ void Spell::EffectMomentMove(uint32 i) step = dist/10.0f; } - - for(int i = 0;i<10;i++) + int j = 0; + for(j; j<10 ;j++) { if(fabs(z - destz) > 6) { @@ -5517,7 +5517,7 @@ void Spell::EffectMomentMove(uint32 i) }else break; } - if(i == 9) + if(j == 9) { return; }