Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -5,11 +5,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
[Script(ScriptCategory.Pokemon, "ice_ball")]
|
||||
public class IceBallEffect : Script, IScriptForceTurnSelection, IScriptOnMoveMiss, IScriptOnEndTurn
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly IBattlePokemon _owner;
|
||||
private readonly StringKey _moveName;
|
||||
public int TurnCount { get; set; }
|
||||
|
||||
public IceBallEffect(IPokemon owner, StringKey moveName)
|
||||
public IceBallEffect(IBattlePokemon owner, StringKey moveName)
|
||||
{
|
||||
_owner = owner;
|
||||
_moveName = moveName;
|
||||
@@ -19,12 +19,12 @@ public class IceBallEffect : Script, IScriptForceTurnSelection, IScriptOnMoveMis
|
||||
/// <inheritdoc />
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
var opposingSideIndex = (byte)(_owner.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _moveName, opposingSideIndex, position);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnMoveMiss(IExecutingMove move, IPokemon target)
|
||||
public void OnMoveMiss(IExecutingMove move, IBattlePokemon target)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user