Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -9,17 +9,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
public class ShieldsDown : Script, IScriptOnEndTurn, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
public void OnSwitchIn(IBattlePokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IBattlePokemon);
|
||||
|
||||
private static void ChangeFormIfNeeded(IPokemon? pokemon)
|
||||
private static void ChangeFormIfNeeded(IBattlePokemon? pokemon)
|
||||
{
|
||||
if (pokemon is null)
|
||||
return;
|
||||
|
||||
if (pokemon.Species.Name != SpeciesNames.Minior || pokemon.BattleData?.Battle == null)
|
||||
if (pokemon.Species.Name != SpeciesNames.Minior || pokemon.Battle == null)
|
||||
return;
|
||||
if (pokemon.CurrentHealth < pokemon.MaxHealth / 2 && pokemon.Form.Name.ToString().EndsWith("-meteor"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user