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