Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper

This commit is contained in:
Deukhoofd committed 2026-08-28 15:22:26 +02:00
1 parent 942be8eaeb
commit 8a2733a0a9
859 files changed
+4408 -5331

No files matched your search

+6 -6
View File
@@ -163,19 +163,19 @@ public static class TestCommandRunner
var pokemon1 = battle.Sides[0].Pokemon[0];
while (pokemon1 is null && !battle.HasEnded)
{
pokemon1 = battle.Parties[0].Party.WhereNotNull().FirstOrDefault(x => x.IsUsable);
if (pokemon1 is null)
var replacement1 = battle.Parties[0].BattlePokemon.WhereNotNull().FirstOrDefault(x => x.IsUsable);
if (replacement1 is null)
throw new InvalidOperationException("No usable Pokémon found in party 1.");
battle.Sides[0].SwapPokemon(0, pokemon1);
battle.Sides[0].SwapPokemon(0, replacement1);
pokemon1 = battle.Sides[0].Pokemon[0];
}
var pokemon2 = battle.Sides[1].Pokemon[0];
while (pokemon2 is null && !battle.HasEnded)
{
pokemon2 = battle.Parties[1].Party.WhereNotNull().FirstOrDefault(x => x.IsUsable);
if (pokemon2 is null)
var replacement2 = battle.Parties[1].BattlePokemon.WhereNotNull().FirstOrDefault(x => x.IsUsable);
if (replacement2 is null)
throw new InvalidOperationException("No usable Pokémon found in party 2.");
battle.Sides[1].SwapPokemon(0, pokemon2);
battle.Sides[1].SwapPokemon(0, replacement2);
pokemon2 = battle.Sides[1].Pokemon[0];
}
if (pokemon1 is null || pokemon2 is null)