mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 00:53:46 +00:00
fix(DB/SAI): Fix Poisonous Mushroom cast logic and move script to SAI (#22567)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
--
|
||||
DELETE FROM `creature_template_addon` WHERE `entry` IN (31461, 31462);
|
||||
INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES
|
||||
(31461, 0, 0, 0, 0, 0, 0, '31690 56740'),
|
||||
(31462, 0, 0, 0, 0, 0, 0, '31690 56741');
|
||||
|
||||
UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~2&~33554432, `flags_extra` = `flags_extra` &~128, `ScriptName` = '' WHERE `entry` IN (30435, 30391, 31461, 31462);
|
||||
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 30435;
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 30435);
|
||||
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
|
||||
(30435, 0, 0, 0, 60, 0, 100, 1, 1000, 1000, 0, 0, 0, 0, 11, 57059, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - On Update - Cast \'Serverside - Grow\' (No Repeat)'),
|
||||
(30435, 0, 1, 0, 26, 0, 100, 1, 0, 3, 0, 0, 1, 0, 223, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - In Combat LoS - Do Action ID 1 (No Repeat)'),
|
||||
(30435, 0, 2, 3, 2, 0, 100, 0, 0, 5, 0, 0, 0, 0, 11, 31691, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - Between 0-5% Health - Cast \'Serverside - Shrink\''),
|
||||
(30435, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 41, 4000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - Between 0-5% Health - Despawn In 4000 ms'),
|
||||
(30435, 0, 4, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - On Respawn - Set Reactstate Passive'),
|
||||
(30435, 0, 5, 0, 32, 0, 100, 1, 1, 150, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - On Damaged Between 1-150 - Do Action ID 1 (No Repeat)'),
|
||||
(30435, 0, 6, 0, 72, 0, 100, 1, 1, 0, 0, 0, 0, 0, 80, 3043500, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - On Action 1 Done - Run Script (No Repeat)'),
|
||||
(30435, 0, 7, 0, 101, 0, 100, 0, 1, 0, 4000, 4000, 4000, 0, 28, 56648, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - On 1 or More Players in Range - Remove Aura \'Potent Fungus\'');
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 3043500) AND (`source_type` = 9) AND (`id` IN (0, 1, 2));
|
||||
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
|
||||
(3043500, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 57061, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - Actionlist - Cast \'Poison Cloud\''),
|
||||
(3043500, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 0, 0, 11, 31691, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - Actionlist - Cast \'Serverside - Shrink\''),
|
||||
(3043500, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 41, 3000, 3000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Poisonous Mushroom - Actionlist - Despawn In 3000 ms');
|
||||
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 30391;
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 30391);
|
||||
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
|
||||
(30391, 0, 0, 0, 60, 0, 100, 0, 1000, 1000, 0, 0, 0, 0, 11, 57059, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Healthy Mushroom - On Update - Cast \'Serverside - Grow\''),
|
||||
(30391, 0, 1, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Healthy Mushroom - On Respawn - Set Reactstate Passive'),
|
||||
(30391, 0, 2, 3, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 56648, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Healthy Mushroom - On Just Died - Cast \'Potent Fungus\''),
|
||||
(30391, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 31691, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Healthy Mushroom - On Just Died - Cast \'Serverside - Shrink\'');
|
||||
@@ -31,14 +31,7 @@ enum Spells
|
||||
SPELL_REMOVE_MUSHROOM_POWER = 57283,
|
||||
|
||||
// Mushroom
|
||||
SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS = 56648,
|
||||
SPELL_POISONOUS_MUSHROOM_POISON_CLOUD = 57061,
|
||||
SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741,
|
||||
SPELL_POISONOUS_MUSHROOM_VISUAL_AREA = 61566, // Self
|
||||
SPELL_HEALTHY_MUSHROOM_VISUAL_AURA = 56740,
|
||||
SPELL_PUTRID_MUSHROOM = 31690,
|
||||
SPELL_GROW = 57059,
|
||||
SPELL_SHRINK = 31691,
|
||||
SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS = 56648
|
||||
};
|
||||
|
||||
enum Creatures
|
||||
@@ -94,13 +87,12 @@ Position const MushroomPositions[MAX_MUSHROOMS_COUNT] =
|
||||
|
||||
struct boss_amanitar : public BossAI
|
||||
{
|
||||
boss_amanitar(Creature* creature) : BossAI(creature, DATA_AMANITAR), mushroomsSummoned(false) { }
|
||||
boss_amanitar(Creature* creature) : BossAI(creature, DATA_AMANITAR) { }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
_mushroomsDeque.clear();
|
||||
mushroomsSummoned = false;
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* /*attacker*/) override
|
||||
@@ -110,7 +102,7 @@ struct boss_amanitar : public BossAI
|
||||
}, 10s, 15s);
|
||||
|
||||
ScheduleTimedEvent(10s, 14s, [&] {
|
||||
DoCastVictim(SPELL_BASH, false);
|
||||
DoCastVictim(SPELL_BASH);
|
||||
}, 15s, 20s);
|
||||
|
||||
ScheduleTimedEvent(15s, 20s, [&] {
|
||||
@@ -153,10 +145,10 @@ struct boss_amanitar : public BossAI
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
|
||||
}
|
||||
|
||||
void SummonedCreatureDies(Creature* summon, Unit* killer) override
|
||||
void SummonedCreatureDespawn(Creature* summon) override
|
||||
{
|
||||
_mushroomsDeque.push_back(summon->GetPosition());
|
||||
BossAI::SummonedCreatureDies(summon, killer);
|
||||
BossAI::SummonedCreatureDespawn(summon);
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason why) override
|
||||
@@ -167,7 +159,6 @@ struct boss_amanitar : public BossAI
|
||||
|
||||
private:
|
||||
std::deque<Position> _mushroomsDeque;
|
||||
bool mushroomsSummoned;
|
||||
|
||||
void SummonMushroom(Position const& pos)
|
||||
{
|
||||
@@ -175,98 +166,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
struct npc_amanitar_mushrooms : public ScriptedAI
|
||||
{
|
||||
npc_amanitar_mushrooms(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
me->SetCombatMovement(false);
|
||||
|
||||
//TODO: this prolly needs to be done in database
|
||||
pCreature->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
pCreature->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
|
||||
pCreature->SetRegeneratingHealth(false);
|
||||
}
|
||||
|
||||
// Disabled events
|
||||
void JustEngagedWith(Unit* /*who*/) override {}
|
||||
void AttackStart(Unit* /*victim*/) override {}
|
||||
void EnterEvadeMode(EvadeReason /*why*/) override {}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
DoCastSelf(SPELL_PUTRID_MUSHROOM);
|
||||
|
||||
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
|
||||
{
|
||||
DoCastSelf(SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoCastSelf(SPELL_HEALTHY_MUSHROOM_VISUAL_AURA, true);
|
||||
}
|
||||
|
||||
events.ScheduleEvent(EVENT_GROW, 800ms);
|
||||
|
||||
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
|
||||
{
|
||||
events.ScheduleEvent(EVENT_CHECK_PLAYER, 250ms);
|
||||
}
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override
|
||||
{
|
||||
if (me->GetEntry() == NPC_HEALTHY_MUSHROOM && damage >= me->GetHealth())
|
||||
{
|
||||
DoCastSelf(SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, true);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (events.Empty())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
while (uint32 const eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_GROW:
|
||||
{
|
||||
DoCastSelf(SPELL_GROW);
|
||||
break;
|
||||
}
|
||||
case EVENT_CHECK_PLAYER:
|
||||
{
|
||||
if (Player* plr = me->SelectNearestPlayer(2.0f))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS);
|
||||
DoCastSelf(SPELL_POISONOUS_MUSHROOM_VISUAL_AREA);
|
||||
DoCastSelf(SPELL_POISONOUS_MUSHROOM_POISON_CLOUD);
|
||||
DoCastSelf(SPELL_SHRINK);
|
||||
events.ScheduleEvent(EVENT_KILLSELF, 4s);
|
||||
}
|
||||
else
|
||||
{
|
||||
events.Repeat(250ms);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EVENT_KILLSELF:
|
||||
{
|
||||
me->DisappearAndDie();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap events;
|
||||
};
|
||||
|
||||
// 57283 Remove Mushroom Power
|
||||
class spell_amanitar_remove_mushroom_power : public AuraScript
|
||||
{
|
||||
@@ -274,8 +173,7 @@ class spell_amanitar_remove_mushroom_power : public AuraScript
|
||||
|
||||
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* target = GetTarget())
|
||||
target->RemoveAurasDueToSpell(SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS);
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -287,8 +185,5 @@ class spell_amanitar_remove_mushroom_power : public AuraScript
|
||||
void AddSC_boss_amanitar()
|
||||
{
|
||||
RegisterAhnKahetCreatureAI(boss_amanitar);
|
||||
RegisterAhnKahetCreatureAI(npc_amanitar_mushrooms);
|
||||
|
||||
// Spells
|
||||
RegisterSpellScript(spell_amanitar_remove_mushroom_power);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user