More work on refactor to interfaces
All checks were successful
Build / Build (push) Successful in 50s

This commit is contained in:
2025-06-29 12:03:51 +02:00
parent 436d1899e0
commit 1feb27e826
173 changed files with 713 additions and 562 deletions

View File

@@ -1,13 +1,13 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "chip_away")]
public class ChipAway : Script
public class ChipAway : Script, IScriptBypassDefensiveStatBoosts, IScriptBypassEvasionStatBoosts
{
/// <inheritdoc />
public override void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
public void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
bypass = true;
/// <inheritdoc />
public override void
BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) => bypass = true;
public void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) =>
bypass = true;
}

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "counter")]
public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets
public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets, IScriptChangeMoveDamage
{
/// <inheritdoc />
public void OnBeforeTurnStart(ITurnChoice choice)
@@ -25,7 +25,7 @@ public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets
}
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var counterHelper = move.User.Volatile.Get<CounterHelperEffect>();
if (counterHelper == null || counterHelper.LastHitBy == null || counterHelper.LastHitBy != target)

View File

@@ -1,13 +1,13 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "darkest_lariat")]
public class DarkestLariat : Script
public class DarkestLariat : Script, IScriptBypassDefensiveStatBoosts, IScriptBypassEvasionStatBoosts
{
/// <inheritdoc />
public override void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
public void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
bypass = true;
/// <inheritdoc />
public override void
BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) => bypass = true;
public void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) =>
bypass = true;
}

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "echoed_voice")]
public class EchoedVoice : Script, IScriptOnSecondaryEffect
public class EchoedVoice : Script, IScriptOnSecondaryEffect, IScriptChangeDamageModifier
{
/// <inheritdoc />
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{
var battleData = move.User.BattleData;
if (battleData == null)

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "endeavor")]
public class Endeavor : Script
public class Endeavor : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var user = move.User;
var userHealth = user.CurrentHealth;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "explosion")]
public class Explosion : Script
public class Explosion : Script, IScriptOnAfterHits
{
/// <inheritdoc />
public override void OnAfterHits(IExecutingMove move, IPokemon target)
public void OnAfterHits(IExecutingMove move, IPokemon target)
{
move.User.Damage(move.User.CurrentHealth * 10, DamageSource.Misc);
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "false_swipe")]
public class FalseSwipe : Script
public class FalseSwipe : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (target.CurrentHealth - damage < 1)
{

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fell_stinger")]
public class FellStinger : Script
public class FellStinger : Script, IScriptOnAfterHits
{
/// <inheritdoc />
public override void OnAfterHits(IExecutingMove move, IPokemon target)
public void OnAfterHits(IExecutingMove move, IPokemon target)
{
if (target.IsFainted)
{

View File

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

View File

@@ -3,10 +3,10 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "foul_play")]
public class FoulPlay : Script
public class FoulPlay : Script, IScriptChangeOffensiveStatValue
{
/// <inheritdoc />
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint _,
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint _,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
{
value = move.UseMove.Category == MoveCategory.Physical

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "guardian_of_alola")]
public class GuardianOfAlola : Script
public class GuardianOfAlola : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var maxHp = target.BoostedStats.Hp;
damage = (uint)(maxHp * (3f / 4f));

View File

@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "metal_burst")]
public class MetalBurst : Script, IScriptOnBeforeTurnStart
public class MetalBurst : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDamage
{
/// <inheritdoc />
public void OnBeforeTurnStart(ITurnChoice choice)
@@ -12,7 +12,7 @@ public class MetalBurst : Script, IScriptOnBeforeTurnStart
}
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var helper = target.Volatile.Get<MetalBurstHelper>();
@@ -27,7 +27,7 @@ public class MetalBurst : Script, IScriptOnBeforeTurnStart
}
[Script(ScriptCategory.Pokemon, "metal_burst_helper")]
private class MetalBurstHelper : Script, IScriptOnIncomingHit
private class MetalBurstHelper : Script, IScriptOnIncomingHit, IScriptOnEndTurn
{
public IPokemon? LastAttacker { get; set; }
public uint LastDamage { get; set; }
@@ -42,7 +42,7 @@ public class MetalBurst : Script, IScriptOnBeforeTurnStart
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
RemoveSelf();
}

View File

@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "mirror_coat")]
public class MirrorCoat : Script, IScriptOnBeforeTurnStart
public class MirrorCoat : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDamage
{
/// <inheritdoc />
public void OnBeforeTurnStart(ITurnChoice choice)
@@ -12,7 +12,7 @@ public class MirrorCoat : Script, IScriptOnBeforeTurnStart
}
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var helper = target.Volatile.Get<MirrorCoatHelper>();
@@ -27,7 +27,7 @@ public class MirrorCoat : Script, IScriptOnBeforeTurnStart
}
[Script(ScriptCategory.Pokemon, "mirror_coat_helper")]
private class MirrorCoatHelper : Script, IScriptOnIncomingHit
private class MirrorCoatHelper : Script, IScriptOnIncomingHit, IScriptOnEndTurn
{
public IPokemon? LastAttacker { get; set; }
public uint LastDamage { get; set; }
@@ -42,7 +42,7 @@ public class MirrorCoat : Script, IScriptOnBeforeTurnStart
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
RemoveSelf();
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "natures_madness")]
public class NaturesMadness : Script
public class NaturesMadness : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var targetMaxHp = target.BoostedStats.Hp;
damage = targetMaxHp / 2;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "night_shade")]
public class NightShade : Script
public class NightShade : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
damage = move.User.Level;
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "one_hit_ko")]
public class OneHitKo : Script
public class OneHitKo : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
@@ -17,7 +17,7 @@ public class OneHitKo : Script
}
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
damage = target.BoostedStats.Hp.MultiplyOrMax(10);
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "power_trip")]
public class PowerTrip : Script
public class PowerTrip : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var modifier = 1;
foreach (Statistic stat in Enum.GetValues(typeof(Statistic)))

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "psyshock")]
public class Psyshock : Script
public class Psyshock : Script, IScriptChangeDefensiveStatValue
{
/// <inheritdoc />
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
public void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
{
value = targetStats.Defense;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "psywave")]
public class Psywave : Script
public class Psywave : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (move.User.BattleData == null)
return;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "smelling_salts")]
public class SmellingSalts : Script, IScriptOnSecondaryEffect
public class SmellingSalts : Script, IScriptOnSecondaryEffect, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
// If the target is paralyzed, double the damage
if (target.HasStatus(ScriptUtils.ResolveName<Status.Paralyzed>()))

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "static_damage")]
public class StaticDamage : Script, IScriptOnInitialize
public class StaticDamage : Script, IScriptOnInitialize, IScriptChangeMoveDamage
{
private uint Damage { get; set; }
@@ -24,7 +24,7 @@ public class StaticDamage : Script, IScriptOnInitialize
}
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
damage = Damage;
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "super_fang")]
public class SuperFang : Script
public class SuperFang : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
// Super Fang always does 50% of the target's current HP
damage = target.CurrentHealth / 2;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "venoshock")]
public class Venoshock : Script
public class Venoshock : Script, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (target.HasStatus(ScriptUtils.ResolveName<Status.Poisoned>()) ||
target.HasStatus(ScriptUtils.ResolveName<Status.BadlyPoisoned>()))