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

@@ -41,7 +41,7 @@ public abstract class ItemScript : IDeepCloneable
/// <summary>
/// Returns whether the item is usable on the given target.
/// </summary>
public virtual bool IsTargetValid(IPokemon target) => false;
public virtual bool IsTargetValid(IBattlePokemon target) => false;
/// <summary>
/// Returns whether the item can be held by a Pokémon.
@@ -51,7 +51,7 @@ public abstract class ItemScript : IDeepCloneable
/// <summary>
/// Returns whether the item can be held by the given target.
/// </summary>
public virtual bool CanTargetHold(IPokemon pokemon) => true;
public virtual bool CanTargetHold(IBattlePokemon pokemon) => true;
/// <summary>
/// Handles the use of the item.
@@ -63,7 +63,7 @@ public abstract class ItemScript : IDeepCloneable
/// <summary>
/// Handles the use of the item on the given target.
/// </summary>
public virtual void OnUseWithTarget(IPokemon target, EventHook eventHook)
public virtual void OnUseWithTarget(IBattlePokemon target, EventHook eventHook)
{
}
}

View File

@@ -17,9 +17,9 @@ public abstract class PokeballScript : ItemScript
/// <summary>
/// Returns the catch rate of the Pokéball against the given target Pokémon.
/// </summary>
public abstract void ChangeCatchRate(IPokemon target, ref byte catchRate);
public abstract void ChangeCatchRate(IBattlePokemon target, ref byte catchRate);
public virtual void OnAfterSuccessfulCapture(IPokemon target)
public virtual void OnAfterSuccessfulCapture(IBattlePokemon target)
{
// Default implementation does nothing.
// Override this method in derived classes to add custom behavior after a successful capture.
@@ -32,16 +32,13 @@ public abstract class PokeballScript : ItemScript
public override ItemTargetType TargetType => ItemTargetType.FoePokemon;
/// <inheritdoc />
public override bool IsTargetValid(IPokemon target) =>
target.BattleData is not null && target.BattleData.Battle.IsWildBattle;
public override bool IsTargetValid(IBattlePokemon target) => target.Battle.IsWildBattle;
/// <inheritdoc />
public override void OnUseWithTarget(IPokemon target, EventHook eventHook)
public override void OnUseWithTarget(IBattlePokemon target, EventHook eventHook)
{
var battleData = target.BattleData;
var result = battleData?.Battle.AttempCapture(battleData.SideIndex, battleData.Position, Item);
if (result is { IsCaught: true })
var result = target.Battle.AttempCapture(target.SideIndex, target.Position, Item);
if (result.IsCaught)
{
OnAfterSuccessfulCapture(target);
}

View File

@@ -25,7 +25,7 @@ public interface IAIInfoScriptExpectedEndOfTurnDamage
/// This function returns the expected end of turn damage for the script. This is used for scripts that
/// have an end of turn effect, such as Poison or Burn.
/// </summary>
void ExpectedEndOfTurnDamage(IPokemon pokemon, ref int damage);
void ExpectedEndOfTurnDamage(IBattlePokemon pokemon, ref int damage);
}
/// <summary>
@@ -37,5 +37,5 @@ public interface IAIInfoScriptExpectedEntryDamage
/// This function returns the expected entry damage for the script. This is used for scripts that have
/// an entry hazard effect, such as Spikes or Stealth Rock.
/// </summary>
void ExpectedEntryDamage(IPokemon pokemon, ref uint damage);
void ExpectedEntryDamage(IBattlePokemon pokemon, ref uint damage);
}

View File

@@ -100,8 +100,8 @@ public static class ScriptExecution
/// <summary>
/// Executes a script on an item.
/// </summary>
public static void RunItemScript(this IItem item, ScriptResolver scriptResolver, IPokemon? target, IPokemon user,
IBattle battle, EventHook eventHook)
public static void RunItemScript(this IItem item, ScriptResolver scriptResolver, IBattlePokemon? target,
IBattlePokemon user, IBattle battle, EventHook eventHook)
{
if (!scriptResolver.TryResolveBattleItemScript(item, out var itemScript))
{

View File

@@ -125,7 +125,7 @@ public interface IScriptChangeTargets
/// <summary>
/// Changes the targets of a move choice. This allows for changing the targets of a move before the move starts.
/// </summary>
void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets);
void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IBattlePokemon?> targets);
}
/// <summary>
@@ -136,7 +136,7 @@ public interface IScriptChangeIncomingTargets
/// <summary>
/// This function allows you to change the targets of a move choice before the move starts.
/// </summary>
void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets);
void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IBattlePokemon?> targets);
}
/// <summary>
@@ -219,7 +219,7 @@ public interface IScriptChangeMoveType
/// This function allows the script to change the actual type that is used for the move on a target.
/// If this is set to null, the move will be treated as a typeless move.
/// </summary>
void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier);
void ChangeMoveType(IExecutingMove move, IBattlePokemon target, byte hit, ref TypeIdentifier? typeIdentifier);
}
/// <summary>
@@ -230,7 +230,7 @@ public interface IScriptChangeEffectiveness
/// <summary>
/// This function allows the script to change how effective a move is on a target.
/// </summary>
void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness);
void ChangeEffectiveness(IExecutingMove move, IBattlePokemon target, byte hit, ref float effectiveness);
}
/// <summary>
@@ -241,7 +241,7 @@ public interface IScriptChangeIncomingEffectiveness
/// <summary>
/// This function allows the script to override how effective a move is on a target.
/// </summary>
void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
void ChangeIncomingEffectiveness(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex,
ref float effectiveness);
}
@@ -253,7 +253,7 @@ public interface IScriptBlockCriticalHit
/// <summary>
/// This function allows a script to block an outgoing move from being critical.
/// </summary>
void BlockCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block);
void BlockCriticalHit(IExecutingMove move, IBattlePokemon target, byte hit, ref bool block);
}
/// <summary>
@@ -264,7 +264,7 @@ public interface IScriptBlockIncomingCriticalHit
/// <summary>
/// This function allows a script to block an incoming move from being critical.
/// </summary>
void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block);
void BlockIncomingCriticalHit(IExecutingMove move, IBattlePokemon target, byte hit, ref bool block);
}
/// <summary>
@@ -276,7 +276,7 @@ public interface IScriptOnIncomingHit
/// This function triggers when an incoming hit happens. This triggers after the damage is done,
/// but before the secondary effect of the move happens.
/// </summary>
void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit);
void OnIncomingHit(IExecutingMove move, IBattlePokemon target, byte hit);
}
/// <summary>
@@ -287,7 +287,7 @@ public interface IScriptOnOpponentFaints
/// <summary>
/// This function triggers when an opponent on the f ield faints due to the move that is being executed.
/// </summary>
void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit);
void OnOpponentFaints(IExecutingMove move, IBattlePokemon target, byte hit);
}
/// <summary>
@@ -300,7 +300,7 @@ public interface IScriptOnSecondaryEffect
/// secondary effects here. Status moves should implement their actual functionality in this
/// function as well, as status moves effects are defined as secondary effects for simplicity.
/// </summary>
void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit);
void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit);
}
/// <summary>
@@ -312,7 +312,7 @@ public interface IScriptFailIncomingMove
/// This function allows a script to prevent a move that is targeted at its owner. If set to true
/// the move fails, and fail events get triggered.
/// </summary>
void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail);
void FailIncomingMove(IExecutingMove move, IBattlePokemon target, ref bool fail);
}
/// <summary>
@@ -323,7 +323,7 @@ public interface IScriptIsInvulnerableToMove
/// <summary>
/// This function allows a script to make its owner invulnerable to an incoming move.
/// </summary>
void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable);
void IsInvulnerableToMove(IExecutingMove move, IBattlePokemon target, ref bool invulnerable);
}
/// <summary>
@@ -335,7 +335,7 @@ public interface IScriptOnMoveMiss
/// This function allows a script to run when a move misses its target. This is used for moves
/// that have a secondary effect that should run even if the move misses, such as Spore.
/// </summary>
void OnMoveMiss(IExecutingMove move, IPokemon target);
void OnMoveMiss(IExecutingMove move, IBattlePokemon target);
}
/// <summary>
@@ -347,7 +347,7 @@ public interface IScriptChangeAccuracyModifier
/// This function allows a script to modify the accuracy of a move used. This value represents
/// the percentage accuracy, so anything above 100% will make it always hit.
/// </summary>
void ChangeAccuracyModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier);
void ChangeAccuracyModifier(IExecutingMove move, IBattlePokemon target, byte hit, ref float modifier);
}
/// <summary>
@@ -358,7 +358,7 @@ public interface IScriptChangeCriticalStage
/// <summary>
/// This function allows a script to change the critical stage of the move used.
/// </summary>
void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage);
void ChangeCriticalStage(IExecutingMove move, IBattlePokemon target, byte hit, ref byte stage);
}
/// <summary>
@@ -370,7 +370,7 @@ public interface IScriptChangeCriticalModifier
/// This function allows a script to change the damage modifier of a critical hit. This will only
/// run when a hit is critical.
/// </summary>
void ChangeCriticalModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier);
void ChangeCriticalModifier(IExecutingMove move, IBattlePokemon target, byte hit, ref float modifier);
}
/// <summary>
@@ -382,7 +382,7 @@ public interface IScriptChangeStabModifier
/// This function allows a script to change the damage modifier of a Same Type Attack Bonus, which
/// occurs when the user has the move type as one of its own types.
/// </summary>
void ChangeStabModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber, bool isStab,
void ChangeStabModifier(IExecutingMove executingMove, IBattlePokemon target, byte hitNumber, bool isStab,
ref float modifier);
}
@@ -394,7 +394,7 @@ public interface IScriptChangeBasePower
/// <summary>
/// This function allows a script to change the effective base power of a move hit.
/// </summary>
void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower);
void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower);
}
/// <summary>
@@ -407,7 +407,7 @@ public interface IScriptBypassDefensiveStatBoosts
/// If this is true, the damage will be calculated as if the target has no positive stat boosts. Negative
/// stat boosts will still be applied.
/// </summary>
void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass);
void BypassDefensiveStatBoosts(IExecutingMove move, IBattlePokemon target, byte hit, ref bool bypass);
}
/// <summary>
@@ -419,7 +419,7 @@ public interface IScriptBypassEvasionStatBoosts
/// This function allows a script to bypass evasion stat boosts for a move hit.
/// If this is true, the move will handle the evasion stat boosts as if the target has no positive stat boosts.
/// </summary>
void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass);
void BypassEvasionStatBoosts(IExecutingMove move, IBattlePokemon target, byte hitIndex, ref bool bypass);
}
/// <summary>
@@ -432,7 +432,7 @@ public interface IScriptBypassOffensiveStatBoosts
/// If this is true, the damage will be calculated as if the user has no negative offensive stat boosts. Positive
/// stat boosts will still be applied.
/// </summary>
void BypassOffensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass);
void BypassOffensiveStatBoosts(IExecutingMove move, IBattlePokemon target, byte hit, ref bool bypass);
}
/// <summary>
@@ -443,7 +443,7 @@ public interface IScriptChangeOffensiveStatValue
/// <summary>
/// This function allows a script to change the actual offensive stat values used when calculating damage
/// </summary>
void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
void ChangeOffensiveStatValue(IExecutingMove move, IBattlePokemon target, byte hit, uint defensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value);
}
@@ -455,7 +455,7 @@ public interface IScriptChangeDefensiveStatValue
/// <summary>
/// This function allows a script to change the actual defensive stat values used when calculating damage.
/// </summary>
void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
void ChangeDefensiveStatValue(IExecutingMove move, IBattlePokemon target, byte hit, uint offensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value);
}
@@ -467,7 +467,7 @@ public interface IScriptChangeIncomingMoveOffensiveStatValue
/// <summary>
/// This function allows a script to change the offensive stat value of an incoming move.
/// </summary>
void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IPokemon target, byte hitNumber,
void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IBattlePokemon target, byte hitNumber,
uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat);
}
@@ -479,7 +479,7 @@ public interface IScriptChangeIncomingMoveDefensiveStatValue
/// <summary>
/// This function allows a script to change the defensive stat value of an incoming move.
/// </summary>
void ChangeIncomingMoveDefensiveStatValue(IExecutingMove executingMove, IPokemon target, byte hitNumber,
void ChangeIncomingMoveDefensiveStatValue(IExecutingMove executingMove, IBattlePokemon target, byte hitNumber,
uint origOffensiveStat, StatisticSet<uint> targetStats, Statistic defensive, ref uint defensiveStat);
}
@@ -492,7 +492,7 @@ public interface IScriptChangeDamageStatModifier
/// This function allows a script to change the raw modifier we retrieved from the stats of the
/// defender and attacker. The default value is the offensive stat divided by the defensive stat.
/// </summary>
void ChangeDamageStatModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier);
void ChangeDamageStatModifier(IExecutingMove move, IBattlePokemon target, byte hit, ref float modifier);
}
/// <summary>
@@ -503,7 +503,7 @@ public interface IScriptChangeDamageModifier
/// <summary>
/// This function allows a script to apply a raw multiplier to the damage done by a move.
/// </summary>
void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier);
void ChangeDamageModifier(IExecutingMove move, IBattlePokemon target, byte hit, ref float modifier);
}
/// <summary>
@@ -514,7 +514,7 @@ public interface IScriptChangeIncomingMoveDamageModifier
/// <summary>
/// This function allows a script to change the damage modifier of an incoming move.
/// </summary>
void ChangeIncomingMoveDamageModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber,
void ChangeIncomingMoveDamageModifier(IExecutingMove executingMove, IBattlePokemon target, byte hitNumber,
ref float modifier);
}
@@ -526,7 +526,7 @@ public interface IScriptChangeMoveDamage
/// <summary>
/// This function allows a script to modify the outgoing damage done by a move.
/// </summary>
void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage);
void ChangeMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage);
}
/// <summary>
@@ -537,7 +537,7 @@ public interface IScriptChangeIncomingMoveDamage
/// <summary>
/// This function allows a script to modify the incoming damage done by a move.
/// </summary>
void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage);
void ChangeIncomingMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage);
}
/// <summary>
@@ -549,7 +549,8 @@ public interface IScriptPreventStatBoostChange
/// This function allows a script attached to a Pokemon or its parents to prevent stat boost
/// changes on that Pokemon.
/// </summary>
void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted, ref bool prevent);
void PreventStatBoostChange(IBattlePokemon target, Statistic stat, sbyte amount, bool selfInflicted,
ref bool prevent);
}
/// <summary>
@@ -562,7 +563,7 @@ public interface IScriptChangeStatBoostChange
/// which the stat boost will change. If the stat boost is done by the user itself, self
/// inflicted will be true, otherwise it will be false.
/// </summary>
void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount);
void ChangeStatBoostChange(IBattlePokemon target, Statistic stat, bool selfInflicted, ref sbyte amount);
}
/// <summary>
@@ -573,7 +574,7 @@ public interface IScriptOnAfterStatBoostChange
/// <summary>
/// This function allows a script to run after a stat boost change has been applied.
/// </summary>
void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change);
void OnAfterStatBoostChange(IBattlePokemon pokemon, Statistic stat, bool selfInflicted, sbyte change);
}
/// <summary>
@@ -586,7 +587,7 @@ public interface IScriptPreventSecondaryEffect
/// This means the move will still hit and do damage, but not trigger its secondary effect. Note that this
/// function is not called for status moves.
/// </summary>
void PreventSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent);
void PreventSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit, ref bool prevent);
}
/// <summary>
@@ -599,7 +600,7 @@ public interface IScriptPreventIncomingSecondaryEffect
/// secondary effect. This means the move will still hit and do damage, but not trigger its
/// secondary effect. Note that this function is not called for status moves.
/// </summary>
void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent);
void PreventIncomingSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit, ref bool prevent);
}
/// <summary>
@@ -613,7 +614,7 @@ public interface IScriptChangeEffectChance
/// changing this to above or equal to 100 will make it always hit, while setting it to equal or
/// below 0 will make it never hit.
/// </summary>
void ChangeEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance);
void ChangeEffectChance(IExecutingMove move, IBattlePokemon target, byte hit, ref float chance);
}
/// <summary>
@@ -627,7 +628,7 @@ public interface IScriptChangeIncomingEffectChance
/// so changing this to above or equal to 100 will make it always hit, while setting it to equal
/// or below 0 will make it never hit.
/// </summary>
void ChangeIncomingEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance);
void ChangeIncomingEffectChance(IExecutingMove move, IBattlePokemon target, byte hit, ref float chance);
}
/// <summary>
@@ -638,7 +639,7 @@ public interface IScriptOnAfterHits
/// <summary>
/// This function triggers on a move or its parents when all hits on a target are finished.
/// </summary>
void OnAfterHits(IExecutingMove move, IPokemon target);
void OnAfterHits(IExecutingMove move, IBattlePokemon target);
}
/// <summary>
@@ -706,7 +707,7 @@ public interface IScriptOnDamage
/// <summary>
/// This function is triggered on a Pokemon and its parents when the given Pokemon takes damage.
/// </summary>
void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth);
void OnDamage(IBattlePokemon pokemon, DamageSource source, uint oldHealth, uint newHealth);
}
/// <summary>
@@ -717,7 +718,7 @@ public interface IScriptOnFaint
/// <summary>
/// This function is triggered on a Pokemon and its parents when the given Pokemon faints.
/// </summary>
void OnFaint(IPokemon pokemon, DamageSource source);
void OnFaint(IBattlePokemon pokemon, DamageSource source);
}
/// <summary>
@@ -728,7 +729,7 @@ public interface IScriptOnAllyFaint
/// <summary>
/// This function is triggered on a Pokemon when an ally Pokemon faints.
/// </summary>
void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon);
void OnAllyFaint(IBattlePokemon ally, IBattlePokemon faintedPokemon);
}
/// <summary>
@@ -740,7 +741,7 @@ public interface IScriptOnSwitchOut
/// This function is triggered on a Pokemon and its parents when the given Pokemon switches out
/// of the battlefield.
/// </summary>
void OnSwitchOut(IPokemon oldPokemon, byte position);
void OnSwitchOut(IBattlePokemon oldPokemon, byte position);
}
/// <summary>
@@ -752,7 +753,7 @@ public interface IScriptOnSwitchIn
/// This function is triggered on a Pokemon and its parents when the given Pokemon is switched into
/// the battlefield.
/// </summary>
void OnSwitchIn(IPokemon pokemon, byte position);
void OnSwitchIn(IBattlePokemon pokemon, byte position);
}
/// <summary>
@@ -763,7 +764,7 @@ public interface IScriptOnOpponentSwitchIn
/// <summary>
/// This function is triggered on a Pokemon and its parents when an opponent switches in.
/// </summary>
void OnOpponentSwitchIn(IPokemon pokemon, byte position);
void OnOpponentSwitchIn(IBattlePokemon pokemon, byte position);
}
/// <summary>
@@ -787,7 +788,7 @@ public interface IScriptOnAfterItemConsume
/// This function is triggered on a Pokemon and its parents when the given Pokemon consumes the
/// held item it had.
/// </summary>
void OnAfterItemConsume(IPokemon pokemon, IItem item);
void OnAfterItemConsume(IBattlePokemon pokemon, IItem item);
}
/// <summary>
@@ -798,7 +799,7 @@ public interface IScriptBlockIncomingHit
/// <summary>
/// This function allows a script to block an incoming hit.
/// </summary>
void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block);
void BlockIncomingHit(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex, ref bool block);
}
/// <summary>
@@ -809,7 +810,7 @@ public interface IScriptBlockOutgoingHit
/// <summary>
/// This function allows a script to block an outgoing hit.
/// </summary>
void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block);
void BlockOutgoingHit(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex, ref bool block);
}
/// <summary>
@@ -820,7 +821,7 @@ public interface IScriptPreventHeldItemConsume
/// <summary>
/// This function allows a script to prevent a held item from being consumed.
/// </summary>
void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented);
void PreventHeldItemConsume(IBattlePokemon pokemon, IItem heldItem, ref bool prevented);
}
/// <summary>
@@ -831,7 +832,7 @@ public interface IScriptChangeIncomingDamage
/// <summary>
/// This function allows a script to change any kind of damage that is incoming.
/// </summary>
void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage);
void ChangeIncomingDamage(IBattlePokemon pokemon, DamageSource source, ref uint damage);
}
/// <summary>
@@ -853,7 +854,7 @@ public interface IScriptPreventHeal
/// <summary>
/// This function allows a script to prevent a Pokemon from being healed.
/// </summary>
void PreventHeal(IPokemon pokemon, uint heal, bool allowRevive, ref bool prevented);
void PreventHeal(IBattlePokemon pokemon, uint heal, bool allowRevive, ref bool prevented);
}
/// <summary>
@@ -865,7 +866,8 @@ public interface IScriptChangeTypesForMove
/// This function allows a script to change the types a target has. Multiple types can be set, and will be used
/// for the effectiveness calculation.
/// </summary>
void ChangeTypesForMove(IExecutingMove executingMove, IPokemon target, byte hitIndex, IList<TypeIdentifier> types);
void ChangeTypesForMove(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex,
IList<TypeIdentifier> types);
}
/// <summary>
@@ -877,7 +879,7 @@ public interface IScriptChangeTypesForIncomingMove
/// This function allows a script to change the types a Pokemon has for a move that's incoming. Multiple types can
/// be set, and will be used for the effectiveness calculation.
/// </summary>
void ChangeTypesForIncomingMove(IExecutingMove executingMove, IPokemon target, byte hitIndex,
void ChangeTypesForIncomingMove(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex,
IList<TypeIdentifier> types);
}
@@ -890,7 +892,7 @@ public interface IScriptChangeCategory
/// This function allows a script to change the handling of the move category. This is used for moves that
/// are sometimes a status move, and sometimes a damaging move, such as pollen puff.
/// </summary>
void ChangeCategory(IExecutingMove move, IPokemon target, byte hitIndex, ref MoveCategory category);
void ChangeCategory(IExecutingMove move, IBattlePokemon target, byte hitIndex, ref MoveCategory category);
}
/// <summary>
@@ -901,7 +903,7 @@ public interface IScriptOnBeforeHit
/// <summary>
/// Triggers first when we're about to hit a target.
/// </summary>
void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex);
void OnBeforeHit(IExecutingMove move, IBattlePokemon target, byte hitIndex);
}
/// <summary>
@@ -912,7 +914,7 @@ public interface IScriptPreventStatusChange
/// <summary>
/// This function allows a script to prevent a Pokemon from being affected by a status condition.
/// </summary>
void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus);
void PreventStatusChange(IBattlePokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus);
}
/// <summary>
@@ -923,7 +925,7 @@ public interface IScriptOnAfterStatusChange
/// <summary>
/// This function triggers after a status condition has been applied to a Pokemon.
/// </summary>
void OnAfterStatusChange(IPokemon pokemon, StringKey status, IPokemon? originPokemon);
void OnAfterStatusChange(IBattlePokemon pokemon, StringKey status, IPokemon? originPokemon);
}
/// <summary>
@@ -946,7 +948,7 @@ public interface IScriptIsFloating
/// This function allows a script to make the Pokémon it is attached to float. This is used for moves
/// such as levitate, and allows for moves such as earthquake to not hit the Pokémon.
/// </summary>
void IsFloating(IPokemon pokemon, ref bool isFloating);
void IsFloating(IBattlePokemon pokemon, ref bool isFloating);
}
/// <summary>
@@ -991,7 +993,7 @@ public interface IScriptModifyIsContact
/// <summary>
/// Modifies whether a move is a contact move or not. This is used for abilities such as Long Reach.
/// </summary>
void ModifyIsContact(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool isContact);
void ModifyIsContact(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex, ref bool isContact);
}
/// <summary>
@@ -1002,7 +1004,7 @@ public interface IScriptPreventHeldItemSteal
/// <summary>
/// This function allows a script to prevent a held item from being stolen by an effect such as Thief or Covet.
/// </summary>
void PreventHeldItemSteal(IPokemon pokemon, IItem heldItem, ref bool prevent);
void PreventHeldItemSteal(IBattlePokemon pokemon, IItem heldItem, ref bool prevent);
}
/// <summary>
@@ -1013,7 +1015,7 @@ public interface IScriptOnAfterHeldItemChange
/// <summary>
/// This function allows a script to run after a held item has changed.
/// </summary>
void OnAfterHeldItemChange(IPokemon pokemon, IItem? previous, IItem? item);
void OnAfterHeldItemChange(IBattlePokemon pokemon, IItem? previous, IItem? item);
}
/// <summary>
@@ -1080,7 +1082,7 @@ public interface IScriptChangeExperienceGained
/// This function is triggered on a Pokemon and its parents when the given Pokemon gains experience,
/// and allows for changing this amount of experience.
/// </summary>
void ChangeExperienceGained(IPokemon faintedPokemon, IPokemon winningPokemon, ref uint amount);
void ChangeExperienceGained(IBattlePokemon faintedPokemon, IBattlePokemon winningPokemon, ref uint amount);
}
/// <summary>
@@ -1093,7 +1095,8 @@ public interface IScriptShareExperience
/// and allows for making the experience be shared across multiple Pokemon.
/// Amount is the modifier for how much experience is shared, with 1 being the default amount.
/// </summary>
void ShareExperience(IPokemon faintedPokemon, IPokemon winningPokemon, ref bool share, ref float amount);
void ShareExperience(IBattlePokemon faintedPokemon, IBattlePokemon winningPokemon, ref bool share,
ref float amount);
}
/// <summary>
@@ -1117,7 +1120,7 @@ public interface IScriptChangeCatchRateBonus
/// rate of this attempt. Pokeball modifier effects should be implemented here, as well as for
/// example status effects that change capture rates.
/// </summary>
void ChangeCatchRateBonus(IPokemon pokemon, IItem pokeball, ref byte modifier);
void ChangeCatchRateBonus(IBattlePokemon pokemon, IItem pokeball, ref byte modifier);
}
/// <summary>
@@ -1142,7 +1145,7 @@ public interface IScriptChangeAccuracy
/// A custom case goes when 255 is returned, in which case the entire accuracy check is skipped, and the move
/// will always hit.
/// </summary>
void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref int modifiedAccuracy);
void ChangeAccuracy(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex, ref int modifiedAccuracy);
}
/// <summary>
@@ -1155,5 +1158,6 @@ public interface IScriptChangeIncomingAccuracy
/// A custom case goes when 255 is returned, in which case the entire accuracy check is skipped, and the move
/// will always hit.
/// </summary>
void ChangeIncomingAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref int modifiedAccuracy);
void ChangeIncomingAccuracy(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex,
ref int modifiedAccuracy);
}