Further work on refactor to interface based scripts

This commit is contained in:
Deukhoofd 2025-06-28 18:40:33 +02:00
parent b7bdf2b744
commit 436d1899e0
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
352 changed files with 940 additions and 867 deletions

View File

@ -126,7 +126,8 @@ public static class MoveTurnExecutor
private static void ExecuteMoveChoiceForTarget(IBattle battle, IExecutingMove executingMove, IPokemon target) private static void ExecuteMoveChoiceForTarget(IBattle battle, IExecutingMove executingMove, IPokemon target)
{ {
var failed = false; var failed = false;
target.RunScriptHook(x => x.FailIncomingMove(executingMove, target, ref failed)); target.RunScriptHookInterface<IScriptFailIncomingMove>(x =>
x.FailIncomingMove(executingMove, target, ref failed));
if (failed) if (failed)
{ {
// TODO: fail handling // TODO: fail handling
@ -134,7 +135,8 @@ public static class MoveTurnExecutor
} }
var isInvulnerable = false; var isInvulnerable = false;
target.RunScriptHook(x => x.IsInvulnerableToMove(executingMove, target, ref isInvulnerable)); target.RunScriptHookInterface<IScriptIsInvulnerableToMove>(x =>
x.IsInvulnerableToMove(executingMove, target, ref isInvulnerable));
if (isInvulnerable) if (isInvulnerable)
{ {
battle.EventHook.Invoke(new MoveInvulnerableEvent(executingMove, target)); battle.EventHook.Invoke(new MoveInvulnerableEvent(executingMove, target));
@ -166,7 +168,8 @@ public static class MoveTurnExecutor
hitData.IsContact = isContact; hitData.IsContact = isContact;
var hitType = (TypeIdentifier?)useMove.MoveType; var hitType = (TypeIdentifier?)useMove.MoveType;
executingMove.RunScriptHook(x => x.ChangeMoveType(executingMove, target, hitIndex, ref hitType)); executingMove.RunScriptHookInterface<IScriptChangeMoveType>(x =>
x.ChangeMoveType(executingMove, target, hitIndex, ref hitType));
hitData.Type = hitType; hitData.Type = hitType;
@ -177,14 +180,17 @@ public static class MoveTurnExecutor
var effectiveness = hitType == null var effectiveness = hitType == null
? 1 ? 1
: battle.Library.StaticLibrary.Types.GetEffectiveness(hitType.Value, types); : battle.Library.StaticLibrary.Types.GetEffectiveness(hitType.Value, types);
executingMove.RunScriptHook(x => x.ChangeEffectiveness(executingMove, target, hitIndex, ref effectiveness)); executingMove.RunScriptHookInterface<IScriptChangeEffectiveness>(x =>
target.RunScriptHook(x => x.ChangeEffectiveness(executingMove, target, hitIndex, ref effectiveness));
target.RunScriptHookInterface<IScriptChangeIncomingEffectiveness>(x =>
x.ChangeIncomingEffectiveness(executingMove, target, hitIndex, ref effectiveness)); x.ChangeIncomingEffectiveness(executingMove, target, hitIndex, ref effectiveness));
hitData.Effectiveness = effectiveness; hitData.Effectiveness = effectiveness;
var blockCritical = false; var blockCritical = false;
executingMove.RunScriptHook(x => x.BlockCriticalHit(executingMove, target, hitIndex, ref blockCritical)); executingMove.RunScriptHookInterface<IScriptBlockCriticalHit>(x =>
target.RunScriptHook(x => x.BlockIncomingCriticalHit(executingMove, target, hitIndex, ref blockCritical)); x.BlockCriticalHit(executingMove, target, hitIndex, ref blockCritical));
target.RunScriptHookInterface<IScriptBlockIncomingCriticalHit>(x =>
x.BlockIncomingCriticalHit(executingMove, target, hitIndex, ref blockCritical));
if (!blockCritical) if (!blockCritical)
{ {
var critical = battle.Library.DamageCalculator.IsCritical(battle, executingMove, target, hitIndex); var critical = battle.Library.DamageCalculator.IsCritical(battle, executingMove, target, hitIndex);
@ -208,7 +214,7 @@ public static class MoveTurnExecutor
if (accuracy < 100 && battle.Random.GetInt(100) >= accuracy) if (accuracy < 100 && battle.Random.GetInt(100) >= accuracy)
{ {
executingMove.RunScriptHook(x => x.OnMoveMiss(executingMove, target)); executingMove.RunScriptHookInterface<IScriptOnMoveMiss>(x => x.OnMoveMiss(executingMove, target));
battle.EventHook.Invoke(new MoveMissEvent(executingMove)); battle.EventHook.Invoke(new MoveMissEvent(executingMove));
break; break;
} }
@ -230,7 +236,8 @@ public static class MoveTurnExecutor
var chance = secondaryEffect.Chance; var chance = secondaryEffect.Chance;
if (chance < 0 || battle.Random.EffectChance(chance, executingMove, target, hitIndex)) if (chance < 0 || battle.Random.EffectChance(chance, executingMove, target, hitIndex))
{ {
executingMove.RunScriptHook(x => x.OnSecondaryEffect(executingMove, target, hitIndex)); executingMove.RunScriptHookInterface<IScriptOnSecondaryEffect>(x =>
x.OnSecondaryEffect(executingMove, target, hitIndex));
} }
} }
} }
@ -252,9 +259,11 @@ public static class MoveTurnExecutor
}); });
target.Damage(damage, DamageSource.MoveDamage, hitEventBatch); target.Damage(damage, DamageSource.MoveDamage, hitEventBatch);
if (!target.IsFainted) if (!target.IsFainted)
target.RunScriptHook(x => x.OnIncomingHit(executingMove, target, hitIndex)); target.RunScriptHookInterface<IScriptOnIncomingHit>(x =>
x.OnIncomingHit(executingMove, target, hitIndex));
else else
executingMove.RunScriptHook(x => x.OnOpponentFaints(executingMove, target, hitIndex)); executingMove.RunScriptHookInterface<IScriptOnOpponentFaints>(x =>
x.OnOpponentFaints(executingMove, target, hitIndex));
if (!target.IsFainted) if (!target.IsFainted)
{ {
@ -273,13 +282,14 @@ public static class MoveTurnExecutor
var chance = secondaryEffect.Chance; var chance = secondaryEffect.Chance;
if (chance < 0 || battle.Random.EffectChance(chance, executingMove, target, hitIndex)) if (chance < 0 || battle.Random.EffectChance(chance, executingMove, target, hitIndex))
{ {
executingMove.RunScriptHook(x => executingMove.RunScriptHookInterface<IScriptOnSecondaryEffect>(x =>
x.OnSecondaryEffect(executingMove, target, hitIndex)); x.OnSecondaryEffect(executingMove, target, hitIndex));
} }
} }
} }
if (target.IsFainted) if (target.IsFainted)
executingMove.RunScriptHook(x => x.OnOpponentFaints(executingMove, target, hitIndex)); executingMove.RunScriptHookInterface<IScriptOnOpponentFaints>(x =>
x.OnOpponentFaints(executingMove, target, hitIndex));
} }
} }
} }
@ -287,7 +297,7 @@ public static class MoveTurnExecutor
if (numberOfHits == 0) if (numberOfHits == 0)
{ {
target.RunScriptHook(x => x.OnMoveMiss(executingMove, target)); target.RunScriptHookInterface<IScriptOnMoveMiss>(x => x.OnMoveMiss(executingMove, target));
battle.EventHook.Invoke(new MoveMissEvent(executingMove)); battle.EventHook.Invoke(new MoveMissEvent(executingMove));
} }

View File

@ -61,106 +61,6 @@ public abstract class Script : IDeepCloneable
{ {
} }
/// <summary>
/// This function allows a script to prevent a move that is targeted at its owner. If set to true
/// the move fails, and fail events get triggered.
/// </summary>
public virtual void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
{
}
/// <summary>
/// This function allows a script to make its owner invulnerable to an incoming move.
/// </summary>
public virtual void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{
}
/// <summary>
/// This function occurs when a move gets missed. This runs on the scripts belonging to the executing
/// move, which include the scripts that are attached to the owner of the script.
/// </summary>
public virtual void OnMoveMiss(IExecutingMove move, IPokemon target)
{
}
/// <summary>
/// This function allows the script to change the actual type that is used for the move on a target.
/// If this is set to null, the move will be treated as a typeless move.
/// </summary>
public virtual void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
ref TypeIdentifier? typeIdentifier)
{
}
/// <summary>
/// This function allows the script to change how effective a move is on a target.
/// </summary>
public virtual void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{
}
/// <summary>
/// This function allows the script to override how effective a move is on a target.
/// </summary>
public virtual void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
ref float effectiveness)
{
}
/// <summary>
/// This function allows a script to block an outgoing move from being critical.
/// </summary>
public virtual void BlockCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block)
{
}
/// <summary>
/// This function allows a script to block an incoming move from being critical.
/// </summary>
public virtual void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block)
{
}
/// <summary>
/// This function allows a script to modify the accuracy of a move used. This value represents
/// the percentage accuracy, so anything above 100% will make it always hit.
/// </summary>
public virtual void ChangeAccuracyModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{
}
/// <summary>
/// This function allows a script to change the critical stage of the move used.
/// </summary>
public virtual void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
{
}
/// <summary>
/// This function allows a script to change the damage modifier of a critical hit. This will only
/// run when a hit is critical.
/// </summary>
public virtual void ChangeCriticalModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{
}
/// <summary>
/// This function allows a script to change the damage modifier of a Same Type Attack Bonus, which
/// occurs when the user has the move type as one of its own types.
/// </summary>
public virtual void ChangeStabModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber, bool isStab,
ref float modifier)
{
}
/// <summary>
/// This function allows a script to change the effective base power of a move hit.
/// </summary>
public virtual void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
}
/// <summary> /// <summary>
/// This function allows a script to bypass defensive stat boosts for a move hit. /// 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 /// If this is true, the damage will be calculated as if the target has no positive stat boosts. Negative
@ -257,21 +157,6 @@ public abstract class Script : IDeepCloneable
{ {
} }
/// <summary>
/// This function triggers when an incoming hit happens. This triggers after the damage is done,
/// but before the secondary effect of the move happens.
/// </summary>
public virtual void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
}
/// <summary>
/// This function triggers when an opponent on the field faints due to the move that is being executed.
/// </summary>
public virtual void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit)
{
}
/// <summary> /// <summary>
/// This function allows a script attached to a Pokemon or its parents to prevent stat boost /// This function allows a script attached to a Pokemon or its parents to prevent stat boost
/// changes on that Pokemon. /// changes on that Pokemon.
@ -335,15 +220,6 @@ public abstract class Script : IDeepCloneable
{ {
} }
/// <summary>
/// This function triggers when the move uses its secondary effect. Moves should implement their
/// secondary effects here. Status moves should implement their actual functionality in this
/// function as well, as status moves effects are defined as secondary effects for simplicity.
/// </summary>
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
}
/// <summary> /// <summary>
/// This function triggers on a move or its parents when all hits on a target are finished. /// This function triggers on a move or its parents when all hits on a target are finished.
/// </summary> /// </summary>
@ -910,4 +786,191 @@ public interface IScriptOnAfterMove
/// This function runs immediately after all targets have had their hits executed. /// This function runs immediately after all targets have had their hits executed.
/// </summary> /// </summary>
void OnAfterMove(IExecutingMove move); void OnAfterMove(IExecutingMove move);
}
/// <summary>
/// This interface allows scripts to change the type of a move that is used on a target.
/// </summary>
public interface IScriptChangeMoveType
{
/// <summary>
/// This function allows the script to change the actual type that is used for the move on a target.
/// If this is set to null, the move will be treated as a typeless move.
/// </summary>
void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier);
}
/// <summary>
/// This interface allows scripts to change the effectiveness of a move on a target.
/// </summary>
public interface IScriptChangeEffectiveness
{
/// <summary>
/// This function allows the script to change how effective a move is on a target.
/// </summary>
void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness);
}
/// <summary>
/// This interface allows scripts to change the effectiveness of a move on a target.
/// </summary>
public interface IScriptChangeIncomingEffectiveness
{
/// <summary>
/// This function allows the script to override how effective a move is on a target.
/// </summary>
void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
ref float effectiveness);
}
/// <summary>
/// This interface allows scripts to block a critical hit from being applied to a move.
/// </summary>
public interface IScriptBlockCriticalHit
{
/// <summary>
/// This function allows a script to block an outgoing move from being critical.
/// </summary>
void BlockCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block);
}
/// <summary>
/// This interface allows scripts to block an incoming critical hit from being applied to a move.
/// </summary>
public interface IScriptBlockIncomingCriticalHit
{
/// <summary>
/// This function allows a script to block an incoming move from being critical.
/// </summary>
void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block);
}
/// <summary>
/// This interface allows scripts to run when an incoming hit happens.
/// </summary>
public interface IScriptOnIncomingHit
{
/// <summary>
/// This function triggers when an incoming hit happens. This triggers after the damage is done,
/// but before the secondary effect of the move happens.
/// </summary>
void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit);
}
/// <summary>
/// This interface allows scripts to run when an opponent faints due to the move that is being executed.
/// </summary>
public interface IScriptOnOpponentFaints
{
/// <summary>
/// This function triggers when an opponent on the f ield faints due to the move that is being executed.
/// </summary>
void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit);
}
/// <summary>
/// This interface allows scripts to run when the move uses its secondary effect.
/// </summary>
public interface IScriptOnSecondaryEffect
{
/// <summary>
/// This function triggers when the move uses its secondary effect. Moves should implement their
/// secondary effects here. Status moves should implement their actual functionality in this
/// function as well, as status moves effects are defined as secondary effects for simplicity.
/// </summary>
void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit);
}
/// <summary>
/// This interface allows scripts to run when a move fails to hit its target.
/// </summary>
public interface IScriptFailIncomingMove
{
/// <summary>
/// This function allows a script to prevent a move that is targeted at its owner. If set to true
/// the move fails, and fail events get triggered.
/// </summary>
void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail);
}
/// <summary>
/// This interface allows scripts to run making the owner invulnerable to an incoming move.
/// </summary>
public interface IScriptIsInvulnerableToMove
{
/// <summary>
/// This function allows a script to make its owner invulnerable to an incoming move.
/// </summary>
void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable);
}
/// <summary>
/// This interface allows scripts to run when a move misses its target.
/// </summary>
public interface IScriptOnMoveMiss
{
/// <summary>
/// This function allows a script to run when a move misses its target. This is used for moves
/// that have a secondary effect that should run even if the move misses, such as Spore.
/// </summary>
void OnMoveMiss(IExecutingMove move, IPokemon target);
}
/// <summary>
/// This interface allows scripts to modify the accuracy modifier of a move.
/// </summary>
public interface IScriptChangeAccuracyModifier
{
/// <summary>
/// This function allows a script to modify the accuracy of a move used. This value represents
/// the percentage accuracy, so anything above 100% will make it always hit.
/// </summary>
void ChangeAccuracyModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier);
}
/// <summary>
/// This interface allows scripts to change the critical stage of a move.
/// </summary>
public interface IScriptChangeCriticalStage
{
/// <summary>
/// This function allows a script to change the critical stage of the move used.
/// </summary>
void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage);
}
/// <summary>
/// This interface allows scripts to change the damage modifier of a critical hit.
/// </summary>
public interface IScriptChangeCriticalModifier
{
/// <summary>
/// This function allows a script to change the damage modifier of a critical hit. This will only
/// run when a hit is critical.
/// </summary>
void ChangeCriticalModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier);
}
/// <summary>
/// This interface allows scripts to change the STAB (Same Type Attack Bonus) modifier.
/// </summary>
public interface IScriptChangeStabModifier
{
/// <summary>
/// This function allows a script to change the damage modifier of a Same Type Attack Bonus, which
/// occurs when the user has the move type as one of its own types.
/// </summary>
void ChangeStabModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber, bool isStab,
ref float modifier);
}
/// <summary>
/// This interface allows scripts to change the effective base power of a move.
/// </summary>
public interface IScriptChangeBasePower
{
/// <summary>
/// This function allows a script to change the effective base power of a move hit.
/// </summary>
void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower);
} }

View File

@ -52,7 +52,7 @@ public class Gen7BattleStatCalculator : IBattleStatCalculator
byte moveAccuracy) byte moveAccuracy)
{ {
var accuracyModifier = 1.0f; var accuracyModifier = 1.0f;
executingMove.RunScriptHook(x => executingMove.RunScriptHookInterface<IScriptChangeAccuracyModifier>(x =>
x.ChangeAccuracyModifier(executingMove, target, hitIndex, ref accuracyModifier)); x.ChangeAccuracyModifier(executingMove, target, hitIndex, ref accuracyModifier));
var modifiedAccuracy = (int)(moveAccuracy * accuracyModifier); var modifiedAccuracy = (int)(moveAccuracy * accuracyModifier);
// ReSharper disable once AccessToModifiedClosure // ReSharper disable once AccessToModifiedClosure

View File

@ -29,7 +29,7 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
if (hitData.IsCritical) if (hitData.IsCritical)
{ {
var critModifier = 1.5f; var critModifier = 1.5f;
executingMove?.RunScriptHook(script => executingMove?.RunScriptHookInterface<IScriptChangeCriticalModifier>(script =>
script.ChangeCriticalModifier(executingMove, target, hitNumber, ref critModifier)); script.ChangeCriticalModifier(executingMove, target, hitNumber, ref critModifier));
floatDamage = MathF.Floor(floatDamage * critModifier); floatDamage = MathF.Floor(floatDamage * critModifier);
} }
@ -51,7 +51,7 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
stabModifier = 1.5f; stabModifier = 1.5f;
isStab = true; isStab = true;
} }
executingMove?.RunScriptHook(script => executingMove?.RunScriptHookInterface<IScriptChangeStabModifier>(script =>
script.ChangeStabModifier(executingMove, target, hitNumber, isStab, ref stabModifier)); script.ChangeStabModifier(executingMove, target, hitNumber, isStab, ref stabModifier));
floatDamage = MathF.Floor(floatDamage * stabModifier); floatDamage = MathF.Floor(floatDamage * stabModifier);
@ -80,7 +80,8 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
if (executingMove.UseMove.Category == MoveCategory.Status) if (executingMove.UseMove.Category == MoveCategory.Status)
return 0; return 0;
var basePower = (ushort)executingMove.UseMove.BasePower; var basePower = (ushort)executingMove.UseMove.BasePower;
executingMove.RunScriptHook(script => script.ChangeBasePower(executingMove, target, hitNumber, ref basePower)); executingMove.RunScriptHookInterface<IScriptChangeBasePower>(script =>
script.ChangeBasePower(executingMove, target, hitNumber, ref basePower));
return basePower; return basePower;
} }
@ -90,7 +91,7 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
if (executingMove.UseMove.Category == MoveCategory.Status) if (executingMove.UseMove.Category == MoveCategory.Status)
return false; return false;
byte critStage = 0; byte critStage = 0;
executingMove.RunScriptHook(script => executingMove.RunScriptHookInterface<IScriptChangeCriticalStage>(script =>
script.ChangeCriticalStage(executingMove, target, hitNumber, ref critStage)); script.ChangeCriticalStage(executingMove, target, hitNumber, ref critStage));
var random = battle.Random; var random = battle.Random;

View File

@ -7,12 +7,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aftermath_(Ability)">Bulbapedia - Aftermath</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Aftermath_(Ability)">Bulbapedia - Aftermath</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "aftermath")] [Script(ScriptCategory.Ability, "aftermath")]
public class Aftermath : Script public class Aftermath : Script, IScriptOnIncomingHit
{ {
private IExecutingMove? _lastAttack; private IExecutingMove? _lastAttack;
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
_lastAttack = !move.GetHitData(target, hit).IsContact ? move : null; _lastAttack = !move.GetHitData(target, hit).IsContact ? move : null;
} }

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Anger_Point_(Ability)">Bulbapedia - Anger Point</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Anger_Point_(Ability)">Bulbapedia - Anger Point</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "anger_point")] [Script(ScriptCategory.Ability, "anger_point")]
public class AngerPoint : Script public class AngerPoint : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.GetHitData(target, hit).IsCritical) if (move.GetHitData(target, hit).IsCritical)
{ {

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Battle_Bond_(Ability)">Bulbapedia - Battle Bond</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Battle_Bond_(Ability)">Bulbapedia - Battle Bond</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "battle_bond")] [Script(ScriptCategory.Ability, "battle_bond")]
public class BattleBond : Script, IScriptChangeNumberOfHits public class BattleBond : Script, IScriptChangeNumberOfHits, IScriptOnOpponentFaints, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit) public void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.User.Species.Name == "greninja" && move.User.Form.Name != "ash" && if (move.User.Species.Name == "greninja" && move.User.Form.Name != "ash" &&
move.User.Species.TryGetForm("ash", out var ashForm)) move.User.Species.TryGetForm("ash", out var ashForm))
@ -21,7 +21,7 @@ public class BattleBond : Script, IScriptChangeNumberOfHits
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.UseMove.Name == "water_shuriken" && move.User.Form.Name == "ash") if (move.UseMove.Name == "water_shuriken" && move.User.Form.Name == "ash")
basePower = 20; basePower = 20;

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Beast_Boost_(Ability)">Bulbapedia - Beast Boost</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Beast_Boost_(Ability)">Bulbapedia - Beast Boost</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "beast_boost")] [Script(ScriptCategory.Ability, "beast_boost")]
public class BeastBoost : Script public class BeastBoost : Script, IScriptOnOpponentFaints
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit) public void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit)
{ {
var highestStat = move.User.BoostedStats.OrderByDescending(x => x.value).First().statistic; var highestStat = move.User.BoostedStats.OrderByDescending(x => x.value).First().statistic;
EventBatchId batchId = new(); EventBatchId batchId = new();

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Bulletproof_(Ability)">Bulbapedia - Bulletproof</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Bulletproof_(Ability)">Bulbapedia - Bulletproof</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "bulletproof")] [Script(ScriptCategory.Ability, "bulletproof")]
public class Bulletproof : Script public class Bulletproof : Script, IScriptFailIncomingMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
{ {
if (move.UseMove.HasFlag("ballistics")) if (move.UseMove.HasFlag("ballistics"))
fail = true; fail = true;

View File

@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Refrigerate_(Ability)">Bulbapedia - Refrigerate</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Refrigerate_(Ability)">Bulbapedia - Refrigerate</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "change_move_type")] [Script(ScriptCategory.Ability, "change_move_type")]
public class ChangeMoveTypeAbility : Script, IScriptOnInitialize public class ChangeMoveTypeAbility : Script, IScriptOnInitialize, IScriptChangeMoveType, IScriptChangeBasePower
{ {
private StringKey _fromType; private StringKey _fromType;
private StringKey _toType; private StringKey _toType;
@ -29,8 +29,7 @@ public class ChangeMoveTypeAbility : Script, IScriptOnInitialize
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
ref TypeIdentifier? typeIdentifier)
{ {
var typeLibrary = target.Library.StaticLibrary.Types; var typeLibrary = target.Library.StaticLibrary.Types;
// Both types must be valid and the current type must match the from type // Both types must be valid and the current type must match the from type
@ -45,7 +44,7 @@ public class ChangeMoveTypeAbility : Script, IScriptOnInitialize
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.GetHitData(target, hit).HasFlag("change_move_type_ability")) if (move.GetHitData(target, hit).HasFlag("change_move_type_ability"))
basePower = basePower.MultiplyOrMax(1.3f); basePower = basePower.MultiplyOrMax(1.3f);

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Color_Change_(Ability)">Bulbapedia - Color Change</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Color_Change_(Ability)">Bulbapedia - Color Change</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "color_change")] [Script(ScriptCategory.Ability, "color_change")]
public class ColorChange : Script public class ColorChange : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
var hitData = move.GetHitData(target, hit); var hitData = move.GetHitData(target, hit);
if (hitData.Type != null && (hitData.Type != target.Types.FirstOrDefault() || target.Types.Count > 1)) if (hitData.Type != null && (hitData.Type != target.Types.FirstOrDefault() || target.Types.Count > 1))

View File

@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cursed_Body_(Ability)">Bulbapedia - Cursed Body</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Cursed_Body_(Ability)">Bulbapedia - Cursed Body</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "cursed_body")] [Script(ScriptCategory.Ability, "cursed_body")]
public class CursedBody : Script public class CursedBody : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
// 30% chance to disable the move // 30% chance to disable the move
if (move.Battle.Random.GetFloat() > 0.3f) if (move.Battle.Random.GetFloat() > 0.3f)

View File

@ -11,10 +11,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cute_Charm_(Ability)">Bulbapedia - Cute Charm</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Cute_Charm_(Ability)">Bulbapedia - Cute Charm</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "cute_charm")] [Script(ScriptCategory.Ability, "cute_charm")]
public class CuteCharm : Script public class CuteCharm : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
// Only trigger on contact moves // Only trigger on contact moves
if (!move.GetHitData(target, hit).IsContact) if (!move.GetHitData(target, hit).IsContact)

View File

@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Damp_(Ability)">Bulbapedia - Damp</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Damp_(Ability)">Bulbapedia - Damp</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "damp")] [Script(ScriptCategory.Ability, "damp")]
public class Damp : Script public class Damp : Script, IScriptFailIncomingMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
{ {
if (move.UseMove.Name == "self_destruct" || move.UseMove.Name == "explosion") if (move.UseMove.Name == "self_destruct" || move.UseMove.Name == "explosion")
{ {

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dazzling_(Ability)">Bulbapedia - Dazzling</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Dazzling_(Ability)">Bulbapedia - Dazzling</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "dazzling")] [Script(ScriptCategory.Ability, "dazzling")]
public class Dazzling : Script public class Dazzling : Script, IScriptFailIncomingMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
{ {
if (move.UseMove.Priority > 0) if (move.UseMove.Priority > 0)
{ {

View File

@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Effect_Spore_(Ability)">Bulbapedia - Effect Spore</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Effect_Spore_(Ability)">Bulbapedia - Effect Spore</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "effect_spore")] [Script(ScriptCategory.Ability, "effect_spore")]
public class EffectSpore : Script public class EffectSpore : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.User.Types.Any(x => x.Name == "grass")) if (move.User.Types.Any(x => x.Name == "grass"))
return; return;

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flame_Body_(Ability)">Bulbapedia - Flame Body</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Flame_Body_(Ability)">Bulbapedia - Flame Body</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "flame_body")] [Script(ScriptCategory.Ability, "flame_body")]
public class FlameBody : Script public class FlameBody : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (!move.GetHitData(target, hit).IsContact) if (!move.GetHitData(target, hit).IsContact)
return; return;

View File

@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flash_Fire_(Ability)">Bulbapedia - Flash Fire</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Flash_Fire_(Ability)">Bulbapedia - Flash Fire</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "flash_fire")] [Script(ScriptCategory.Ability, "flash_fire")]
public class FlashFire : Script public class FlashFire : Script, IScriptChangeIncomingEffectiveness
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex, public void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
ref float effectiveness) ref float effectiveness)
{ {
if (executingMove.GetHitData(target, hitIndex).Type?.Name != "fire") if (executingMove.GetHitData(target, hitIndex).Type?.Name != "fire")

View File

@ -7,11 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Galvanize_(Ability)">Bulbapedia - Galvanize</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Galvanize_(Ability)">Bulbapedia - Galvanize</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "galvanize")] [Script(ScriptCategory.Ability, "galvanize")]
public class Galvanize : Script public class Galvanize : Script, IScriptChangeMoveType
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
ref TypeIdentifier? typeIdentifier)
{ {
if (typeIdentifier?.Name == "normal" && if (typeIdentifier?.Name == "normal" &&
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType)) move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType))

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Gooey_(Ability)">Bulbapedia - Gooey</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Gooey_(Ability)">Bulbapedia - Gooey</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "gooey")] [Script(ScriptCategory.Ability, "gooey")]
public class Gooey : Script public class Gooey : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (!move.GetHitData(target, hit).IsContact) if (!move.GetHitData(target, hit).IsContact)
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Heatproof_(Ability)">Bulbapedia - Heatproof</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Heatproof_(Ability)">Bulbapedia - Heatproof</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "heatproof")] [Script(ScriptCategory.Ability, "heatproof")]
public class Heatproof : Script public class Heatproof : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.GetHitData(target, hit).Type?.Name == "fire") if (move.GetHitData(target, hit).Type?.Name == "fire")
{ {

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Illusion_(Ability)">Bulbapedia - Illusion</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Illusion_(Ability)">Bulbapedia - Illusion</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "illusion")] [Script(ScriptCategory.Ability, "illusion")]
public class Illusion : Script public class Illusion : Script, IScriptOnIncomingHit
{ {
private IPokemon? _pokemon; private IPokemon? _pokemon;
@ -43,7 +43,7 @@ public class Illusion : Script
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (_pokemon?.BattleData?.Battle is null) if (_pokemon?.BattleData?.Battle is null)
return; return;

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Adaptability_(Ability)">Bulbapedia - Adaptability</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Adaptability_(Ability)">Bulbapedia - Adaptability</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "increased_stab")] [Script(ScriptCategory.Ability, "increased_stab")]
public class IncreasedStab : Script public class IncreasedStab : Script, IScriptChangeStabModifier
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeStabModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber, bool isStab, public void ChangeStabModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber, bool isStab,
ref float modifier) ref float modifier)
{ {
if (!isStab || !modifier.IsApproximatelyEqualTo(1.5f)) if (!isStab || !modifier.IsApproximatelyEqualTo(1.5f))

View File

@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Innards_Out_(Ability)">Bulbapedia - Innards Out</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Innards_Out_(Ability)">Bulbapedia - Innards Out</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "innards_out")] [Script(ScriptCategory.Ability, "innards_out")]
public class InnardsOut : Script public class InnardsOut : Script, IScriptOnIncomingHit
{ {
private IPokemon? _lastPokemonToHit; private IPokemon? _lastPokemonToHit;
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
_lastPokemonToHit = move.User; _lastPokemonToHit = move.User;
} }

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Iron_Barbs_(Ability)">Bulbapedia - Iron Barbs</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Iron_Barbs_(Ability)">Bulbapedia - Iron Barbs</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "iron_barbs")] [Script(ScriptCategory.Ability, "iron_barbs")]
public class IronBarbs : Script public class IronBarbs : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.GetHitData(target, hit).IsContact) if (move.GetHitData(target, hit).IsContact)
{ {

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Iron_Fist_(Ability)">Bulbapedia - Iron Fist</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Iron_Fist_(Ability)">Bulbapedia - Iron Fist</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "iron_fist")] [Script(ScriptCategory.Ability, "iron_fist")]
public class IronFist : Script public class IronFist : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.UseMove.HasFlag("punch")) if (move.UseMove.HasFlag("punch"))
basePower = basePower.MultiplyOrMax(1.2f); basePower = basePower.MultiplyOrMax(1.2f);

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Justified_(Ability)">Bulbapedia - Justified</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Justified_(Ability)">Bulbapedia - Justified</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "justified")] [Script(ScriptCategory.Ability, "justified")]
public class Justified : Script public class Justified : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.GetHitData(target, hit).Type?.Name != "dark") if (move.GetHitData(target, hit).Type?.Name != "dark")
return; return;

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Lightning_Rod_(Ability)">Bulbapedia - Lightning Rod</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Lightning_Rod_(Ability)">Bulbapedia - Lightning Rod</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "lightning_rod")] [Script(ScriptCategory.Ability, "lightning_rod")]
public class LightningRod : Script, IScriptChangeIncomingTargets public class LightningRod : Script, IScriptChangeIncomingTargets, IScriptChangeEffectiveness
{ {
/// <inheritdoc /> /// <inheritdoc />
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets) public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
@ -18,7 +18,7 @@ public class LightningRod : Script, IScriptChangeIncomingTargets
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness) public void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{ {
if (move.GetHitData(target, hit).Type?.Name != "electric") if (move.GetHitData(target, hit).Type?.Name != "electric")
return; return;

View File

@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Liquid_Voice_(Ability)">Bulbapedia - Liquid Voice</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Liquid_Voice_(Ability)">Bulbapedia - Liquid Voice</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "liquid_voice")] [Script(ScriptCategory.Ability, "liquid_voice")]
public class LiquidVoice : Script public class LiquidVoice : Script, IScriptChangeMoveType
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
ref TypeIdentifier? typeIdentifier)
{ {
if (move.UseMove.HasFlag("sound") && if (move.UseMove.HasFlag("sound") &&
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("water", out var waterType)) move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("water", out var waterType))

View File

@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magician_(Ability)">Bulbapedia - Magician</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Magician_(Ability)">Bulbapedia - Magician</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "magician")] [Script(ScriptCategory.Ability, "magician")]
public class Magician : Script public class Magician : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.UseMove.Category is MoveCategory.Status) if (move.UseMove.Category is MoveCategory.Status)
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Mega_Launcher_(Ability)">Bulbapedia - Mega Launcher</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Mega_Launcher_(Ability)">Bulbapedia - Mega Launcher</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "mega_launcher")] [Script(ScriptCategory.Ability, "mega_launcher")]
public class MegaLauncher : Script public class MegaLauncher : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.UseMove.HasFlag("pulse")) if (move.UseMove.HasFlag("pulse"))
{ {

View File

@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Merciless_(Ability)">Bulbapedia - Merciless</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Merciless_(Ability)">Bulbapedia - Merciless</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "merciless")] [Script(ScriptCategory.Ability, "merciless")]
public class Merciless : Script public class Merciless : Script, IScriptChangeCriticalStage
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage) public void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
{ {
if (target.StatusScript.Script?.Name == ScriptUtils.ResolveName<Poisoned>() || if (target.StatusScript.Script?.Name == ScriptUtils.ResolveName<Poisoned>() ||
target.StatusScript.Script?.Name == ScriptUtils.ResolveName<BadlyPoisoned>()) target.StatusScript.Script?.Name == ScriptUtils.ResolveName<BadlyPoisoned>())

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Motor_Drive_(Ability)">Bulbapedia - Motor Drive</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Motor_Drive_(Ability)">Bulbapedia - Motor Drive</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "motor_drive")] [Script(ScriptCategory.Ability, "motor_drive")]
public class MotorDrive : Script public class MotorDrive : Script, IScriptIsInvulnerableToMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{ {
if (move.UseMove.MoveType.Name != "electric") if (move.UseMove.MoveType.Name != "electric")
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Moxie_(Ability)">Bulbapedia - Moxie</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Moxie_(Ability)">Bulbapedia - Moxie</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "moxie")] [Script(ScriptCategory.Ability, "moxie")]
public class Moxie : Script public class Moxie : Script, IScriptOnOpponentFaints
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit) public void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit)
{ {
move.User.ChangeStatBoost(Statistic.Attack, 1, true, false); move.User.ChangeStatBoost(Statistic.Attack, 1, true, false);
} }

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Mummy_(Ability)">Bulbapedia - Mummy</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Mummy_(Ability)">Bulbapedia - Mummy</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "mummy")] [Script(ScriptCategory.Ability, "mummy")]
public class Mummy : Script public class Mummy : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (!move.GetHitData(target, hit).IsContact || move.User.ActiveAbility?.Name == "mummy" || if (!move.GetHitData(target, hit).IsContact || move.User.ActiveAbility?.Name == "mummy" ||
!move.Battle.Library.StaticLibrary.Abilities.TryGet("mummy", out var mummyAbility)) !move.Battle.Library.StaticLibrary.Abilities.TryGet("mummy", out var mummyAbility))

View File

@ -6,18 +6,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Normalize_(Ability)">Bulbapedia - Normalize</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Normalize_(Ability)">Bulbapedia - Normalize</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "normalize")] [Script(ScriptCategory.Ability, "normalize")]
public class Normalize : Script public class Normalize : Script, IScriptChangeMoveType, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
ref TypeIdentifier? typeIdentifier)
{ {
if (move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("normal", out var normalType)) if (move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("normal", out var normalType))
typeIdentifier = normalType; typeIdentifier = normalType;
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.GetHitData(target, hit).Type?.Name == "normal") if (move.GetHitData(target, hit).Type?.Name == "normal")
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30% basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Overcoat_(Ability)">Bulbapedia - Overcoat</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Overcoat_(Ability)">Bulbapedia - Overcoat</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "overcoat")] [Script(ScriptCategory.Ability, "overcoat")]
public class Overcoat : Script public class Overcoat : Script, IScriptIsInvulnerableToMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args) public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
@ -23,7 +23,7 @@ public class Overcoat : Script
} }
/// <inheritdoc /> /// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{ {
if (move.UseMove.HasFlag("powder")) if (move.UseMove.HasFlag("powder"))
{ {

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(Ability)">Bulbapedia - Parental Bond</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(Ability)">Bulbapedia - Parental Bond</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "parental_bond")] [Script(ScriptCategory.Ability, "parental_bond")]
public class ParentalBond : Script, IScriptChangeNumberOfHits public class ParentalBond : Script, IScriptChangeNumberOfHits, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits) public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
@ -16,7 +16,7 @@ public class ParentalBond : Script, IScriptChangeNumberOfHits
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (hit == 1) if (hit == 1)
basePower = (ushort)(basePower / 4); basePower = (ushort)(basePower / 4);

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pickpocket_(Ability)">Bulbapedia - Pickpocket</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Pickpocket_(Ability)">Bulbapedia - Pickpocket</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "pickpocket")] [Script(ScriptCategory.Ability, "pickpocket")]
public class Pickpocket : Script public class Pickpocket : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (!move.GetHitData(target, hit).IsContact || target.HeldItem is not null || if (!move.GetHitData(target, hit).IsContact || target.HeldItem is not null ||
!move.User.TryStealHeldItem(out var item)) !move.User.TryStealHeldItem(out var item))

View File

@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pixilate_(Ability)">Bulbapedia - Pixilate</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Pixilate_(Ability)">Bulbapedia - Pixilate</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "pixilate")] [Script(ScriptCategory.Ability, "pixilate")]
public class Pixilate : Script public class Pixilate : Script, IScriptChangeMoveType, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
ref TypeIdentifier? typeIdentifier)
{ {
if (typeIdentifier?.Name == "normal" && if (typeIdentifier?.Name == "normal" &&
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("fairy", out var fairyType)) move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("fairy", out var fairyType))
@ -18,7 +17,7 @@ public class Pixilate : Script
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.GetHitData(target, hit).Type?.Name == "fairy") if (move.GetHitData(target, hit).Type?.Name == "fairy")
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30% basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Point_(Ability)">Bulbapedia - Poison Point</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Point_(Ability)">Bulbapedia - Poison Point</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "poison_point")] [Script(ScriptCategory.Ability, "poison_point")]
public class PoisonPoint : Script public class PoisonPoint : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.GetHitData(target, hit).IsContact) if (move.GetHitData(target, hit).IsContact)
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), move.User); move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), move.User);

View File

@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Touch_(Ability)">Bulbapedia - Poison Touch</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Touch_(Ability)">Bulbapedia - Poison Touch</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "poison_touch")] [Script(ScriptCategory.Ability, "poison_touch")]
public class PoisonTouch : Script public class PoisonTouch : Script, IScriptOnIncomingHit
{ {
private const int PoisonChance = 30; private const int PoisonChance = 30;
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.GetHitData(target, hit).IsContact && move.Battle.Random.GetInt(0, 100) < PoisonChance) if (move.GetHitData(target, hit).IsContact && move.Battle.Random.GetInt(0, 100) < PoisonChance)
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), target); move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), target);

View File

@ -9,9 +9,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(Ability)">Bulbapedia - Shell Armor</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(Ability)">Bulbapedia - Shell Armor</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "prevent_critical")] [Script(ScriptCategory.Ability, "prevent_critical")]
public class PreventCritical : Script public class PreventCritical : Script, IScriptBlockIncomingCriticalHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block) => public void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block) =>
block = true; block = true;
} }

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Queenly_Majesty_(Ability)">Bulbapedia - Queenly Majesty</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Queenly_Majesty_(Ability)">Bulbapedia - Queenly Majesty</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "queenly_majesty")] [Script(ScriptCategory.Ability, "queenly_majesty")]
public class QueenlyMajesty : Script public class QueenlyMajesty : Script, IScriptFailIncomingMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
{ {
if (move.Targets.Count != 1) if (move.Targets.Count != 1)
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rattled_(Ability)">Bulbapedia - Rattled</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Rattled_(Ability)">Bulbapedia - Rattled</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "rattled")] [Script(ScriptCategory.Ability, "rattled")]
public class Rattled : Script public class Rattled : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
var type = move.GetHitData(target, hit).Type; var type = move.GetHitData(target, hit).Type;
if (type is null) if (type is null)

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Reckless_(Ability)">Bulbapedia - Reckless</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Reckless_(Ability)">Bulbapedia - Reckless</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "reckless")] [Script(ScriptCategory.Ability, "reckless")]
public class Reckless : Script public class Reckless : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.UseMove.HasFlag("recoil")) if (move.UseMove.HasFlag("recoil"))
{ {

View File

@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Refrigerate_(Ability)">Bulbapedia - Refrigerate</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Refrigerate_(Ability)">Bulbapedia - Refrigerate</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "refrigerate")] [Script(ScriptCategory.Ability, "refrigerate")]
public class Refrigerate : Script public class Refrigerate : Script, IScriptChangeMoveType, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
ref TypeIdentifier? typeIdentifier)
{ {
if (typeIdentifier?.Name == "normal" && if (typeIdentifier?.Name == "normal" &&
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("ice", out var iceType)) move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("ice", out var iceType))
@ -18,7 +17,7 @@ public class Refrigerate : Script
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.GetHitData(target, hit).Type?.Name == "ice") if (move.GetHitData(target, hit).Type?.Name == "ice")
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30% basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%

View File

@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rivalry_(Ability)">Bulbapedia - Rivalry</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Rivalry_(Ability)">Bulbapedia - Rivalry</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "rivalry")] [Script(ScriptCategory.Ability, "rivalry")]
public class Rivalry : Script public class Rivalry : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.User.Gender == Gender.Genderless || target.Gender == Gender.Genderless) if (move.User.Gender == Gender.Genderless || target.Gender == Gender.Genderless)
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rough_Skin_(Ability)">Bulbapedia - Rough Skin</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Rough_Skin_(Ability)">Bulbapedia - Rough Skin</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "rough_skin")] [Script(ScriptCategory.Ability, "rough_skin")]
public class RoughSkin : Script public class RoughSkin : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.GetHitData(target, hit).IsContact) if (move.GetHitData(target, hit).IsContact)
{ {

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Force_(Ability)">Bulbapedia - Sand Force</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Force_(Ability)">Bulbapedia - Sand Force</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "sand_force")] [Script(ScriptCategory.Ability, "sand_force")]
public class SandForce : Script public class SandForce : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Sandstorm>()) if (move.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Sandstorm>())
{ {

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sap_Sipper_(Ability)">Bulbapedia - Sap Sipper</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Sap_Sipper_(Ability)">Bulbapedia - Sap Sipper</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "sap_sipper")] [Script(ScriptCategory.Ability, "sap_sipper")]
public class SapSipper : Script public class SapSipper : Script, IScriptIsInvulnerableToMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{ {
if (move.GetHitData(target, 0).Type?.Name == "grass") if (move.GetHitData(target, 0).Type?.Name == "grass")
{ {

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sheer_Force_(Ability)">Bulbapedia - Sheer Force</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Sheer_Force_(Ability)">Bulbapedia - Sheer Force</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "sheer_force")] [Script(ScriptCategory.Ability, "sheer_force")]
public class SheerForce : Script public class SheerForce : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
basePower = basePower.MultiplyOrMax(5325f / 4096f); basePower = basePower.MultiplyOrMax(5325f / 4096f);
} }

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(Ability)">Bulbapedia - Shell Armor</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(Ability)">Bulbapedia - Shell Armor</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "shell_armor")] [Script(ScriptCategory.Ability, "shell_armor")]
public class ShellArmor : Script public class ShellArmor : Script, IScriptBlockIncomingCriticalHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block) public void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block)
{ {
block = true; block = true;
} }

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sniper_(Ability)">Bulbapedia - Sniper</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Sniper_(Ability)">Bulbapedia - Sniper</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "sniper")] [Script(ScriptCategory.Ability, "sniper")]
public class Sniper : Script public class Sniper : Script, IScriptChangeCriticalModifier
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeCriticalModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier) public void ChangeCriticalModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{ {
modifier *= 1.5f; modifier *= 1.5f;
} }

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soul-Heart_(Ability)">Bulbapedia - Soul-Heart</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Soul-Heart_(Ability)">Bulbapedia - Soul-Heart</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "soul_heart")] [Script(ScriptCategory.Ability, "soul_heart")]
public class SoulHeart : Script public class SoulHeart : Script, IScriptOnOpponentFaints
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon) public override void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
@ -15,7 +15,7 @@ public class SoulHeart : Script
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit) public void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit)
{ {
move.User.ChangeStatBoost(Statistic.SpecialAttack, 1, true, false); move.User.ChangeStatBoost(Statistic.SpecialAttack, 1, true, false);
} }

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soundproof_(Ability)">Bulbapedia - Soundproof</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Soundproof_(Ability)">Bulbapedia - Soundproof</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "soundproof")] [Script(ScriptCategory.Ability, "soundproof")]
public class Soundproof : Script public class Soundproof : Script, IScriptIsInvulnerableToMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{ {
if (move.UseMove.HasFlag("sound")) if (move.UseMove.HasFlag("sound"))
invulnerable = true; invulnerable = true;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stakeout_(Ability)">Bulbapedia - Stakeout</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Stakeout_(Ability)">Bulbapedia - Stakeout</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "stakeout")] [Script(ScriptCategory.Ability, "stakeout")]
public class Stakeout : Script public class Stakeout : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (target.BattleData?.SwitchInTurn == move.Battle.CurrentTurnNumber) if (target.BattleData?.SwitchInTurn == move.Battle.CurrentTurnNumber)
basePower = basePower.MultiplyOrMax(2); basePower = basePower.MultiplyOrMax(2);

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stamina_(Ability)">Bulbapedia - Stamina</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Stamina_(Ability)">Bulbapedia - Stamina</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "stamina")] [Script(ScriptCategory.Ability, "stamina")]
public class Stamina : Script public class Stamina : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
EventBatchId batchId = new(); EventBatchId batchId = new();
if (target.ChangeStatBoost(Statistic.Defense, 1, true, false, batchId)) if (target.ChangeStatBoost(Statistic.Defense, 1, true, false, batchId))

View File

@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Static_(Ability)">Bulbapedia - Static</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Static_(Ability)">Bulbapedia - Static</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "static")] [Script(ScriptCategory.Ability, "static")]
public class Static : Script public class Static : Script, IScriptOnIncomingHit
{ {
private const int ChanceToParalyze = 30; private const int ChanceToParalyze = 30;
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (!move.GetHitData(target, hit).IsContact) if (!move.GetHitData(target, hit).IsContact)
return; return;

View File

@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stench_(Ability)">Bulbapedia - Stench</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Stench_(Ability)">Bulbapedia - Stench</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "stench")] [Script(ScriptCategory.Ability, "stench")]
public class Stench : Script public class Stench : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.Battle.Random.GetInt(100) >= 10) if (move.Battle.Random.GetInt(100) >= 10)
return; return;

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Storm_Drain_(Ability)">Bulbapedia - Storm Drain</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Storm_Drain_(Ability)">Bulbapedia - Storm Drain</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "storm_drain")] [Script(ScriptCategory.Ability, "storm_drain")]
public class StormDrain : Script, IScriptChangeIncomingTargets public class StormDrain : Script, IScriptChangeIncomingTargets, IScriptChangeEffectiveness
{ {
/// <inheritdoc /> /// <inheritdoc />
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets) public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
@ -18,7 +18,7 @@ public class StormDrain : Script, IScriptChangeIncomingTargets
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness) public void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{ {
if (move.GetHitData(target, hit).Type?.Name != "water") if (move.GetHitData(target, hit).Type?.Name != "water")
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Strong_Jaw_(Ability)">Bulbapedia - Strong Jaw</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Strong_Jaw_(Ability)">Bulbapedia - Strong Jaw</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "strong_jaw")] [Script(ScriptCategory.Ability, "strong_jaw")]
public class StrongJaw : Script public class StrongJaw : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.UseMove.HasFlag("bite")) if (move.UseMove.HasFlag("bite"))
{ {

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Super_Luck_(Ability)">Bulbapedia - Super Luck</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Super_Luck_(Ability)">Bulbapedia - Super Luck</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "super_luck")] [Script(ScriptCategory.Ability, "super_luck")]
public class SuperLuck : Script public class SuperLuck : Script, IScriptChangeCriticalStage
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage) public void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
{ {
if (stage == byte.MaxValue) if (stage == byte.MaxValue)
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Tangling_Hair_(Ability)">Bulbapedia - Tangling Hair</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Tangling_Hair_(Ability)">Bulbapedia - Tangling Hair</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "tangling_hair")] [Script(ScriptCategory.Ability, "tangling_hair")]
public class TanglingHair : Script public class TanglingHair : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (!move.GetHitData(target, hit).IsContact) if (!move.GetHitData(target, hit).IsContact)
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Technician_(Ability)">Bulbapedia - Technician</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Technician_(Ability)">Bulbapedia - Technician</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "technician")] [Script(ScriptCategory.Ability, "technician")]
public class Technician : Script public class Technician : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.UseMove.BasePower <= 60) if (move.UseMove.BasePower <= 60)
{ {

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Telepathy_(Ability)">Bulbapedia - Telepathy</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Telepathy_(Ability)">Bulbapedia - Telepathy</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "telepathy")] [Script(ScriptCategory.Ability, "telepathy")]
public class Telepathy : Script public class Telepathy : Script, IScriptIsInvulnerableToMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{ {
if (move.User.BattleData?.BattleSide == target.BattleData?.BattleSide) if (move.User.BattleData?.BattleSide == target.BattleData?.BattleSide)
invulnerable = true; invulnerable = true;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Volt_Absorb_(Ability)">Bulbapedia - Volt Absorb</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Volt_Absorb_(Ability)">Bulbapedia - Volt Absorb</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "volt_absorb")] [Script(ScriptCategory.Ability, "volt_absorb")]
public class VoltAbsorb : Script public class VoltAbsorb : Script, IScriptIsInvulnerableToMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{ {
if (move.GetHitData(target, 0).Type?.Name != "electric") if (move.GetHitData(target, 0).Type?.Name != "electric")
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Absorb_(Ability)">Bulbapedia - Water Absorb</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Absorb_(Ability)">Bulbapedia - Water Absorb</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "water_absorb")] [Script(ScriptCategory.Ability, "water_absorb")]
public class WaterAbsorb : Script public class WaterAbsorb : Script, IScriptIsInvulnerableToMove
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{ {
if (move.GetHitData(target, 0).Type?.Name != "water") if (move.GetHitData(target, 0).Type?.Name != "water")
return; return;

View File

@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Compaction_(Ability)">Bulbapedia - Water Compaction</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Compaction_(Ability)">Bulbapedia - Water Compaction</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "water_compaction")] [Script(ScriptCategory.Ability, "water_compaction")]
public class WaterCompaction : Script public class WaterCompaction : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.GetHitData(target, hit).Type?.Name != "water") if (move.GetHitData(target, hit).Type?.Name != "water")
return; return;

View File

@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Weak_Armor_(Ability)">Bulbapedia - Weak Armor</see> /// <see href="https://bulbapedia.bulbagarden.net/wiki/Weak_Armor_(Ability)">Bulbapedia - Weak Armor</see>
/// </summary> /// </summary>
[Script(ScriptCategory.Ability, "weak_armor")] [Script(ScriptCategory.Ability, "weak_armor")]
public class WeakArmor : Script public class WeakArmor : Script, IScriptOnIncomingHit
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.UseMove.Category != MoveCategory.Physical) if (move.UseMove.Category != MoveCategory.Physical)
return; return;

View File

@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle; namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "gravity")] [Script(ScriptCategory.Battle, "gravity")]
public class Gravity : Script public class Gravity : Script, IScriptFailIncomingMove
{ {
private int _turns = 5; private int _turns = 5;
@ -18,7 +18,7 @@ public class Gravity : Script
} }
/// <inheritdoc /> /// <inheritdoc />
public override void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
{ {
if (move.UseMove.HasFlag("gravity")) if (move.UseMove.HasFlag("gravity"))
fail = true; fail = true;

View File

@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle; namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Move, "ion_deluge")] [Script(ScriptCategory.Move, "ion_deluge")]
public class IonDelugeEffect : Script public class IonDelugeEffect : Script, IScriptChangeMoveType
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? moveType) public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? moveType)
{ {
if (moveType?.Name == "normal" && if (moveType?.Name == "normal" &&
target.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType)) target.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType))

View File

@ -1,12 +1,12 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle; namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "mud_sport")] [Script(ScriptCategory.Battle, "mud_sport")]
public class MudSportEffect : Script public class MudSportEffect : Script, IScriptChangeBasePower
{ {
private int _turnsLeft = 5; private int _turnsLeft = 5;
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.UseMove.MoveType.Name == "electric") if (move.UseMove.MoveType.Name == "electric")
{ {

View File

@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle; namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "uproar_effect")] [Script(ScriptCategory.Battle, "uproar_effect")]
public class UproarEffect : Script, IScriptOnBeforeTurnStart public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect
{ {
private IPokemon? _placer; private IPokemon? _placer;
private bool _hasUsedUproar; private bool _hasUsedUproar;
@ -30,7 +30,7 @@ public class UproarEffect : Script, IScriptOnBeforeTurnStart
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
if (move.User == _placer && move.UseMove.Name == "uproar") if (move.User == _placer && move.UseMove.Name == "uproar")
_hasUsedUproar = true; _hasUsedUproar = true;

View File

@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile; namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "electrify")] [Script(ScriptCategory.MoveVolatile, "electrify")]
public class ElectrifyEffect : Script public class ElectrifyEffect : Script, IScriptChangeMoveType
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? moveType) public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? moveType)
{ {
var battleData = target.BattleData; var battleData = target.BattleData;
if (battleData == null) if (battleData == null)

View File

@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile; namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "fire_grass_pledge")] [Script(ScriptCategory.MoveVolatile, "fire_grass_pledge")]
public class FireGrassPledgeMove : Script, IScriptChangeMove public class FireGrassPledgeMove : Script, IScriptChangeMove, IScriptOnSecondaryEffect, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public void ChangeMove(IMoveChoice choice, ref StringKey moveName) public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
@ -12,13 +12,13 @@ public class FireGrassPledgeMove : Script, IScriptChangeMove
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
basePower = 150; basePower = 150;
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
target.BattleData?.BattleSide.VolatileScripts.Add(new SeaOfFireEffect()); target.BattleData?.BattleSide.VolatileScripts.Add(new SeaOfFireEffect());
} }

View File

@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile; namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "fire_water_pledge")] [Script(ScriptCategory.MoveVolatile, "fire_water_pledge")]
public class FireWaterPledgeMove : Script, IScriptChangeMove public class FireWaterPledgeMove : Script, IScriptChangeMove, IScriptOnSecondaryEffect, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public void ChangeMove(IMoveChoice choice, ref StringKey moveName) public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
@ -12,13 +12,13 @@ public class FireWaterPledgeMove : Script, IScriptChangeMove
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
basePower = 150; basePower = 150;
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
move.User.BattleData?.BattleSide.VolatileScripts.Add(new RainbowEffect()); move.User.BattleData?.BattleSide.VolatileScripts.Add(new RainbowEffect());
} }

View File

@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile; namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "grass_water_pledge")] [Script(ScriptCategory.MoveVolatile, "grass_water_pledge")]
public class GrassWaterPledgeMove : Script, IScriptChangeMove public class GrassWaterPledgeMove : Script, IScriptChangeMove, IScriptOnSecondaryEffect, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public void ChangeMove(IMoveChoice choice, ref StringKey moveName) public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
@ -12,13 +12,13 @@ public class GrassWaterPledgeMove : Script, IScriptChangeMove
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
basePower = 150; basePower = 150;
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
move.User.BattleData?.BattleSide.VolatileScripts.Add(new SwampEffect()); move.User.BattleData?.BattleSide.VolatileScripts.Add(new SwampEffect());
} }

View File

@ -1,9 +1,9 @@
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile; namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "me_first")] [Script(ScriptCategory.MoveVolatile, "me_first")]
public class MeFirstPowerBoost : Script public class MeFirstPowerBoost : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) => public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) =>
basePower = basePower.MultiplyOrMax(1.5f); basePower = basePower.MultiplyOrMax(1.5f);
} }

View File

@ -1,9 +1,9 @@
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile; namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "round")] [Script(ScriptCategory.MoveVolatile, "round")]
public class RoundPowerBoost : Script public class RoundPowerBoost : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) => public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) =>
basePower = basePower.MultiplyOrMax(2f); basePower = basePower.MultiplyOrMax(2f);
} }

View File

@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// Does double base power if the user is not holding an item. /// Does double base power if the user is not holding an item.
/// </remarks> /// </remarks>
[Script(ScriptCategory.Move, "acrobatics")] [Script(ScriptCategory.Move, "acrobatics")]
public class Acrobatics : Script public class Acrobatics : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (move.User.HeldItem == null) if (move.User.HeldItem == null)
basePower = basePower.MultiplyOrMax(2); basePower = basePower.MultiplyOrMax(2);

View File

@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// to raise a stat that is already maximized, meaning that the move will fail if all stats are maximized /// to raise a stat that is already maximized, meaning that the move will fail if all stats are maximized
/// </remarks> /// </remarks>
[Script(ScriptCategory.Move, "acupressure")] [Script(ScriptCategory.Move, "acupressure")]
public class Acupressure : Script public class Acupressure : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
// If the target has no stats to raise, the move fails // If the target has no stats to raise, the move fails
if (target.StatBoost.All(s => s.value == 6)) if (target.StatBoost.All(s => s.value == 6))

View File

@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// After You fails if the order remains the same after using After You. /// After You fails if the order remains the same after using After You.
/// </remarks> /// </remarks>
[Script(ScriptCategory.Move, "after_you")] [Script(ScriptCategory.Move, "after_you")]
public class AfterYou : Script public class AfterYou : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var queue = move.User.BattleData!.Battle.ChoiceQueue; var queue = move.User.BattleData!.Battle.ChoiceQueue;
if (queue == null) if (queue == null)

View File

@ -18,10 +18,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// target. /// target.
/// </remarks> /// </remarks>
[Script(ScriptCategory.Move, "attract")] [Script(ScriptCategory.Move, "attract")]
public class Attract : Script public class Attract : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
if (target.Gender == move.User.Gender) if (target.Gender == move.User.Gender)
{ {

View File

@ -22,10 +22,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// If a Light Clay is held when Aurora Veil is used, it will extend the duration of Aurora Veil from 5 to 8 turns. /// If a Light Clay is held when Aurora Veil is used, it will extend the duration of Aurora Veil from 5 to 8 turns.
/// </remarks> /// </remarks>
[Script(ScriptCategory.Move, "aurora_veil")] [Script(ScriptCategory.Move, "aurora_veil")]
public class AuroraVeil : Script public class AuroraVeil : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var battle = move.User.BattleData?.Battle; var battle = move.User.BattleData?.Battle;
if (battle == null) if (battle == null)

View File

@ -17,10 +17,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// (from Generation VI onward), switches out or faints, or the battle ends. /// (from Generation VI onward), switches out or faints, or the battle ends.
/// </remarks> /// </remarks>
[Script(ScriptCategory.Move, "autotomize")] [Script(ScriptCategory.Move, "autotomize")]
public class Autotomize : Script public class Autotomize : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var user = move.User; var user = move.User;

View File

@ -2,8 +2,8 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IScriptOnBeforeMove public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IScriptOnBeforeMove,
where TVolatile : RequireChargeEffect IScriptOnSecondaryEffect where TVolatile : RequireChargeEffect
{ {
public abstract TVolatile CreateVolatile(IPokemon user); public abstract TVolatile CreateVolatile(IPokemon user);
@ -25,4 +25,9 @@ public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IS
{ {
move.User.Volatile.Remove(ScriptUtils.ResolveName<TVolatile>()); move.User.Volatile.Remove(ScriptUtils.ResolveName<TVolatile>());
} }
/// <inheritdoc />
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
}
} }

View File

@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "baton_pass")] [Script(ScriptCategory.Move, "baton_pass")]
public class BatonPass : Script public class BatonPass : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var user = move.User; var user = move.User;
var additionalData = move.MoveChoice.AdditionalData; var additionalData = move.MoveChoice.AdditionalData;

View File

@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "beak_blast")] [Script(ScriptCategory.Move, "beak_blast")]
public class BeakBlast : Script, IScriptOnBeforeTurnStart public class BeakBlast : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public void OnBeforeTurnStart(ITurnChoice choice) public void OnBeforeTurnStart(ITurnChoice choice)
@ -19,7 +19,7 @@ public class BeakBlast : Script, IScriptOnBeforeTurnStart
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
move.User.Volatile.Remove(ScriptUtils.ResolveName<BeakBlastEffect>()); move.User.Volatile.Remove(ScriptUtils.ResolveName<BeakBlastEffect>());
} }

View File

@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "beat_up")] [Script(ScriptCategory.Move, "beat_up")]
public class BeatUp : Script, IScriptChangeNumberOfHits public class BeatUp : Script, IScriptChangeNumberOfHits, IScriptChangeBasePower
{ {
private IPokemon[]? _relevantPartyMembers; private IPokemon[]? _relevantPartyMembers;
@ -26,7 +26,7 @@ public class BeatUp : Script, IScriptChangeNumberOfHits
} }
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
var relevantPartyMembers = _relevantPartyMembers ??= GetRelevantPartyMembers(move.User).ToArray(); var relevantPartyMembers = _relevantPartyMembers ??= GetRelevantPartyMembers(move.User).ToArray();
var hittingPokemon = relevantPartyMembers.ElementAtOrDefault(hit); var hittingPokemon = relevantPartyMembers.ElementAtOrDefault(hit);

View File

@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "belly_drum")] [Script(ScriptCategory.Move, "belly_drum")]
public class BellyDrum : Script public class BellyDrum : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var maxHealthHalved = target.BoostedStats.Hp / 2; var maxHealthHalved = target.BoostedStats.Hp / 2;
if (target.CurrentHealth <= maxHealthHalved) if (target.CurrentHealth <= maxHealthHalved)

View File

@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bestow")] [Script(ScriptCategory.Move, "bestow")]
public class Bestow : Script public class Bestow : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var user = move.User; var user = move.User;
var userHeldItem = user.RemoveHeldItemForBattle(); var userHeldItem = user.RemoveHeldItemForBattle();

View File

@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bide")] [Script(ScriptCategory.Move, "bide")]
public class Bide : Script public class Bide : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var bideEffect = move.User.Volatile.Get<BideEffect>(); var bideEffect = move.User.Volatile.Get<BideEffect>();
if (bideEffect == null) if (bideEffect == null)

View File

@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bind")] [Script(ScriptCategory.Move, "bind")]
public class Bind : Script public class Bind : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var args = new CustomTriggers.ModifyBindArgs(move); var args = new CustomTriggers.ModifyBindArgs(move);
move.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.ModifyBind, args)); move.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.ModifyBind, args));

View File

@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "block")] [Script(ScriptCategory.Move, "block")]
public class Block : Script public class Block : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
target.Volatile.Add(new BlockEffect()); target.Volatile.Add(new BlockEffect());
} }

View File

@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bounce")] [Script(ScriptCategory.Move, "bounce")]
public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public void PreventMove(IExecutingMove move, ref bool prevent) public void PreventMove(IExecutingMove move, ref bool prevent)
@ -26,7 +26,7 @@ public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var battle = move.User.BattleData?.Battle; var battle = move.User.BattleData?.Battle;
if (battle == null) if (battle == null)

View File

@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "brine")] [Script(ScriptCategory.Move, "brine")]
public class Brine : Script public class Brine : Script, IScriptChangeBasePower
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
if (target.CurrentHealth <= target.BoostedStats.Hp / 2) if (target.CurrentHealth <= target.BoostedStats.Hp / 2)
{ {

View File

@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bug_bite")] [Script(ScriptCategory.Move, "bug_bite")]
public class BugBite : Script public class BugBite : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var user = move.User; var user = move.User;
var battleData = user.BattleData; var battleData = user.BattleData;

View File

@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "burn_up")] [Script(ScriptCategory.Move, "burn_up")]
public class BurnUp : Script public class BurnUp : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var battleData = move.User.BattleData; var battleData = move.User.BattleData;
if (battleData == null) if (battleData == null)

View File

@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "camouflage")] [Script(ScriptCategory.Move, "camouflage")]
public class Camouflage : Script public class Camouflage : Script, IScriptOnSecondaryEffect
{ {
/// <inheritdoc /> /// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{ {
var type = GetTypeIdentifier(move.Battle); var type = GetTypeIdentifier(move.Battle);
if (type == null) if (type == null)

Some files were not shown because too many files have changed in this diff Show More