Scripts/Spells: Implemented Wind Rush Totem (#26985)

This commit is contained in:
ModoX
2021-10-03 20:36:06 +02:00
committed by GitHub
parent cbf1f2883a
commit b1c0d069e1
2 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
--
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=97285;
DELETE FROM `smart_scripts` WHERE `entryorguid`=97285 AND `source_type`=0;
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `action_type`, `action_param1`, `target_type`, `comment`) VALUES
(97285, 0, 0, 0, 25, 11, 192078, 1, 'On Reset - Cast Spell Wind Rush Totem - Self');
UPDATE `areatrigger_template` SET `ScriptName`='areatrigger_sha_wind_rush_totem', `VerifiedBuild`=40120 WHERE `Id`=12676;
DELETE FROM `areatrigger_create_properties` WHERE `Id`=8537;
INSERT INTO `areatrigger_create_properties` (`Id`, `AreaTriggerId`, `MoveCurveId`, `ScaleCurveId`, `MorphCurveId`, `FacingCurveId`, `AnimId`, `AnimKitId`, `DecalPropertiesId`, `TimeToTarget`, `TimeToTargetScale`, `Shape`, `ShapeData0`, `ShapeData1`, `ShapeData2`, `ShapeData3`, `ShapeData4`, `ShapeData5`, `VerifiedBuild`) VALUES
(8537, 12676, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0, 40120); -- SpellId : 192078

View File

@@ -22,6 +22,7 @@
*/
#include "ScriptMgr.h"
#include "AreaTriggerAI.h"
#include "CellImpl.h"
#include "CreatureAIImpl.h" // for RAND()
#include "GridNotifiersImpl.h"
@@ -76,6 +77,7 @@ enum ShamanSpells
SPELL_SHAMAN_TOTEMIC_POWER_ATTACK_POWER = 28826,
SPELL_SHAMAN_TOTEMIC_POWER_ARMOR = 28827,
SPELL_SHAMAN_WINDFURY_ATTACK = 25504,
SPELL_SHAMAN_WIND_RUSH = 192082,
};
enum MiscSpells
@@ -1435,6 +1437,50 @@ public:
}
};
// 192078 - Wind Rush Totem (Spell)
// 12676 - AreaTriggerId
struct areatrigger_sha_wind_rush_totem : AreaTriggerAI
{
static constexpr uint32 REFRESH_TIME = 4500;
areatrigger_sha_wind_rush_totem(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger), _refreshTimer(REFRESH_TIME) { }
void OnUpdate(uint32 diff) override
{
_refreshTimer -= diff;
if (_refreshTimer <= 0)
{
if (Unit* caster = at->GetCaster())
{
for (ObjectGuid const& guid : at->GetInsideUnits())
{
if (Unit* unit = ObjectAccessor::GetUnit(*caster, guid))
{
if (!caster->IsFriendlyTo(unit))
continue;
caster->CastSpell(unit, SPELL_SHAMAN_WIND_RUSH, true);
}
}
}
_refreshTimer += REFRESH_TIME;
}
}
void OnUnitEnter(Unit* unit) override
{
if (Unit* caster = at->GetCaster())
{
if (!caster->IsFriendlyTo(unit))
return;
caster->CastSpell(unit, SPELL_SHAMAN_WIND_RUSH, true);
}
}
private:
int32 _refreshTimer;
};
void AddSC_shaman_spell_scripts()
{
new spell_sha_ancestral_guidance();
@@ -1469,4 +1515,5 @@ void AddSC_shaman_spell_scripts()
new spell_sha_t10_elemental_4p_bonus();
new spell_sha_t10_restoration_4p_bonus();
new spell_sha_windfury();
RegisterAreaTriggerAI(areatrigger_sha_wind_rush_totem);
}