More work on refactor to interfaces
All checks were successful
Build / Build (push) Successful in 50s
All checks were successful
Build / Build (push) Successful in 50s
This commit is contained in:
parent
436d1899e0
commit
1feb27e826
@ -259,11 +259,15 @@ public static class MoveTurnExecutor
|
||||
});
|
||||
target.Damage(damage, DamageSource.MoveDamage, hitEventBatch);
|
||||
if (!target.IsFainted)
|
||||
{
|
||||
target.RunScriptHookInterface<IScriptOnIncomingHit>(x =>
|
||||
x.OnIncomingHit(executingMove, target, hitIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
executingMove.RunScriptHookInterface<IScriptOnOpponentFaints>(x =>
|
||||
x.OnOpponentFaints(executingMove, target, hitIndex));
|
||||
}
|
||||
|
||||
if (!target.IsFainted)
|
||||
{
|
||||
@ -271,9 +275,9 @@ public static class MoveTurnExecutor
|
||||
if (secondaryEffect != null)
|
||||
{
|
||||
var preventSecondary = false;
|
||||
executingMove.RunScriptHook(x =>
|
||||
executingMove.RunScriptHookInterface<IScriptPreventSecondaryEffect>(x =>
|
||||
x.PreventSecondaryEffect(executingMove, target, hitIndex, ref preventSecondary));
|
||||
target.RunScriptHook(x =>
|
||||
target.RunScriptHookInterface<IScriptPreventIncomingSecondaryEffect>(x =>
|
||||
x.PreventIncomingSecondaryEffect(executingMove, target, hitIndex,
|
||||
ref preventSecondary));
|
||||
|
||||
@ -288,8 +292,10 @@ public static class MoveTurnExecutor
|
||||
}
|
||||
}
|
||||
if (target.IsFainted)
|
||||
{
|
||||
executingMove.RunScriptHookInterface<IScriptOnOpponentFaints>(x =>
|
||||
x.OnOpponentFaints(executingMove, target, hitIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,7 +309,7 @@ public static class MoveTurnExecutor
|
||||
|
||||
if (!executingMove.User.IsFainted)
|
||||
{
|
||||
executingMove.RunScriptHook(x => x.OnAfterHits(executingMove, target));
|
||||
executingMove.RunScriptHookInterface<IScriptOnAfterHits>(x => x.OnAfterHits(executingMove, target));
|
||||
}
|
||||
}
|
||||
}
|
@ -60,15 +60,15 @@ public static class TurnRunner
|
||||
{
|
||||
scripts.Clear();
|
||||
pokemon.GetOwnScripts(scripts);
|
||||
scripts.RunScriptHook(x => x.OnEndTurn(pokemon, battle));
|
||||
scripts.RunScriptHookInterface<IScriptOnEndTurn>(x => x.OnEndTurn(pokemon, battle));
|
||||
}
|
||||
scripts.Clear();
|
||||
side.GetOwnScripts(scripts);
|
||||
scripts.RunScriptHook(x => x.OnEndTurn(side, battle));
|
||||
scripts.RunScriptHookInterface<IScriptOnEndTurn>(x => x.OnEndTurn(side, battle));
|
||||
}
|
||||
scripts.Clear();
|
||||
battle.GetOwnScripts(scripts);
|
||||
scripts.RunScriptHook(x => x.OnEndTurn(battle, battle));
|
||||
scripts.RunScriptHookInterface<IScriptOnEndTurn>(x => x.OnEndTurn(battle, battle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,10 @@ public class BattleRandomImpl : RandomImpl, IBattleRandom
|
||||
/// <inheritdoc />
|
||||
public bool EffectChance(float chance, IExecutingMove executingMove, IPokemon target, byte hitNumber)
|
||||
{
|
||||
executingMove.RunScriptHook(script => script.ChangeEffectChance(executingMove, target, hitNumber, ref chance));
|
||||
target.RunScriptHook(script => script.ChangeIncomingEffectChance(executingMove, target, hitNumber, ref chance));
|
||||
executingMove.RunScriptHookInterface<IScriptChangeEffectChance>(script =>
|
||||
script.ChangeEffectChance(executingMove, target, hitNumber, ref chance));
|
||||
target.RunScriptHookInterface<IScriptChangeIncomingEffectChance>(script =>
|
||||
script.ChangeIncomingEffectChance(executingMove, target, hitNumber, ref chance));
|
||||
if (chance > 100.0)
|
||||
return true;
|
||||
if (chance < 0.0)
|
||||
|
@ -889,11 +889,12 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
if (!force)
|
||||
{
|
||||
var prevented = false;
|
||||
this.RunScriptHook(script =>
|
||||
this.RunScriptHookInterface<IScriptPreventStatBoostChange>(script =>
|
||||
script.PreventStatBoostChange(this, stat, change, selfInflicted, ref prevented));
|
||||
if (prevented)
|
||||
return false;
|
||||
this.RunScriptHook(script => script.ChangeStatBoostChange(this, stat, selfInflicted, ref change));
|
||||
this.RunScriptHookInterface<IScriptChangeStatBoostChange>(script =>
|
||||
script.ChangeStatBoostChange(this, stat, selfInflicted, ref change));
|
||||
if (change == 0)
|
||||
return false;
|
||||
}
|
||||
@ -917,7 +918,8 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
}
|
||||
|
||||
RecalculateBoostedStats();
|
||||
this.RunScriptHook(script => script.OnAfterStatBoostChange(this, stat, selfInflicted, change));
|
||||
this.RunScriptHookInterface<IScriptOnAfterStatBoostChange>(script =>
|
||||
script.OnAfterStatBoostChange(this, stat, selfInflicted, change));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -61,172 +61,6 @@ public abstract class Script : IDeepCloneable
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to bypass defensive stat boosts for a move hit.
|
||||
/// 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>
|
||||
public virtual void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public virtual void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to bypass offensive stat boosts for a move hit.
|
||||
/// 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>
|
||||
public virtual void BypassOffensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to change the actual offensive stat values used when calculating damage
|
||||
/// </summary>
|
||||
public virtual void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to change the actual defensive stat values used when calculating damage.
|
||||
/// </summary>
|
||||
public virtual void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to change the offensive stat value of an incoming move.
|
||||
/// </summary>
|
||||
public virtual void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IPokemon target,
|
||||
byte hitNumber, uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to change the defensive stat value of an incoming move.
|
||||
/// </summary>
|
||||
public virtual void ChangeIncomingMoveDefensiveStatValue(IExecutingMove executingMove, IPokemon target,
|
||||
byte hitNumber, uint origOffensiveStat, StatisticSet<uint> targetStats, Statistic defensive,
|
||||
ref uint defensiveStat)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public virtual void ChangeDamageStatModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to apply a raw multiplier to the damage done by a move.
|
||||
/// </summary>
|
||||
public virtual void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to change the damage modifier of an incoming move.
|
||||
/// </summary>
|
||||
public virtual void ChangeIncomingMoveDamageModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber,
|
||||
ref float modifier)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to modify the outgoing damage done by a move.
|
||||
/// </summary>
|
||||
public virtual void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to modify the incoming damage done by a move.
|
||||
/// </summary>
|
||||
public virtual void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a Pokemon or its parents to prevent stat boost
|
||||
/// changes on that Pokemon.
|
||||
/// </summary>
|
||||
public virtual void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a Pokemon or its parents to modify the amount by
|
||||
/// 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>
|
||||
public virtual void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to run after a stat boost change has been applied.
|
||||
/// </summary>
|
||||
public virtual void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to prevent a secondary effect of a move from being applied.
|
||||
/// 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>
|
||||
public virtual void PreventSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a Pokemon or its parents to prevent an incoming
|
||||
/// 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>
|
||||
public virtual void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a move or its parents to change the chance the
|
||||
/// secondary effect of a move will trigger. The chance is depicted in percentage here, 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>
|
||||
public virtual void ChangeEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a Pokemon or its parents to change the chance the
|
||||
/// secondary effect of an incoming move will trigger. The chance is depicted in percentage here,
|
||||
/// 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>
|
||||
public virtual void ChangeIncomingEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function triggers on a move or its parents when all hits on a target are finished.
|
||||
/// </summary>
|
||||
public virtual void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function prevents the Pokemon it is attached to from being able to switch out.
|
||||
/// </summary>
|
||||
@ -270,17 +104,6 @@ public abstract class Script : IDeepCloneable
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function id triggered on all scripts active in the battle after all choices have finished
|
||||
/// running. Note that choices are not active anymore here, so their scripts do not call this
|
||||
/// function.
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="battle"></param>
|
||||
public virtual void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is triggered on a Pokemon and its parents when the given Pokemon takes damage.
|
||||
/// </summary>
|
||||
@ -973,4 +796,261 @@ public interface IScriptChangeBasePower
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to bypass defensive stat boosts for a move hit.
|
||||
/// </summary>
|
||||
public interface IScriptBypassDefensiveStatBoosts
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows a script to bypass defensive stat boosts for a move hit.
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to bypass evasion stat boosts for a move hit.
|
||||
/// </summary>
|
||||
public interface IScriptBypassEvasionStatBoosts
|
||||
{
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to bypass offensive stat boosts for a move hit.
|
||||
/// </summary>
|
||||
public interface IScriptBypassOffensiveStatBoosts
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows a script to bypass offensive stat boosts for a move hit.
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the actual offensive stat values used when calculating damage.
|
||||
/// </summary>
|
||||
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,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the actual defensive stat values used when calculating damage.
|
||||
/// </summary>
|
||||
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,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the offensive stat value of an incoming move.
|
||||
/// </summary>
|
||||
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,
|
||||
uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the defensive stat value of an incoming move.
|
||||
/// </summary>
|
||||
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,
|
||||
uint origOffensiveStat, StatisticSet<uint> targetStats, Statistic defensive, ref uint defensiveStat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the raw modifier retrieved from the stats of the defender and attacker.
|
||||
/// </summary>
|
||||
public interface IScriptChangeDamageStatModifier
|
||||
{
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to apply a raw multiplier to the damage done by a move.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the damage modifier of an incoming move.
|
||||
/// </summary>
|
||||
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,
|
||||
ref float modifier);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to modify the outgoing damage done by a move.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to modify the incoming damage done by a move.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts attached to a Pokemon or its parents to prevent stat boost changes.
|
||||
/// </summary>
|
||||
public interface IScriptPreventStatBoostChange
|
||||
{
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts attached to a Pokemon or its parents to modify stat boost changes.
|
||||
/// </summary>
|
||||
public interface IScriptChangeStatBoostChange
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a Pokemon or its parents to modify the amount by
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to run after a stat boost change has been applied.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to prevent a secondary effect of a move from being applied.
|
||||
/// </summary>
|
||||
public interface IScriptPreventSecondaryEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows a script to prevent a secondary effect of a move from being applied.
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts attached to a Pokemon or its parents to prevent incoming secondary effects.
|
||||
/// </summary>
|
||||
public interface IScriptPreventIncomingSecondaryEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a Pokemon or its parents to prevent an incoming
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts attached to a move or its parents to change the chance of secondary effects.
|
||||
/// </summary>
|
||||
public interface IScriptChangeEffectChance
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a move or its parents to change the chance the
|
||||
/// secondary effect of a move will trigger. The chance is depicted in percentage here, 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 ChangeEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts attached to a Pokemon or its parents to change the chance of incoming secondary effects.
|
||||
/// </summary>
|
||||
public interface IScriptChangeIncomingEffectChance
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows a script attached to a Pokemon or its parents to change the chance the
|
||||
/// secondary effect of an incoming move will trigger. The chance is depicted in percentage here,
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to trigger when all hits on a target are finished.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to trigger at the end of each turn.
|
||||
/// </summary>
|
||||
public interface IScriptOnEndTurn
|
||||
{
|
||||
/// <summary>
|
||||
/// This function id triggered on all scripts active in the battle after all choices have finished
|
||||
/// running. Note that choices are not active anymore here, so their scripts do not call this
|
||||
/// function.
|
||||
/// </summary>
|
||||
void OnEndTurn(IScriptSource owner, IBattle battle);
|
||||
}
|
@ -91,6 +91,36 @@ public static class ScriptExecution
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes a hook on all scripts in a source.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void RunScriptHookInterface<TScriptHook>(this IEnumerable<IScriptSource> sources,
|
||||
Action<TScriptHook> hook)
|
||||
{
|
||||
var iterator = sources.Distinct().SelectMany(x => x.GetScripts()).ToArray();
|
||||
List<ScriptCategory>? suppressedCategories = null;
|
||||
foreach (var container in iterator)
|
||||
{
|
||||
if (container.IsEmpty)
|
||||
continue;
|
||||
var script = container.Script;
|
||||
if (script is IScriptOnBeforeAnyHookInvoked onBeforeAnyHookInvoked)
|
||||
onBeforeAnyHookInvoked.OnBeforeAnyHookInvoked(ref suppressedCategories);
|
||||
}
|
||||
foreach (var container in iterator)
|
||||
{
|
||||
if (container.IsEmpty)
|
||||
continue;
|
||||
var script = container.Script;
|
||||
if (script is not TScriptHook scriptHook)
|
||||
continue;
|
||||
if (suppressedCategories != null && suppressedCategories.Contains(script.Category))
|
||||
continue;
|
||||
hook(scriptHook);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes a hook on all scripts in a list of sources. Note that this does not walk through the parents of the
|
||||
/// sources, but only the sources themselves.
|
||||
@ -117,6 +147,35 @@ public static class ScriptExecution
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes a hook on all scripts in a list of sources. Note that this does not walk through the parents of the
|
||||
/// sources, but only the sources themselves.
|
||||
/// </summary>
|
||||
public static void RunScriptHookInterface<TScriptHook>(this IReadOnlyList<IEnumerable<ScriptContainer>> source,
|
||||
Action<TScriptHook> hook)
|
||||
{
|
||||
List<ScriptCategory>? suppressedCategories = null;
|
||||
foreach (var container in source.SelectMany(x => x))
|
||||
{
|
||||
if (container.IsEmpty)
|
||||
continue;
|
||||
var script = container.Script;
|
||||
if (script is IScriptOnBeforeAnyHookInvoked onBeforeAnyHookInvoked)
|
||||
onBeforeAnyHookInvoked.OnBeforeAnyHookInvoked(ref suppressedCategories);
|
||||
}
|
||||
foreach (var container in source.SelectMany(x => x))
|
||||
{
|
||||
if (container.IsEmpty)
|
||||
continue;
|
||||
var script = container.Script;
|
||||
if (script is not TScriptHook scriptHook)
|
||||
continue;
|
||||
if (suppressedCategories != null && suppressedCategories.Contains(script.Category))
|
||||
continue;
|
||||
hook(scriptHook);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes a script on an item.
|
||||
/// </summary>
|
||||
|
@ -64,7 +64,8 @@ public class Gen7BattleStatCalculator : IBattleStatCalculator
|
||||
return 255;
|
||||
var targetEvasion = target.StatBoost.Evasion;
|
||||
var ignoreEvasion = false;
|
||||
executingMove.RunScriptHook(x => x.BypassEvasionStatBoosts(executingMove, target, hitIndex, ref ignoreEvasion));
|
||||
executingMove.RunScriptHookInterface<IScriptBypassEvasionStatBoosts>(x =>
|
||||
x.BypassEvasionStatBoosts(executingMove, target, hitIndex, ref ignoreEvasion));
|
||||
if (ignoreEvasion)
|
||||
targetEvasion = 0;
|
||||
var userAccuracy = executingMove.User.StatBoost.Accuracy;
|
||||
|
@ -65,9 +65,9 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
|
||||
if (executingMove is not null)
|
||||
{
|
||||
executingMove.RunScriptHook(script =>
|
||||
executingMove.RunScriptHookInterface<IScriptChangeMoveDamage>(script =>
|
||||
script.ChangeMoveDamage(executingMove, target, hitNumber, ref damage));
|
||||
target.RunScriptHook(script =>
|
||||
target.RunScriptHookInterface<IScriptChangeIncomingMoveDamage>(script =>
|
||||
script.ChangeIncomingMoveDamage(executingMove, target, hitNumber, ref damage));
|
||||
}
|
||||
|
||||
@ -120,14 +120,14 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
// move is critical, and the target has a defensive stat boost of > 0, but a script is
|
||||
// allowed to change this.
|
||||
var bypassDefense = hitData.IsCritical && target.StatBoost.GetStatistic(defensive) > 0;
|
||||
executingMove?.RunScriptHook(script =>
|
||||
executingMove?.RunScriptHookInterface<IScriptBypassDefensiveStatBoosts>(script =>
|
||||
script.BypassDefensiveStatBoosts(executingMove, target, hitNumber, ref bypassDefense));
|
||||
|
||||
// Check if we can bypass the offensive stat boost on the user. We default to this if the
|
||||
// move is critical, and the user has an offensive stat boost of < 0, but a script is
|
||||
// allowed to change this.
|
||||
var bypassOffense = hitData.IsCritical && user.StatBoost.GetStatistic(offensive) < 0;
|
||||
executingMove?.RunScriptHook(script =>
|
||||
executingMove?.RunScriptHookInterface<IScriptBypassOffensiveStatBoosts>(script =>
|
||||
script.BypassOffensiveStatBoosts(executingMove, target, hitNumber, ref bypassOffense));
|
||||
|
||||
var userStats = user.BoostedStats;
|
||||
@ -143,18 +143,22 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
|
||||
if (executingMove != null)
|
||||
{
|
||||
executingMove.RunScriptHook(script => script.ChangeOffensiveStatValue(executingMove, target, hitNumber,
|
||||
defensiveStat, targetStats, offensive, ref offensiveStat));
|
||||
executingMove.RunScriptHook(script => script.ChangeDefensiveStatValue(executingMove, target, hitNumber,
|
||||
origOffensiveStat, targetStats, defensive, ref defensiveStat));
|
||||
target.RunScriptHook(script => script.ChangeIncomingMoveOffensiveStatValue(executingMove, target, hitNumber,
|
||||
defensiveStat, targetStats, offensive, ref offensiveStat));
|
||||
target.RunScriptHook(script => script.ChangeIncomingMoveDefensiveStatValue(executingMove, target, hitNumber,
|
||||
origOffensiveStat, targetStats, defensive, ref defensiveStat));
|
||||
executingMove.RunScriptHookInterface<IScriptChangeOffensiveStatValue>(script =>
|
||||
script.ChangeOffensiveStatValue(executingMove, target, hitNumber, defensiveStat, targetStats, offensive,
|
||||
ref offensiveStat));
|
||||
executingMove.RunScriptHookInterface<IScriptChangeDefensiveStatValue>(script =>
|
||||
script.ChangeDefensiveStatValue(executingMove, target, hitNumber, origOffensiveStat, targetStats,
|
||||
defensive, ref defensiveStat));
|
||||
target.RunScriptHookInterface<IScriptChangeIncomingMoveOffensiveStatValue>(script =>
|
||||
script.ChangeIncomingMoveOffensiveStatValue(executingMove, target, hitNumber, defensiveStat,
|
||||
targetStats, offensive, ref offensiveStat));
|
||||
target.RunScriptHookInterface<IScriptChangeIncomingMoveDefensiveStatValue>(script =>
|
||||
script.ChangeIncomingMoveDefensiveStatValue(executingMove, target, hitNumber, origOffensiveStat,
|
||||
targetStats, defensive, ref defensiveStat));
|
||||
}
|
||||
|
||||
var modifier = (float)offensiveStat / defensiveStat;
|
||||
executingMove?.RunScriptHook(script =>
|
||||
executingMove?.RunScriptHookInterface<IScriptChangeDamageStatModifier>(script =>
|
||||
script.ChangeDamageStatModifier(executingMove, target, hitNumber, ref modifier));
|
||||
|
||||
return modifier;
|
||||
@ -168,9 +172,9 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
{
|
||||
var modifier = 1.0f;
|
||||
|
||||
executingMove.RunScriptHook(script =>
|
||||
executingMove.RunScriptHookInterface<IScriptChangeDamageModifier>(script =>
|
||||
script.ChangeDamageModifier(executingMove, target, hitNumber, ref modifier));
|
||||
target.RunScriptHook(script =>
|
||||
target.RunScriptHookInterface<IScriptChangeIncomingMoveDamageModifier>(script =>
|
||||
script.ChangeIncomingMoveDamageModifier(executingMove, target, hitNumber, ref modifier));
|
||||
|
||||
return modifier;
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Analytic_(Ability)">Bulbapedia - Analytic</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "analytic")]
|
||||
public class Analytic : Script
|
||||
public class Analytic : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.Battle.ChoiceQueue?.HasNext() == false)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Bad_Dreams_(Ability)">Bulbapedia - Bad Dreams</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "bad_dreams")]
|
||||
public class BadDreams : Script
|
||||
public class BadDreams : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _owner;
|
||||
|
||||
@ -20,7 +20,7 @@ public class BadDreams : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_owner is null)
|
||||
return;
|
||||
|
@ -7,11 +7,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Competitive_(Ability)">Bulbapedia - Competitive</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "competitive")]
|
||||
public class Competitive : Script
|
||||
public class Competitive : Script, IScriptOnAfterStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
|
||||
public void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
|
||||
{
|
||||
if (change >= 0)
|
||||
return;
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Contrary_(Ability)">Bulbapedia - Contrary</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "contrary")]
|
||||
public class Contrary : Script
|
||||
public class Contrary : Script, IScriptChangeStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
|
||||
public void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
|
||||
{
|
||||
// Invert the stat change
|
||||
amount = (sbyte)-amount;
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dark_Aura_(Ability)">Bulbapedia - Dark Aura</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "dark_aura")]
|
||||
public class DarkAura : Script
|
||||
public class DarkAura : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "dark")
|
||||
{
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Defeatist_(Ability)">Bulbapedia - Defeatist</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "defeatist")]
|
||||
public class Defeatist : Script
|
||||
public class Defeatist : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.User.CurrentHealth < move.User.MaxHealth / 2)
|
||||
{
|
||||
|
@ -7,11 +7,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Defiant_(Ability)">Bulbapedia - Defiant</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "defiant")]
|
||||
public class Defiant : Script
|
||||
public class Defiant : Script, IScriptOnAfterStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
|
||||
public void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
|
||||
{
|
||||
if (change >= 0)
|
||||
return;
|
||||
|
@ -8,7 +8,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dry_Skin_(Ability)">Bulbapedia - Dry Skin</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "dry_skin")]
|
||||
public class DrySkin : Script
|
||||
public class DrySkin : Script, IScriptChangeDamageModifier, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _owningPokemon;
|
||||
|
||||
@ -23,7 +23,7 @@ public class DrySkin : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var hitType = move.GetHitData(target, hit).Type;
|
||||
if (hitType?.Name == "fire")
|
||||
@ -39,7 +39,7 @@ public class DrySkin : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_owningPokemon == null)
|
||||
return;
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fairy_Aura_(Ability)">Bulbapedia - Fairy Aura</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "fairy_aura")]
|
||||
public class FairyAura : Script
|
||||
public class FairyAura : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "fairy")
|
||||
{
|
||||
|
@ -7,11 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Filter_(Ability)">Bulbapedia - Filter</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "filter")]
|
||||
public class Filter : Script
|
||||
public class Filter : Script, IScriptChangeIncomingMoveDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamageModifier(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref float modifier)
|
||||
public void ChangeIncomingMoveDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Effectiveness >= 2.0f)
|
||||
{
|
||||
|
@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flare_Boost_(Ability)">Bulbapedia - Flare Boost</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "flare_boost")]
|
||||
public class FlareBoost : Script
|
||||
public class FlareBoost : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (!move.User.HasStatus(ScriptUtils.ResolveName<Status.Burned>()))
|
||||
return;
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fluffy_(Ability)">Bulbapedia - Fluffy</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "fluffy")]
|
||||
public class Fluffy : Script
|
||||
public class Fluffy : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "fire")
|
||||
{
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Full_Metal_Body_(Ability)">Bulbapedia - Full Metal Body</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "full_metal_body")]
|
||||
public class FullMetalBody : Script
|
||||
public class FullMetalBody : Script, IScriptPreventStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
public void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
if (selfInflicted)
|
||||
|
@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fur_Coat_(Ability)">Bulbapedia - Fur Coat</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "fur_coat")]
|
||||
public class FurCoat : Script
|
||||
public class FurCoat : Script, IScriptChangeIncomingMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Physical)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Galvanize_(Ability)">Bulbapedia - Galvanize</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "galvanize")]
|
||||
public class Galvanize : Script, IScriptChangeMoveType
|
||||
public class Galvanize : Script, IScriptChangeMoveType, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
|
||||
@ -20,7 +20,7 @@ public class Galvanize : Script, IScriptChangeMoveType
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "electric")
|
||||
modifier *= 1.2f;
|
||||
|
@ -7,11 +7,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Grass_Pelt_(Ability)">Bulbapedia - Grass Pelt</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "grass_pelt")]
|
||||
public class GrassPelt : Script
|
||||
public class GrassPelt : Script, IScriptChangeIncomingMoveDefensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit,
|
||||
uint offensiveStat, StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
|
||||
public void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
|
||||
{
|
||||
if (move.Battle.TerrainName == ScriptUtils.ResolveName<Terrain.GrassyTerrain>() && stat == Statistic.Defense)
|
||||
value = value.MultiplyOrMax(1.5f);
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Guts_(Ability)">Bulbapedia - Guts</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "guts")]
|
||||
public class Guts : Script
|
||||
public class Guts : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if (target.StatusScript.IsEmpty)
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Harvest_(Ability)">Bulbapedia - Harvest</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "harvest")]
|
||||
public class Harvest : Script
|
||||
public class Harvest : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@ -19,7 +19,7 @@ public class Harvest : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_pokemon?.BattleData is null)
|
||||
return;
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Healer_(Ability)">Bulbapedia - Healer</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "healer")]
|
||||
public class Healer : Script
|
||||
public class Healer : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@ -19,7 +19,7 @@ public class Healer : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_pokemon?.BattleData is null)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Huge_Power_(Ability)">Bulbapedia - Huge Power</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "huge_power")]
|
||||
public class HugePower : Script
|
||||
public class HugePower : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if (stat == Statistic.Attack)
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Hustle_(Ability)">Bulbapedia - Hustle</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "hustle")]
|
||||
public class Hustle : Script
|
||||
public class Hustle : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if (stat != Statistic.Attack)
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Hydration_(Ability)">Bulbapedia - Hydration</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "hydration")]
|
||||
public class Hydration : Script
|
||||
public class Hydration : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@ -19,7 +19,7 @@ public class Hydration : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_pokemon is null)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Hyper_Cutter_(Ability)">Bulbapedia - Hyper Cutter</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "hyper_cutter")]
|
||||
public class HyperCutter : Script
|
||||
public class HyperCutter : Script, IScriptPreventStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
public void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
if (stat != Statistic.Attack)
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Ice_Body_(Ability)">Bulbapedia - Ice Body</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "ice_body")]
|
||||
public class IceBody : Script
|
||||
public class IceBody : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@ -19,7 +19,7 @@ public class IceBody : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_pokemon is null)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Keen_Eye_(Ability)">Bulbapedia - Keen Eye</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "keen_eye")]
|
||||
public class KeenEye : Script
|
||||
public class KeenEye : Script, IScriptPreventStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
public void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
if (stat == Statistic.Accuracy && amount < 0)
|
||||
|
@ -6,11 +6,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Marvel_Scale_(Ability)">Bulbapedia - Marvel Scale</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "marvel_scale")]
|
||||
public class MarvelScale : Script
|
||||
public class MarvelScale : Script, IScriptChangeIncomingMoveDefensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit,
|
||||
uint offensiveStat, StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
|
||||
public void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
|
||||
{
|
||||
if (!target.StatusScript.IsEmpty && stat == Statistic.Defense)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Minus_(Ability)">Bulbapedia - Minus</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "minus")]
|
||||
public class Minus : Script
|
||||
public class Minus : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Moody_(Ability)">Bulbapedia - Moody</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "moody")]
|
||||
public class Moody : Script
|
||||
public class Moody : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@ -19,7 +19,7 @@ public class Moody : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_pokemon == null)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Multiscale_(Ability)">Bulbapedia - Multiscale</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "multiscale")]
|
||||
public class Multiscale : Script
|
||||
public class Multiscale : Script, IScriptChangeIncomingMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (target.CurrentHealth == target.BoostedStats.Hp)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Plus_(Ability)">Bulbapedia - Plus</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "plus")]
|
||||
public class Plus : Script
|
||||
public class Plus : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Power_Construct_(Ability)">Bulbapedia - Power Construct</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "power_construct")]
|
||||
public class PowerConstruct : Script
|
||||
public class PowerConstruct : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@ -19,7 +19,7 @@ public class PowerConstruct : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_pokemon?.BattleData?.Battle == null)
|
||||
return;
|
||||
|
@ -11,7 +11,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Swarm_(Ability)">Bulbapedia - Swarm</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "power_up_type_at_low_health")]
|
||||
public class PowerUpTypeAtLowHealth : Script, IScriptOnInitialize
|
||||
public class PowerUpTypeAtLowHealth : Script, IScriptOnInitialize, IScriptChangeDamageModifier
|
||||
{
|
||||
private StringKey _type;
|
||||
private float _threshold;
|
||||
@ -35,7 +35,7 @@ public class PowerUpTypeAtLowHealth : Script, IScriptOnInitialize
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var currentHealthFraction = move.User.CurrentHealth / (float)move.User.MaxHealth;
|
||||
if (currentHealthFraction <= _threshold && move.GetHitData(target, hit).Type?.Name == _type)
|
||||
|
@ -10,7 +10,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Full_Metal_Body_(Ability)">Bulbapedia - Full Metal Body</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "prevent_stat_lowering")]
|
||||
public class PreventStatLowering : Script, IScriptOnInitialize
|
||||
public class PreventStatLowering : Script, IScriptOnInitialize, IScriptPreventStatBoostChange
|
||||
{
|
||||
/// <summary>
|
||||
/// The statistic that this ability prevents from being lowered.
|
||||
@ -32,7 +32,7 @@ public class PreventStatLowering : Script, IScriptOnInitialize
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
public void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
if (_statistic is not null && _statistic != stat)
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Prism_Armor_(Ability)">Bulbapedia - Prism Armor</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "prism_armor")]
|
||||
public class PrismArmor : Script
|
||||
public class PrismArmor : Script, IScriptChangeIncomingMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Effectiveness >= 2)
|
||||
damage = (uint)(damage * 0.75);
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pure_Power_(Ability)">Bulbapedia - Pure Power</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "pure_power")]
|
||||
public class PurePower : Script
|
||||
public class PurePower : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if (stat == Statistic.Attack)
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rain_Dish_(Ability)">Bulbapedia - Rain Dish</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "rain_dish")]
|
||||
public class RainDish : Script
|
||||
public class RainDish : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _owner;
|
||||
|
||||
@ -19,7 +19,7 @@ public class RainDish : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_owner is null)
|
||||
return;
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Schooling_(Ability)">Bulbapedia - Schooling</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "schooling")]
|
||||
public class Schooling : Script
|
||||
public class Schooling : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _owningPokemon;
|
||||
|
||||
@ -22,7 +22,7 @@ public class Schooling : Script
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
|
||||
|
||||
private static void ChangeFormIfNeeded(IPokemon? pokemon)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Serene_Grace_(Ability)">Bulbapedia - Serene Grace</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "serene_grace")]
|
||||
public class SereneGrace : Script
|
||||
public class SereneGrace : Script, IScriptChangeEffectChance
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance)
|
||||
public void ChangeEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance)
|
||||
{
|
||||
chance *= 2;
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shadow_Shield_(Ability)">Bulbapedia - Shadow Shield</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "shadow_shield")]
|
||||
public class ShadowShield : Script, IScriptOnBeforeAnyHookInvoked
|
||||
public class ShadowShield : Script, IScriptOnBeforeAnyHookInvoked, IScriptChangeIncomingMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (target.CurrentHealth == target.BoostedStats.Hp)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shed_Skin_(Ability)">Bulbapedia - Shed Skin</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "shed_skin")]
|
||||
public class ShedSkin : Script
|
||||
public class ShedSkin : Script, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _owningPokemon;
|
||||
|
||||
@ -19,7 +19,7 @@ public class ShedSkin : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_owningPokemon is null || _owningPokemon.StatusScript.IsEmpty)
|
||||
return;
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sheer_Force_(Ability)">Bulbapedia - Sheer Force</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sheer_force")]
|
||||
public class SheerForce : Script, IScriptChangeBasePower
|
||||
public class SheerForce : Script, IScriptChangeBasePower, IScriptPreventSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
@ -15,7 +15,7 @@ public class SheerForce : Script, IScriptChangeBasePower
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
|
||||
public void PreventSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
|
||||
{
|
||||
prevent = true;
|
||||
}
|
||||
|
@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shield_Dust_(Ability)">Bulbapedia - Shield Dust</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "shield_dust")]
|
||||
public class ShieldDust : Script
|
||||
public class ShieldDust : Script, IScriptPreventIncomingSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref bool prevent)
|
||||
public void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
|
||||
{
|
||||
prevent = true;
|
||||
}
|
||||
|
@ -6,13 +6,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shields_Down_(Ability)">Bulbapedia - Shields Down</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "shields_down")]
|
||||
public class ShieldsDown : Script
|
||||
public class ShieldsDown : Script, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||
|
||||
private static void ChangeFormIfNeeded(IPokemon? pokemon)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Simple_(Ability)">Bulbapedia - Simple</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "simple")]
|
||||
public class Simple : Script
|
||||
public class Simple : Script, IScriptChangeStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
|
||||
public void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
|
||||
{
|
||||
amount = amount.MultiplyOrMax(2);
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Solar_Power_(Ability)">Bulbapedia - Solar Power</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "solar_power")]
|
||||
public class SolarPower : Script
|
||||
public class SolarPower : Script, IScriptChangeOffensiveStatValue, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if ((stat == Statistic.SpecialAttack &&
|
||||
@ -21,7 +21,7 @@ public class SolarPower : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (owner is not IPokemon pokemon)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Solid_Rock_(Ability)">Bulbapedia - Solid Rock</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "solid_rock")]
|
||||
public class SolidRock : Script
|
||||
public class SolidRock : Script, IScriptChangeIncomingMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Effectiveness >= 2f)
|
||||
damage = (uint)(damage * 0.75f);
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Speed_Boost_(Ability)">Bulbapedia - Speed Boost</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "speed_boost")]
|
||||
public class SpeedBoost : Script
|
||||
public class SpeedBoost : Script, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (owner is not IPokemon pokemon)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Steelworker_(Ability)">Bulbapedia - Steelworker</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "steelworker")]
|
||||
public class Steelworker : Script
|
||||
public class Steelworker : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "steel")
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sturdy_(Ability)">Bulbapedia - Sturdy</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sturdy")]
|
||||
public class Sturdy : Script
|
||||
public class Sturdy : Script, IScriptChangeIncomingMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (damage >= target.MaxHealth && target.CurrentHealth == target.MaxHealth)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Thick_Fat_(Ability)">Bulbapedia - Thick Fat</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "thick_fat")]
|
||||
public class ThickFat : Script
|
||||
public class ThickFat : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var type = move.GetHitData(target, hit).Type;
|
||||
if (type is not null && (type.Value.Name == "ice" || type.Value.Name == "fire"))
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Tinted_Lens_(Ability)">Bulbapedia - Tinted Lens</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "tinted_lens")]
|
||||
public class TintedLens : Script
|
||||
public class TintedLens : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Effectiveness < 1.0f)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Tough_Claws_(Ability)">Bulbapedia - Tough Claws</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "tough_claws")]
|
||||
public class ToughClaws : Script
|
||||
public class ToughClaws : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.GetHitData(target, hit).IsContact)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Toxic_Boost_(Ability)">Bulbapedia - Toxic Boost</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "toxic_boost")]
|
||||
public class ToxicBoost : Script
|
||||
public class ToxicBoost : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.User.HasStatus(ScriptUtils.ResolveName<Status.Poisoned>()) ||
|
||||
move.User.HasStatus(ScriptUtils.ResolveName<Status.BadlyPoisoned>()))
|
||||
|
@ -6,17 +6,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Unaware_(Ability)">Bulbapedia - Unaware</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "unaware")]
|
||||
public class Unaware : Script
|
||||
public class Unaware : Script, IScriptChangeIncomingMoveOffensiveStatValue, IScriptChangeDefensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IPokemon target,
|
||||
byte hitNumber, uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat)
|
||||
public void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IPokemon target, byte hitNumber,
|
||||
uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat)
|
||||
{
|
||||
offensiveStat = executingMove.User.FlatStats.GetStatistic(offensive);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
public void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
value = target.FlatStats.GetStatistic(stat);
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Bubble_(Ability)">Bulbapedia - Water Bubble</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "water_bubble")]
|
||||
public class WaterBubble : Script
|
||||
public class WaterBubble : Script, IScriptChangeIncomingMoveDamage, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
@ -17,14 +17,14 @@ public class WaterBubble : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "fire")
|
||||
damage /= 2;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "water")
|
||||
damage *= 2;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/White_Smoke_(Ability)">Bulbapedia - White Smoke</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "white_smoke")]
|
||||
public class WhiteSmoke : Script
|
||||
public class WhiteSmoke : Script, IScriptPreventStatBoostChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
public void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
if (selfInflicted || amount >= 0)
|
||||
|
@ -6,13 +6,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Zen_Mode_(Ability)">Bulbapedia - Zen Mode</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "zen_mode")]
|
||||
public class ZenMode : Script
|
||||
public class ZenMode : Script, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||
|
||||
private static void ChangeFormIfNeeded(IPokemon? pokemon)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "fairy_lock")]
|
||||
public class FairyLockEffect : Script
|
||||
public class FairyLockEffect : Script, IScriptOnEndTurn
|
||||
{
|
||||
private int _turns = 1;
|
||||
|
||||
@ -18,7 +18,7 @@ public class FairyLockEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_turns <= 0)
|
||||
RemoveSelf();
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "future_sight")]
|
||||
public class FutureSightEffect : Script
|
||||
public class FutureSightEffect : Script, IScriptOnEndTurn
|
||||
{
|
||||
private int _turnsLeft = 3;
|
||||
private readonly IMoveChoice _moveChoice;
|
||||
@ -12,7 +12,7 @@ public class FutureSightEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_turnsLeft -= 1;
|
||||
if (_turnsLeft <= 0)
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "gravity")]
|
||||
public class Gravity : Script, IScriptFailIncomingMove
|
||||
public class Gravity : Script, IScriptFailIncomingMove, IScriptOnEndTurn
|
||||
{
|
||||
private int _turns = 5;
|
||||
|
||||
@ -32,7 +32,7 @@ public class Gravity : Script, IScriptFailIncomingMove
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_turns--;
|
||||
if (_turns > 0)
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "magic_room")]
|
||||
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked
|
||||
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnEndTurn
|
||||
{
|
||||
private int _turnsLeft = 5;
|
||||
|
||||
@ -19,7 +19,7 @@ public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_turnsLeft > 0)
|
||||
_turnsLeft--;
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "mud_sport")]
|
||||
public class MudSportEffect : Script, IScriptChangeBasePower
|
||||
public class MudSportEffect : Script, IScriptChangeBasePower, IScriptOnEndTurn
|
||||
{
|
||||
private int _turnsLeft = 5;
|
||||
|
||||
@ -15,7 +15,7 @@ public class MudSportEffect : Script, IScriptChangeBasePower
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_turnsLeft--;
|
||||
if (_turnsLeft <= 0)
|
||||
|
@ -4,7 +4,7 @@ using PkmnLib.Dynamic.BattleFlow;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "snatch_effect")]
|
||||
public class SnatchEffect : Script, IScriptStopBeforeMove
|
||||
public class SnatchEffect : Script, IScriptStopBeforeMove, IScriptOnEndTurn
|
||||
{
|
||||
private Queue<IPokemon> _snatchers = new();
|
||||
|
||||
@ -53,7 +53,7 @@ public class SnatchEffect : Script, IScriptStopBeforeMove
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "trick_room")]
|
||||
public class TrickRoomEffect : Script, IScriptChangeSpeed
|
||||
public class TrickRoomEffect : Script, IScriptChangeSpeed, IScriptOnEndTurn
|
||||
{
|
||||
private int _turnsLeft = 5;
|
||||
|
||||
@ -12,7 +12,7 @@ public class TrickRoomEffect : Script, IScriptChangeSpeed
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_turnsLeft--;
|
||||
if (_turnsLeft <= 0)
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "uproar_effect")]
|
||||
public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect
|
||||
public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect, IScriptOnEndTurn
|
||||
{
|
||||
private IPokemon? _placer;
|
||||
private bool _hasUsedUproar;
|
||||
@ -37,7 +37,7 @@ public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondary
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (!_hasUsedUproar)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "water_sport")]
|
||||
public class WaterSportEffect : Script
|
||||
public class WaterSportEffect : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
public readonly HashSet<IPokemon> Placers = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.UseMove.MoveType.Name == "fire")
|
||||
{
|
||||
|
@ -2,12 +2,12 @@ using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
public class WonderRoomEffect : Script
|
||||
public class WonderRoomEffect : Script, IScriptChangeDefensiveStatValue, IScriptOnEndTurn
|
||||
{
|
||||
public int TurnsLeft { get; private set; } = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
public void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
value = move.UseMove.Category switch
|
||||
@ -19,7 +19,7 @@ public class WonderRoomEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
TurnsLeft--;
|
||||
if (TurnsLeft <= 0)
|
||||
|
@ -1,13 +1,13 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "chip_away")]
|
||||
public class ChipAway : Script
|
||||
public class ChipAway : Script, IScriptBypassDefensiveStatBoosts, IScriptBypassEvasionStatBoosts
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
|
||||
public void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
|
||||
bypass = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void
|
||||
BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) => bypass = true;
|
||||
public void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) =>
|
||||
bypass = true;
|
||||
}
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "counter")]
|
||||
public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets
|
||||
public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
@ -25,7 +25,7 @@ public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var counterHelper = move.User.Volatile.Get<CounterHelperEffect>();
|
||||
if (counterHelper == null || counterHelper.LastHitBy == null || counterHelper.LastHitBy != target)
|
||||
|
@ -1,13 +1,13 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "darkest_lariat")]
|
||||
public class DarkestLariat : Script
|
||||
public class DarkestLariat : Script, IScriptBypassDefensiveStatBoosts, IScriptBypassEvasionStatBoosts
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
|
||||
public void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
|
||||
bypass = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void
|
||||
BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) => bypass = true;
|
||||
public void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) =>
|
||||
bypass = true;
|
||||
}
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "echoed_voice")]
|
||||
public class EchoedVoice : Script, IScriptOnSecondaryEffect
|
||||
public class EchoedVoice : Script, IScriptOnSecondaryEffect, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "endeavor")]
|
||||
public class Endeavor : Script
|
||||
public class Endeavor : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var user = move.User;
|
||||
var userHealth = user.CurrentHealth;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "explosion")]
|
||||
public class Explosion : Script
|
||||
public class Explosion : Script, IScriptOnAfterHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
public void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
move.User.Damage(move.User.CurrentHealth * 10, DamageSource.Misc);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "false_swipe")]
|
||||
public class FalseSwipe : Script
|
||||
public class FalseSwipe : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (target.CurrentHealth - damage < 1)
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fell_stinger")]
|
||||
public class FellStinger : Script
|
||||
public class FellStinger : Script, IScriptOnAfterHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
public void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
if (target.IsFainted)
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "final_gambit")]
|
||||
public class FinalGambit : Script, IScriptOnSecondaryEffect
|
||||
public class FinalGambit : Script, IScriptOnSecondaryEffect, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
damage = move.User.CurrentHealth;
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "foul_play")]
|
||||
public class FoulPlay : Script
|
||||
public class FoulPlay : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint _,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint _,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
value = move.UseMove.Category == MoveCategory.Physical
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fusion_bolt")]
|
||||
public class FusionBolt : Script
|
||||
public class FusionBolt : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fusion_flare")]
|
||||
public class FusionFlare : Script
|
||||
public class FusionFlare : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "guardian_of_alola")]
|
||||
public class GuardianOfAlola : Script
|
||||
public class GuardianOfAlola : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var maxHp = target.BoostedStats.Hp;
|
||||
damage = (uint)(maxHp * (3f / 4f));
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "metal_burst")]
|
||||
public class MetalBurst : Script, IScriptOnBeforeTurnStart
|
||||
public class MetalBurst : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
@ -12,7 +12,7 @@ public class MetalBurst : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var helper = target.Volatile.Get<MetalBurstHelper>();
|
||||
|
||||
@ -27,7 +27,7 @@ public class MetalBurst : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "metal_burst_helper")]
|
||||
private class MetalBurstHelper : Script, IScriptOnIncomingHit
|
||||
private class MetalBurstHelper : Script, IScriptOnIncomingHit, IScriptOnEndTurn
|
||||
{
|
||||
public IPokemon? LastAttacker { get; set; }
|
||||
public uint LastDamage { get; set; }
|
||||
@ -42,7 +42,7 @@ public class MetalBurst : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "mirror_coat")]
|
||||
public class MirrorCoat : Script, IScriptOnBeforeTurnStart
|
||||
public class MirrorCoat : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
@ -12,7 +12,7 @@ public class MirrorCoat : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var helper = target.Volatile.Get<MirrorCoatHelper>();
|
||||
|
||||
@ -27,7 +27,7 @@ public class MirrorCoat : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "mirror_coat_helper")]
|
||||
private class MirrorCoatHelper : Script, IScriptOnIncomingHit
|
||||
private class MirrorCoatHelper : Script, IScriptOnIncomingHit, IScriptOnEndTurn
|
||||
{
|
||||
public IPokemon? LastAttacker { get; set; }
|
||||
public uint LastDamage { get; set; }
|
||||
@ -42,7 +42,7 @@ public class MirrorCoat : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "natures_madness")]
|
||||
public class NaturesMadness : Script
|
||||
public class NaturesMadness : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var targetMaxHp = target.BoostedStats.Hp;
|
||||
damage = targetMaxHp / 2;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "night_shade")]
|
||||
public class NightShade : Script
|
||||
public class NightShade : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
damage = move.User.Level;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "one_hit_ko")]
|
||||
public class OneHitKo : Script
|
||||
public class OneHitKo : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
@ -17,7 +17,7 @@ public class OneHitKo : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
damage = target.BoostedStats.Hp.MultiplyOrMax(10);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "power_trip")]
|
||||
public class PowerTrip : Script
|
||||
public class PowerTrip : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var modifier = 1;
|
||||
foreach (Statistic stat in Enum.GetValues(typeof(Statistic)))
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "psyshock")]
|
||||
public class Psyshock : Script
|
||||
public class Psyshock : Script, IScriptChangeDefensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
public void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
value = targetStats.Defense;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "psywave")]
|
||||
public class Psywave : Script
|
||||
public class Psywave : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.User.BattleData == null)
|
||||
return;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "smelling_salts")]
|
||||
public class SmellingSalts : Script, IScriptOnSecondaryEffect
|
||||
public class SmellingSalts : Script, IScriptOnSecondaryEffect, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
// If the target is paralyzed, double the damage
|
||||
if (target.HasStatus(ScriptUtils.ResolveName<Status.Paralyzed>()))
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "static_damage")]
|
||||
public class StaticDamage : Script, IScriptOnInitialize
|
||||
public class StaticDamage : Script, IScriptOnInitialize, IScriptChangeMoveDamage
|
||||
{
|
||||
private uint Damage { get; set; }
|
||||
|
||||
@ -24,7 +24,7 @@ public class StaticDamage : Script, IScriptOnInitialize
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
damage = Damage;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "super_fang")]
|
||||
public class SuperFang : Script
|
||||
public class SuperFang : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
// Super Fang always does 50% of the target's current HP
|
||||
damage = target.CurrentHealth / 2;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "venoshock")]
|
||||
public class Venoshock : Script
|
||||
public class Venoshock : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (target.HasStatus(ScriptUtils.ResolveName<Status.Poisoned>()) ||
|
||||
target.HasStatus(ScriptUtils.ResolveName<Status.BadlyPoisoned>()))
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user