Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper

This commit is contained in:
2026-08-28 15:20:26 +02:00
parent 942be8eaeb
commit 8a2733a0a9
859 changed files with 4408 additions and 5331 deletions

View File

@@ -8,16 +8,16 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
[Script(ScriptCategory.Ability, "innards_out")]
public class InnardsOut : Script, IScriptOnIncomingHit, IScriptOnDamage
{
private IPokemon? _lastPokemonToHit;
private IBattlePokemon? _lastPokemonToHit;
/// <inheritdoc />
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
public void OnIncomingHit(IExecutingMove move, IBattlePokemon target, byte hit)
{
_lastPokemonToHit = move.User;
}
/// <inheritdoc />
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
public void OnDamage(IBattlePokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
{
if (newHealth != 0 || source is not DamageSource.MoveDamage)
return;
@@ -26,7 +26,7 @@ public class InnardsOut : Script, IScriptOnIncomingHit, IScriptOnDamage
EventBatchId batchId = new();
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
pokemon.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
{
BatchId = batchId,
});