fix(Scripts/ZulAman): add Scout run to drums (#21095)
Co-authored-by: MantisLord <sabinprosper@gmail.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 23586) AND (`source_type` = 0);
|
||||||
|
UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_amanishi_scout' WHERE (`entry` = 23586);
|
||||||
|
DELETE FROM `spell_script_names` WHERE `spell_id`=42177 AND `ScriptName`='spell_alert_drums';
|
||||||
|
DELETE FROM `spell_script_names` WHERE `spell_id`=42179 AND `ScriptName`='spell_summon_amanishi_sentries';
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||||
|
(42177, 'spell_alert_drums'),
|
||||||
|
(42179, 'spell_summon_amanishi_sentries');
|
||||||
|
|
||||||
|
-- Reinforcement
|
||||||
|
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 23587) AND (`source_type` = 0) AND (`id` IN (2, 3));
|
||||||
|
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||||
|
(23587, 0, 2, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani\'shi Reinforcement - On Just Summoned - Set In Combat With Zone'),
|
||||||
|
(23587, 0, 3, 0, 1, 0, 100, 1, 10000, 10000, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani\'shi Reinforcement - Out of Combat - Despawn Instant (No Repeat)');
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
#include "ScriptedGossip.h"
|
#include "ScriptedGossip.h"
|
||||||
|
#include "SpellAuraEffects.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include "SpellScript.h"
|
#include "SpellScript.h"
|
||||||
#include "SpellScriptLoader.h"
|
#include "SpellScriptLoader.h"
|
||||||
@@ -681,6 +682,166 @@ private:
|
|||||||
SummonList _summons;
|
SummonList _summons;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct WorldTriggerHutPred
|
||||||
|
{
|
||||||
|
bool operator()(Creature* trigger) const
|
||||||
|
{
|
||||||
|
return trigger->GetOrientation() > 2.7f || (trigger->GetOrientation() < 2.7f && 1270.0f < trigger->GetPositionY() && trigger->GetPositionY() < 1280.0f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WorldTriggerDrumPred
|
||||||
|
{
|
||||||
|
bool operator()(Creature* trigger) const
|
||||||
|
{
|
||||||
|
return !WorldTriggerHutPred()(trigger);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum AmanishiScout
|
||||||
|
{
|
||||||
|
NPC_WORLD_TRIGGER = 22515,
|
||||||
|
POINT_DRUM = 0,
|
||||||
|
SAY_AGGRO = 0,
|
||||||
|
SPELL_ALERT_DRUMS = 42177,
|
||||||
|
SPELL_MULTI_SHOT = 43205,
|
||||||
|
SPELL_SHOOT = 16496
|
||||||
|
};
|
||||||
|
|
||||||
|
struct npc_amanishi_scout : public ScriptedAI
|
||||||
|
{
|
||||||
|
npc_amanishi_scout(Creature* creature) : ScriptedAI(creature) { }
|
||||||
|
|
||||||
|
void Reset() override
|
||||||
|
{
|
||||||
|
scheduler.CancelAll();
|
||||||
|
me->SetCombatMovement(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
|
{
|
||||||
|
me->SetInCombatWithZone();
|
||||||
|
Talk(SAY_AGGRO);
|
||||||
|
// Move to Drum
|
||||||
|
std::list<Creature*> triggers;
|
||||||
|
GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 50.0f);
|
||||||
|
triggers.remove_if(WorldTriggerHutPred());
|
||||||
|
triggers.sort(Acore::ObjectDistanceOrderPred(me));
|
||||||
|
if (!triggers.empty())
|
||||||
|
{
|
||||||
|
me->ClearTarget();
|
||||||
|
Creature* closestDrum = triggers.front();
|
||||||
|
me->GetMotionMaster()->MovePoint(POINT_DRUM, closestDrum->GetPositionX(), closestDrum->GetPositionY(), closestDrum->GetPositionZ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ScheduleCombat();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MovementInform(uint32 type, uint32 id) override
|
||||||
|
{
|
||||||
|
if (type == POINT_MOTION_TYPE && id == POINT_DRUM)
|
||||||
|
{
|
||||||
|
DoCastSelf(SPELL_ALERT_DRUMS);
|
||||||
|
scheduler.Schedule(5s, [this](TaskContext /*context*/)
|
||||||
|
{
|
||||||
|
ScheduleCombat();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScheduleCombat()
|
||||||
|
{
|
||||||
|
me->SetCombatMovement(true);
|
||||||
|
if (Unit* victim = me->GetVictim())
|
||||||
|
me->GetMotionMaster()->MoveChase(victim);
|
||||||
|
scheduler.Schedule(2s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_SHOOT);
|
||||||
|
context.Repeat(4s, 5s);
|
||||||
|
}).Schedule(6s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastAOE(SPELL_MULTI_SHOT);
|
||||||
|
context.Repeat(20s, 24s);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateAI(uint32 diff) override
|
||||||
|
{
|
||||||
|
scheduler.Update(diff);
|
||||||
|
|
||||||
|
if (!UpdateVictim())
|
||||||
|
return;
|
||||||
|
|
||||||
|
DoMeleeAttackIfReady();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SpellAlertDrums
|
||||||
|
{
|
||||||
|
SPELL_SUMMON_AMANISHI_SENTRIES = 42179
|
||||||
|
};
|
||||||
|
|
||||||
|
class spell_alert_drums : public AuraScript
|
||||||
|
{
|
||||||
|
PrepareAuraScript(spell_alert_drums);
|
||||||
|
|
||||||
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
|
{
|
||||||
|
return ValidateSpellInfo({ SPELL_SUMMON_AMANISHI_SENTRIES });
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleTriggerSpell(AuraEffect const* aurEff)
|
||||||
|
{
|
||||||
|
PreventDefaultAction();
|
||||||
|
if (aurEff->GetTickNumber() == 1)
|
||||||
|
GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_AMANISHI_SENTRIES, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectPeriodic += AuraEffectPeriodicFn(spell_alert_drums::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum AmanishiSentries
|
||||||
|
{
|
||||||
|
SUMMON_AMANISHI_SENTRIES_1 = 42180,
|
||||||
|
SUMMON_AMANISHI_SENTRIES_2 = 42181,
|
||||||
|
SUMMON_AMANISHI_SENTRIES_3 = 42182,
|
||||||
|
SUMMON_AMANISHI_SENTRIES_4 = 42183,
|
||||||
|
};
|
||||||
|
|
||||||
|
class spell_summon_amanishi_sentries : public SpellScript
|
||||||
|
{
|
||||||
|
PrepareSpellScript(spell_summon_amanishi_sentries);
|
||||||
|
|
||||||
|
constexpr static uint32 spells[4] = { SUMMON_AMANISHI_SENTRIES_1, SUMMON_AMANISHI_SENTRIES_2, SUMMON_AMANISHI_SENTRIES_3, SUMMON_AMANISHI_SENTRIES_4 };
|
||||||
|
|
||||||
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
|
{
|
||||||
|
return ValidateSpellInfo(spells);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
std::list<Creature*> triggers;
|
||||||
|
GetCreatureListWithEntryInGrid(triggers, GetHitUnit(), NPC_WORLD_TRIGGER, 50.0f);
|
||||||
|
triggers.remove_if(WorldTriggerDrumPred());
|
||||||
|
if (triggers.empty())
|
||||||
|
return;
|
||||||
|
Creature* trigger = Acore::Containers::SelectRandomContainerElement(triggers);
|
||||||
|
uint8 index_1 = urand(0, 3);
|
||||||
|
uint8 index_2 = (index_1 + 1) % 4;
|
||||||
|
trigger->CastSpell(trigger, spells[index_1], true);
|
||||||
|
trigger->CastSpell(trigger, spells[index_2], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_summon_amanishi_sentries::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_zulaman()
|
void AddSC_zulaman()
|
||||||
{
|
{
|
||||||
RegisterZulAmanCreatureAI(npc_forest_frog);
|
RegisterZulAmanCreatureAI(npc_forest_frog);
|
||||||
@@ -689,4 +850,7 @@ void AddSC_zulaman()
|
|||||||
RegisterSpellScript(spell_ritual_of_power);
|
RegisterSpellScript(spell_ritual_of_power);
|
||||||
RegisterZulAmanCreatureAI(npc_amanishi_lookout);
|
RegisterZulAmanCreatureAI(npc_amanishi_lookout);
|
||||||
RegisterZulAmanCreatureAI(npc_amanishi_tempest);
|
RegisterZulAmanCreatureAI(npc_amanishi_tempest);
|
||||||
|
RegisterZulAmanCreatureAI(npc_amanishi_scout);
|
||||||
|
RegisterSpellScript(spell_alert_drums);
|
||||||
|
RegisterSpellScript(spell_summon_amanishi_sentries);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user