Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user