Further work on refactor to interface based scripts
This commit is contained in:
parent
b7bdf2b744
commit
436d1899e0
@ -126,7 +126,8 @@ public static class MoveTurnExecutor
|
||||
private static void ExecuteMoveChoiceForTarget(IBattle battle, IExecutingMove executingMove, IPokemon target)
|
||||
{
|
||||
var failed = false;
|
||||
target.RunScriptHook(x => x.FailIncomingMove(executingMove, target, ref failed));
|
||||
target.RunScriptHookInterface<IScriptFailIncomingMove>(x =>
|
||||
x.FailIncomingMove(executingMove, target, ref failed));
|
||||
if (failed)
|
||||
{
|
||||
// TODO: fail handling
|
||||
@ -134,7 +135,8 @@ public static class MoveTurnExecutor
|
||||
}
|
||||
|
||||
var isInvulnerable = false;
|
||||
target.RunScriptHook(x => x.IsInvulnerableToMove(executingMove, target, ref isInvulnerable));
|
||||
target.RunScriptHookInterface<IScriptIsInvulnerableToMove>(x =>
|
||||
x.IsInvulnerableToMove(executingMove, target, ref isInvulnerable));
|
||||
if (isInvulnerable)
|
||||
{
|
||||
battle.EventHook.Invoke(new MoveInvulnerableEvent(executingMove, target));
|
||||
@ -166,7 +168,8 @@ public static class MoveTurnExecutor
|
||||
hitData.IsContact = isContact;
|
||||
|
||||
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;
|
||||
|
||||
@ -177,14 +180,17 @@ public static class MoveTurnExecutor
|
||||
var effectiveness = hitType == null
|
||||
? 1
|
||||
: battle.Library.StaticLibrary.Types.GetEffectiveness(hitType.Value, types);
|
||||
executingMove.RunScriptHook(x => x.ChangeEffectiveness(executingMove, target, hitIndex, ref effectiveness));
|
||||
target.RunScriptHook(x =>
|
||||
executingMove.RunScriptHookInterface<IScriptChangeEffectiveness>(x =>
|
||||
x.ChangeEffectiveness(executingMove, target, hitIndex, ref effectiveness));
|
||||
target.RunScriptHookInterface<IScriptChangeIncomingEffectiveness>(x =>
|
||||
x.ChangeIncomingEffectiveness(executingMove, target, hitIndex, ref effectiveness));
|
||||
hitData.Effectiveness = effectiveness;
|
||||
|
||||
var blockCritical = false;
|
||||
executingMove.RunScriptHook(x => x.BlockCriticalHit(executingMove, target, hitIndex, ref blockCritical));
|
||||
target.RunScriptHook(x => x.BlockIncomingCriticalHit(executingMove, target, hitIndex, ref blockCritical));
|
||||
executingMove.RunScriptHookInterface<IScriptBlockCriticalHit>(x =>
|
||||
x.BlockCriticalHit(executingMove, target, hitIndex, ref blockCritical));
|
||||
target.RunScriptHookInterface<IScriptBlockIncomingCriticalHit>(x =>
|
||||
x.BlockIncomingCriticalHit(executingMove, target, hitIndex, ref blockCritical));
|
||||
if (!blockCritical)
|
||||
{
|
||||
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)
|
||||
{
|
||||
executingMove.RunScriptHook(x => x.OnMoveMiss(executingMove, target));
|
||||
executingMove.RunScriptHookInterface<IScriptOnMoveMiss>(x => x.OnMoveMiss(executingMove, target));
|
||||
battle.EventHook.Invoke(new MoveMissEvent(executingMove));
|
||||
break;
|
||||
}
|
||||
@ -230,7 +236,8 @@ public static class MoveTurnExecutor
|
||||
var chance = secondaryEffect.Chance;
|
||||
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);
|
||||
if (!target.IsFainted)
|
||||
target.RunScriptHook(x => x.OnIncomingHit(executingMove, target, hitIndex));
|
||||
target.RunScriptHookInterface<IScriptOnIncomingHit>(x =>
|
||||
x.OnIncomingHit(executingMove, target, hitIndex));
|
||||
else
|
||||
executingMove.RunScriptHook(x => x.OnOpponentFaints(executingMove, target, hitIndex));
|
||||
executingMove.RunScriptHookInterface<IScriptOnOpponentFaints>(x =>
|
||||
x.OnOpponentFaints(executingMove, target, hitIndex));
|
||||
|
||||
if (!target.IsFainted)
|
||||
{
|
||||
@ -273,13 +282,14 @@ public static class MoveTurnExecutor
|
||||
var chance = secondaryEffect.Chance;
|
||||
if (chance < 0 || battle.Random.EffectChance(chance, executingMove, target, hitIndex))
|
||||
{
|
||||
executingMove.RunScriptHook(x =>
|
||||
executingMove.RunScriptHookInterface<IScriptOnSecondaryEffect>(x =>
|
||||
x.OnSecondaryEffect(executingMove, target, hitIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
target.RunScriptHook(x => x.OnMoveMiss(executingMove, target));
|
||||
target.RunScriptHookInterface<IScriptOnMoveMiss>(x => x.OnMoveMiss(executingMove, target));
|
||||
battle.EventHook.Invoke(new MoveMissEvent(executingMove));
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
/// 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
|
||||
@ -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>
|
||||
/// This function allows a script attached to a Pokemon or its parents to prevent stat boost
|
||||
/// 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>
|
||||
/// This function triggers on a move or its parents when all hits on a target are finished.
|
||||
/// </summary>
|
||||
@ -911,3 +787,190 @@ public interface IScriptOnAfterMove
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
@ -52,7 +52,7 @@ public class Gen7BattleStatCalculator : IBattleStatCalculator
|
||||
byte moveAccuracy)
|
||||
{
|
||||
var accuracyModifier = 1.0f;
|
||||
executingMove.RunScriptHook(x =>
|
||||
executingMove.RunScriptHookInterface<IScriptChangeAccuracyModifier>(x =>
|
||||
x.ChangeAccuracyModifier(executingMove, target, hitIndex, ref accuracyModifier));
|
||||
var modifiedAccuracy = (int)(moveAccuracy * accuracyModifier);
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
|
@ -29,7 +29,7 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
if (hitData.IsCritical)
|
||||
{
|
||||
var critModifier = 1.5f;
|
||||
executingMove?.RunScriptHook(script =>
|
||||
executingMove?.RunScriptHookInterface<IScriptChangeCriticalModifier>(script =>
|
||||
script.ChangeCriticalModifier(executingMove, target, hitNumber, ref critModifier));
|
||||
floatDamage = MathF.Floor(floatDamage * critModifier);
|
||||
}
|
||||
@ -51,7 +51,7 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
stabModifier = 1.5f;
|
||||
isStab = true;
|
||||
}
|
||||
executingMove?.RunScriptHook(script =>
|
||||
executingMove?.RunScriptHookInterface<IScriptChangeStabModifier>(script =>
|
||||
script.ChangeStabModifier(executingMove, target, hitNumber, isStab, ref stabModifier));
|
||||
floatDamage = MathF.Floor(floatDamage * stabModifier);
|
||||
|
||||
@ -80,7 +80,8 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
if (executingMove.UseMove.Category == MoveCategory.Status)
|
||||
return 0;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -90,7 +91,7 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
|
||||
if (executingMove.UseMove.Category == MoveCategory.Status)
|
||||
return false;
|
||||
byte critStage = 0;
|
||||
executingMove.RunScriptHook(script =>
|
||||
executingMove.RunScriptHookInterface<IScriptChangeCriticalStage>(script =>
|
||||
script.ChangeCriticalStage(executingMove, target, hitNumber, ref critStage));
|
||||
|
||||
var random = battle.Random;
|
||||
|
@ -7,12 +7,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aftermath_(Ability)">Bulbapedia - Aftermath</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "aftermath")]
|
||||
public class Aftermath : Script
|
||||
public class Aftermath : Script, IScriptOnIncomingHit
|
||||
{
|
||||
private IExecutingMove? _lastAttack;
|
||||
|
||||
/// <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;
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Anger_Point_(Ability)">Bulbapedia - Anger Point</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "anger_point")]
|
||||
public class AngerPoint : Script
|
||||
public class AngerPoint : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Battle_Bond_(Ability)">Bulbapedia - Battle Bond</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "battle_bond")]
|
||||
public class BattleBond : Script, IScriptChangeNumberOfHits
|
||||
public class BattleBond : Script, IScriptChangeNumberOfHits, IScriptOnOpponentFaints, IScriptChangeBasePower
|
||||
{
|
||||
/// <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" &&
|
||||
move.User.Species.TryGetForm("ash", out var ashForm))
|
||||
@ -21,7 +21,7 @@ public class BattleBond : Script, IScriptChangeNumberOfHits
|
||||
}
|
||||
|
||||
/// <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")
|
||||
basePower = 20;
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Beast_Boost_(Ability)">Bulbapedia - Beast Boost</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "beast_boost")]
|
||||
public class BeastBoost : Script
|
||||
public class BeastBoost : Script, IScriptOnOpponentFaints
|
||||
{
|
||||
/// <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;
|
||||
EventBatchId batchId = new();
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Bulletproof_(Ability)">Bulbapedia - Bulletproof</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "bulletproof")]
|
||||
public class Bulletproof : Script
|
||||
public class Bulletproof : Script, IScriptFailIncomingMove
|
||||
{
|
||||
/// <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"))
|
||||
fail = true;
|
||||
|
@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Refrigerate_(Ability)">Bulbapedia - Refrigerate</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "change_move_type")]
|
||||
public class ChangeMoveTypeAbility : Script, IScriptOnInitialize
|
||||
public class ChangeMoveTypeAbility : Script, IScriptOnInitialize, IScriptChangeMoveType, IScriptChangeBasePower
|
||||
{
|
||||
private StringKey _fromType;
|
||||
private StringKey _toType;
|
||||
@ -29,8 +29,7 @@ public class ChangeMoveTypeAbility : Script, IScriptOnInitialize
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref TypeIdentifier? typeIdentifier)
|
||||
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
|
||||
{
|
||||
var typeLibrary = target.Library.StaticLibrary.Types;
|
||||
// Both types must be valid and the current type must match the from type
|
||||
@ -45,7 +44,7 @@ public class ChangeMoveTypeAbility : Script, IScriptOnInitialize
|
||||
}
|
||||
|
||||
/// <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"))
|
||||
basePower = basePower.MultiplyOrMax(1.3f);
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Color_Change_(Ability)">Bulbapedia - Color Change</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "color_change")]
|
||||
public class ColorChange : Script
|
||||
public class ColorChange : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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);
|
||||
if (hitData.Type != null && (hitData.Type != target.Types.FirstOrDefault() || target.Types.Count > 1))
|
||||
|
@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cursed_Body_(Ability)">Bulbapedia - Cursed Body</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "cursed_body")]
|
||||
public class CursedBody : Script
|
||||
public class CursedBody : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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
|
||||
if (move.Battle.Random.GetFloat() > 0.3f)
|
||||
|
@ -11,10 +11,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cute_Charm_(Ability)">Bulbapedia - Cute Charm</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "cute_charm")]
|
||||
public class CuteCharm : Script
|
||||
public class CuteCharm : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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
|
||||
if (!move.GetHitData(target, hit).IsContact)
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Damp_(Ability)">Bulbapedia - Damp</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "damp")]
|
||||
public class Damp : Script
|
||||
public class Damp : Script, IScriptFailIncomingMove
|
||||
{
|
||||
/// <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")
|
||||
{
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dazzling_(Ability)">Bulbapedia - Dazzling</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "dazzling")]
|
||||
public class Dazzling : Script
|
||||
public class Dazzling : Script, IScriptFailIncomingMove
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Effect_Spore_(Ability)">Bulbapedia - Effect Spore</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "effect_spore")]
|
||||
public class EffectSpore : Script
|
||||
public class EffectSpore : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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"))
|
||||
return;
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flame_Body_(Ability)">Bulbapedia - Flame Body</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "flame_body")]
|
||||
public class FlameBody : Script
|
||||
public class FlameBody : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flash_Fire_(Ability)">Bulbapedia - Flash Fire</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "flash_fire")]
|
||||
public class FlashFire : Script
|
||||
public class FlashFire : Script, IScriptChangeIncomingEffectiveness
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
public void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref float effectiveness)
|
||||
{
|
||||
if (executingMove.GetHitData(target, hitIndex).Type?.Name != "fire")
|
||||
|
@ -7,11 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Galvanize_(Ability)">Bulbapedia - Galvanize</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "galvanize")]
|
||||
public class Galvanize : Script
|
||||
public class Galvanize : Script, IScriptChangeMoveType
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref TypeIdentifier? typeIdentifier)
|
||||
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
|
||||
{
|
||||
if (typeIdentifier?.Name == "normal" &&
|
||||
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType))
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Gooey_(Ability)">Bulbapedia - Gooey</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "gooey")]
|
||||
public class Gooey : Script
|
||||
public class Gooey : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Heatproof_(Ability)">Bulbapedia - Heatproof</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "heatproof")]
|
||||
public class Heatproof : Script
|
||||
public class Heatproof : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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")
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Illusion_(Ability)">Bulbapedia - Illusion</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "illusion")]
|
||||
public class Illusion : Script
|
||||
public class Illusion : Script, IScriptOnIncomingHit
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@ -43,7 +43,7 @@ public class Illusion : Script
|
||||
}
|
||||
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Adaptability_(Ability)">Bulbapedia - Adaptability</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "increased_stab")]
|
||||
public class IncreasedStab : Script
|
||||
public class IncreasedStab : Script, IScriptChangeStabModifier
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
if (!isStab || !modifier.IsApproximatelyEqualTo(1.5f))
|
||||
|
@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Innards_Out_(Ability)">Bulbapedia - Innards Out</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "innards_out")]
|
||||
public class InnardsOut : Script
|
||||
public class InnardsOut : Script, IScriptOnIncomingHit
|
||||
{
|
||||
private IPokemon? _lastPokemonToHit;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
_lastPokemonToHit = move.User;
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Iron_Barbs_(Ability)">Bulbapedia - Iron Barbs</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "iron_barbs")]
|
||||
public class IronBarbs : Script
|
||||
public class IronBarbs : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Iron_Fist_(Ability)">Bulbapedia - Iron Fist</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "iron_fist")]
|
||||
public class IronFist : Script
|
||||
public class IronFist : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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"))
|
||||
basePower = basePower.MultiplyOrMax(1.2f);
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Justified_(Ability)">Bulbapedia - Justified</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "justified")]
|
||||
public class Justified : Script
|
||||
public class Justified : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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")
|
||||
return;
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Lightning_Rod_(Ability)">Bulbapedia - Lightning Rod</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "lightning_rod")]
|
||||
public class LightningRod : Script, IScriptChangeIncomingTargets
|
||||
public class LightningRod : Script, IScriptChangeIncomingTargets, IScriptChangeEffectiveness
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
@ -18,7 +18,7 @@ public class LightningRod : Script, IScriptChangeIncomingTargets
|
||||
}
|
||||
|
||||
/// <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")
|
||||
return;
|
||||
|
@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Liquid_Voice_(Ability)">Bulbapedia - Liquid Voice</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "liquid_voice")]
|
||||
public class LiquidVoice : Script
|
||||
public class LiquidVoice : Script, IScriptChangeMoveType
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref TypeIdentifier? typeIdentifier)
|
||||
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
|
||||
{
|
||||
if (move.UseMove.HasFlag("sound") &&
|
||||
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("water", out var waterType))
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magician_(Ability)">Bulbapedia - Magician</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "magician")]
|
||||
public class Magician : Script
|
||||
public class Magician : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Mega_Launcher_(Ability)">Bulbapedia - Mega Launcher</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "mega_launcher")]
|
||||
public class MegaLauncher : Script
|
||||
public class MegaLauncher : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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"))
|
||||
{
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Merciless_(Ability)">Bulbapedia - Merciless</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "merciless")]
|
||||
public class Merciless : Script
|
||||
public class Merciless : Script, IScriptChangeCriticalStage
|
||||
{
|
||||
/// <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>() ||
|
||||
target.StatusScript.Script?.Name == ScriptUtils.ResolveName<BadlyPoisoned>())
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Motor_Drive_(Ability)">Bulbapedia - Motor Drive</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "motor_drive")]
|
||||
public class MotorDrive : Script
|
||||
public class MotorDrive : Script, IScriptIsInvulnerableToMove
|
||||
{
|
||||
/// <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")
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Moxie_(Ability)">Bulbapedia - Moxie</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "moxie")]
|
||||
public class Moxie : Script
|
||||
public class Moxie : Script, IScriptOnOpponentFaints
|
||||
{
|
||||
/// <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);
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Mummy_(Ability)">Bulbapedia - Mummy</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "mummy")]
|
||||
public class Mummy : Script
|
||||
public class Mummy : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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" ||
|
||||
!move.Battle.Library.StaticLibrary.Abilities.TryGet("mummy", out var mummyAbility))
|
||||
|
@ -6,18 +6,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Normalize_(Ability)">Bulbapedia - Normalize</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "normalize")]
|
||||
public class Normalize : Script
|
||||
public class Normalize : Script, IScriptChangeMoveType, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref TypeIdentifier? typeIdentifier)
|
||||
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
|
||||
{
|
||||
if (move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("normal", out var normalType))
|
||||
typeIdentifier = normalType;
|
||||
}
|
||||
|
||||
/// <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")
|
||||
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Overcoat_(Ability)">Bulbapedia - Overcoat</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "overcoat")]
|
||||
public class Overcoat : Script
|
||||
public class Overcoat : Script, IScriptIsInvulnerableToMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
||||
@ -23,7 +23,7 @@ public class Overcoat : Script
|
||||
}
|
||||
|
||||
/// <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"))
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(Ability)">Bulbapedia - Parental Bond</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "parental_bond")]
|
||||
public class ParentalBond : Script, IScriptChangeNumberOfHits
|
||||
public class ParentalBond : Script, IScriptChangeNumberOfHits, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
@ -16,7 +16,7 @@ public class ParentalBond : Script, IScriptChangeNumberOfHits
|
||||
}
|
||||
|
||||
/// <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)
|
||||
basePower = (ushort)(basePower / 4);
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pickpocket_(Ability)">Bulbapedia - Pickpocket</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "pickpocket")]
|
||||
public class Pickpocket : Script
|
||||
public class Pickpocket : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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 ||
|
||||
!move.User.TryStealHeldItem(out var item))
|
||||
|
@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pixilate_(Ability)">Bulbapedia - Pixilate</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "pixilate")]
|
||||
public class Pixilate : Script
|
||||
public class Pixilate : Script, IScriptChangeMoveType, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref TypeIdentifier? typeIdentifier)
|
||||
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
|
||||
{
|
||||
if (typeIdentifier?.Name == "normal" &&
|
||||
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("fairy", out var fairyType))
|
||||
@ -18,7 +17,7 @@ public class Pixilate : Script
|
||||
}
|
||||
|
||||
/// <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")
|
||||
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Point_(Ability)">Bulbapedia - Poison Point</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "poison_point")]
|
||||
public class PoisonPoint : Script
|
||||
public class PoisonPoint : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), move.User);
|
||||
|
@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Touch_(Ability)">Bulbapedia - Poison Touch</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "poison_touch")]
|
||||
public class PoisonTouch : Script
|
||||
public class PoisonTouch : Script, IScriptOnIncomingHit
|
||||
{
|
||||
private const int PoisonChance = 30;
|
||||
|
||||
/// <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)
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), target);
|
||||
|
@ -9,9 +9,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(Ability)">Bulbapedia - Shell Armor</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "prevent_critical")]
|
||||
public class PreventCritical : Script
|
||||
public class PreventCritical : Script, IScriptBlockIncomingCriticalHit
|
||||
{
|
||||
/// <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;
|
||||
}
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Queenly_Majesty_(Ability)">Bulbapedia - Queenly Majesty</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "queenly_majesty")]
|
||||
public class QueenlyMajesty : Script
|
||||
public class QueenlyMajesty : Script, IScriptFailIncomingMove
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rattled_(Ability)">Bulbapedia - Rattled</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "rattled")]
|
||||
public class Rattled : Script
|
||||
public class Rattled : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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;
|
||||
if (type is null)
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Reckless_(Ability)">Bulbapedia - Reckless</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "reckless")]
|
||||
public class Reckless : Script
|
||||
public class Reckless : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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"))
|
||||
{
|
||||
|
@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Refrigerate_(Ability)">Bulbapedia - Refrigerate</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "refrigerate")]
|
||||
public class Refrigerate : Script
|
||||
public class Refrigerate : Script, IScriptChangeMoveType, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref TypeIdentifier? typeIdentifier)
|
||||
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
|
||||
{
|
||||
if (typeIdentifier?.Name == "normal" &&
|
||||
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("ice", out var iceType))
|
||||
@ -18,7 +17,7 @@ public class Refrigerate : Script
|
||||
}
|
||||
|
||||
/// <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")
|
||||
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rivalry_(Ability)">Bulbapedia - Rivalry</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "rivalry")]
|
||||
public class Rivalry : Script
|
||||
public class Rivalry : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rough_Skin_(Ability)">Bulbapedia - Rough Skin</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "rough_skin")]
|
||||
public class RoughSkin : Script
|
||||
public class RoughSkin : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Force_(Ability)">Bulbapedia - Sand Force</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sand_force")]
|
||||
public class SandForce : Script
|
||||
public class SandForce : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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>())
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sap_Sipper_(Ability)">Bulbapedia - Sap Sipper</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sap_sipper")]
|
||||
public class SapSipper : Script
|
||||
public class SapSipper : Script, IScriptIsInvulnerableToMove
|
||||
{
|
||||
/// <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")
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sheer_Force_(Ability)">Bulbapedia - Sheer Force</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sheer_force")]
|
||||
public class SheerForce : Script
|
||||
public class SheerForce : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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);
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(Ability)">Bulbapedia - Shell Armor</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "shell_armor")]
|
||||
public class ShellArmor : Script
|
||||
public class ShellArmor : Script, IScriptBlockIncomingCriticalHit
|
||||
{
|
||||
/// <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;
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sniper_(Ability)">Bulbapedia - Sniper</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sniper")]
|
||||
public class Sniper : Script
|
||||
public class Sniper : Script, IScriptChangeCriticalModifier
|
||||
{
|
||||
/// <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;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soul-Heart_(Ability)">Bulbapedia - Soul-Heart</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "soul_heart")]
|
||||
public class SoulHeart : Script
|
||||
public class SoulHeart : Script, IScriptOnOpponentFaints
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
||||
@ -15,7 +15,7 @@ public class SoulHeart : Script
|
||||
}
|
||||
|
||||
/// <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);
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soundproof_(Ability)">Bulbapedia - Soundproof</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "soundproof")]
|
||||
public class Soundproof : Script
|
||||
public class Soundproof : Script, IScriptIsInvulnerableToMove
|
||||
{
|
||||
/// <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"))
|
||||
invulnerable = true;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stakeout_(Ability)">Bulbapedia - Stakeout</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "stakeout")]
|
||||
public class Stakeout : Script
|
||||
public class Stakeout : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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)
|
||||
basePower = basePower.MultiplyOrMax(2);
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stamina_(Ability)">Bulbapedia - Stamina</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "stamina")]
|
||||
public class Stamina : Script
|
||||
public class Stamina : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
EventBatchId batchId = new();
|
||||
if (target.ChangeStatBoost(Statistic.Defense, 1, true, false, batchId))
|
||||
|
@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Static_(Ability)">Bulbapedia - Static</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "static")]
|
||||
public class Static : Script
|
||||
public class Static : Script, IScriptOnIncomingHit
|
||||
{
|
||||
private const int ChanceToParalyze = 30;
|
||||
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stench_(Ability)">Bulbapedia - Stench</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "stench")]
|
||||
public class Stench : Script
|
||||
public class Stench : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Storm_Drain_(Ability)">Bulbapedia - Storm Drain</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "storm_drain")]
|
||||
public class StormDrain : Script, IScriptChangeIncomingTargets
|
||||
public class StormDrain : Script, IScriptChangeIncomingTargets, IScriptChangeEffectiveness
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
@ -18,7 +18,7 @@ public class StormDrain : Script, IScriptChangeIncomingTargets
|
||||
}
|
||||
|
||||
/// <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")
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Strong_Jaw_(Ability)">Bulbapedia - Strong Jaw</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "strong_jaw")]
|
||||
public class StrongJaw : Script
|
||||
public class StrongJaw : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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"))
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Super_Luck_(Ability)">Bulbapedia - Super Luck</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "super_luck")]
|
||||
public class SuperLuck : Script
|
||||
public class SuperLuck : Script, IScriptChangeCriticalStage
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Tangling_Hair_(Ability)">Bulbapedia - Tangling Hair</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "tangling_hair")]
|
||||
public class TanglingHair : Script
|
||||
public class TanglingHair : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Technician_(Ability)">Bulbapedia - Technician</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "technician")]
|
||||
public class Technician : Script
|
||||
public class Technician : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Telepathy_(Ability)">Bulbapedia - Telepathy</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "telepathy")]
|
||||
public class Telepathy : Script
|
||||
public class Telepathy : Script, IScriptIsInvulnerableToMove
|
||||
{
|
||||
/// <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)
|
||||
invulnerable = true;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Volt_Absorb_(Ability)">Bulbapedia - Volt Absorb</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "volt_absorb")]
|
||||
public class VoltAbsorb : Script
|
||||
public class VoltAbsorb : Script, IScriptIsInvulnerableToMove
|
||||
{
|
||||
/// <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")
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Absorb_(Ability)">Bulbapedia - Water Absorb</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "water_absorb")]
|
||||
public class WaterAbsorb : Script
|
||||
public class WaterAbsorb : Script, IScriptIsInvulnerableToMove
|
||||
{
|
||||
/// <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")
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Compaction_(Ability)">Bulbapedia - Water Compaction</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "water_compaction")]
|
||||
public class WaterCompaction : Script
|
||||
public class WaterCompaction : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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")
|
||||
return;
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Weak_Armor_(Ability)">Bulbapedia - Weak Armor</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "weak_armor")]
|
||||
public class WeakArmor : Script
|
||||
public class WeakArmor : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <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)
|
||||
return;
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "gravity")]
|
||||
public class Gravity : Script
|
||||
public class Gravity : Script, IScriptFailIncomingMove
|
||||
{
|
||||
private int _turns = 5;
|
||||
|
||||
@ -18,7 +18,7 @@ public class Gravity : Script
|
||||
}
|
||||
|
||||
/// <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"))
|
||||
fail = true;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Move, "ion_deluge")]
|
||||
public class IonDelugeEffect : Script
|
||||
public class IonDelugeEffect : Script, IScriptChangeMoveType
|
||||
{
|
||||
/// <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" &&
|
||||
target.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType))
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "mud_sport")]
|
||||
public class MudSportEffect : Script
|
||||
public class MudSportEffect : Script, IScriptChangeBasePower
|
||||
{
|
||||
private int _turnsLeft = 5;
|
||||
|
||||
/// <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")
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "uproar_effect")]
|
||||
public class UproarEffect : Script, IScriptOnBeforeTurnStart
|
||||
public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect
|
||||
{
|
||||
private IPokemon? _placer;
|
||||
private bool _hasUsedUproar;
|
||||
@ -30,7 +30,7 @@ public class UproarEffect : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
/// <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")
|
||||
_hasUsedUproar = true;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "electrify")]
|
||||
public class ElectrifyEffect : Script
|
||||
public class ElectrifyEffect : Script, IScriptChangeMoveType
|
||||
{
|
||||
/// <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;
|
||||
if (battleData == null)
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "fire_grass_pledge")]
|
||||
public class FireGrassPledgeMove : Script, IScriptChangeMove
|
||||
public class FireGrassPledgeMove : Script, IScriptChangeMove, IScriptOnSecondaryEffect, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
@ -12,13 +12,13 @@ public class FireGrassPledgeMove : Script, IScriptChangeMove
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
|
||||
/// <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());
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "fire_water_pledge")]
|
||||
public class FireWaterPledgeMove : Script, IScriptChangeMove
|
||||
public class FireWaterPledgeMove : Script, IScriptChangeMove, IScriptOnSecondaryEffect, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
@ -12,13 +12,13 @@ public class FireWaterPledgeMove : Script, IScriptChangeMove
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
|
||||
/// <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());
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "grass_water_pledge")]
|
||||
public class GrassWaterPledgeMove : Script, IScriptChangeMove
|
||||
public class GrassWaterPledgeMove : Script, IScriptChangeMove, IScriptOnSecondaryEffect, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
@ -12,13 +12,13 @@ public class GrassWaterPledgeMove : Script, IScriptChangeMove
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
|
||||
/// <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());
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "me_first")]
|
||||
public class MeFirstPowerBoost : Script
|
||||
public class MeFirstPowerBoost : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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);
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "round")]
|
||||
public class RoundPowerBoost : Script
|
||||
public class RoundPowerBoost : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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);
|
||||
}
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
/// Does double base power if the user is not holding an item.
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "acrobatics")]
|
||||
public class Acrobatics : Script
|
||||
public class Acrobatics : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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)
|
||||
basePower = basePower.MultiplyOrMax(2);
|
||||
|
@ -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
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "acupressure")]
|
||||
public class Acupressure : Script
|
||||
public class Acupressure : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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 (target.StatBoost.All(s => s.value == 6))
|
||||
|
@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
/// After You fails if the order remains the same after using After You.
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "after_you")]
|
||||
public class AfterYou : Script
|
||||
public class AfterYou : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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;
|
||||
if (queue == null)
|
||||
|
@ -18,10 +18,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
/// target.
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "attract")]
|
||||
public class Attract : Script
|
||||
public class Attract : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
|
@ -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.
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "aurora_veil")]
|
||||
public class AuroraVeil : Script
|
||||
public class AuroraVeil : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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;
|
||||
if (battle == null)
|
||||
|
@ -17,10 +17,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
/// (from Generation VI onward), switches out or faints, or the battle ends.
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "autotomize")]
|
||||
public class Autotomize : Script
|
||||
public class Autotomize : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
|
||||
|
@ -2,8 +2,8 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
where TVolatile : RequireChargeEffect
|
||||
public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IScriptOnBeforeMove,
|
||||
IScriptOnSecondaryEffect where TVolatile : RequireChargeEffect
|
||||
{
|
||||
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>());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
}
|
||||
}
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "baton_pass")]
|
||||
public class BatonPass : Script
|
||||
public class BatonPass : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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 additionalData = move.MoveChoice.AdditionalData;
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "beak_blast")]
|
||||
public class BeakBlast : Script, IScriptOnBeforeTurnStart
|
||||
public class BeakBlast : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
@ -19,7 +19,7 @@ public class BeakBlast : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
/// <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>());
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "beat_up")]
|
||||
public class BeatUp : Script, IScriptChangeNumberOfHits
|
||||
public class BeatUp : Script, IScriptChangeNumberOfHits, IScriptChangeBasePower
|
||||
{
|
||||
private IPokemon[]? _relevantPartyMembers;
|
||||
|
||||
@ -26,7 +26,7 @@ public class BeatUp : Script, IScriptChangeNumberOfHits
|
||||
}
|
||||
|
||||
/// <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 hittingPokemon = relevantPartyMembers.ElementAtOrDefault(hit);
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "belly_drum")]
|
||||
public class BellyDrum : Script
|
||||
public class BellyDrum : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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;
|
||||
if (target.CurrentHealth <= maxHealthHalved)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bestow")]
|
||||
public class Bestow : Script
|
||||
public class Bestow : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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 userHeldItem = user.RemoveHeldItemForBattle();
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bide")]
|
||||
public class Bide : Script
|
||||
public class Bide : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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>();
|
||||
if (bideEffect == null)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bind")]
|
||||
public class Bind : Script
|
||||
public class Bind : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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);
|
||||
move.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.ModifyBind, args));
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "block")]
|
||||
public class Block : Script
|
||||
public class Block : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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());
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bounce")]
|
||||
public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
@ -26,7 +26,7 @@ public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
}
|
||||
|
||||
/// <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;
|
||||
if (battle == null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "brine")]
|
||||
public class Brine : Script
|
||||
public class Brine : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bug_bite")]
|
||||
public class BugBite : Script
|
||||
public class BugBite : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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 battleData = user.BattleData;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "burn_up")]
|
||||
public class BurnUp : Script
|
||||
public class BurnUp : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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;
|
||||
if (battleData == null)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "camouflage")]
|
||||
public class Camouflage : Script
|
||||
public class Camouflage : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <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);
|
||||
if (type == null)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user