Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user