Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target furthest player on poison charge #2583

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions sql/migrations/20240413233003_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
DROP PROCEDURE IF EXISTS add_migration;
DELIMITER ??
CREATE PROCEDURE `add_migration`()
BEGIN
DECLARE v INT DEFAULT 1;
SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20240413233003');
IF v = 0 THEN
INSERT INTO `migrations` VALUES ('20240413233003');
-- Add your query below.


/*
- Switch Necro Stalker and Venom Stalker to use script that targets farthest player.
*/
UPDATE `creature_template` SET `spell_list_id`=0,`script_name`='poison_charge_stalker_ai' WHERE `entry`=16453 OR `entry`=15976;


-- End of migration.
END IF;
END??
DELIMITER ;
CALL add_migration();
DROP PROCEDURE IF EXISTS add_migration;
Original file line number Diff line number Diff line change
Expand Up @@ -307,40 +307,40 @@ void instance_naxxramas::UpdateTeleporters(uint32 uiType, uint32 uiData)
case TYPE_MAEXXNA:
if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_ARAC_EYE_BOSS))
SetTeleporterVisualState(pGO, uiData);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there were spaces before the newline here before that git kept deleting automatically I think


if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_ARAC_EYE_RAMP))
SetTeleporterVisualState(pGO, uiData);

if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_ARAC_PORTAL))
SetTeleporterState(pGO, uiData);
break;
case TYPE_THADDIUS:
if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_CONS_EYE_BOSS))
SetTeleporterVisualState(pGO, uiData);

if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_CONS_EYE_RAMP))
SetTeleporterVisualState(pGO, uiData);

if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_CONS_PORTAL))
SetTeleporterState(pGO, uiData);
break;
case TYPE_LOATHEB:
if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_PLAG_EYE_BOSS))
SetTeleporterVisualState(pGO, uiData);

if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_PLAG_EYE_RAMP))
SetTeleporterVisualState(pGO, uiData);

if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_PLAG_PORTAL))
SetTeleporterState(pGO, uiData);
break;
case TYPE_FOUR_HORSEMEN:
if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_MILI_EYE_BOSS))
SetTeleporterVisualState(pGO, uiData);

if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_MILI_EYE_RAMP))
SetTeleporterVisualState(pGO, uiData);

if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_MILI_PORTAL))
SetTeleporterState(pGO, uiData);
break;
Expand Down Expand Up @@ -1502,6 +1502,7 @@ enum
SPELL_STONESKIN = 28995, // Periodic Heal and Damage Immunity
SPELL_GARGOYLE_STONEFORM_VISUAL = 29153, // Dummy Aura
SPELL_ACID_VOLLEY = 29325,
SPELL_POISONCHARGE = 28431,

BCT_STRANGE_NOISE = 10755, // %s emits a strange noise.
};
Expand Down Expand Up @@ -1748,6 +1749,46 @@ struct mob_dark_touched_warriorAI : public ScriptedAI
}
};

struct mob_poison_charge_stalkerAI : public ScriptedAI
{
mob_poison_charge_stalkerAI(Creature* pCreature) : ScriptedAI(pCreature)
{
Reset();
}

uint32 m_uiChargeTimer;

void Reset() override
{
m_uiChargeTimer = 0;
}

void UpdateAI(uint32 const uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())
return;

// Charge Timer
if (m_uiChargeTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_FARTHEST, 0, SPELL_POISONCHARGE, SELECT_FLAG_PLAYER | SELECT_FLAG_IN_LOS))
{
if (DoCastSpellIfCan(pTarget, SPELL_POISONCHARGE) == CAST_OK)
m_uiChargeTimer = urand(8000, 12000);
}
}
else
m_uiChargeTimer -= uiDiff;

DoMeleeAttackIfReady();
}
};

CreatureAI* GetAI_mob_poison_charge_stalker(Creature* pCreature)
{
return new mob_poison_charge_stalkerAI(pCreature);
}

CreatureAI* GetAI_mob_spiritOfNaxxramas(Creature* pCreature)
{
return new mob_spiritOfNaxxramasAI(pCreature);
Expand Down Expand Up @@ -1889,7 +1930,7 @@ bool GossipSelect_npc_MasterCraftsmanOmarion(Player* pPlayer, Creature* pCreatur
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Polar Gloves", GOSSIP_SELECT_LW, GOSSIP_SELECT_POLAR_GLOVES);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Icy Scale Gauntlets", GOSSIP_SELECT_LW, GOSSIP_SELECT_ICYSCALE_GLOVES);

pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Polar Bracers", GOSSIP_SELECT_LW, GOSSIP_SELECT_POLAR_WRISTS);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Icy Scale Bracers", GOSSIP_SELECT_LW, GOSSIP_SELECT_ICYSCALE_WRISTS);
}
Expand Down Expand Up @@ -2084,4 +2125,9 @@ void AddSC_instance_naxxramas()
pNewScript->pGossipHello = &GossipHello_npc_MasterCraftsmanOmarion;
pNewScript->pGossipSelect = &GossipSelect_npc_MasterCraftsmanOmarion;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "poison_charge_stalker_ai";
pNewScript->GetAI = &GetAI_mob_poison_charge_stalker;
pNewScript->RegisterSelf();
}