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

@@ -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())
{