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

Prevent Warriors using Charge in Halls of Lightning #836

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "HallsOfLightningTriggers.h"
#include "Action.h"

#include "WarriorActions.h"

float BjarngrimMultiplier::GetValue(Action* action)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "general bjarngrim");
Expand Down Expand Up @@ -73,31 +75,52 @@ float IonarMultiplier::GetValue(Action* action)
Unit* boss = AI_VALUE2(Unit*, "find target", "ionar");
if (!boss) { return 1.0f; }

if(!bot->CanSeeOrDetect(boss))
// Check if the boss has dispersed into Sparks (not visible).
if (!bot->CanSeeOrDetect(boss))
{
// Block MovementActions except for specific exceptions.
if (dynamic_cast<MovementAction*>(action)
&& !dynamic_cast<DispersePositionAction*>(action)
&& !dynamic_cast<StaticOverloadSpreadAction*>(action))
{
if (dynamic_cast<MovementAction*>(action)
&& !dynamic_cast<DispersePositionAction*>(action)
&& !dynamic_cast<StaticOverloadSpreadAction*>(action))
{
return 0.0f;
}
return 0.0f;
}
}

if (boss->FindCurrentSpellBySpellId(SPELL_DISPERSE))
{
// Explicitly block the CastChargeAction during dispersal.
if (dynamic_cast<CastChargeAction*>(action))
{
return 0.0f;
}
}
return 1.0f;
}

float LokenMultiplier::GetValue(Action* action)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "loken");
if (!boss) { return 1.0f; }

// Prevent FleeAction from being executed.
if (dynamic_cast<FleeAction*>(action)) { return 0.0f; }

if (boss->FindCurrentSpellBySpellId(SPELL_LIGHTNING_NOVA)
&& dynamic_cast<MovementAction*>(action)
&& !dynamic_cast<AvoidLightningNovaAction*>(action))
// Prevent MovementActions during Lightning Nova unless it's AvoidLightningNovaAction.
if (boss->FindCurrentSpellBySpellId(SPELL_LIGHTNING_NOVA))
{
return 0.0f;
if (dynamic_cast<MovementAction*>(action)
&& !dynamic_cast<AvoidLightningNovaAction*>(action))
{
return 0.0f;
}

// Specifically prevent Charge during Lightning Nova.
if (dynamic_cast<CastChargeAction*>(action))
{
return 0.0f;
}
}

return 1.0f;
return 1.0f; // Default multiplier value for other cases.
}

Loading