Deukhoofd 2533512eda
All checks were successful
Build / Build (push) Successful in 51s
Slight cleanup, do some TODOs
2025-06-22 10:42:25 +02:00

22 lines
762 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "core_enforcer")]
public class CoreEnforcer : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = target.BattleData;
if (battleData == null)
return;
var turnChoices = battleData.Battle.PreviousTurnChoices.Last();
var currentChoiceIndex = turnChoices.IndexOf(move.MoveChoice);
if (currentChoiceIndex == -1 ||
!turnChoices.Take(currentChoiceIndex).Any(choice => choice is IMoveChoice or IItemChoice))
{
move.GetHitData(target, hit).Fail();
return;
}
target.SuppressAbility();
}
}