Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -10,14 +10,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
public class Frisk : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IBattlePokemon pokemon, byte position)
|
||||
{
|
||||
if (pokemon.BattleData?.BattleSide is null)
|
||||
if (pokemon.BattleSide is null)
|
||||
return;
|
||||
|
||||
// Check if the Pokémon has an opposing side
|
||||
var opposingSide =
|
||||
pokemon.BattleData.Battle.Sides.FirstOrDefault(side => side != pokemon.BattleData.BattleSide);
|
||||
var opposingSide = pokemon.Battle.Sides.FirstOrDefault(side => side != pokemon.BattleSide);
|
||||
if (opposingSide is null)
|
||||
return;
|
||||
|
||||
@@ -28,7 +27,7 @@ public class Frisk : Script, IScriptOnSwitchIn
|
||||
// If the opponent has a held item, reveal it
|
||||
if (opponent.HeldItem != null)
|
||||
{
|
||||
pokemon.BattleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
|
||||
pokemon.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
|
||||
{
|
||||
Metadata = new Dictionary<StringKey, object?>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user