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

@@ -20,16 +20,14 @@ public class Assist : Script, IScriptChangeMove
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
{
var user = choice.User;
if (user.BattleData == null)
return;
var battle = user.BattleData.Battle;
var party = battle.Parties.FirstOrDefault(p => p.Party.Contains(user));
var battle = user.Battle;
var party = battle.Parties.FirstOrDefault(p => p.BattlePokemon.Contains(user));
if (party == null)
{
choice.Fail();
return;
}
var moves = GetPartyMoves(party.Party, user).ToList();
var moves = GetPartyMoves(party.BattlePokemon, user).ToList();
if (moves.Count == 0)
{
choice.Fail();
@@ -39,7 +37,7 @@ public class Assist : Script, IScriptChangeMove
moveName = moves[random].Name;
}
private static IEnumerable<IMoveData> GetPartyMoves(IPokemonParty party, IPokemon user)
private static IEnumerable<IMoveData> GetPartyMoves(IReadOnlyList<IBattlePokemon?> party, IBattlePokemon user)
{
foreach (var pokemon in party.WhereNotNull())
{