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

@@ -19,7 +19,7 @@ public class RandomAI : PokemonAI
}
/// <inheritdoc />
public override ITurnChoice GetChoice(IBattle battle, IPokemon pokemon)
public override ITurnChoice GetChoice(IBattle battle, IBattlePokemon pokemon)
{
var moves = pokemon.Moves.WhereNotNull().Where(x => x.CurrentPp > 0).ToList();
while (moves.Count > 0)
@@ -28,7 +28,7 @@ public class RandomAI : PokemonAI
var targets = GetValidTargetsForMove(pokemon, move).ToArray();
if (move.MoveData.Category is MoveCategory.Physical or MoveCategory.Special)
{
targets = targets.Where(x => x.side != pokemon.BattleData!.SideIndex).ToArray();
targets = targets.Where(x => x.side != pokemon.SideIndex).ToArray();
}
if (targets.Length == 0)
{
@@ -43,7 +43,7 @@ public class RandomAI : PokemonAI
}
moves.Remove(move);
}
return battle.Library.MiscLibrary.ReplacementChoice(pokemon,
pokemon.BattleData!.SideIndex == 0 ? (byte)1 : (byte)0, pokemon.BattleData.Position);
return battle.Library.MiscLibrary.ReplacementChoice(pokemon, pokemon.SideIndex == 0 ? (byte)1 : (byte)0,
pokemon.Position);
}
}