Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage, IScriptBlockIncomingHit,
|
||||
IScriptOnAfterMoveChoice
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly IBattlePokemon _owner;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsSemiInvulnerableTurn => true;
|
||||
|
||||
public DiveEffect(IPokemon owner)
|
||||
public DiveEffect(IBattlePokemon owner)
|
||||
{
|
||||
_owner = owner;
|
||||
}
|
||||
@@ -19,19 +19,19 @@ public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomi
|
||||
/// <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, "dive", opposingSideIndex, position);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
public void BlockIncomingHit(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
if (!executingMove.UseMove.HasFlag(MoveFlags.HitUnderwater))
|
||||
block = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.UseMove.HasFlag(MoveFlags.EffectiveAgainstUnderwater))
|
||||
damage *= 2;
|
||||
|
||||
Reference in New Issue
Block a user