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

@@ -27,12 +27,13 @@ public class Poisoned : Script, IScriptOnEndTurn, IAIInfoScriptExpectedEndOfTurn
if (damage == 0)
damage = 1;
var battleData = _pokemon.BattleData;
var args = new CustomTriggers.PoisonedDamageArgs(_pokemon, damage);
if (_pokemon is not IBattlePokemon battlePokemon)
return;
var args = new CustomTriggers.PoisonedDamageArgs(battlePokemon, damage);
_pokemon.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.PoisonedDamage, args));
var eventBatchId = new EventBatchId();
battleData?.Battle.EventHook.Invoke(new DialogEvent("poisoned_damage", new Dictionary<string, object>
battle.EventHook.Invoke(new DialogEvent("poisoned_damage", new Dictionary<string, object>
{
{ "pokemon", _pokemon },
{ "damage", damage },
@@ -48,7 +49,7 @@ public class Poisoned : Script, IScriptOnEndTurn, IAIInfoScriptExpectedEndOfTurn
}
/// <inheritdoc />
public virtual void ExpectedEndOfTurnDamage(IPokemon pokemon, ref int damage)
public virtual void ExpectedEndOfTurnDamage(IBattlePokemon pokemon, ref int damage)
{
if (_pokemon != null)
damage += (int)(_pokemon.MaxHealth * GetPoisonMultiplier());