diff options
Diffstat (limited to 'src')
38 files changed, 2188 insertions, 1370 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 98b5c0a6ba3..f8658dd8689 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -696,8 +696,9 @@ void SmartAI::OnCharmed(bool apply) GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply); } -void SmartAI::DoAction(const int32 /*param*/) +void SmartAI::DoAction(const int32 param) { + GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, NULL, param); } uint32 SmartAI::GetData(uint32 /*id*/) @@ -825,28 +826,6 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId) GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId); } -/* -SMART_EVENT_UPDATE_OOC -SMART_EVENT_SPELLHIT -SMART_EVENT_RANGE -SMART_EVENT_RESPAWN -SMART_EVENT_SUMMONED_UNIT -SMART_EVENT_ACCEPTED_QUEST -SMART_EVENT_REWARD_QUEST -SMART_EVENT_TARGET_BUFFED -SMART_EVENT_SUMMON_DESPAWNED -SMART_EVENT_AI_INIT -SMART_EVENT_DATA_SET -SMART_EVENT_TEXT_OVER -SMART_EVENT_TIMED_EVENT_TRIGGERED -SMART_EVENT_UPDATE -SMART_EVENT_LINK -SMART_EVENT_GOSSIP_SELECT -SMART_EVENT_JUST_CREATED -SMART_EVENT_GOSSIP_HELLO -SMART_EVENT_DEATH -*/ - int SmartGameObjectAI::Permissible(const GameObject* g) { if (g->GetAIName() == "SmartGameObjectAI") diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1b414029366..4bc5671b84b 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2778,6 +2778,13 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui ProcessAction(e, NULL, var0); break; } + case SMART_EVENT_ACTION_DONE: + { + if (e.event.doAction.eventId != var0) + return; + ProcessAction(e, unit, var0); + break; + } default: sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); break; @@ -2894,23 +2901,6 @@ void SmartScript::InstallEvents() } } -bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3) -{ - if (c == 0) - return true; - - if (!u || !u->ToPlayer()) - return false; - - Condition cond; - cond.ConditionType = ConditionTypes(uint32(c)); - cond.ConditionValue1 = uint32(v1); - cond.ConditionValue1 = uint32(v2); - cond.ConditionValue1 = uint32(v3); - ConditionSourceInfo srcInfo = ConditionSourceInfo(u->ToPlayer()); - return cond.Meets(srcInfo); -} - void SmartScript::OnUpdate(uint32 const diff) { if ((mScriptType == SMART_SCRIPT_TYPE_CREATURE || mScriptType == SMART_SCRIPT_TYPE_GAMEOBJECT) && !GetBaseObject()) diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 5fb691c87f2..03d533e69e5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -83,8 +83,6 @@ class SmartScript return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT; } - bool ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3); - void OnUpdate(const uint32 diff); void OnMoveInLineOfSight(Unit* who); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index bf84f39747a..426593d1757 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -475,63 +475,76 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_EVENT_TRANSPORT_ADDCREATURE: - { - if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) - return false; - break; - } + { + if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) + return false; + break; + } case SMART_EVENT_MOVEMENTINFORM: + { + if (e.event.movementInform.type > NULL_MOTION_TYPE) { - if (e.event.movementInform.type > NULL_MOTION_TYPE) - { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); - return false; - } - break; + sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); + return false; } + break; + } case SMART_EVENT_DATA_SET: - { - if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) - return false; - break; - } + { + if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) + return false; + break; + } case SMART_EVENT_AREATRIGGER_ONTRIGGER: - { - if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) - return false; - break; - } + { + if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) + return false; + break; + } case SMART_EVENT_TEXT_OVER: //if (e.event.textOver.textGroupID && !IsTextValid(e, e.event.textOver.textGroupID)) return false;// 0 is a valid text group! break; case SMART_EVENT_LINK: + { + if (e.link && e.link == e.event_id) { - if (e.link && e.link == e.event_id) - { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); - return false; - } - break; + sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); + return false; } + break; + } case SMART_EVENT_DUMMY_EFFECT: + { if (!IsSpellValid(e, e.event.dummy.spell)) return false; if (e.event.dummy.effIndex > EFFECT_2) return false; break; + } case SMART_EVENT_IS_BEHIND_TARGET: + { if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax)) return false; break; + } case SMART_EVENT_GAME_EVENT_START: case SMART_EVENT_GAME_EVENT_END: + { + GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); + if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid()) + return false; + break; + } + case SMART_EVENT_ACTION_DONE: + { + if (e.event.doAction.eventId < EVENT_SPELLCLICK || e.event.doAction.eventId > EVENT_CHARGE) { - GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); - if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid()) - return false; - break; + sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); + return false; } + break; + } case SMART_EVENT_GO_STATE_CHANGED: case SMART_EVENT_GO_EVENT_INFORM: case SMART_EVENT_TIMED_EVENT_TRIGGERED: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index b82d0724f53..0f50985cef4 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -22,7 +22,6 @@ #include "Creature.h" #include "CreatureAI.h" #include "Unit.h" -#include "ConditionMgr.h" #include "Spell.h" //#include "SmartScript.h" @@ -82,81 +81,81 @@ const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] = enum SMART_EVENT { - SMART_EVENT_UPDATE_IC = 0, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax - SMART_EVENT_UPDATE_OOC = 1, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax - SMART_EVENT_HEALT_PCT = 2, //1 // HPMin%, HPMax%, RepeatMin, RepeatMax - SMART_EVENT_MANA_PCT = 3, //1 // ManaMin%, ManaMax%, RepeatMin, RepeatMax - SMART_EVENT_AGGRO = 4, //1 // NONE - SMART_EVENT_KILL = 5, //1 // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3 - SMART_EVENT_DEATH = 6, //1 // NONE - SMART_EVENT_EVADE = 7, //1 // NONE - SMART_EVENT_SPELLHIT = 8, //1 // SpellID, School, CooldownMin, CooldownMax - SMART_EVENT_RANGE = 9, //1 // MinDist, MaxDist, RepeatMin, RepeatMax - SMART_EVENT_OOC_LOS = 10, //1 // NoHostile, MaxRnage, CooldownMin, CooldownMax - SMART_EVENT_RESPAWN = 11, //1 // type, MapId, ZoneId - SMART_EVENT_TARGET_HEALTH_PCT = 12, //1 // HPMin%, HPMax%, RepeatMin, RepeatMax - SMART_EVENT_TARGET_CASTING = 13, //1 // RepeatMin, RepeatMax - SMART_EVENT_FRIENDLY_HEALTH = 14, //1 // HPDeficit, Radius, RepeatMin, RepeatMax - SMART_EVENT_FRIENDLY_IS_CC = 15, //1 // Radius, RepeatMin, RepeatMax - SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, //1 // SpellId, Radius, RepeatMin, RepeatMax - SMART_EVENT_SUMMONED_UNIT = 17, //1 // CreatureId(0 all), CooldownMin, CooldownMax - SMART_EVENT_TARGET_MANA_PCT = 18, //1 // ManaMin%, ManaMax%, RepeatMin, RepeatMax - SMART_EVENT_ACCEPTED_QUEST = 19, //1 // QuestID(0any) - SMART_EVENT_REWARD_QUEST = 20, //1 // QuestID(0any) - SMART_EVENT_REACHED_HOME = 21, //1 // NONE - SMART_EVENT_RECEIVE_EMOTE = 22, //1 // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3 - SMART_EVENT_HAS_AURA = 23, //1 // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax - SMART_EVENT_TARGET_BUFFED = 24, //1 // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax - SMART_EVENT_RESET = 25, //1 // Called after combat, when the creature respawn and spawn. - - SMART_EVENT_IC_LOS = 26, //1 // NoHostile, MaxRnage, CooldownMin, CooldownMax - SMART_EVENT_PASSENGER_BOARDED = 27, //1 // CooldownMin, CooldownMax - SMART_EVENT_PASSENGER_REMOVED = 28, //1 // CooldownMin, CooldownMax - SMART_EVENT_CHARMED = 29, //1 // NONE - SMART_EVENT_CHARMED_TARGET = 30, //1 // NONE - SMART_EVENT_SPELLHIT_TARGET = 31, //1 // SpellID, School, CooldownMin, CooldownMax - SMART_EVENT_DAMAGED = 32, //1 // MinDmg, MaxDmg, CooldownMin, CooldownMax - SMART_EVENT_DAMAGED_TARGET = 33, //1 // MinDmg, MaxDmg, CooldownMin, CooldownMax - SMART_EVENT_MOVEMENTINFORM = 34, //1 // MovementType(any), PointID - SMART_EVENT_SUMMON_DESPAWNED = 35, //1 // Entry, CooldownMin, CooldownMax - SMART_EVENT_CORPSE_REMOVED = 36, //1 // NONE - SMART_EVENT_AI_INIT = 37, //1 // NONE - SMART_EVENT_DATA_SET = 38, //1 // Id, Value, CooldownMin, CooldownMax - SMART_EVENT_WAYPOINT_START = 39, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_REACHED = 40, //1 // PointId(0any), pathID(0any) - SMART_EVENT_TRANSPORT_ADDPLAYER = 41, //1 // NONE - SMART_EVENT_TRANSPORT_ADDCREATURE = 42, //1 // Entry (0 any) - SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, //1 // NONE - SMART_EVENT_TRANSPORT_RELOCATE = 44, //1 // PointId - SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, //1 // Team (0 any), CooldownMin, CooldownMax - SMART_EVENT_AREATRIGGER_ONTRIGGER = 46, //1 // TriggerId(0 any) - SMART_EVENT_QUEST_ACCEPTED = 47, //1 // none - SMART_EVENT_QUEST_OBJ_COPLETETION = 48, //1 // none - SMART_EVENT_QUEST_COMPLETION = 49, //1 // none - SMART_EVENT_QUEST_REWARDED = 50, //1 // none - SMART_EVENT_QUEST_FAIL = 51, //1 // none - SMART_EVENT_TEXT_OVER = 52, //1 // GroupId from creature_text, creature entry who talks (0 any) - SMART_EVENT_RECEIVE_HEAL = 53, //1 // MinHeal, MaxHeal, CooldownMin, CooldownMax - SMART_EVENT_JUST_SUMMONED = 54, //1 // none - SMART_EVENT_WAYPOINT_PAUSED = 55, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_RESUMED = 56, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_STOPPED = 57, //1 // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_ENDED = 58, //1 // PointId(0any), pathID(0any) - SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, //1 // id - SMART_EVENT_UPDATE = 60, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax - SMART_EVENT_LINK = 61, //1 // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly - SMART_EVENT_GOSSIP_SELECT = 62, //1 // menuID, actionID - SMART_EVENT_JUST_CREATED = 63, //1 // none - SMART_EVENT_GOSSIP_HELLO = 64, //1 // none - SMART_EVENT_FOLLOW_COMPLETED = 65, //1 // none - SMART_EVENT_DUMMY_EFFECT = 66, //1 // spellId, effectIndex - SMART_EVENT_IS_BEHIND_TARGET = 67, //1 // cooldownMin, CooldownMax - SMART_EVENT_GAME_EVENT_START = 68, //1 // game_event.Entry - SMART_EVENT_GAME_EVENT_END = 69, //1 // game_event.Entry - SMART_EVENT_GO_STATE_CHANGED = 70, //1 // go state - SMART_EVENT_GO_EVENT_INFORM = 71, //1 // eventId - - SMART_EVENT_END = 72, + SMART_EVENT_UPDATE_IC = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax + SMART_EVENT_UPDATE_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax + SMART_EVENT_HEALT_PCT = 2, // HPMin%, HPMax%, RepeatMin, RepeatMax + SMART_EVENT_MANA_PCT = 3, // ManaMin%, ManaMax%, RepeatMin, RepeatMax + SMART_EVENT_AGGRO = 4, // NONE + SMART_EVENT_KILL = 5, // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3 + SMART_EVENT_DEATH = 6, // NONE + SMART_EVENT_EVADE = 7, // NONE + SMART_EVENT_SPELLHIT = 8, // SpellID, School, CooldownMin, CooldownMax + SMART_EVENT_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax + SMART_EVENT_OOC_LOS = 10, // NoHostile, MaxRnage, CooldownMin, CooldownMax + SMART_EVENT_RESPAWN = 11, // type, MapId, ZoneId + SMART_EVENT_TARGET_HEALTH_PCT = 12, // HPMin%, HPMax%, RepeatMin, RepeatMax + SMART_EVENT_TARGET_CASTING = 13, // RepeatMin, RepeatMax + SMART_EVENT_FRIENDLY_HEALTH = 14, // HPDeficit, Radius, RepeatMin, RepeatMax + SMART_EVENT_FRIENDLY_IS_CC = 15, // Radius, RepeatMin, RepeatMax + SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax + SMART_EVENT_SUMMONED_UNIT = 17, // CreatureId(0 all), CooldownMin, CooldownMax + SMART_EVENT_TARGET_MANA_PCT = 18, // ManaMin%, ManaMax%, RepeatMin, RepeatMax + SMART_EVENT_ACCEPTED_QUEST = 19, // QuestID(0any) + SMART_EVENT_REWARD_QUEST = 20, // QuestID(0any) + SMART_EVENT_REACHED_HOME = 21, // NONE + SMART_EVENT_RECEIVE_EMOTE = 22, // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3 + SMART_EVENT_HAS_AURA = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax + SMART_EVENT_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax + SMART_EVENT_RESET = 25, // Called after combat, when the creature respawn and spawn. + SMART_EVENT_IC_LOS = 26, // NoHostile, MaxRnage, CooldownMin, CooldownMax + SMART_EVENT_PASSENGER_BOARDED = 27, // CooldownMin, CooldownMax + SMART_EVENT_PASSENGER_REMOVED = 28, // CooldownMin, CooldownMax + SMART_EVENT_CHARMED = 29, // NONE + SMART_EVENT_CHARMED_TARGET = 30, // NONE + SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax + SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax + SMART_EVENT_DAMAGED_TARGET = 33, // MinDmg, MaxDmg, CooldownMin, CooldownMax + SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID + SMART_EVENT_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax + SMART_EVENT_CORPSE_REMOVED = 36, // NONE + SMART_EVENT_AI_INIT = 37, // NONE + SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax + SMART_EVENT_WAYPOINT_START = 39, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any) + SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE + SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any) + SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, // NONE + SMART_EVENT_TRANSPORT_RELOCATE = 44, // PointId + SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, // Team (0 any), CooldownMin, CooldownMax + SMART_EVENT_AREATRIGGER_ONTRIGGER = 46, // TriggerId(0 any) + SMART_EVENT_QUEST_ACCEPTED = 47, // none + SMART_EVENT_QUEST_OBJ_COPLETETION = 48, // none + SMART_EVENT_QUEST_COMPLETION = 49, // none + SMART_EVENT_QUEST_REWARDED = 50, // none + SMART_EVENT_QUEST_FAIL = 51, // none + SMART_EVENT_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any) + SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax + SMART_EVENT_JUST_SUMMONED = 54, // none + SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any) + SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any) + SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id + SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax + SMART_EVENT_LINK = 61, // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly + SMART_EVENT_GOSSIP_SELECT = 62, // menuID, actionID + SMART_EVENT_JUST_CREATED = 63, // none + SMART_EVENT_GOSSIP_HELLO = 64, // none + SMART_EVENT_FOLLOW_COMPLETED = 65, // none + SMART_EVENT_DUMMY_EFFECT = 66, // spellId, effectIndex + SMART_EVENT_IS_BEHIND_TARGET = 67, // cooldownMin, CooldownMax + SMART_EVENT_GAME_EVENT_START = 68, // game_event.Entry + SMART_EVENT_GAME_EVENT_END = 69, // game_event.Entry + SMART_EVENT_GO_STATE_CHANGED = 70, // go state + SMART_EVENT_GO_EVENT_INFORM = 71, // eventId + SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId) + + SMART_EVENT_END = 73, }; struct SmartEvent @@ -356,6 +355,11 @@ struct SmartEvent uint32 eventId; } eventInform; + struct + { + uint32 eventId; + } doAction; + struct { uint32 param1; @@ -1173,6 +1177,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, + {SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE }, }; enum SmartEventFlags @@ -1385,26 +1390,6 @@ class SmartAIMgr } return true; } - /*inline bool IsConditionValid(SmartScriptHolder e, int32 t, int32 v1, int32 v2, int32 v3) - { - bool error = false; - if (t > 0 && v1 >= 0 && v2 >= 0 && v3 >= 0) - { - Condition cond; - cond.mConditionType = ConditionType(t); - cond.mConditionValue1 = uint32(v1); - cond.mConditionValue2 = uint32(v2); - cond.mConditionValue3 = uint32(v3); - if (!sConditionMgr->isConditionTypeValid(&cond)) - error = true; - } - if (error) - { - sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Condition, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); - return false; - } - return true; - }*/ bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry) { diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 9737d4584ea..0c43c9ece0e 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -354,7 +354,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR // list sorted and and we check current target, then this is best case if (currentVictim == currentRef || currentRef->getThreat() <= 1.1f * currentVictim->getThreat()) { - currentRef = currentVictim; // for second case + if (currentVictim != currentRef && attacker->canCreatureAttack(currentVictim->getTarget())) + currentRef = currentVictim; // for second case, if currentvictim is attackable + found = true; break; } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 07e8e37e82a..4d54d1599a8 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1676,11 +1676,15 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data. bool immunedToAllEffects = true; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + if (!spellInfo->Effects[i].IsEffect()) + continue; if (!IsImmunedToSpellEffect(spellInfo, i)) { immunedToAllEffects = false; break; } + } if (immunedToAllEffects) return true; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index daa8c1e05de..a261a633499 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3602,87 +3602,6 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId // Call AfterDispel hook on AuraScript aura->CallScriptAfterDispel(&dispelInfo); - switch (aura->GetSpellInfo()->SpellFamilyName) - { - case SPELLFAMILY_WARLOCK: - { - // Unstable Affliction (crash if before removeaura?) - if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x0100) - { - Unit* caster = aura->GetCaster(); - if (!caster) - break; - if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_0)) - { - int32 damage = aurEff->GetAmount() * 9; - // backfire damage and silence - caster->CastCustomSpell(dispeller, 31117, &damage, NULL, NULL, true, NULL, aurEff); - } - } - break; - } - case SPELLFAMILY_DRUID: - { - // Lifebloom - if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x10) - { - if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_1)) - { - // final heal - int32 healAmount = aurEff->GetAmount(); - if (Unit* caster = aura->GetCaster()) - { - healAmount = caster->SpellHealingBonusDone(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); - healAmount = this->SpellHealingBonusTaken(caster, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); - } - CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); - - // mana - if (Unit* caster = aura->GetCaster()) - { - int32 mana = CalculatePctU(caster->GetCreateMana(), aura->GetSpellInfo()->ManaCostPercentage) * chargesRemoved / 2; - caster->CastCustomSpell(caster, 64372, &mana, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); - } - } - } - break; - } - case SPELLFAMILY_SHAMAN: - { - // Flame Shock - if (aura->GetSpellInfo()->SpellFamilyFlags[0] & 0x10000000) - { - if (Unit* caster = aura->GetCaster()) - { - uint32 triggeredSpellId = 0; - // Lava Flows - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 3087, 0)) - { - switch (aurEff->GetId()) - { - case 51482: // Rank 3 - triggeredSpellId = 65264; - break; - case 51481: // Rank 2 - triggeredSpellId = 65263; - break; - case 51480: // Rank 1 - triggeredSpellId = 64694; - break; - default: - sLog->outError("Unit::RemoveAurasDueToSpellByDispel: Unknown rank of Lava Flows (%d) found", aurEff->GetId()); - } - } - - if (triggeredSpellId) - caster->CastSpell(caster, triggeredSpellId, true); - } - } - break; - } - default: - break; - } return; } else @@ -11538,6 +11457,8 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately + if (!spellInfo->Effects[i].IsEffect()) + continue; if (!IsImmunedToSpellEffect(spellInfo, i)) { immuneToAllEffects = false; @@ -13039,7 +12960,7 @@ Unit* Creature::SelectVictim() else return NULL; - if (target && _IsTargetAcceptable(target)) + if (target && _IsTargetAcceptable(target) && canCreatureAttack(target)) { SetInFront(target); return target; @@ -13065,7 +12986,7 @@ Unit* Creature::SelectVictim() { target = SelectNearestTargetInAttackDistance(m_CombatDistance ? m_CombatDistance : ATTACK_DISTANCE); - if (target && _IsTargetAcceptable(target)) + if (target && _IsTargetAcceptable(target) && canCreatureAttack(target)) return target; } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 9b63de0cdb8..98088f9ef6a 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1337,10 +1337,10 @@ class Unit : public WorldObject uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); } - bool HealthBelowPct(int32 pct) const { return GetHealth() * uint64(100) < GetMaxHealth() * uint64(pct); } - bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return (int32(GetHealth()) - damage) * int64(100) < GetMaxHealth() * int64(pct); } - bool HealthAbovePct(int32 pct) const { return GetHealth() * uint64(100) > GetMaxHealth() * uint64(pct); } - bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return (GetHealth() + heal) * uint64(100) > GetMaxHealth() * uint64(pct); } + bool HealthBelowPct(int32 pct) const { return GetHealth() < CountPctFromMaxHealth(pct); } + bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); } + bool HealthAbovePct(int32 pct) const { return GetHealth() > CountPctFromMaxHealth(pct); } + bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); } float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; } uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePctN(GetMaxHealth(), pct); } uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePctN(GetHealth(), pct); } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 849a7136ea8..e1285eb2db9 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -781,33 +781,18 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) m_amplitude = 1 * IN_MILLISECONDS; case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_HEAL: - case SPELL_AURA_PERIODIC_ENERGIZE: case SPELL_AURA_OBS_MOD_HEALTH: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL: + case SPELL_AURA_PERIODIC_ENERGIZE: case SPELL_AURA_PERIODIC_LEECH: case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: case SPELL_AURA_PERIODIC_MANA_LEECH: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: case SPELL_AURA_POWER_BURN: - m_isPeriodic = true; - break; - case SPELL_AURA_PERIODIC_TRIGGER_SPELL: - if (GetId() == 51912) - m_amplitude = 3000; - m_isPeriodic = true; - break; - case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: case SPELL_AURA_PERIODIC_DUMMY: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: m_isPeriodic = true; break; - case SPELL_AURA_DUMMY: - // Haunting Spirits - perdiodic trigger demon - if (GetId() == 7057) - { - m_isPeriodic = true; - m_amplitude = irand (0, 60) + 30; - m_amplitude *= IN_MILLISECONDS; - } - break; default: break; } @@ -1103,14 +1088,6 @@ void AuraEffect::UpdatePeriodic(Unit* caster) { switch (GetAuraType()) { - case SPELL_AURA_DUMMY: - // Haunting Spirits - if (GetId() == 7057) - { - m_amplitude = irand (0, 60) + 30; - m_amplitude *= IN_MILLISECONDS; - } - break; case SPELL_AURA_PERIODIC_DUMMY: switch (GetSpellInfo()->SpellFamilyName) { @@ -1312,11 +1289,6 @@ void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const case SPELL_AURA_POWER_BURN: HandlePeriodicPowerBurnAuraTick(target, caster); break; - case SPELL_AURA_DUMMY: - // Haunting Spirits - if (GetId() == 7057) - target->CastSpell((Unit*)NULL, GetAmount(), true); - break; default: break; } @@ -5011,38 +4983,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget())) target->CastSpell(spellTarget, 51699, true); break; - case 28832: // Mark of Korth'azz - case 28833: // Mark of Blaumeux - case 28834: // Mark of Rivendare - case 28835: // Mark of Zeliek - if (caster) // actually we can also use cast(this, originalcasterguid) - { - int32 damage; - switch (GetBase()->GetStackAmount()) - { - case 1: damage = 0; break; - case 2: damage = 500; break; - case 3: damage = 1000; break; - case 4: damage = 1500; break; - case 5: damage = 4000; break; - case 6: damage = 12000; break; - default:damage = 20000 + 1000 * (GetBase()->GetStackAmount() - 7); break; - } - if (damage) - caster->CastCustomSpell(28836, SPELLVALUE_BASE_POINT0, damage, target); - } - break; - case 63322: // Saronite Vapors - { - if (caster) - { - int32 mana = int32(GetAmount() * pow(2.0f, GetBase()->GetStackAmount())); // mana restore - bp * 2^stackamount - int32 damage = mana * 2; // damage - caster->CastCustomSpell(target, 63337, &mana, NULL, NULL, true); - caster->CastCustomSpell(target, 63338, &damage, NULL, NULL, true); - } - break; - } case 71563: if (Aura* newAura = target->AddAura(71564, target)) newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount); @@ -5136,57 +5076,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool break; } break; - case SPELLFAMILY_MAGE: - // Living Bomb - if (m_spellInfo->SpellFamilyFlags[1] & 0x20000) - { - AuraRemoveMode removeMode = aurApp->GetRemoveMode(); - if (caster && (removeMode == AURA_REMOVE_BY_ENEMY_SPELL || removeMode == AURA_REMOVE_BY_EXPIRE)) - caster->CastSpell(target, GetAmount(), true); - } - break; - case SPELLFAMILY_PRIEST: - // Vampiric Touch - if (m_spellInfo->SpellFamilyFlags[1] & 0x0400 && aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && GetEffIndex() == 0) - if (AuraEffect const* aurEff = GetBase()->GetEffect(1)) - { - int32 damage = aurEff->GetAmount() * 8; - // backfire damage - target->CastCustomSpell(target, 64085, &damage, NULL, NULL, true, NULL, NULL, GetCasterGUID()); - } - break; - case SPELLFAMILY_WARLOCK: - // Haunt - if (m_spellInfo->SpellFamilyFlags[1] & 0x40000) - if (caster) - target->CastCustomSpell(caster, 48210, &m_amount, 0, 0, true, NULL, this, GetCasterGUID()); - break; - case SPELLFAMILY_DRUID: - // Lifebloom - if (GetSpellInfo()->SpellFamilyFlags[1] & 0x10) - { - // Final heal only on duration end - if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - return; - - // final heal - int32 stack = GetBase()->GetStackAmount(); - int32 heal = m_amount; - if (caster) - { - heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack); - heal = target->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, HEAL, stack); - } - target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID()); - - // restore mana - if (caster) - { - int32 returnmana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; - caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID()); - } - } - break; case SPELLFAMILY_DEATHKNIGHT: // Summon Gargoyle (Dismiss Gargoyle at remove) if (GetId() == 61777) @@ -5262,48 +5151,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->SetEntry(apply ? 17654 : 17326); break; } - //Summon Fire Elemental - case 40133: - { - if (!caster) - break; - - Unit* owner = caster->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) - { - if (apply) - owner->CastSpell(owner, 8985, true); - else - owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); - } - break; - } - //Summon Earth Elemental - case 40132 : - { - if (!caster) - break; - - Unit* owner = caster->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) - { - if (apply) - owner->CastSpell(owner, 19704, true); - else - owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); - } - break; - } - case 57723: // Exhaustion - case 57724: // Sated - { - switch (GetId()) - { - case 57723: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 32182, apply); break; // Heroism - case 57724: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 2825, apply); break; // Bloodlust - } - break; - } case 57819: // Argent Champion case 57820: // Ebon Champion case 57821: // Champion of the Kirin Tor @@ -5396,69 +5243,14 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool } case SPELLFAMILY_DRUID: { - if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK)) - break; - switch (GetId()) - { - case 52610: // Savage Roar - { - uint32 spellId = 62071; - if (apply) - { - if (target->GetShapeshiftForm() != FORM_CAT) - break; - - target->CastSpell(target, spellId, true, NULL, NULL, GetCasterGUID()); - break; - } - target->RemoveAurasDueToSpell(spellId); - break; - } - case 61336: // Survival Instincts - { - if (!(mode & AURA_EFFECT_HANDLE_REAL)) - break; - - if (apply) - { - if (!target->IsInFeralForm()) - break; - - int32 bp0 = int32(target->CountPctFromMaxHealth(GetAmount())); - target->CastCustomSpell(target, 50322, &bp0, NULL, NULL, true); - } - else - target->RemoveAurasDueToSpell(50322); - break; - } - } - // Predatory Strikes - if (target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->SpellIconID == 1563) - { - target->ToPlayer()->UpdateAttackPowerAndDamage(); - } + //if (!(mode & AURA_EFFECT_HANDLE_REAL)) + //break; break; } case SPELLFAMILY_SHAMAN: { - if (!(mode & AURA_EFFECT_HANDLE_REAL)) - break; - // Sentry Totem - if (GetId() == 6495 && caster && caster->GetTypeId() == TYPEID_PLAYER) - { - if (apply) - { - if (uint64 guid = caster->m_SummonSlot[4]) - { - if (Creature* totem = caster->GetMap()->GetCreature(guid)) - if (totem->isTotem()) - caster->ToPlayer()->CastSpell(totem, 6277, true); - } - } - else - caster->ToPlayer()->StopCastingBindSight(); - return; - } + //if (!(mode & AURA_EFFECT_HANDLE_REAL)) + //break; break; } case SPELLFAMILY_PALADIN: @@ -6088,14 +5880,6 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) if (caster) caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this); return; - // Detonate Mana - case 27819: - if (int32 mana = (int32)(target->GetMaxPower(POWER_MANA) / 10)) - { - mana = target->ModifyPower(POWER_MANA, -mana); - target->CastCustomSpell(27820, SPELLVALUE_BASE_POINT0, -mana*10, target, true, NULL, this); - } - return; // Inoculate Nestlewood Owlkin case 29528: if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target @@ -6760,33 +6544,6 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()); } - // spell-specific code - switch (GetId()) - { - case 31447: // Mark of Kaz'rogal - if (target->GetPower(powerType) == 0) - { - target->CastSpell(target, 31463, true, 0, this); - // Remove aura - GetBase()->SetDuration(0); - } - break; - case 32960: // Mark of Kazzak - { - int32 modifier = int32(target->GetPower(powerType) * 0.05f); - target->ModifyPower(powerType, -modifier); - - if (target->GetPower(powerType) == 0) - { - target->CastSpell(target, 32961, true, 0, this); - // Remove aura - GetBase()->SetDuration(0); - } - break; - } - default: - break; - } // Drain Mana if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[0] & 0x00000010) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 4dda1c731a7..9456a219274 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1221,19 +1221,6 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); } } - // Renew - else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000040 && GetEffect(0)) - { - // Empowered Renew - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1)) - { - uint32 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL); - damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, HEAL); - - int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; - caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); - } - } // Power Word: Shield else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0)) { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index b51a3e8ee73..f823e45525d 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1286,18 +1286,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth power = POWER_HEALTH; } - else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall - { - // Remove targets not in LoS or in stealth - for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();) - { - if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster)) - itr = unitTargets.erase(itr); - else - ++itr; - } - break; - } else break; @@ -1338,6 +1326,11 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge } } + // todo: move to scripts, but we must call it before resize list by MaxAffectedTargets + // Intimidating Shout + if (m_spellInfo->Id == 5246 && effIndex != EFFECT_0) + unitTargets.remove(m_targets.GetUnitTarget()); + // Other special target selection goes here if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) { @@ -1346,8 +1339,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge if ((*j)->IsAffectedOnSpell(m_spellInfo)) maxTargets += (*j)->GetAmount(); - if (m_spellInfo->Id == 5246) //Intimidating Shout - unitTargets.remove(m_targets.GetUnitTarget()); Trinity::Containers::RandomResizeList(unitTargets, maxTargets); } @@ -2473,12 +2464,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); } - // Haunt - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1)) - { - AuraEffect* aurEff = m_spellAura->GetEffect(1); - aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage)); - } m_damage = damageInfo.damage; @@ -4858,19 +4843,9 @@ SpellCastResult Spell::CheckCast(bool strict) if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) return SPELL_FAILED_LINE_OF_SIGHT; } - else - { - if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster - { - // Lay on Hands - cannot be self-cast on paladin with Forbearance or after using Avenging Wrath - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && m_spellInfo->SpellFamilyFlags[0] & 0x0008000) - if (target->HasAura(61988)) // Immunity shield marker - return SPELL_FAILED_TARGET_AURASTATE; - } - } } - //Check for line of sight for spells with dest + // Check for line of sight for spells with dest if (m_targets.HasDst()) { float x, y, z; @@ -4969,7 +4944,8 @@ SpellCastResult Spell::CheckCast(bool strict) bool hasDispellableAura = false; bool hasNonDispelEffect = false; - for (int i = 0; i < MAX_SPELL_EFFECTS; i++) + uint32 dispelMask = 0; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL) { if (m_spellInfo->Effects[i].IsTargetingArea() || m_spellInfo->AttributesEx & SPELL_ATTR1_MELEE_COMBAT_START) @@ -4977,17 +4953,8 @@ SpellCastResult Spell::CheckCast(bool strict) hasDispellableAura = true; break; } - if (Unit* target = m_targets.GetUnitTarget()) - { - DispelChargesList dispelList; - uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue)); - target->GetDispellableAuraList(m_caster, dispelMask, dispelList); - if (!dispelList.empty()) - { - hasDispellableAura = true; - break; - } - } + + dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue)); } else if (m_spellInfo->Effects[i].IsEffect()) { @@ -4995,34 +4962,22 @@ SpellCastResult Spell::CheckCast(bool strict) break; } - if (!hasNonDispelEffect && !hasDispellableAura && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL) && !IsTriggered()) - return SPELL_FAILED_NOTHING_TO_DISPEL; + if (!hasNonDispelEffect && !hasDispellableAura && dispelMask && !IsTriggered()) + { + if (Unit* target = m_targets.GetUnitTarget()) + { + DispelChargesList dispelList; + target->GetDispellableAuraList(m_caster, dispelMask, dispelList); + if (dispelList.empty()) + return SPELL_FAILED_NOTHING_TO_DISPEL; + } + } - for (int i = 0; i < MAX_SPELL_EFFECTS; i++) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { // for effects of spells that have only one target switch (m_spellInfo->Effects[i].Effect) { - case SPELL_EFFECT_DUMMY: - { - if (m_spellInfo->Id == 19938) // Awaken Peon - { - Unit* unit = m_targets.GetUnitTarget(); - if (!unit || !unit->HasAura(17743)) - return SPELL_FAILED_BAD_TARGETS; - } - else if (m_spellInfo->Id == 31789) // Righteous Defense - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return SPELL_FAILED_DONT_REPORT; - - Unit* target = m_targets.GetUnitTarget(); - if (!target || !target->IsFriendlyTo(m_caster) || target->getAttackers().empty()) - return SPELL_FAILED_BAD_TARGETS; - - } - break; - } case SPELL_EFFECT_LEARN_SPELL: { if (m_caster->GetTypeId() != TYPEID_PLAYER) @@ -5339,10 +5294,6 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_LEAP_BACK: { - // Spell 781 (Disengage) requires player to be in combat - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 781 && !m_caster->isInCombat()) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - if (m_caster->HasUnitState(UNIT_STATE_ROOT)) { if (m_caster->GetTypeId() == TYPEID_PLAYER) @@ -5364,66 +5315,10 @@ SpellCastResult Spell::CheckCast(bool strict) } } - for (int i = 0; i < MAX_SPELL_EFFECTS; i++) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { switch (m_spellInfo->Effects[i].ApplyAuraName) { - case SPELL_AURA_DUMMY: - { - //custom check - switch (m_spellInfo->Id) - { - // Tag Murloc - case 30877: - { - Unit* target = m_targets.GetUnitTarget(); - if (!target || target->GetEntry() != 17326) - return SPELL_FAILED_BAD_TARGETS; - break; - } - case 61336: - if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm()) - return SPELL_FAILED_ONLY_SHAPESHIFT; - break; - case 1515: - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return SPELL_FAILED_BAD_TARGETS; - - if (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER) - return SPELL_FAILED_BAD_IMPLICIT_TARGETS; - - Creature* target = m_targets.GetUnitTarget()->ToCreature(); - - if (target->getLevel() > m_caster->getLevel()) - return SPELL_FAILED_HIGHLEVEL; - - // use SMSG_PET_TAME_FAILURE? - if (!target->GetCreatureTemplate()->isTameable (m_caster->ToPlayer()->CanTameExoticPets())) - return SPELL_FAILED_BAD_TARGETS; - - if (m_caster->GetPetGUID()) - return SPELL_FAILED_ALREADY_HAVE_SUMMON; - - if (m_caster->GetCharmGUID()) - return SPELL_FAILED_ALREADY_HAVE_CHARM; - - break; - } - case 44795: // Parachute - { - float x, y, z; - m_caster->GetPosition(x, y, z); - float ground_Z = m_caster->GetMap()->GetHeight(m_caster->GetPhaseMask(), x, y, z); - if (fabs(ground_Z - z) < 0.1f) - return SPELL_FAILED_DONT_REPORT; - break; - } - default: - break; - } - break; - } case SPELL_AURA_MOD_POSSESS_PET: { if (m_caster->GetTypeId() != TYPEID_PLAYER) @@ -7183,12 +7078,6 @@ void Spell::PrepareTriggersExecutedOnHit() // todo: move this to scripts switch (m_spellInfo->SpellFamilyName) { - case SPELLFAMILY_GENERIC: - { - if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages - m_preCastSpell = 11196; // Recently Bandaged - break; - } case SPELLFAMILY_MAGE: { // Permafrost diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 0d5dac8f8e0..b4a1ba19a08 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -353,43 +353,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) return; break; } - case 33671: // gruul's shatter - case 50811: // krystallus shatter ( Normal ) - case 61547: // krystallus shatter ( Heroic ) - { - // don't damage self and only players - if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster); - if (!radius) - return; - float distance = m_caster->GetDistance2d(unitTarget); - damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * ((radius - distance)/radius)); - break; - } - // Loken Pulsing Shockwave - case 59837: - case 52942: - { - // don't damage self and only players - if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster); - if (!radius) - return; - float distance = m_caster->GetDistance2d(unitTarget); - damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * distance); - break; - } - // TODO: add spell specific target requirement hook for spells - // Shadowbolts only affects targets with Shadow Mark (Gothik) - case 27831: - case 55638: - if (!unitTarget->HasAura(27825)) - return; - break; // Gargoyle Strike case 51963: { @@ -3425,7 +3388,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Blood Strike if (m_spellInfo->SpellFamilyFlags[0] & 0x400000) { - AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f); + float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f; + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) + AddPctF(bonusPct, aurEff->GetAmount()); + AddPctF(totalDamagePercentMod, bonusPct); // Glyph of Blood Strike if (m_caster->GetAuraEffect(59332, EFFECT_0)) @@ -3452,7 +3419,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) if (roll_chance_i(aurEff->GetAmount())) consumeDiseases = false; - AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f); + float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f; + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) + AddPctF(bonusPct, aurEff->GetAmount()); + AddPctF(totalDamagePercentMod, bonusPct); break; } // Blood-Caked Strike - Blood-Caked Blade @@ -3464,7 +3435,12 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Heart Strike if (m_spellInfo->SpellFamilyFlags[0] & 0x1000000) { - AddPctN(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID())); + float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()); + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) + AddPctF(bonusPct, aurEff->GetAmount()); + + AddPctF(totalDamagePercentMod, bonusPct); break; } break; @@ -3574,15 +3550,6 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) return; int32 addhealth = 0; - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands - { - if (m_caster->GetGUID() == unitTarget->GetGUID()) - { - m_caster->CastSpell(m_caster, 25771, true); // Forbearance - m_caster->CastSpell(m_caster, 61988, true); // Immune shield marker (serverside) - m_caster->CastSpell(m_caster, 61987, true); // Avenging Wrath marker - } - } // damage == 0 - heal for caster max health if (damage == 0) @@ -3813,12 +3780,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER) return; - uint32 spell_id = 0; - switch (urand(1, 5)) - { - case 1: spell_id = 8854; break; - default: spell_id = 8855; break; - } + uint32 spell_id = roll_chance_i(20) ? 8854 : 8855; m_caster->CastSpell(m_caster, spell_id, true, NULL); return; @@ -3865,10 +3827,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE); return; } - // Escape artist - case 20589: - m_caster->RemoveMovementImpairingAuras(); - return; // Decimate case 28374: case 54426: @@ -3899,15 +3857,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) DoCreateItem(effIndex, item); break; } - // Improved Sprint - case 30918: - { - // Removes snares and roots. - unitTarget->RemoveMovementImpairingAuras(); - break; - } - // Spirit Walk - case 58876: + case 20589: // Escape artist + case 30918: // Improved Sprint { // Removes snares and roots. unitTarget->RemoveMovementImpairingAuras(); @@ -3925,96 +3876,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } } break; - case 48025: // Headless Horseman's Mount - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 51621, true); break; - case 150: unitTarget->CastSpell(unitTarget, 48024, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 51617, true); - else - unitTarget->CastSpell(unitTarget, 48024, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 48023, true); - else - unitTarget->CastSpell(unitTarget, 48024, true); - }break; - } - return; - } - case 47977: // Magic Broom - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 42680, true); break; - case 150: unitTarget->CastSpell(unitTarget, 42683, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 42667, true); - else - unitTarget->CastSpell(unitTarget, 42683, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 42668, true); - else - unitTarget->CastSpell(unitTarget, 42683, true); - }break; - } - return; - } // Mug Transformation case 41931: { @@ -4206,25 +4067,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (unitTarget) unitTarget->CastSpell(m_caster, damage, true); return; - // Winged Steed of the Ebon Blade - case 54729: - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill - if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING)) - { - if (skillval >= 300) - unitTarget->CastSpell(unitTarget, 54727, true); - else - unitTarget->CastSpell(unitTarget, 54726, true); - } - return; - } case 57347: // Retrieving (Wintergrasp RP-GG pickup spell) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->GetTypeId() != TYPEID_PLAYER) @@ -4307,188 +4149,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) m_caster->CastSpell(m_caster, 63919, true); return; } - case 71342: // Big Love Rocket - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 0: unitTarget->CastSpell(unitTarget, 71343, true); break; - case 75: unitTarget->CastSpell(unitTarget, 71344, true); break; - case 150: unitTarget->CastSpell(unitTarget, 71345, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 71346, true); - else - unitTarget->CastSpell(unitTarget, 71345, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 71347, true); - else - unitTarget->CastSpell(unitTarget, 71345, true); - }break; - } - return; - } - case 72286: // Invincible - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 72281, true); break; - case 150: unitTarget->CastSpell(unitTarget, 72282, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 72283, true); - else - unitTarget->CastSpell(unitTarget, 72282, true); - }break; - case 300: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 72284, true); - else - unitTarget->CastSpell(unitTarget, 72282, true); - }break; - } - return; - } - case 74856: // Blazing Hippogryph - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill - if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING)) - { - if (skillval >= 300) - unitTarget->CastSpell(unitTarget, 74855, true); - else - unitTarget->CastSpell(unitTarget, 74854, true); - } - return; - } - case 75614: // Celestial Steed - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts and client crashes upon dismounting - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill and zone - bool canFly = true; - uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId()); - if (v_map != 530 && v_map != 571) - canFly = false; - - if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197)) - canFly = false; - - float x, y, z; - unitTarget->GetPosition(x, y, z); - uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); - if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) - canFly = false; - - switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING)) - { - case 75: unitTarget->CastSpell(unitTarget, 75619, true); break; - case 150: unitTarget->CastSpell(unitTarget, 75620, true); break; - case 225: - { - if (canFly) - unitTarget->CastSpell(unitTarget, 75617, true); - else - unitTarget->CastSpell(unitTarget, 75620, true); - }break; - case 300: - { - if (canFly) - { - if (unitTarget->ToPlayer()->Has310Flyer(false)) - unitTarget->CastSpell(unitTarget, 76153, true); - else - unitTarget->CastSpell(unitTarget, 75618, true); - } - else - unitTarget->CastSpell(unitTarget, 75620, true); - }break; - } - return; - } - case 75973: // X-53 Touring Rocket - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - // Prevent stacking of mounts - unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED); - - // Triggered spell id dependent on riding skill - if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING)) - { - if (skillval >= 300) - { - if (unitTarget->ToPlayer()->Has310Flyer(false)) - unitTarget->CastSpell(unitTarget, 76154, true); - else - unitTarget->CastSpell(unitTarget, 75972, true); - } - else - unitTarget->CastSpell(unitTarget, 75957, true); - } - return; - } case 59317: // Teleporting if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -5104,16 +4764,14 @@ void Spell::EffectDisEnchant(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - Player* p_caster = (Player*)m_caster; if (!itemTarget || !itemTarget->GetTemplate()->DisenchantID) return; - p_caster->UpdateCraftSkill(m_spellInfo->Id); - - m_caster->ToPlayer()->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING); + if (Player* caster = m_caster->ToPlayer()) + { + caster->UpdateCraftSkill(m_spellInfo->Id); + caster->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING); + } // item will be removed at disenchanting end } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index d9459b11ba1..834da088c56 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2960,8 +2960,10 @@ void SpellMgr::LoadDbcDataCorrections() switch (spellInfo->Id) { - case 40244: case 40245: // Simon Game Visual - case 40246: case 40247: // Simon Game Visual + case 40244: // Simon Game Visual + case 40245: // Simon Game Visual + case 40246: // Simon Game Visual + case 40247: // Simon Game Visual case 42835: // Spout, remove damage effect, only anim is needed spellInfo->Effect[0] = 0; break; @@ -2973,7 +2975,6 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetB[0] = 0; break; case 63665: // Charge (Argent Tournament emote on riders) - case 31447: // Mark of Kaz'rogal (needs target selection script) case 31298: // Sleep (needs target selection script) case 51904: // Summon Ghouls On Scarlet Crusade (this should use conditions table, script for this spell needs to be fixed) case 2895: // Wrath of Air Totem rank 1 (Aura) @@ -3128,6 +3129,9 @@ void SpellMgr::LoadDbcDataCorrections() case 51852: // The Eye of Acherus (no spawn in phase 2 in db) spellInfo->EffectMiscValue[0] |= 1; break; + case 51912: // Crafty's Ultra-Advanced Proto-Typical Shortening Blaster + spellInfo->EffectAmplitude[0] = 3000; + break; case 29809: // Desecration Arm - 36 instead of 37 - typo? :/ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_7_YARDS; break; @@ -3258,6 +3262,10 @@ void SpellMgr::LoadDbcDataCorrections() case 53313: // Entangling Roots (Rank 8) -- Nature's Grasp Proc spellInfo->CastingTimeIndex = 1; break; + case 59414: // Pulsing Shockwave Aura (Loken) + // this flag breaks movement, remove it + spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; + break; case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE; break; @@ -3299,11 +3307,6 @@ void SpellMgr::LoadDbcDataCorrections() // that will be clear if we get more spells with problem like this spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; break; - case 62584: // Lifebinder's Gift - case 64185: // Lifebinder's Gift - spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY; - spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY; - break; case 62301: // Cosmic Smash (Algalon the Observer) spellInfo->MaxAffectedTargets = 1; break; @@ -3545,11 +3548,6 @@ void SpellMgr::LoadDbcDataCorrections() switch (spellInfo->SpellFamilyName) { - case SPELLFAMILY_DRUID: - // Starfall Target Selection - if (spellInfo->SpellFamilyFlags[2] & 0x100) - spellInfo->MaxAffectedTargets = 2; - break; case SPELLFAMILY_PALADIN: // Seals of the Pure should affect Seal of Righteousness if (spellInfo->SpellIconID == 25 && spellInfo->Attributes & SPELL_ATTR0_PASSIVE) diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 63e753a18ba..676cd7be4f0 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -27,7 +27,11 @@ EndScriptData */ npc_shadowfang_prisoner EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "ScriptedEscortAI.h" #include "shadowfang_keep.h" @@ -193,8 +197,48 @@ public: }; +class spell_shadowfang_keep_haunting_spirits : public SpellScriptLoader +{ + public: + spell_shadowfang_keep_haunting_spirits() : SpellScriptLoader("spell_shadowfang_keep_haunting_spirits") { } + + class spell_shadowfang_keep_haunting_spirits_AuraScript : public AuraScript + { + PrepareAuraScript(spell_shadowfang_keep_haunting_spirits_AuraScript); + + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = (irand(0, 60) + 30) * IN_MILLISECONDS; + } + + void HandleDummyTick(AuraEffect const* aurEff) + { + GetTarget()->CastSpell((Unit*)NULL, aurEff->GetAmount(), true); + } + + void HandleUpdatePeriodic(AuraEffect* aurEff) + { + aurEff->CalculatePeriodic(GetCaster()); + } + + void Register() + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_shadowfang_keep_haunting_spirits_AuraScript(); + } +}; + void AddSC_shadowfang_keep() { new npc_shadowfang_prisoner(); new npc_arugal_voidwalker(); + new spell_shadowfang_keep_haunting_spirits(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index b5698d851f8..4fcfa8a046e 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -23,7 +23,10 @@ SDComment: SDCategory: Zul'Aman EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "zulaman.h" #define YELL_AGGRO "Da shadow gonna fall on you... " @@ -47,54 +50,58 @@ EndScriptData */ //Defines for various powers he uses after using soul drain -//Druid -#define SPELL_DR_LIFEBLOOM 43421 -#define SPELL_DR_THORNS 43420 -#define SPELL_DR_MOONFIRE 43545 - -//Hunter -#define SPELL_HU_EXPLOSIVE_TRAP 43444 -#define SPELL_HU_FREEZING_TRAP 43447 -#define SPELL_HU_SNAKE_TRAP 43449 - -//Mage -#define SPELL_MG_FIREBALL 41383 -#define SPELL_MG_FROSTBOLT 43428 -#define SPELL_MG_FROST_NOVA 43426 -#define SPELL_MG_ICE_LANCE 43427 - -//Paladin -#define SPELL_PA_CONSECRATION 43429 -#define SPELL_PA_HOLY_LIGHT 43451 -#define SPELL_PA_AVENGING_WRATH 43430 - -//Priest -#define SPELL_PR_HEAL 41372 -#define SPELL_PR_MIND_CONTROL 43550 -#define SPELL_PR_MIND_BLAST 41374 -#define SPELL_PR_SW_DEATH 41375 -#define SPELL_PR_PSYCHIC_SCREAM 43432 -#define SPELL_PR_PAIN_SUPP 44416 - -//Rogue -#define SPELL_RO_BLIND 43433 -#define SPELL_RO_SLICE_DICE 43457 -#define SPELL_RO_WOUND_POISON 39665 - -//Shaman -#define SPELL_SH_FIRE_NOVA 43436 -#define SPELL_SH_HEALING_WAVE 43548 -#define SPELL_SH_CHAIN_LIGHT 43435 - -//Warlock -#define SPELL_WL_CURSE_OF_DOOM 43439 -#define SPELL_WL_RAIN_OF_FIRE 43440 -#define SPELL_WL_UNSTABLE_AFFL 35183 - -//Warrior -#define SPELL_WR_SPELL_REFLECT 43443 -#define SPELL_WR_WHIRLWIND 43442 -#define SPELL_WR_MORTAL_STRIKE 43441 +enum Spells +{ + // Druid + SPELL_DR_THORNS = 43420, + SPELL_DR_LIFEBLOOM = 43421, + SPELL_DR_MOONFIRE = 43545, + + // Hunter + SPELL_HU_EXPLOSIVE_TRAP = 43444, + SPELL_HU_FREEZING_TRAP = 43447, + SPELL_HU_SNAKE_TRAP = 43449, + + // Mage + SPELL_MG_FIREBALL = 41383, + SPELL_MG_FROST_NOVA = 43426, + SPELL_MG_ICE_LANCE = 43427, + SPELL_MG_FROSTBOLT = 43428, + + // Paladin + SPELL_PA_CONSECRATION = 43429, + SPELL_PA_AVENGING_WRATH = 43430, + SPELL_PA_HOLY_LIGHT = 43451, + + // Priest + SPELL_PR_HEAL = 41372, + SPELL_PR_MIND_BLAST = 41374, + SPELL_PR_SW_DEATH = 41375, + SPELL_PR_PSYCHIC_SCREAM = 43432, + SPELL_PR_MIND_CONTROL = 43550, + SPELL_PR_PAIN_SUPP = 44416, + + // Rogue + SPELL_RO_BLIND = 43433, + SPELL_RO_SLICE_DICE = 43457, + SPELL_RO_WOUND_POISON = 43461, + + // Shaman + SPELL_SH_CHAIN_LIGHT = 43435, + SPELL_SH_FIRE_NOVA = 43436, + SPELL_SH_HEALING_WAVE = 43548, + + // Warlock + SPELL_WL_CURSE_OF_DOOM = 43439, + SPELL_WL_RAIN_OF_FIRE = 43440, + SPELL_WL_UNSTABLE_AFFL = 43522, + SPELL_WL_UNSTABLE_AFFL_DISPEL = 43523, + + // Warrior + SPELL_WR_MORTAL_STRIKE = 43441, + SPELL_WR_WHIRLWIND = 43442, + SPELL_WR_SPELL_REFLECT = 43443 +}; #define ORIENT 1.5696f #define POS_Y 921.2795f @@ -936,6 +943,40 @@ class boss_koragg : public CreatureScript } }; +class spell_hexlord_unstable_affliction : public SpellScriptLoader +{ + public: + spell_hexlord_unstable_affliction() : SpellScriptLoader("spell_hexlord_unstable_affliction") { } + + class spell_hexlord_unstable_affliction_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hexlord_unstable_affliction_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_WL_UNSTABLE_AFFL_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, NULL, GetEffect(EFFECT_0)); + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_hexlord_unstable_affliction_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hexlord_unstable_affliction_AuraScript(); + } +}; + void AddSC_boss_hex_lord_malacrass() { new boss_hexlord_malacrass(); @@ -947,5 +988,6 @@ void AddSC_boss_hex_lord_malacrass() new boss_fenstalker(); new boss_koragg(); new boss_alyson_antille(); + new spell_hexlord_unstable_affliction(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 407faa19eaa..c1ae04cf4c0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -15,13 +15,20 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" #include "hyjal.h" #include "hyjal_trash.h" -#define SPELL_CLEAVE 31436 -#define SPELL_WARSTOMP 31480 -#define SPELL_MARK 31447 +enum Spells +{ + SPELL_CLEAVE = 31436, + SPELL_WARSTOMP = 31480, + SPELL_MARK = 31447, + SPELL_MARK_DAMAGE = 31463 +}; #define SOUND_ONDEATH 11018 @@ -162,22 +169,10 @@ public: WarStompTimer = 60000; } else WarStompTimer -= diff; - if (me->HasAura(SPELL_MARK)) - me->RemoveAurasDueToSpell(SPELL_MARK); if (MarkTimer <= diff) { - //cast dummy, useful for bos addons - me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); + DoCastAOE(SPELL_MARK); - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA) - { - target->CastSpell(target, SPELL_MARK, true);//only cast on mana users - } - } MarkTimerBase -= 5000; if (MarkTimerBase < 5500) MarkTimerBase = 5500; @@ -201,7 +196,80 @@ public: }; +class MarkTargetFilter +{ + public: + bool operator()(Unit* target) const + { + if (target->getPowerType() != POWER_MANA) + return true; + + return false; + } +}; + +class spell_mark_of_kazrogal : public SpellScriptLoader +{ + public: + spell_mark_of_kazrogal() : SpellScriptLoader("spell_mark_of_kazrogal") { } + + class spell_mark_of_kazrogal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_mark_of_kazrogal_SpellScript); + + void FilterTargets(std::list<Unit*>& unitList) + { + unitList.remove_if(MarkTargetFilter()); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_mark_of_kazrogal_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + class spell_mark_of_kazrogal_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mark_of_kazrogal_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MARK_DAMAGE)) + return false; + return true; + } + + void OnPeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + + if (target->GetPower(POWER_MANA) == 0) + { + target->CastSpell(target, SPELL_MARK_DAMAGE, true, NULL, aurEff); + // Remove aura + SetDuration(0); + } + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazrogal_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_mark_of_kazrogal_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_mark_of_kazrogal_AuraScript(); + } +}; + void AddSC_boss_kazrogal() { new boss_kazrogal(); + new spell_mark_of_kazrogal(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 79bbb470edf..3b0aeb958cb 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -27,7 +27,10 @@ EndScriptData */ // All - untested // Pets aren't being summoned by their masters -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "trial_of_the_crusader.h" enum eYell @@ -945,18 +948,18 @@ public: }; -enum eWarlockSpells +enum WarlockSpells { - SPELL_HELLFIRE = 65816, - SPELL_CORRUPTION = 65810, - SPELL_CURSE_OF_AGONY = 65814, - SPELL_CURSE_OF_EXHAUSTION = 65815, - SPELL_FEAR = 65809, //8s - SPELL_SEARING_PAIN = 65819, - SPELL_SHADOW_BOLT = 65821, - SPELL_UNSTABLE_AFFLICTION = 65812, - SPELL_SUMMON_FELHUNTER = 67514, - H_SPELL_UNSTABLE_AFFLICTION = 68155, //15s + SPELL_HELLFIRE = 65816, + SPELL_CORRUPTION = 65810, + SPELL_CURSE_OF_AGONY = 65814, + SPELL_CURSE_OF_EXHAUSTION = 65815, + SPELL_FEAR = 65809, // 8s + SPELL_SEARING_PAIN = 65819, + SPELL_SHADOW_BOLT = 65821, + SPELL_UNSTABLE_AFFLICTION = 65812, // 15s + SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813, + SPELL_SUMMON_FELHUNTER = 67514, }; class mob_toc_warlock : public CreatureScript @@ -2030,6 +2033,40 @@ public: }; }; +class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader +{ + public: + spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { } + + class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript + { + PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0)); + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_faction_champion_warl_unstable_affliction_AuraScript(); + } +}; + void AddSC_boss_faction_champions() { new boss_toc_champion_controller(); @@ -2049,4 +2086,5 @@ void AddSC_boss_faction_champions() new mob_toc_retro_paladin(); new mob_toc_pet_warlock(); new mob_toc_pet_hunter(); + new spell_faction_champion_warl_unstable_affliction(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 9baf6ba7a00..fdc9a6a21d6 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -200,7 +200,7 @@ class boss_sindragosa : public CreatureScript struct boss_sindragosaAI : public BossAI { - boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA) + boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA), _summoned(false) { } @@ -220,7 +220,7 @@ class boss_sindragosa : public CreatureScript _isInAirPhase = false; _isThirdPhase = false; - if (instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) != 255) + if (!_summoned) { me->SetCanFly(true); me->SetDisableGravity(true); @@ -266,10 +266,13 @@ class boss_sindragosa : public CreatureScript { if (action == ACTION_START_FROSTWYRM) { + if (_summoned) + return; + + _summoned = true; if (TempSummon* summon = me->ToTempSummon()) summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN); - instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 255); if (me->isDead()) return; @@ -550,6 +553,7 @@ class boss_sindragosa : public CreatureScript uint8 _mysticBuffetStack; bool _isInAirPhase; bool _isThirdPhase; + bool _summoned; }; CreatureAI* GetAI(Creature* creature) const @@ -642,7 +646,7 @@ class npc_spinestalker : public CreatureScript struct npc_spinestalkerAI : public ScriptedAI { - npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) { } @@ -651,7 +655,7 @@ class npc_spinestalker : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -664,7 +668,7 @@ class npc_spinestalker : public CreatureScript _events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(8000, 12000)); me->SetReactState(REACT_DEFENSIVE); - if (_instance->GetData(DATA_SPINESTALKER) != 255) + if (!_summoned) { me->SetCanFly(true); me->SetDisableGravity(true); @@ -674,7 +678,7 @@ class npc_spinestalker : public CreatureScript void JustRespawned() { ScriptedAI::JustRespawned(); - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) @@ -686,7 +690,10 @@ class npc_spinestalker : public CreatureScript { if (action == ACTION_START_FROSTWYRM) { - _instance->SetData(DATA_SPINESTALKER, 255); + if (_summoned) + return; + + _summoned = true; if (me->isDead()) return; @@ -753,6 +760,7 @@ class npc_spinestalker : public CreatureScript private: EventMap _events; InstanceScript* _instance; + bool _summoned; }; CreatureAI* GetAI(Creature* creature) const @@ -768,7 +776,7 @@ class npc_rimefang : public CreatureScript struct npc_rimefangAI : public ScriptedAI { - npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) { } @@ -777,7 +785,7 @@ class npc_rimefang : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -790,7 +798,7 @@ class npc_rimefang : public CreatureScript me->SetReactState(REACT_DEFENSIVE); _icyBlastCounter = 0; - if (_instance->GetData(DATA_RIMEFANG) != 255) + if (!_summoned) { me->SetCanFly(true); me->SetDisableGravity(true); @@ -800,7 +808,7 @@ class npc_rimefang : public CreatureScript void JustRespawned() { ScriptedAI::JustRespawned(); - _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) @@ -812,7 +820,10 @@ class npc_rimefang : public CreatureScript { if (action == ACTION_START_FROSTWYRM) { - _instance->SetData(DATA_RIMEFANG, 255); + if (_summoned) + return; + + _summoned = true; if (me->isDead()) return; @@ -906,6 +917,7 @@ class npc_rimefang : public CreatureScript EventMap _events; InstanceScript* _instance; uint8 _icyBlastCounter; + bool _summoned; }; CreatureAI* GetAI(Creature* creature) const @@ -933,7 +945,7 @@ class npc_sindragosa_trash : public CreatureScript if (!me->isDead()) { if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetData64(_frostwyrmId, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -956,7 +968,7 @@ class npc_sindragosa_trash : public CreatureScript // Increase add count if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetData64(_frostwyrmId, me->GetGUID()); // this cannot be in Reset because reset also happens on evade + _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade } void SetData(uint32 type, uint32 data) @@ -1503,7 +1515,7 @@ class at_sindragosa_lair : public AreaTriggerScript if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_RIMEFANG))) rimefang->AI()->DoAction(ACTION_START_FROSTWYRM); - if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) + if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetData64(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) { if (player->GetMap()->IsHeroic() && !instance->GetData(DATA_HEROIC_ATTEMPTS)) return true; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 288fde28c38..704c3c2b0c2 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -89,13 +89,6 @@ WeeklyQuest const WeeklyQuestData[WeeklyNPCs] = {NPC_VALITHRIA_DREAMWALKER_QUEST, {QUEST_RESPITE_FOR_A_TORNMENTED_SOUL_10, QUEST_RESPITE_FOR_A_TORNMENTED_SOUL_25}}, // Respite for a Tormented Soul }; -enum FrostwyrmFlags -{ - FLAG_SPINESTALKER_SUMMONED = 0x01, - FLAG_RIMEFANG_SUMMONED = 0x02, - FLAG_SINDRAGOSA_SUMMONED = 0x04, -}; - class instance_icecrown_citadel : public InstanceMapScript { public: @@ -152,7 +145,6 @@ class instance_icecrown_citadel : public InstanceMapScript ColdflameJetsState = NOT_STARTED; BloodQuickeningState = NOT_STARTED; BloodQuickeningMinutes = 0; - FrostwyrmFlags = 0; } void FillInitialWorldStates(WorldPacket& data) @@ -284,13 +276,9 @@ class instance_icecrown_citadel : public InstanceMapScript break; case NPC_SPINESTALKER: SpinestalkerGUID = creature->GetGUID(); - if (!creature->isAlive()) - FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; break; case NPC_RIMEFANG: RimefangGUID = creature->GetGUID(); - if (!creature->isAlive()) - FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; break; case NPC_THE_LICH_KING: TheLichKingGUID = creature->GetGUID(); @@ -307,6 +295,12 @@ class instance_icecrown_citadel : public InstanceMapScript } } + void OnCreatureRemove(Creature* creature) + { + if (creature->GetEntry() == NPC_SINDRAGOSA) + SindragosaGUID = 0; + } + // Weekly quest spawn prevention uint32 GetCreatureEntry(uint32 /*guidLow*/, CreatureData const* data) { @@ -357,49 +351,36 @@ class instance_icecrown_citadel : public InstanceMapScript crok->AI()->SetGUID(creature->GetGUID(), ACTION_VRYKUL_DEATH); break; case NPC_FROSTWING_WHELP: + if (FrostwyrmGUIDs.empty()) + return; + if (creature->AI()->GetData(1/*DATA_FROSTWYRM_OWNER*/) == DATA_SPINESTALKER) { - if (FrostwyrmFlags & FLAG_SPINESTALKER_SUMMONED) - return; - - SpinestalkerTrash.erase(creature->GetGUID()); + SpinestalkerTrash.erase(creature->GetDBTableGUIDLow()); if (SpinestalkerTrash.empty()) - { - FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; if (Creature* spinestalk = instance->GetCreature(SpinestalkerGUID)) spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM); - } } else { - if (FrostwyrmFlags & FLAG_RIMEFANG_SUMMONED) - return; - - RimefangTrash.erase(creature->GetGUID()); + RimefangTrash.erase(creature->GetDBTableGUIDLow()); if (RimefangTrash.empty()) - { - FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; if (Creature* spinestalk = instance->GetCreature(RimefangGUID)) spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM); - } } break; case NPC_RIMEFANG: case NPC_SPINESTALKER: { - if (FrostwyrmFlags & FLAG_SINDRAGOSA_SUMMONED) - return; - if (instance->IsHeroic() && !HeroicAttempts) return; if (GetBossState(DATA_SINDRAGOSA) == DONE) return; - FrostwyrmGUIDs.erase(creature->GetGUID()); + FrostwyrmGUIDs.erase(creature->GetDBTableGUIDLow()); if (FrostwyrmGUIDs.empty()) { - FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; instance->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY()); if (Creature* boss = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos)) boss->AI()->DoAction(ACTION_START_FROSTWYRM); @@ -597,16 +578,10 @@ class instance_icecrown_citadel : public InstanceMapScript switch (type) { case DATA_SINDRAGOSA_FROSTWYRMS: - if (FrostwyrmFlags & FLAG_SINDRAGOSA_SUMMONED) - return 255; return FrostwyrmGUIDs.size(); case DATA_SPINESTALKER: - if (FrostwyrmFlags & FLAG_SPINESTALKER_SUMMONED) - return 255; return SpinestalkerTrash.size(); case DATA_RIMEFANG: - if (FrostwyrmFlags & FLAG_RIMEFANG_SUMMONED) - return 255; return RimefangTrash.size(); case DATA_COLDFLAME_JETS: return ColdflameJetsState; @@ -806,9 +781,6 @@ class instance_icecrown_citadel : public InstanceMapScript sindra->DespawnOrUnsummon(); } } - // Reached when loading from DB - if (state == DONE) - FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; break; case DATA_THE_LICH_KING: { @@ -866,16 +838,13 @@ class instance_icecrown_citadel : public InstanceMapScript IsOrbWhispererEligible = data ? true : false; break; case DATA_SINDRAGOSA_FROSTWYRMS: - if (data == 255) - FrostwyrmFlags |= FLAG_SINDRAGOSA_SUMMONED; + FrostwyrmGUIDs.insert(data); break; case DATA_SPINESTALKER: - if (data == 255) - FrostwyrmFlags |= FLAG_SPINESTALKER_SUMMONED; + SpinestalkerTrash.insert(data); break; case DATA_RIMEFANG: - if (data == 255) - FrostwyrmFlags |= FLAG_RIMEFANG_SUMMONED; + RimefangTrash.insert(data); break; case DATA_COLDFLAME_JETS: ColdflameJetsState = data; @@ -918,22 +887,6 @@ class instance_icecrown_citadel : public InstanceMapScript } } - void SetData64(uint32 id, uint64 data) - { - switch (id) - { - case DATA_SINDRAGOSA_FROSTWYRMS: - FrostwyrmGUIDs.insert(data); - break; - case DATA_SPINESTALKER: - SpinestalkerTrash.insert(data); - break; - case DATA_RIMEFANG: - RimefangTrash.insert(data); - break; - } - } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) { switch (criteria_id) @@ -1301,13 +1254,12 @@ class instance_icecrown_citadel : public InstanceMapScript uint64 PillarsUnchainedGUID; uint32 TeamInInstance; uint32 ColdflameJetsState; - std::set<uint64> FrostwyrmGUIDs; - std::set<uint64> SpinestalkerTrash; - std::set<uint64> RimefangTrash; + std::set<uint32> FrostwyrmGUIDs; + std::set<uint32> SpinestalkerTrash; + std::set<uint32> RimefangTrash; uint32 BloodQuickeningState; uint32 HeroicAttempts; uint16 BloodQuickeningMinutes; - uint16 FrostwyrmFlags; bool IsBonedEligible; bool IsOozeDanceEligible; bool IsNauseaEligible; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 17ed6a79c76..f81ddbf6bf8 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -15,7 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "naxxramas.h" enum Horsemen @@ -26,6 +29,11 @@ enum Horsemen HORSEMEN_SIR, }; +enum Spells +{ + SPELL_MARK_DAMAGE = 28836 +}; + enum Events { EVENT_NONE, @@ -395,7 +403,63 @@ public: }; +class spell_four_horsemen_mark : public SpellScriptLoader +{ + public: + spell_four_horsemen_mark() : SpellScriptLoader("spell_four_horsemen_mark") { } + + class spell_four_horsemen_mark_AuraScript : public AuraScript + { + PrepareAuraScript(spell_four_horsemen_mark_AuraScript); + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + int32 damage; + switch (GetStackAmount()) + { + case 1: + damage = 0; + break; + case 2: + damage = 500; + break; + case 3: + damage = 1000; + break; + case 4: + damage = 1500; + break; + case 5: + damage = 4000; + break; + case 6: + damage = 12000; + break; + default: + damage = 20000 + 1000 * (GetStackAmount() - 7); + break; + } + if (damage) + caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget()); + } + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_four_horsemen_mark_AuraScript(); + } +}; + void AddSC_boss_four_horsemen() { new boss_four_horsemen(); + new spell_four_horsemen_mark(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 8d23de5427c..7f4915cb3f1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -15,7 +15,11 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "GridNotifiers.h" +#include "CombatAI.h" #include "naxxramas.h" enum Yells @@ -25,6 +29,7 @@ enum Yells SAY_DEATH = -1533042, SAY_TELEPORT = -1533043 }; + //Gothik enum Spells { @@ -36,8 +41,11 @@ enum Spells SPELL_INFORM_LIVE_RIDER = 27935, SPELL_INFORM_DEAD_TRAINEE = 27915, SPELL_INFORM_DEAD_KNIGHT = 27931, - SPELL_INFORM_DEAD_RIDER = 27937 + SPELL_INFORM_DEAD_RIDER = 27937, + + SPELL_SHADOW_MARK = 27825 }; + enum Creatures { MOB_LIVE_TRAINEE = 16124, @@ -585,8 +593,35 @@ class mob_gothik_minion : public CreatureScript } }; +class spell_gothik_shadow_bolt_volley : public SpellScriptLoader +{ + public: + spell_gothik_shadow_bolt_volley() : SpellScriptLoader("spell_gothik_shadow_bolt_volley") { } + + class spell_gothik_shadow_bolt_volley_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gothik_shadow_bolt_volley_SpellScript); + + void FilterTargets(std::list<Unit*>& unitList) + { + unitList.remove_if(Trinity::UnitAuraCheck(false, SPELL_SHADOW_MARK)); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gothik_shadow_bolt_volley_SpellScript(); + } +}; + void AddSC_boss_gothik() { new boss_gothik(); new mob_gothik_minion(); + new spell_gothik_shadow_bolt_volley(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 0a4fdec7222..38c22a93ac4 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -86,6 +86,7 @@ enum Spells SPELL_SHADOW_FISURE = 27810, SPELL_VOID_BLAST = 27812, SPELL_MANA_DETONATION = 27819, + SPELL_MANA_DETONATION_DAMAGE = 27820, SPELL_FROST_BLAST = 27808, SPELL_CHAINS_OF_KELTHUZAD = 28410, //28408 script effect SPELL_KELTHUZAD_CHANNEL = 29423, @@ -773,6 +774,46 @@ class npc_kelthuzad_abomination : public CreatureScript } }; +class spell_kelthuzad_detonate_mana : public SpellScriptLoader +{ + public: + spell_kelthuzad_detonate_mana() : SpellScriptLoader("spell_kelthuzad_detonate_mana") { } + + class spell_kelthuzad_detonate_mana_AuraScript : public AuraScript + { + PrepareAuraScript(spell_kelthuzad_detonate_mana_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MANA_DETONATION_DAMAGE)) + return false; + return true; + } + + void HandleScript(AuraEffect const* aurEff) + { + PreventDefaultAction(); + + Unit* target = GetTarget(); + if (int32 mana = int32(target->GetMaxPower(POWER_MANA) / 10)) + { + mana = target->ModifyPower(POWER_MANA, -mana); + target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, NULL, aurEff); + } + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_detonate_mana_AuraScript::HandleScript, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_kelthuzad_detonate_mana_AuraScript(); + } +}; + class achievement_just_cant_get_enough : public AchievementCriteriaScript { public: @@ -796,5 +837,6 @@ void AddSC_boss_kelthuzad() new boss_kelthuzad(); new at_kelthuzad_center(); new npc_kelthuzad_abomination(); + new spell_kelthuzad_detonate_mana(); new achievement_just_cant_get_enough(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index 2e2744baa3c..f42fd87c643 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -19,11 +19,13 @@ /* ScriptData SDName: Boss Loken SD%Complete: 60% -SDComment: Missing intro. Remove hack of Pulsing Shockwave when core supports. Aura is not working (59414) +SDComment: Missing intro. SDCategory: Halls of Lightning EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "halls_of_lightning.h" enum eEnums @@ -73,23 +75,17 @@ public: InstanceScript* instance; - bool m_bIsAura; - uint32 m_uiArcLightning_Timer; uint32 m_uiLightningNova_Timer; - uint32 m_uiPulsingShockwave_Timer; uint32 m_uiResumePulsingShockwave_Timer; uint32 m_uiHealthAmountModifier; void Reset() { - m_bIsAura = false; - m_uiArcLightning_Timer = 15000; m_uiLightningNova_Timer = 20000; - m_uiPulsingShockwave_Timer = 2000; - m_uiResumePulsingShockwave_Timer = 15000; + m_uiResumePulsingShockwave_Timer = 1000; m_uiHealthAmountModifier = 1; @@ -116,7 +112,10 @@ public: Talk(SAY_DEATH); if (instance) + { instance->SetData(TYPE_LOKEN, DONE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PULSING_SHOCKWAVE_AURA); + } } void KilledUnit(Unit* /*victim*/) @@ -130,44 +129,13 @@ public: if (!UpdateVictim()) return; - if (m_bIsAura) - { - // workaround for PULSING_SHOCKWAVE - if (m_uiPulsingShockwave_Timer <= uiDiff) - { - Map* map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (PlayerList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) - { - int32 dmg; - float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ()); - - dmg = DUNGEON_MODE(100, 150); // need to correct damage - if (m_fDist > 1.0f) // Further from 1 yard - dmg = int32(dmg*m_fDist); - - me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false); - } - } - m_uiPulsingShockwave_Timer = 2000; - } else m_uiPulsingShockwave_Timer -= uiDiff; - } - else + if (m_uiResumePulsingShockwave_Timer) { if (m_uiResumePulsingShockwave_Timer <= uiDiff) { - //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); - DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support - m_bIsAura = true; + DoCast(me, SPELL_PULSING_SHOCKWAVE_N, true); m_uiResumePulsingShockwave_Timer = 0; } else @@ -190,7 +158,7 @@ public: Talk(EMOTE_NOVA); DoCast(me, SPELL_LIGHTNING_NOVA_N); - m_bIsAura = false; + me->RemoveAurasDueToSpell(DUNGEON_MODE<uint32>(SPELL_PULSING_SHOCKWAVE_N, SPELL_PULSING_SHOCKWAVE_H)); m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura m_uiLightningNova_Timer = urand(20000, 21000); } @@ -216,7 +184,39 @@ public: }; +class spell_loken_pulsing_shockwave : public SpellScriptLoader +{ + public: + spell_loken_pulsing_shockwave() : SpellScriptLoader("spell_loken_pulsing_shockwave") { } + + class spell_loken_pulsing_shockwave_SpellScript : public SpellScript + { + PrepareSpellScript(spell_loken_pulsing_shockwave_SpellScript); + + void CalculateDamage(SpellEffIndex /*effIndex*/) + { + if (!GetHitUnit()) + return; + + float distance = GetCaster()->GetDistance2d(GetHitUnit()); + if (distance > 1.0f) + SetHitDamage(int32(GetHitDamage() * distance)); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_loken_pulsing_shockwave_SpellScript::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_loken_pulsing_shockwave_SpellScript(); + } +}; + void AddSC_boss_loken() { new boss_loken(); + new spell_loken_pulsing_shockwave(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index bc57ce21a4d..e5e3daede91 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -23,7 +23,9 @@ SDComment: SDCategory: Script Data End */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "halls_of_stone.h" enum Spells @@ -162,12 +164,7 @@ public: //this part should be in the core if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) { - //this spell must have custom handling in the core, dealing damage based on distance - target->CastSpell(target, DUNGEON_MODE(SPELL_SHATTER_EFFECT, H_SPELL_SHATTER_EFFECT), true); - - if (target->HasAura(SPELL_STONED)) - target->RemoveAurasDueToSpell(SPELL_STONED); - + // todo: we need eventmap to kill this stuff //clear this, if we are still performing if (bIsSlam) { @@ -186,7 +183,74 @@ public: }; +class spell_krystallus_shatter : public SpellScriptLoader +{ + public: + spell_krystallus_shatter() : SpellScriptLoader("spell_krystallus_shatter") { } + + class spell_krystallus_shatter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_krystallus_shatter_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->RemoveAurasDueToSpell(SPELL_STONED); + target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_krystallus_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_krystallus_shatter_SpellScript(); + } +}; + +class spell_krystallus_shatter_effect : public SpellScriptLoader +{ + public: + spell_krystallus_shatter_effect() : SpellScriptLoader("spell_krystallus_shatter_effect") { } + + class spell_krystallus_shatter_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_krystallus_shatter_effect_SpellScript); + + void CalculateDamage() + { + if (!GetHitUnit()) + return; + + float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + if (!radius) + return; + + float distance = GetCaster()->GetDistance2d(GetHitUnit()); + if (distance > 1.0f) + SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius))); + } + + void Register() + { + OnHit += SpellHitFn(spell_krystallus_shatter_effect_SpellScript::CalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_krystallus_shatter_effect_SpellScript(); + } +}; + void AddSC_boss_krystallus() { new boss_krystallus(); + new spell_krystallus_shatter(); + new spell_krystallus_shatter_effect(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 3556bf188de..8090b9e8a3e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -51,6 +51,8 @@ enum VezaxSpells SPELL_SHADOW_CRASH_HIT = 62659, SPELL_SURGE_OF_DARKNESS = 62662, SPELL_SARONITE_VAPORS = 63323, + SPELL_SARONITE_VAPORS_ENERGIZE = 63337, + SPELL_SARONITE_VAPORS_DAMAGE = 63338, SPELL_SUMMON_SARONITE_VAPORS = 63081, SPELL_BERSERK = 26662, @@ -463,6 +465,45 @@ class spell_mark_of_the_faceless : public SpellScriptLoader } }; +class spell_general_vezax_saronite_vapors : public SpellScriptLoader +{ + public: + spell_general_vezax_saronite_vapors() : SpellScriptLoader("spell_general_vezax_saronite_vapors") { } + + class spell_general_vezax_saronite_vapors_AuraScript : public AuraScript + { + PrepareAuraScript(spell_general_vezax_saronite_vapors_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_DAMAGE)) + return false; + return true; + } + + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + int32 mana = int32(aurEff->GetAmount() * pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount + int32 damage = mana * 2; + caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true); + caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, NULL, NULL, true); + } + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_general_vezax_saronite_vapors_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_general_vezax_saronite_vapors_AuraScript(); + } +}; + class achievement_shadowdodger : public AchievementCriteriaScript { public: @@ -509,6 +550,7 @@ void AddSC_boss_general_vezax() new boss_saronite_animus(); new npc_saronite_vapors(); new spell_mark_of_the_faceless(); + new spell_general_vezax_saronite_vapors(); new achievement_shadowdodger(); new achievement_smell_saronite(); } diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 0e654ade995..3443103fa70 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -19,11 +19,13 @@ /* ScriptData SDName: Boss_Gruul SD%Complete: 60 -SDComment: Ground Slam need further development (knock back effect and shatter effect must be added to the core) +SDComment: Ground Slam need further development (knock back effect must be added to the core) SDCategory: Gruul's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "gruuls_lair.h" enum eEnums @@ -144,12 +146,7 @@ public: //this part should be in the core if (pSpell->Id == SPELL_SHATTER) { - //this spell must have custom handling in the core, dealing damage based on distance - target->CastSpell(target, SPELL_SHATTER_EFFECT, true); - - if (target->HasAura(SPELL_STONED)) - target->RemoveAurasDueToSpell(SPELL_STONED); - + // todo: use eventmap to kill this stuff //clear this, if we are still performing if (m_bPerformingGroundSlam) { @@ -258,7 +255,83 @@ public: }; +class spell_gruul_shatter : public SpellScriptLoader +{ + public: + spell_gruul_shatter() : SpellScriptLoader("spell_gruul_shatter") { } + + class spell_gruul_shatter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gruul_shatter_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_STONED)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHATTER_EFFECT)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->RemoveAurasDueToSpell(SPELL_STONED); + target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gruul_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gruul_shatter_SpellScript(); + } +}; + +class spell_gruul_shatter_effect : public SpellScriptLoader +{ + public: + spell_gruul_shatter_effect() : SpellScriptLoader("spell_gruul_shatter_effect") { } + + class spell_gruul_shatter_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gruul_shatter_effect_SpellScript); + + void CalculateDamage() + { + if (!GetHitUnit()) + return; + + float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + if (!radius) + return; + + float distance = GetCaster()->GetDistance2d(GetHitUnit()); + if (distance > 1.0f) + SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius))); + } + + void Register() + { + OnHit += SpellHitFn(spell_gruul_shatter_effect_SpellScript::CalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gruul_shatter_effect_SpellScript(); + } +}; + void AddSC_boss_gruul() { new boss_gruul(); + new spell_gruul_shatter(); + new spell_gruul_shatter_effect(); } diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index a213713ae1a..ab568249027 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -16,7 +16,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" enum Texts { @@ -36,6 +39,7 @@ enum Spells SPELL_THUNDERCLAP = 36706, SPELL_VOID_BOLT = 39329, SPELL_MARK_OF_KAZZAK = 32960, + SPELL_MARK_OF_KAZZAK_DAMAGE = 32961, SPELL_ENRAGE = 32964, SPELL_CAPTURE_SOUL = 32966, SPELL_TWISTED_REFLECTION = 21063, @@ -171,7 +175,55 @@ class boss_doomlord_kazzak : public CreatureScript } }; +class spell_mark_of_kazzak : public SpellScriptLoader +{ + public: + spell_mark_of_kazzak() : SpellScriptLoader("spell_mark_of_kazzak") { } + + class spell_mark_of_kazzak_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mark_of_kazzak_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_KAZZAK_DAMAGE)) + return false; + return true; + } + + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* owner = GetUnitOwner()) + amount = CalculatePctU(owner->GetPower(POWER_MANA), 5); + } + + void OnPeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + + if (target->GetPower(POWER_MANA) == 0) + { + target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, NULL, aurEff); + // Remove aura + SetDuration(0); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_mark_of_kazzak_AuraScript(); + } +}; + void AddSC_boss_doomlordkazzak() { new boss_doomlord_kazzak(); + new spell_mark_of_kazzak(); } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index c33ca548d73..38901287e0d 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -40,6 +40,7 @@ enum DeathKnightSpells DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, DK_SPELL_UNHOLY_PRESENCE = 48265, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, + SPELL_DK_ITEM_T8_MALEE_4P_BONUS = 64736, }; // 50462 - Anti-Magic Shell (on raid member) @@ -111,8 +112,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) { - // Set absorbtion amount to unlimited - amount = -1; + amount = GetCaster()->CountPctFromMaxHealth(hpPct); } void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) @@ -400,7 +400,12 @@ class spell_dk_scourge_strike : public SpellScriptLoader { Unit* caster = GetCaster(); if (Unit* unitTarget = GetHitUnit()) + { multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MALEE_4P_BONUS, EFFECT_0)) + AddPctF(multiplier, aurEff->GetAmount()); + } } void HandleAfterHit() @@ -603,7 +608,7 @@ public: if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) { int32 basePoints1 = aurEff->GetAmount(); - target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, aurEff); + target->CastCustomSpell(target, DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff); } } @@ -738,14 +743,14 @@ class spell_dk_death_coil : public SpellScriptLoader { PrepareSpellScript(spell_dk_death_coil_SpellScript); - bool Validate(SpellInfo const* /*SpellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL)) return false; return true; } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); Unit* caster = GetCaster(); diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 898350dbd71..4c8a9db1571 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -28,7 +28,11 @@ enum DruidSpells { DRUID_INCREASED_MOONFIRE_DURATION = 38414, - DRUID_NATURES_SPLENDOR = 57865 + DRUID_NATURES_SPLENDOR = 57865, + DRUID_LIFEBLOOM_FINAL_HEAL = 33778, + DRUID_LIFEBLOOM_ENERGIZE = 64372, + DRUID_SURVIVAL_INSTINCTS = 50322, + DRUID_SAVAGE_ROAR = 62071 }; // 54846 Glyph of Starfire @@ -154,7 +158,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // reduces all damage taken while Stunned in Cat Form - if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)) + if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)) absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); } @@ -337,7 +341,12 @@ class spell_dru_starfall_dummy : public SpellScriptLoader { PrepareSpellScript(spell_dru_starfall_dummy_SpellScript); - void HandleDummy(SpellEffIndex /* effIndex */) + void FilterTargets(std::list<Unit*>& unitList) + { + Trinity::Containers::RandomResizeList(unitList, 2); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); // Shapeshifting into an animal form or mounting cancels the effect @@ -348,15 +357,16 @@ class spell_dru_starfall_dummy : public SpellScriptLoader return; } - //Any effect which causes you to lose control of your character will supress the starfall effect. + // Any effect which causes you to lose control of your character will supress the starfall effect. if (caster->HasUnitState(UNIT_STATE_CONTROLLED)) return; - caster->CastSpell(GetHitUnit(), GetEffectValue(), true); + caster->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); } void Register() { + OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -367,6 +377,244 @@ class spell_dru_starfall_dummy : public SpellScriptLoader } }; +class spell_dru_lifebloom : public SpellScriptLoader +{ + public: + spell_dru_lifebloom() : SpellScriptLoader("spell_dru_lifebloom") { } + + class spell_dru_lifebloom_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_lifebloom_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_FINAL_HEAL)) + return false; + if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_ENERGIZE)) + return false; + return true; + } + + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + // final heal + int32 stack = GetStackAmount(); + int32 healAmount = aurEff->GetAmount(); + if (Unit* caster = GetCaster()) + { + healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack); + healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack); + + GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + + // restore mana + int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; + caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + return; + } + + GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* target = GetUnitOwner()) + { + if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) + { + // final heal + int32 healAmount = aurEff->GetAmount(); + if (Unit* caster = GetCaster()) + { + healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + + // restore mana + int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; + caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + return; + } + + target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + } + } + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dru_lifebloom_AuraScript(); + } +}; + +class spell_dru_predatory_strikes : public SpellScriptLoader +{ + public: + spell_dru_predatory_strikes() : SpellScriptLoader("spell_dru_predatory_strikes") { } + + class spell_dru_predatory_strikes_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_predatory_strikes_AuraScript); + + void UpdateAmount(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* target = GetTarget()->ToPlayer()) + target->UpdateAttackPowerAndDamage(); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dru_predatory_strikes_AuraScript(); + } +}; + +class spell_dru_savage_roar : public SpellScriptLoader +{ + public: + spell_dru_savage_roar() : SpellScriptLoader("spell_dru_savage_roar") { } + + class spell_dru_savage_roar_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dru_savage_roar_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetShapeshiftForm() != FORM_CAT) + return SPELL_FAILED_ONLY_SHAPESHIFT; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_dru_savage_roar_SpellScript::CheckCast); + } + }; + + class spell_dru_savage_roar_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_savage_roar_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(DRUID_SAVAGE_ROAR)) + return false; + return true; + } + + void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->CastSpell(target, DRUID_SAVAGE_ROAR, true, NULL, aurEff, GetCasterGUID()); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(DRUID_SAVAGE_ROAR); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dru_savage_roar_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_dru_savage_roar_AuraScript(); + } +}; + +class spell_dru_survival_instincts : public SpellScriptLoader +{ + public: + spell_dru_survival_instincts() : SpellScriptLoader("spell_dru_survival_instincts") { } + + class spell_dru_survival_instincts_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dru_survival_instincts_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (!caster->IsInFeralForm()) + return SPELL_FAILED_ONLY_SHAPESHIFT; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_dru_survival_instincts_SpellScript::CheckCast); + } + }; + + class spell_dru_survival_instincts_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_survival_instincts_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(DRUID_SURVIVAL_INSTINCTS)) + return false; + return true; + } + + void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + int32 bp0 = target->CountPctFromMaxHealth(aurEff->GetAmount()); + target->CastCustomSpell(target, DRUID_SURVIVAL_INSTINCTS, &bp0, NULL, NULL, true); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(DRUID_SURVIVAL_INSTINCTS); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_dru_survival_instincts_AuraScript::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_survival_instincts_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dru_survival_instincts_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_dru_survival_instincts_AuraScript(); + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); @@ -377,4 +625,8 @@ void AddSC_druid_spell_scripts() new spell_dru_starfall_aoe(); new spell_dru_swift_flight_passive(); new spell_dru_starfall_dummy(); + new spell_dru_lifebloom(); + new spell_dru_predatory_strikes(); + new spell_dru_savage_roar(); + new spell_dru_survival_instincts(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 5b65d0ca763..e7cc7360aab 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -239,7 +239,7 @@ class spell_gen_parachute : public SpellScriptLoader { PrepareAuraScript(spell_gen_parachute_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF)) return false; @@ -2739,6 +2739,340 @@ public: } }; +enum GenericBandage +{ + SPELL_RECENTLY_BANDAGED = 11196, +}; + +class spell_gen_bandage : public SpellScriptLoader +{ + public: + spell_gen_bandage() : SpellScriptLoader("spell_gen_bandage") { } + + class spell_gen_bandage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_bandage_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_RECENTLY_BANDAGED)) + return false; + return true; + } + + SpellCastResult CheckCast() + { + if (Unit* target = GetExplTargetUnit()) + { + if (target->HasAura(SPELL_RECENTLY_BANDAGED)) + return SPELL_FAILED_TARGET_AURASTATE; + } + return SPELL_CAST_OK; + } + + void HandleScript() + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_RECENTLY_BANDAGED, true); + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_gen_bandage_SpellScript::CheckCast); + AfterHit += SpellHitFn(spell_gen_bandage_SpellScript::HandleScript); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_bandage_SpellScript(); + } +}; + +enum GenericLifebloom +{ + SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL = 43422, + SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL = 52552, + SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL = 53692, + SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL = 57763, + SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL = 66094, +}; + +class spell_gen_lifebloom : public SpellScriptLoader +{ + public: + spell_gen_lifebloom(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } + + class spell_gen_lifebloom_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_lifebloom_AuraScript); + + public: + spell_gen_lifebloom_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(_spellId)) + return false; + return true; + } + + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + return; + + // final heal + GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID()); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + } + + private: + uint32 _spellId; + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_lifebloom_AuraScript(_spellId); + } + + private: + uint32 _spellId; +}; + +enum SummonElemental +{ + SPELL_SUMMON_FIRE_ELEMENTAL = 8985, + SPELL_SUMMON_EARTH_ELEMENTAL = 19704 +}; + +class spell_gen_summon_elemental : public SpellScriptLoader +{ + public: + spell_gen_summon_elemental(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } + + class spell_gen_summon_elemental_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_summon_elemental_AuraScript); + + public: + spell_gen_summon_elemental_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(_spellId)) + return false; + return true; + } + + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetCaster()) + if (Unit* owner = GetCaster()->GetOwner()) + owner->CastSpell(owner, _spellId, true); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetCaster()) + if (Unit* owner = GetCaster()->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) // todo: this check is maybe wrong + owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_gen_summon_elemental_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_summon_elemental_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + + private: + uint32 _spellId; + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_summon_elemental_AuraScript(_spellId); + } + + private: + uint32 _spellId; +}; + +enum Mounts +{ + SPELL_COLD_WEATHER_FLYING = 54197, + + // Magic Broom + SPELL_MAGIC_BROOM_60 = 42680, + SPELL_MAGIC_BROOM_100 = 42683, + SPELL_MAGIC_BROOM_150 = 42667, + SPELL_MAGIC_BROOM_280 = 42668, + + // Headless Horseman's Mount + SPELL_HEADLESS_HORSEMAN_MOUNT_60 = 51621, + SPELL_HEADLESS_HORSEMAN_MOUNT_100 = 48024, + SPELL_HEADLESS_HORSEMAN_MOUNT_150 = 51617, + SPELL_HEADLESS_HORSEMAN_MOUNT_280 = 48023, + + // Winged Steed of the Ebon Blade + SPELL_WINGED_STEED_150 = 54726, + SPELL_WINGED_STEED_280 = 54727, + + // Big Love Rocket + SPELL_BIG_LOVE_ROCKET_0 = 71343, + SPELL_BIG_LOVE_ROCKET_60 = 71344, + SPELL_BIG_LOVE_ROCKET_100 = 71345, + SPELL_BIG_LOVE_ROCKET_150 = 71346, + SPELL_BIG_LOVE_ROCKET_310 = 71347, + + // Invincible + SPELL_INVINCIBLE_60 = 72281, + SPELL_INVINCIBLE_100 = 72282, + SPELL_INVINCIBLE_150 = 72283, + SPELL_INVINCIBLE_310 = 72284, + + // Blazing Hippogryph + SPELL_BLAZING_HIPPOGRYPH_150 = 74854, + SPELL_BLAZING_HIPPOGRYPH_280 = 74855, + + // Celestial Steed + SPELL_CELESTIAL_STEED_60 = 75619, + SPELL_CELESTIAL_STEED_100 = 75620, + SPELL_CELESTIAL_STEED_150 = 75617, + SPELL_CELESTIAL_STEED_280 = 75618, + SPELL_CELESTIAL_STEED_310 = 76153, + + // X-53 Touring Rocket + SPELL_X53_TOURING_ROCKET_150 = 75957, + SPELL_X53_TOURING_ROCKET_280 = 75972, + SPELL_X53_TOURING_ROCKET_310 = 76154, +}; + +class spell_gen_mount : public SpellScriptLoader +{ + public: + spell_gen_mount(const char* name, uint32 mount0 = 0, uint32 mount60 = 0, uint32 mount100 = 0, uint32 mount150 = 0, uint32 mount280 = 0, uint32 mount310 = 0) : SpellScriptLoader(name), + _mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { } + + class spell_gen_mount_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_mount_SpellScript); + + public: + spell_gen_mount_SpellScript(uint32 mount0, uint32 mount60, uint32 mount100, uint32 mount150, uint32 mount280, uint32 mount310) : SpellScript(), + _mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { } + + bool Validate(SpellInfo const* /*spell*/) + { + if (_mount0 && !sSpellMgr->GetSpellInfo(_mount0)) + return false; + if (_mount60 && !sSpellMgr->GetSpellInfo(_mount60)) + return false; + if (_mount100 && !sSpellMgr->GetSpellInfo(_mount100)) + return false; + if (_mount150 && !sSpellMgr->GetSpellInfo(_mount150)) + return false; + if (_mount280 && !sSpellMgr->GetSpellInfo(_mount280)) + return false; + if (_mount310 && !sSpellMgr->GetSpellInfo(_mount310)) + return false; + return true; + } + + void HandleMount(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + + if (Player* target = GetHitPlayer()) + { + // Prevent stacking of mounts and client crashes upon dismounting + target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura()); + + // Triggered spell id dependent on riding skill and zone + bool canFly = false; + uint32 map = target->GetMapId(); + if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING))) + canFly = true; + + AreaTableEntry const* area = sAreaStore.LookupEntry(target->GetAreaId()); + if (!area || (canFly && (area->flags & AREA_FLAG_NO_FLY_ZONE))) + canFly = false; + + uint32 mount = 0; + switch (target->GetBaseSkillValue(SKILL_RIDING)) + { + case 0: + mount = _mount0; + break; + case 75: + mount = _mount60; + break; + case 150: + mount = _mount100; + break; + case 225: + if (canFly) + mount = _mount150; + else + mount = _mount100; + break; + case 300: + if (canFly) + { + if (_mount310 && target->Has310Flyer(false)) + mount = _mount310; + else + mount = _mount280; + } + else + mount = _mount100; + break; + default: + break; + } + + if (mount) + { + PreventHitAura(); + target->CastSpell(target, mount, true); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_mount_SpellScript::HandleMount, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } + + private: + uint32 _mount0; + uint32 _mount60; + uint32 _mount100; + uint32 _mount150; + uint32 _mount280; + uint32 _mount310; + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_mount_SpellScript(_mount0, _mount60, _mount100, _mount150, _mount280, _mount310); + } + + private: + uint32 _mount0; + uint32 _mount60; + uint32 _mount100; + uint32 _mount150; + uint32 _mount280; + uint32 _mount310; +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2795,4 +3129,20 @@ void AddSC_generic_spell_scripts() new spell_gen_despawn_self(); new spell_gen_touch_the_nightmare(); new spell_gen_dream_funnel(); + new spell_gen_bandage(); + new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_twisted_visage_lifebloom", SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL); + new spell_gen_summon_elemental("spell_gen_summon_fire_elemental", SPELL_SUMMON_FIRE_ELEMENTAL); + new spell_gen_summon_elemental("spell_gen_summon_earth_elemental", SPELL_SUMMON_EARTH_ELEMENTAL); + new spell_gen_mount("spell_magic_broom", 0, SPELL_MAGIC_BROOM_60, SPELL_MAGIC_BROOM_100, SPELL_MAGIC_BROOM_150, SPELL_MAGIC_BROOM_280); + new spell_gen_mount("spell_headless_horseman_mount", 0, SPELL_HEADLESS_HORSEMAN_MOUNT_60, SPELL_HEADLESS_HORSEMAN_MOUNT_100, SPELL_HEADLESS_HORSEMAN_MOUNT_150, SPELL_HEADLESS_HORSEMAN_MOUNT_280); + new spell_gen_mount("spell_winged_steed_of_the_ebon_blade", 0, 0, 0, SPELL_WINGED_STEED_150, SPELL_WINGED_STEED_280); + new spell_gen_mount("spell_big_love_rocket", SPELL_BIG_LOVE_ROCKET_0, SPELL_BIG_LOVE_ROCKET_60, SPELL_BIG_LOVE_ROCKET_100, SPELL_BIG_LOVE_ROCKET_150, SPELL_BIG_LOVE_ROCKET_310); + new spell_gen_mount("spell_invincible", 0, SPELL_INVINCIBLE_60, SPELL_INVINCIBLE_100, SPELL_INVINCIBLE_150, SPELL_INVINCIBLE_310); + new spell_gen_mount("spell_blazing_hippogryph", 0, 0, 0, SPELL_BLAZING_HIPPOGRYPH_150, SPELL_BLAZING_HIPPOGRYPH_280); + new spell_gen_mount("spell_celestial_steed", 0, SPELL_CELESTIAL_STEED_60, SPELL_CELESTIAL_STEED_100, SPELL_CELESTIAL_STEED_150, SPELL_CELESTIAL_STEED_280, SPELL_CELESTIAL_STEED_310); + new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 896ed331bde..a2ee6c1c3a3 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -618,6 +618,86 @@ class spell_hun_misdirection_proc : public SpellScriptLoader } }; +class spell_hun_disengage : public SpellScriptLoader +{ + public: + spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { } + + class spell_hun_disengage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hun_disengage_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() == TYPEID_PLAYER && !caster->isInCombat()) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_disengage_SpellScript(); + } +}; + +class spell_hun_tame_beast : public SpellScriptLoader +{ + public: + spell_hun_tame_beast() : SpellScriptLoader("spell_hun_tame_beast") { } + + class spell_hun_tame_beast_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hun_tame_beast_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_DONT_REPORT; + + if (!GetExplTargetUnit()) + return SPELL_FAILED_BAD_IMPLICIT_TARGETS; + + if (Creature* target = GetExplTargetUnit()->ToCreature()) + { + if (target->getLevel() > caster->getLevel()) + return SPELL_FAILED_HIGHLEVEL; + + // use SMSG_PET_TAME_FAILURE? + if (!target->GetCreatureTemplate()->isTameable(caster->ToPlayer()->CanTameExoticPets())) + return SPELL_FAILED_BAD_TARGETS; + + if (caster->GetPetGUID()) + return SPELL_FAILED_ALREADY_HAVE_SUMMON; + + if (caster->GetCharmGUID()) + return SPELL_FAILED_ALREADY_HAVE_CHARM; + } + else + return SPELL_FAILED_BAD_IMPLICIT_TARGETS; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_hun_tame_beast_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_tame_beast_SpellScript(); + } +}; void AddSC_hunter_spell_scripts() { @@ -633,4 +713,6 @@ void AddSC_hunter_spell_scripts() new spell_hun_pet_carrion_feeder(); new spell_hun_misdirection(); new spell_hun_misdirection_proc(); + new spell_hun_disengage(); + new spell_hun_tame_beast(); } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 050741ffaba..0edfbaee437 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -342,13 +342,52 @@ public: } }; +class spell_mage_living_bomb : public SpellScriptLoader +{ + public: + spell_mage_living_bomb() : SpellScriptLoader("spell_mage_living_bomb") { } + + class spell_mage_living_bomb_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mage_living_bomb_AuraScript); + + bool Validate(SpellInfo const* spell) + { + if (!sSpellMgr->GetSpellInfo(uint32(spell->Effects[EFFECT_1].CalcValue()))) + return false; + return true; + } + + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); + if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE) + return; + + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, NULL, aurEff); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_mage_living_bomb_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_mage_living_bomb_AuraScript(); + } +}; + void AddSC_mage_spell_scripts() { - new spell_mage_blast_wave; - new spell_mage_cold_snap; + new spell_mage_blast_wave(); + new spell_mage_cold_snap(); new spell_mage_frost_warding_trigger(); new spell_mage_incanters_absorbtion_absorb(); new spell_mage_incanters_absorbtion_manashield(); - new spell_mage_polymorph_cast_visual; - new spell_mage_summon_water_elemental; + new spell_mage_polymorph_cast_visual(); + new spell_mage_summon_water_elemental(); + new spell_mage_living_bomb(); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 4baa1eb3735..329e0d2e170 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -43,6 +43,10 @@ enum PaladinSpells SPELL_DIVINE_STORM = 53385, SPELL_DIVINE_STORM_DUMMY = 54171, SPELL_DIVINE_STORM_HEAL = 54172, + + SPELL_FORBEARANCE = 25771, + SPELL_AVENGING_WRATH_MARKER = 61987, + SPELL_IMMUNE_SHIELD_MARKER = 61988, }; // 31850 - Ardent Defender @@ -255,17 +259,18 @@ class spell_pal_holy_shock : public SpellScriptLoader class spell_pal_holy_shock_SpellScript : public SpellScript { - PrepareSpellScript(spell_pal_holy_shock_SpellScript) - bool Validate(SpellInfo const* spellEntry) + PrepareSpellScript(spell_pal_holy_shock_SpellScript); + + bool Validate(SpellInfo const* spell) { if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1)) return false; // can't use other spell than holy shock due to spell_ranks dependency - if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) + if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spell->Id)) return false; - uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); + uint8 rank = sSpellMgr->GetSpellRank(spell->Id); if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) return false; @@ -287,7 +292,7 @@ class spell_pal_holy_shock : public SpellScriptLoader SpellCastResult CheckCast() { - Player* caster = GetCaster()->ToPlayer(); + Unit* caster = GetCaster(); if (Unit* target = GetExplTargetUnit()) { if (!caster->IsFriendlyTo(target)) @@ -433,6 +438,99 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader } }; +class spell_pal_lay_on_hands : public SpellScriptLoader +{ + public: + spell_pal_lay_on_hands() : SpellScriptLoader("spell_pal_lay_on_hands") { } + + class spell_pal_lay_on_hands_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_lay_on_hands_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_FORBEARANCE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_AVENGING_WRATH_MARKER)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_IMMUNE_SHIELD_MARKER)) + return false; + return true; + } + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + if (caster == target) + if (target->HasAura(SPELL_FORBEARANCE) || target->HasAura(SPELL_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_IMMUNE_SHIELD_MARKER)) + return SPELL_FAILED_TARGET_AURASTATE; + + return SPELL_CAST_OK; + } + + void HandleScript() + { + Unit* caster = GetCaster(); + if (caster == GetHitUnit()) + { + caster->CastSpell(caster, SPELL_FORBEARANCE, true); + caster->CastSpell(caster, SPELL_AVENGING_WRATH_MARKER, true); + caster->CastSpell(caster, SPELL_IMMUNE_SHIELD_MARKER, true); + } + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands_SpellScript::CheckCast); + AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pal_lay_on_hands_SpellScript(); + } +}; + +class spell_pal_righteous_defense : public SpellScriptLoader +{ + public: + spell_pal_righteous_defense() : SpellScriptLoader("spell_pal_righteous_defense") { } + + class spell_pal_righteous_defense_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_righteous_defense_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_DONT_REPORT; + + if (Unit* target = GetExplTargetUnit()) + { + if (!target->IsFriendlyTo(caster) || target->getAttackers().empty()) + return SPELL_FAILED_BAD_TARGETS; + } + else + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_pal_righteous_defense_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pal_righteous_defense_SpellScript(); + } +}; + void AddSC_paladin_spell_scripts() { new spell_pal_ardent_defender(); @@ -443,4 +541,6 @@ void AddSC_paladin_spell_scripts() new spell_pal_judgement_of_command(); new spell_pal_divine_storm(); new spell_pal_divine_storm_dummy(); + new spell_pal_lay_on_hands(); + new spell_pal_righteous_defense(); } diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 6ed0f18c785..78bdbb7f127 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * * This program is free software; you can redistribute it and/or modify it @@ -102,7 +102,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader return true; } - void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -121,7 +121,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -140,7 +140,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -155,7 +155,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -170,7 +170,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader } } - void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -237,7 +237,7 @@ public: return true; } - void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -249,7 +249,7 @@ public: } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempBonus) @@ -281,7 +281,7 @@ public: } } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -291,7 +291,7 @@ public: } } - void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -310,16 +310,16 @@ public: // Glyph of felguard if (pet->GetEntry() == ENTRY_FELGUARD) { - if (AuraEffect* aurEffect = owner->GetAuraEffect(56246, EFFECT_0)) + if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0)) { float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT); - amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount()); + amount += CalculatePctN(amount+base_attPower, /* aurEff */ect->GetAmount()); } } } } - void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -374,7 +374,7 @@ public: return true; } - void CalculateIntellectAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateIntellectAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -389,7 +389,7 @@ public: } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempBonus) @@ -417,7 +417,7 @@ public: } } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -427,7 +427,7 @@ public: } } - void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -439,7 +439,7 @@ public: } } - void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -486,7 +486,7 @@ public: return true; } - void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -498,7 +498,7 @@ public: } } - void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -510,7 +510,7 @@ public: } } - void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -553,7 +553,7 @@ public: return true; } - void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) @@ -593,7 +593,7 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -608,7 +608,7 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -623,7 +623,7 @@ public: } } - void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -668,7 +668,7 @@ public: return true; } - void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -690,7 +690,7 @@ public: } } - void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { @@ -741,11 +741,11 @@ public: return true; } - void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { switch (GetCaster()->GetEntry()) { @@ -792,13 +792,13 @@ public: return true; } - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) if (pet->isPet()) if (Unit* owner = pet->ToPet()->GetOwner()) - if (AuraEffect* aurEffect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0)) - amount += aurEffect->GetAmount(); + if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0)) + amount += /* aurEff */ect->GetAmount(); } void Register() @@ -830,10 +830,8 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -847,10 +845,8 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster() || !GetCaster()->GetOwner()) - return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: @@ -886,50 +882,45 @@ public: { PrepareAuraScript(spell_hun_pet_scaling_01_AuraScript); - void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) - { - if (!pet->isPet()) - return; - - Unit* owner = pet->ToPet()->GetOwner(); - if (!owner) - return; - - float mod = 0.45f; - float ownerBonus = 0.0f; + if (pet->isPet()) + if (Unit* owner = pet->ToPet()->GetOwner()) + { + float mod = 0.45f; + float ownerBonus = 0.0f; - PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 - if (itr == pet->ToPet()->m_spells.end()) - itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2 + PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 + if (itr == pet->ToPet()->m_spells.end()) + itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2 - if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue()); - } + if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value + AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue()); + } - ownerBonus = owner->GetStat(STAT_STAMINA)*mod; + ownerBonus = owner->GetStat(STAT_STAMINA)*mod; - amount += ownerBonus; - } + amount += ownerBonus; + } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempHealth) pet->SetHealth(_tempHealth); } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) _tempHealth = pet->GetHealth(); } - void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -959,7 +950,7 @@ public: } } - void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1024,7 +1015,7 @@ public: return true; } - void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1043,7 +1034,7 @@ public: } } - void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1062,7 +1053,7 @@ public: } } - void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1111,7 +1102,7 @@ public: return true; } - void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1130,7 +1121,7 @@ public: } } - void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1149,7 +1140,7 @@ public: } } - void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1198,7 +1189,7 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1215,7 +1206,7 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1232,7 +1223,7 @@ public: } } - void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1279,11 +1270,11 @@ public: return true; } - void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: float CritSpell = 0.0f; @@ -1300,11 +1291,11 @@ public: } } - void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: float CritMelee = 0.0f; @@ -1350,11 +1341,11 @@ public: return true; } - void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; - if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) + if (GetCaster()->GetOwner()->ToPlayer()) { // Pet's base damage changes depending on happiness if (GetCaster()->isPet() && GetCaster()->ToPet()->isHunterPet()) @@ -1408,14 +1399,14 @@ public: return true; } - void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { - if (AuraEffect* aurEffect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1)) - amount = aurEffect->GetAmount(); + if (AuraEffect* /* aurEff */ect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1)) + amount = /* aurEff */ect->GetAmount(); else amount = 0; } @@ -1450,18 +1441,19 @@ public: return true; } - void CalculateAvoidanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAvoidanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { if (Unit* owner = pet->GetOwner()) - + { // Army of the dead ghoul if (pet->GetEntry() == ENTRY_ARMY_OF_THE_DEAD_GHOUL) amount = -90; // Night of the dead else if ( Aura * aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD)) amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + } } } @@ -1494,7 +1486,7 @@ public: return true; } - void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1520,20 +1512,20 @@ public: } } - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) if (_tempHealth) pet->SetHealth(_tempHealth); } - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/) { if (Unit* pet = GetUnitOwner()) _tempHealth = pet->GetHealth(); } - void CalculateStrengthAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateStrengthAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1597,7 +1589,7 @@ public: return true; } - void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1640,7 +1632,7 @@ public: return true; } - void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1657,7 +1649,7 @@ public: } } - void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; @@ -1703,7 +1695,7 @@ public: return true; } - void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* pet = GetUnitOwner()) { @@ -1718,7 +1710,7 @@ public: } } - void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || !GetCaster()->GetOwner()) return; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 8088004c9d1..6910bf47805 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -34,6 +34,9 @@ enum PriestSpells PRIEST_SPELL_PENANCE_R1_HEAL = 47757, PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619, PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201, + PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085, + PRIEST_SPELL_EMPOWERED_RENEW = 63544, + PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021, }; // Guardian Spirit @@ -330,6 +333,88 @@ public: } }; +class spell_pri_vampiric_touch : public SpellScriptLoader +{ + public: + spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { } + + class spell_pri_vampiric_touch_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pri_vampiric_touch_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* /*dispelInfo*/) + { + if (Unit* caster = GetCaster()) + if (Unit* target = GetUnitOwner()) + if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) + { + int32 damage = aurEff->GetAmount() * 8; + // backfire damage + caster->CastCustomSpell(target, PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + } + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_pri_vampiric_touch_AuraScript(); + } +}; + +class spell_priest_renew : public SpellScriptLoader +{ + public: + spell_priest_renew() : SpellScriptLoader("spell_priest_renew") { } + + class spell_priest_renew_AuraScript : public AuraScript + { + PrepareAuraScript(spell_priest_renew_AuraScript); + + bool Load() + { + return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleApplyEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + // Empowered Renew + if (AuraEffect const* empoweredRenewAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT, EFFECT_1)) + { + uint32 heal = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), GetEffect(EFFECT_0)->GetAmount(), DOT); + heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT); + + int32 basepoints0 = empoweredRenewAurEff->GetAmount() * GetEffect(EFFECT_0)->GetTotalTicks() * int32(heal) / 100; + caster->CastCustomSpell(GetTarget(), PRIEST_SPELL_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff); + } + } + } + + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_priest_renew_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_priest_renew_AuraScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); @@ -339,4 +424,6 @@ void AddSC_priest_spell_scripts() new spell_pri_reflective_shield_trigger(); new spell_pri_mind_sear(); new spell_pri_prayer_of_mending_heal(); + new spell_pri_vampiric_touch(); + new spell_priest_renew(); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index c9c036d5329..fce3d0415a6 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -35,13 +35,19 @@ enum ShamanSpells SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349, SHAMAN_SPELL_SATED = 57724, SHAMAN_SPELL_EXHAUSTION = 57723, - + SHAMAN_SPELL_STORM_EARTH_AND_FIRE = 51483, EARTHBIND_TOTEM_SPELL_EARTHGRAB = 64695, // For Earthen Power SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474, SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566, + + SHAMAN_BIND_SIGHT = 6277, + + ICON_ID_SHAMAN_LAVA_FLOW = 3087, + SHAMAN_LAVA_FLOWS_R1 = 51480, + SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694, }; // 51474 - Astral shift @@ -255,7 +261,7 @@ class EarthenPowerTargetSelector { public: EarthenPowerTargetSelector() { } - + bool operator() (Unit* target) { if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) @@ -652,6 +658,94 @@ class spell_sha_chain_heal : public SpellScriptLoader } }; +class spell_sha_flame_shock : public SpellScriptLoader +{ + public: + spell_sha_flame_shock() : SpellScriptLoader("spell_sha_flame_shock") { } + + class spell_sha_flame_shock_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_flame_shock_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_R1)) + return false; + if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_TRIGGERED_R1)) + return false; + return true; + } + + void HandleDispel(DispelInfo* /*dispelInfo*/) + { + if (Unit* caster = GetCaster()) + // Lava Flows + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, EFFECT_0)) + { + if (sSpellMgr->GetFirstSpellInChain(SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId())) + return; + + uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId()); + caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true); + } + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_sha_flame_shock_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_sha_flame_shock_AuraScript(); + } +}; + +class spell_sha_sentry_totem : public SpellScriptLoader +{ + public: + spell_sha_sentry_totem() : SpellScriptLoader("spell_sha_sentry_totem") { } + + class spell_sha_sentry_totem_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_sentry_totem_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SHAMAN_BIND_SIGHT)) + return false; + return true; + } + + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[4])) + if (totem->isTotem()) + caster->CastSpell(totem, SHAMAN_BIND_SIGHT, true); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (caster->GetTypeId() == TYPEID_PLAYER) + caster->ToPlayer()->StopCastingBindSight(); + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_sha_sentry_totem_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_sha_sentry_totem_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_sha_sentry_totem_AuraScript(); + } +}; + void AddSC_shaman_spell_scripts() { new spell_sha_astral_shift(); @@ -667,4 +761,6 @@ void AddSC_shaman_spell_scripts() new spell_sha_mana_spring_totem(); new spell_sha_lava_lash(); new spell_sha_chain_heal(); + new spell_sha_flame_shock(); + new spell_sha_sentry_totem(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 838b9e4f932..e20eb07d45a 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -37,6 +37,9 @@ enum WarlockSpells WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018, WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020, WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388, + WARLOCK_HAUNT = 48181, + WARLOCK_HAUNT_HEAL = 48210, + WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117, }; class spell_warl_banish : public SpellScriptLoader @@ -523,6 +526,107 @@ class spell_warl_demonic_circle_teleport : public SpellScriptLoader } }; +class spell_warl_haunt : public SpellScriptLoader +{ + public: + spell_warl_haunt() : SpellScriptLoader("spell_warl_haunt") { } + + class spell_warl_haunt_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warl_haunt_SpellScript); + + void HandleOnHit() + { + if (Aura* aura = GetHitAura()) + if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) + aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage())); + } + + void Register() + { + OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit); + } + }; + + class spell_warl_haunt_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_haunt_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(WARLOCK_HAUNT_HEAL)) + return false; + return true; + } + + void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + if (Unit* caster = GetCaster()) + { + int32 amount = aurEff->GetAmount(); + GetTarget()->CastCustomSpell(caster, WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + } + } + + void Register() + { + OnEffectRemove += AuraEffectApplyFn(spell_warl_haunt_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_haunt_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_warl_haunt_AuraScript(); + } +}; + +class spell_warl_unstable_affliction : public SpellScriptLoader +{ + public: + spell_warl_unstable_affliction() : SpellScriptLoader("spell_warl_unstable_affliction") { } + + class spell_warl_unstable_affliction_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_unstable_affliction_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(WARLOCK_UNSTABLE_AFFLICTION_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* dispelInfo) + { + if (Unit* caster = GetCaster()) + if (AuraEffect const* aurEff = GetEffect(EFFECT_0)) + { + int32 damage = aurEff->GetAmount() * 9; + // backfire damage and silence + caster->CastCustomSpell(dispelInfo->GetDispeller(), WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + } + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_warl_unstable_affliction_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_unstable_affliction_AuraScript(); + } +}; + void AddSC_warlock_spell_scripts() { new spell_warl_banish(); @@ -535,4 +639,6 @@ void AddSC_warlock_spell_scripts() new spell_warl_life_tap(); new spell_warl_demonic_circle_summon(); new spell_warl_demonic_circle_teleport(); + new spell_warl_haunt(); + new spell_warl_unstable_affliction(); } |