diff options
| author | megamage <none@none.none> | 2011-10-07 12:48:20 -0400 |
|---|---|---|
| committer | megamage <none@none.none> | 2011-10-07 12:48:20 -0400 |
| commit | 42d1562183dd0598de155e30264393edc6925a21 (patch) | |
| tree | 73263639af50fcf177ff9bdf3791d8fc5afce454 /src/server/game/Spells/SpellEffects.cpp | |
| parent | 7f4be7e93a03c2f4c964590efb166c7dadcb6837 (diff) | |
| parent | 7f89678bcda1b58ff0701c0915074e81a9caf720 (diff) | |
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore.git
Conflicts:
src/server/game/Entities/Player/Player.cpp
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
| -rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 89 |
1 files changed, 44 insertions, 45 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 741648ce70f..ee4b771f6fe 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -62,6 +62,7 @@ #include "ScriptMgr.h" #include "GameObjectAI.h" #include "AccountMgr.h" +#include "InstanceScript.h" pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= { @@ -308,7 +309,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffIndex /*effIndex*/) void Spell::EffectSchoolDMG(SpellEffIndex effIndex) { - if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; bool apply_direct_bonus = true; @@ -330,7 +331,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) damage /= count; // divide to all targets } - switch(m_spellInfo->Id) // better way to check unknown + switch (m_spellInfo->Id) // better way to check unknown { // Positive/Negative Charge case 28062: @@ -945,7 +946,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) case 35745: // Socrethar's Stone { uint32 spell_id; - switch(m_caster->GetAreaId()) + switch (m_caster->GetAreaId()) { case 3900: spell_id = 35743; break; // Socrethar Portal case 3742: spell_id = 35744; break; // Socrethar Portal @@ -1281,7 +1282,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) m_damage += CalculatePctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); return; } - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { // Bloodthirst case 23881: @@ -1363,7 +1364,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) return; } - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 31789: // Righteous Defense (step 1) { @@ -1564,7 +1565,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) && effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { // special cases - switch(triggered_spell_id) + switch (triggered_spell_id) { // Mirror Image case 58832: @@ -2141,7 +2142,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex) && effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - Object* target = NULL; + WorldObject* target = NULL; // call events for target if present if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -2162,7 +2163,9 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex) sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); if (ZoneScript* zoneScript = m_caster->GetZoneScript()) - zoneScript->ProcessEvent(unitTarget, m_spellInfo->Effects[effIndex].MiscValue); + zoneScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue); + else if (InstanceScript* instanceScript = m_caster->GetInstanceScript()) // needed in case Player is the caster + instanceScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue); m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->Effects[effIndex].MiscValue, m_caster, target); } @@ -2399,7 +2402,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) // bg reward have some special in code work uint32 bgType = 0; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case SPELL_AV_MARK_WINNER: case SPELL_AV_MARK_LOSER: @@ -3189,7 +3192,7 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) } typedef std::list< std::pair<uint32, uint64> > DispelList; -typedef std::list< std::pair<Aura* , uint8> > DispelChargesList; +typedef std::list< std::pair<Aura*, uint8> > DispelChargesList; void Spell::EffectDispel(SpellEffIndex effIndex) { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -3325,9 +3328,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex) int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue(); m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true); // Glyph of Felhunter - if (Unit* pOwner = m_caster->GetOwner()) - if (pOwner->GetAura(56249)) - pOwner->CastCustomSpell(pOwner, 19658, &heal_amount, NULL, NULL, true); + if (Unit* owner = m_caster->GetOwner()) + if (owner->GetAura(56249)) + owner->CastCustomSpell(owner, 19658, &heal_amount, NULL, NULL, true); } } @@ -3659,7 +3662,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) // enchanting spell selected by calculated damage-per-sec stored in Effect[1] base value // Note: damage calculated (correctly) with rounding int32(float(v)) but // RW enchantments applied damage int32(float(v)+0.5), this create 0..1 difference sometime - switch(damage) + switch (damage) { // Rank 1 case 2: spell_id = 36744; break; // 0% [ 7% == 2, 14% == 2, 20% == 2] @@ -4236,7 +4239,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) { // We assume that a spell have at most one fixed_bonus // and at most one weaponDamagePercentMod - switch(m_spellInfo->Effects[j].Effect) + switch (m_spellInfo->Effects[j].Effect) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: @@ -4382,7 +4385,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) Player* pl = m_caster->ToPlayer(); Battleground* bg = pl->GetBattleground(); - switch(pGameObj->GetMapId()) + switch (pGameObj->GetMapId()) { case 489: //WS { @@ -4438,11 +4441,11 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) // TODO: we must implement hunter pet summon at login there (spell 6962) - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { // Glyph of Backstab case 63975: @@ -4525,7 +4528,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) return; uint32 spell_id = 0; - switch(urand(1, 5)) + switch (urand(1, 5)) { case 1: spell_id = 8854; break; default: spell_id = 8855; break; @@ -4660,7 +4663,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; - switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) + switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) { case 75: unitTarget->CastSpell(unitTarget, 51621, true); break; case 150: unitTarget->CastSpell(unitTarget, 48024, true); break; @@ -4705,7 +4708,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; - switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) + switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) { case 75: unitTarget->CastSpell(unitTarget, 42680, true); break; case 150: unitTarget->CastSpell(unitTarget, 42683, true); break; @@ -4775,7 +4778,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) return; uint32 spellId = 0; - switch(rand() % 4) + switch (rand() % 4) { case 0: spellId = 46740; break; case 1: spellId = 46739; break; @@ -5021,7 +5024,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; - switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) + switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) { case 0: unitTarget->CastSpell(unitTarget, 71343, true); break; case 75: unitTarget->CastSpell(unitTarget, 71344, true); break; @@ -5067,7 +5070,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; - switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) + switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) { case 75: unitTarget->CastSpell(unitTarget, 72281, true); break; case 150: unitTarget->CastSpell(unitTarget, 72282, true); break; @@ -5130,7 +5133,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; - switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) + switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) { case 75: unitTarget->CastSpell(unitTarget, 75619, true); break; case 150: unitTarget->CastSpell(unitTarget, 75620, true); break; @@ -5229,7 +5232,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) uint32 spell_heal; - switch(m_caster->GetEntry()) + switch (m_caster->GetEntry()) { case 31897: spell_heal = 7001; break; case 31896: spell_heal = 27873; break; @@ -5396,7 +5399,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } case SPELLFAMILY_POTION: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { // Netherbloom case 28702: @@ -5562,8 +5565,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex) Map* map = m_caster->GetMap(); if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, m_caster->GetPhaseMask(), - m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 , - m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 , + m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2, + m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2, m_caster->GetPositionZ(), m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { @@ -5879,7 +5882,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue; uint8 slot = 0; - switch(m_spellInfo->Effects[effIndex].Effect) + switch (m_spellInfo->Effects[effIndex].Effect) { case SPELL_EFFECT_SUMMON_OBJECT_SLOT1: slot = 0; break; case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: slot = 1; break; @@ -6241,11 +6244,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) if (unitTarget->IsNonMeleeSpellCasted(true)) unitTarget->InterruptNonMeleeSpells(true); - float ratio = m_caster->GetCombatReach() / std::max(unitTarget->GetCombatReach(), 1.0f); - if (ratio < 1.0f) - ratio = ratio * ratio * ratio * 0.1f; // volume = length^3 - else - ratio = 0.1f; // dbc value ratio + float ratio = 0.1f; float speedxy = float(m_spellInfo->Effects[effIndex].MiscValue) * ratio; float speedz = float(damage) * ratio; if (speedxy < 0.1f && speedz < 0.1f) @@ -6288,7 +6287,7 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player* pPlayer = unitTarget->ToPlayer(); + Player* player = unitTarget->ToPlayer(); uint32 quest_id = m_spellInfo->Effects[effIndex].MiscValue; @@ -6298,24 +6297,24 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex) return; // Player has never done this quest - if (pPlayer->GetQuestStatus(quest_id) == QUEST_STATUS_NONE) + if (player->GetQuestStatus(quest_id) == QUEST_STATUS_NONE) return; // remove all quest entries for 'entry' from quest log for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { - uint32 quest = pPlayer->GetQuestSlotQuestId(slot); + uint32 quest = player->GetQuestSlotQuestId(slot); if (quest == quest_id) { - pPlayer->SetQuestSlot(slot, 0); + player->SetQuestSlot(slot, 0); // we ignore unequippable quest items in this case, its' still be equipped - pPlayer->TakeQuestSourceItem(quest, false); + player->TakeQuestSourceItem(quest, false); } } - pPlayer->RemoveActiveQuest(quest_id); - pPlayer->RemoveRewardedQuest(quest_id); + player->RemoveActiveQuest(quest_id); + player->RemoveRewardedQuest(quest_id); } void Spell::EffectSendTaxi(SpellEffIndex effIndex) @@ -6579,7 +6578,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) int32 duration = m_spellInfo->GetDuration(); - switch(goinfo->type) + switch (goinfo->type) { case GAMEOBJECT_TYPE_FISHINGNODE: { @@ -6589,7 +6588,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME) int32 lastSec = 0; - switch(urand(0, 3)) + switch (urand(0, 3)) { case 0: lastSec = 3; break; case 1: lastSec = 7; break; @@ -7229,7 +7228,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 58730: // Restricted Flight Area case 58600: // Restricted Flight Area |
