Skip to content

Commit

Permalink
Prevent Warriors using Charge during Ionar Disperse and Loken Lightni…
Browse files Browse the repository at this point in the history
…ng Nova (#836)
  • Loading branch information
avirar authored Jan 2, 2025
1 parent c5994e2 commit 823f9e8
Showing 1 changed file with 36 additions and 13 deletions.
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.
}

0 comments on commit 823f9e8

Please sign in to comment.