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,9 +8,9 @@ public class ProtectionScript : Script, IScriptOnSecondaryEffect
protected virtual Script GetEffectScript() => new ProtectionEffectScript();
/// <inheritdoc />
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public virtual void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
{
var battleData = target.BattleData;
var battleData = target;
if (battleData == null)
return;
// If the user goes last in the turn, the move will fail
@@ -30,7 +30,7 @@ public class ProtectionScript : Script, IScriptOnSecondaryEffect
var successive = failure.ProtectTurns;
// Each time, the chance of success is divided by 3.
var chance = 1.0 / Math.Pow(3, successive);
var random = target.BattleData!.Battle.Random.GetFloat();
var random = target.Battle.Random.GetFloat();
if (random < chance)
{
failure.ProtectTurns++;