Further work on refactor to interface based scripts

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

View File

@@ -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);

View File

@@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// to raise a stat that is already maximized, meaning that the move will fail if all stats are maximized
/// </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))

View File

@@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// After You fails if the order remains the same after using After You.
/// </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)

View File

@@ -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)
{

View File

@@ -22,10 +22,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// If a Light Clay is held when Aurora Veil is used, it will extend the duration of Aurora Veil from 5 to 8 turns.
/// </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)

View File

@@ -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;

View File

@@ -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)
{
}
}

View File

@@ -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;

View File

@@ -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>());
}

View File

@@ -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);

View File

@@ -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)

View File

@@ -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();

View File

@@ -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)

View File

@@ -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));

View File

@@ -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());
}

View File

@@ -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)

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -3,10 +3,10 @@ using PkmnLib.Static.Species;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "captivate")]
public class Captivate : Script
public class Captivate : 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;
if (target.Gender == Gender.Genderless || target.Gender == user.Gender)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "change_all_target_stats")]
public class ChangeAllTargetStats : Script, IScriptOnInitialize
public class ChangeAllTargetStats : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private sbyte _amount;
@@ -20,7 +20,7 @@ public class ChangeAllTargetStats : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.ChangeStatBoost(Statistic.Attack, _amount, target == move.User, false);
target.ChangeStatBoost(Statistic.Defense, _amount, target == move.User, false);

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "change_multiple_target_stat_boosts")]
public class ChangeMultipleTargetStatBoosts : Script, IScriptOnInitialize
public class ChangeMultipleTargetStatBoosts : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private Dictionary<Statistic, sbyte> _statBoosts = new();
@@ -25,7 +25,7 @@ public class ChangeMultipleTargetStatBoosts : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId batchId = new();
foreach (var stat in _statBoosts)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "change_multiple_user_stat_boosts")]
public class ChangeMultipleUserStatBoosts : Script, IScriptOnInitialize
public class ChangeMultipleUserStatBoosts : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private Dictionary<Statistic, sbyte> _statBoosts = new();
@@ -25,7 +25,7 @@ public class ChangeMultipleUserStatBoosts : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId batchId = new();
foreach (var stat in _statBoosts)

View File

@@ -1,6 +1,6 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public abstract class ChangeTargetStats : Script, IScriptOnInitialize
public abstract class ChangeTargetStats : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private readonly Statistic _stat;
private sbyte _amount;
@@ -27,7 +27,7 @@ public abstract class ChangeTargetStats : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.ChangeStatBoost(_stat, _amount, target == move.User, false);
}

View File

@@ -1,6 +1,6 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public abstract class ChangeUserStats : Script, IScriptOnInitialize
public abstract class ChangeUserStats : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private readonly Statistic _stat;
private sbyte _amount;
@@ -27,7 +27,7 @@ public abstract class ChangeUserStats : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
move.User.ChangeStatBoost(_stat, _amount, true, false);
}

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "charge")]
public class Charge : Script
public class Charge : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
move.User.ChangeStatBoost(Statistic.SpecialDefense, 1, true, false);
move.User.Volatile.Add(new ChargeEffect());

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "confuse")]
public class Confuse : Script
public class Confuse : 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 Confusion());
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "conversion")]
public class Conversion : Script
public class Conversion : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var moveType = move.User.Moves.WhereNotNull().FirstOrDefault()?.MoveData.MoveType;
if (moveType == null)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "conversion_2")]
public class Conversion2 : Script
public class Conversion2 : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var previousTurnChoices = target.BattleData?.Battle.PreviousTurnChoices;
var nextExecutingChoice = target.BattleData?.Battle.ChoiceQueue?.Peek();

View File

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

View File

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

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "crafty_shield")]
public class CraftyShield : Script
public class CraftyShield : 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)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "crush_grip")]
public class CrushGrip : Script
public class CrushGrip : 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 = Math.Max((byte)(120 * target.CurrentHealth / target.BoostedStats.Hp), (byte)1);
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "cure_party_status")]
public class CurePartyStatus : Script
public class CurePartyStatus : 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 battle = user.BattleData?.Battle;

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "curse")]
public class Curse : Script
public class Curse : 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)

View File

@@ -4,7 +4,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "defog")]
public class Defog : Script
public class Defog : Script, IScriptOnSecondaryEffect
{
[PublicAPI] public static HashSet<StringKey> DefoggedEffects =
[
@@ -19,7 +19,7 @@ public class Defog : Script
];
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (target.BattleData == null)
return;

View File

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

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "disable")]
public class Disable : Script
public class Disable : 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)

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "dive")]
public class Dive : Script, IScriptPreventMove
public class Dive : Script, IScriptPreventMove, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public void PreventMove(IExecutingMove move, ref bool prevent)
@@ -20,7 +20,7 @@ public class Dive : Script, IScriptPreventMove
}
/// <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<DiveEffect>());
}

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "double_power_if_target_damaged_in_turn")]
public class DoublePowerIfTargetDamagedInTurn : Script, IScriptOnBeforeTurnStart
public class DoublePowerIfTargetDamagedInTurn : Script, IScriptOnBeforeTurnStart, IScriptChangeBasePower
{
/// <inheritdoc />
public void OnBeforeTurnStart(ITurnChoice choice)
@@ -19,7 +19,7 @@ public class DoublePowerIfTargetDamagedInTurn : Script, IScriptOnBeforeTurnStart
}
/// <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 battle = move.User.BattleData?.Battle;
if (battle == null)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "dragon_ascent")]
public class DragonAscent : Script
public class DragonAscent : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId batchId = new();
move.User.ChangeStatBoost(Statistic.Defense, -1, true, false, batchId);

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "drain")]
public class Drain : Script, IScriptOnInitialize
public class Drain : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
public float DrainModifier { get; set; } = 0.5f;
@@ -14,7 +14,7 @@ public class Drain : Script, IScriptOnInitialize
}
/// <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 damage = move.GetHitData(target, hit).Damage;

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "dream_eater")]
public class DreamEater : Script
public class DreamEater : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
@@ -11,7 +11,7 @@ public class DreamEater : Script
}
/// <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 damage = move.GetHitData(target, hit).Damage;

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "echoed_voice")]
public class EchoedVoice : Script
public class EchoedVoice : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
@@ -20,7 +20,7 @@ public class EchoedVoice : Script
}
/// <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)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "electric_terrain")]
public class ElectricTerrain : Script
public class ElectricTerrain : 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;
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.ElectricTerrain>());

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "electrify")]
public class Electrify : Script
public class Electrify : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var choiceQueue = target.BattleData?.Battle.ChoiceQueue;
if (choiceQueue == null)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "electro_ball")]
public class ElectroBall : Script
public class ElectroBall : 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)
{
var user = move.User;
var targetSpeed = target.BoostedStats.Speed;

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "embargo")]
public class Embargo : Script
public class Embargo : 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 EmbargoEffect());
}

View File

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

View File

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

View File

@@ -1,9 +1,9 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "eruption")]
public class Eruption : Script
public class Eruption : Script, IScriptChangeBasePower
{
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 = Math.Max((byte)(150 * move.User.CurrentHealth / move.User.BoostedStats.Hp), (byte)1);
}

View File

@@ -1,15 +1,15 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "facade")]
public class Facade : Script
public class Facade : 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)
{
var status = move.User.StatusScript.Script?.Name;
if (status == "paralyzed" || status == "burned" || status == "poisoned")
{
basePower.MultiplyOrMax(2);
basePower = basePower.MultiplyOrMax(2);
}
}
}

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Battle;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fairy_lock")]
public class FairyLock : Script
public class FairyLock : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battle = target.BattleData?.Battle;
battle?.Volatile.Add(new FairyLockEffect());

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fake_out")]
public class FakeOut : Script, IScriptStopBeforeMove
public class FakeOut : Script, IScriptStopBeforeMove, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public void StopBeforeMove(IExecutingMove move, ref bool stop)
@@ -16,7 +16,7 @@ public class FakeOut : Script, IScriptStopBeforeMove
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.Volatile.Add(new FlinchEffect());
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "final_gambit")]
public class FinalGambit : Script
public class FinalGambit : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
@@ -10,7 +10,7 @@ public class FinalGambit : Script
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
move.User.Damage(move.User.CurrentHealth * 10, DamageSource.Misc);
}

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flail")]
public class Flail : Script
public class Flail : 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)
{
var remainingHealth = move.User.CurrentHealth / move.User.BoostedStats.Hp;
var fraction = remainingHealth * 48;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flame_burst")]
public class FlameBurst : Script
public class FlameBurst : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var adjacentFoes = GetAdjacentFoes(move.User).WhereNotNull();
EventBatchId batchId = new();

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flame_wheel")]
public class FlameWheel : Script, IScriptOnInitialize
public class FlameWheel : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private float _burnChance;
@@ -17,7 +17,7 @@ public class FlameWheel : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (move.User.HasStatus("frozen"))
{

View File

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

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flatter")]
public class Flatter : Script
public class Flatter : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.ChangeStatBoost(Statistic.SpecialAttack, 1, false, false);
target.Volatile.StackOrAdd("confusion", () => new Confusion());

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flinch")]
public class Flinch : Script
public class Flinch : 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 FlinchEffect());
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fling")]
public class Fling : Script
public class Fling : Script, IScriptOnSecondaryEffect, 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)
{
var item = move.User.HeldItem;
if (item == null)
@@ -29,6 +29,6 @@ public class Fling : Script
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) =>
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) =>
move.User.RemoveHeldItemForBattle();
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "floral_healing")]
public class FloralHealing : Script
public class FloralHealing : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (target.IsFainted)
return;

View File

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

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "focus_energy")]
public class FocusEnergy : Script
public class FocusEnergy : 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 Pokemon.IncreasedCriticalStage());
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "force_critical")]
public class ForceCritical : Script
public class ForceCritical : 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)
{
stage = 100;
}

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "freeze_dry")]
public class FreezeDry : Script
public class FreezeDry : Script, IScriptChangeEffectiveness, IScriptOnSecondaryEffect
{
/// <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)
{
var battleData = target.BattleData;
if (battleData == null)
@@ -23,7 +23,7 @@ public class FreezeDry : Script
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = target.BattleData;
if (battleData == null)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "frustration")]
public class Frustration : Script
public class Frustration : 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)
{
var friendship = move.User.Happiness;
basePower = Math.Max((byte)1, (byte)((255 - friendship) * 2 / 5));

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fury_cutter")]
public class FuryCutter : Script
public class FuryCutter : 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)
{
var userEffect = move.User.Volatile.Get<FuryCutterEffect>();
if (userEffect == null)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "gastro_acid")]
public class GastroAcid : Script
public class GastroAcid : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.SuppressAbility();
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "gear_up")]
public class GearUp : Script
public class GearUp : 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)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "genesis_supernova")]
public class GenesisSupernova : Script
public class GenesisSupernova : 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)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "grass_knot")]
public class GrassKnot : Script
public class GrassKnot : 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)
{
var targetWeight = target.WeightInKg;
basePower = targetWeight switch

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "grassy_terrain")]
public class GrassyTerrain : Script
public class GrassyTerrain : 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;
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.GrassyTerrain>());

View File

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

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Weather;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "growth")]
public class Growth : Script
public class Growth : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId batchId = new();
sbyte amount = 1;

View File

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

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "guard_split")]
public class GuardSplit : Script
public class GuardSplit : 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 userStats = user.FlatStats;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "guard_swap")]
public class GuardSwap : Script
public class GuardSwap : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId eventBatchId = new();

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "gyro_ball")]
public class GyroBall : Script
public class GyroBall : 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 = Math.Min((byte)150, (byte)(25 * target.BoostedStats.Speed / move.User.BoostedStats.Speed + 1));
}

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heal_bell")]
public class HealBell : Script
public class HealBell : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var party = move.User.BattleData?.Battle.Parties.FirstOrDefault(p => p.Party.Contains(target));
if (party == null)

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heal_block")]
public class HealBlock : Script
public class HealBlock : 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 HealBlockEffect());
}

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heal_each_end_of_turn")]
public class HealEachEndOfTurn : Script, IScriptOnInitialize
public class HealEachEndOfTurn : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private float _healPercentage;
@@ -22,7 +22,7 @@ public class HealEachEndOfTurn : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var effectName = ScriptUtils.ResolveName<HealEachEndOfTurnEffect>();
if (target.Volatile.Contains(effectName))

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heal_percent")]
public class HealPercent : Script, IScriptOnInitialize
public class HealPercent : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
{
private float _healPercent = 0.5f;
@@ -15,7 +15,7 @@ public class HealPercent : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var args = new CustomTriggers.ModifyHealPercentArgs(move, target, hit, _healPercent);
move.RunScriptHook(x => x.CustomTrigger(CustomTriggers.ModifyHealPercent, args));

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "healing_wish")]
public class HealingWish : Script
public class HealingWish : 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)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heart_swap")]
public class HeartSwap : Script
public class HeartSwap : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId eventBatchId = new();
var userStats = move.User.StatBoost;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heat_crash")]
public class HeatCrash : Script
public class HeatCrash : 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)
{
var weightMultiplier = move.User.WeightInKg / target.WeightInKg;
basePower = weightMultiplier switch

View File

@@ -3,9 +3,9 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "helping_hand")]
public class HelpingHand : Script
public class HelpingHand : 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 HelpingHandEffect());
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "hex")]
public class Hex : Script
public class Hex : 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.StatusScript.IsEmpty)
{

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "hidden_power")]
public class HiddenPower : Script
public class HiddenPower : Script, IScriptChangeMoveType, IScriptChangeBasePower
{
/// <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 ivs = move.User.IndividualValues;
@@ -15,7 +15,7 @@ public class HiddenPower : 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)
{
var ivs = move.User.IndividualValues;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "high_jump_kick")]
public class HighJumpKick : Script
public class HighJumpKick : Script, IScriptOnMoveMiss
{
/// <inheritdoc />
public override void OnMoveMiss(IExecutingMove move, IPokemon target)
public void OnMoveMiss(IExecutingMove move, IPokemon target)
{
var damage = move.GetHitData(target, 0).Damage;
var recoil = damage / 2;

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "hyperspace_fury")]
public class HyperspaceFury : Script
public class HyperspaceFury : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var protectionScripts = target.Volatile.Select(x => x.Script).OfType<ProtectionEffectScript>();
foreach (var protectionScript in protectionScripts.ToList())

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "ice_ball")]
public class IceBall : Script
public class IceBall : Script, IScriptOnSecondaryEffect, 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)
{
var userEffect = move.User.Volatile.Get<IceBallEffect>();
if (userEffect == null)
@@ -16,7 +16,7 @@ public class IceBall : Script
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var userEffect = move.User.Volatile.Get<IceBallEffect>();
if (userEffect == null)

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "ice_fang")]
public class IceFang : Script
public class IceFang : 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)

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "imprison")]
public class Imprison : Script
public class Imprison : 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 ImprisonEffect(move.User));
}

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