Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper

This commit is contained in:
2026-08-28 15:20:26 +02:00
parent 942be8eaeb
commit 8a2733a0a9
859 changed files with 4408 additions and 5331 deletions

View File

@@ -4,18 +4,19 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect, IScriptOnEndTurn,
IScriptPreventStatusChange
{
private IPokemon? _placer;
private IBattlePokemon? _placer;
private bool _hasUsedUproar;
private int _turns = 3;
public void SetPlacer(IPokemon placer)
public void SetPlacer(IBattlePokemon placer)
{
_placer = placer;
_hasUsedUproar = true;
}
/// <inheritdoc />
public void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus)
public void PreventStatusChange(IBattlePokemon pokemon, StringKey status, bool selfInflicted,
ref bool preventStatus)
{
if (status == ScriptUtils.ResolveName<Status.Sleep>())
{
@@ -30,7 +31,7 @@ public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondary
}
/// <inheritdoc />
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
{
if (move.User == _placer && move.UseMove.Name == MoveNames.Uproar)
_hasUsedUproar = true;