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,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "bind")]
public class BindEffect : Script
public class BindEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon? _owner;
private int _turns;
@@ -15,7 +15,7 @@ public class BindEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_owner == null)
return;

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "charge_bounce")]
public class ChargeBounceEffect : Script, IScriptForceTurnSelection
public class ChargeBounceEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
{
private readonly IPokemon _owner;
@@ -27,7 +27,7 @@ public class ChargeBounceEffect : Script, IScriptForceTurnSelection
}
/// <inheritdoc />
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_fly"))
damage *= 2;

View File

@@ -1,12 +1,12 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "charge_effect")]
public class ChargeEffect : Script
public class ChargeEffect : Script, IScriptChangeDamageModifier, IScriptOnEndTurn
{
private bool _turnOfUse = true;
/// <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 library = target.BattleData?.Battle.Library;
if (library == null)
@@ -18,7 +18,7 @@ public class ChargeEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_turnOfUse)
{

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "charge_fly")]
public class ChargeFlyEffect : Script, IScriptForceTurnSelection
public class ChargeFlyEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
{
private readonly IPokemon _owner;
@@ -27,7 +27,7 @@ public class ChargeFlyEffect : Script, IScriptForceTurnSelection
}
/// <inheritdoc />
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_fly"))
damage *= 2;

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "charge_sky_drop")]
public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection
public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
{
private readonly IPokemon _owner;
@@ -27,7 +27,7 @@ public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection
}
/// <inheritdoc />
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_fly"))
damage *= 2;

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "dig")]
public class DigEffect : Script, IScriptForceTurnSelection
public class DigEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
{
private readonly IPokemon _owner;
@@ -27,7 +27,7 @@ public class DigEffect : Script, IScriptForceTurnSelection
}
/// <inheritdoc />
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_underground"))
damage *= 2;

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "disable")]
public class DisableEffect : Script, IScriptPreventMoveSelection
public class DisableEffect : Script, IScriptPreventMoveSelection, IScriptOnEndTurn
{
private int _turnsLeft = 4;
private readonly StringKey _move;
@@ -19,7 +19,7 @@ public class DisableEffect : Script, IScriptPreventMoveSelection
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turnsLeft--;
if (_turnsLeft <= 0)

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "dive")]
public class DiveEffect : Script, IScriptForceTurnSelection
public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
{
private readonly IPokemon _owner;
@@ -27,7 +27,7 @@ public class DiveEffect : Script, IScriptForceTurnSelection
}
/// <inheritdoc />
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_underwater"))
damage *= 2;

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "embargo")]
public class EmbargoEffect : Script
public class EmbargoEffect : Script, IScriptOnEndTurn
{
private int _turns = 5;
@@ -18,7 +18,7 @@ public class EmbargoEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turns--;
if (_turns == 0)

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "encore")]
public class EncoreEffect : Script, IScriptForceTurnSelection
public class EncoreEffect : Script, IScriptForceTurnSelection, IScriptOnEndTurn
{
private readonly IPokemon _owner;
private readonly StringKey _move;
@@ -29,7 +29,7 @@ public class EncoreEffect : Script, IScriptForceTurnSelection
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turns--;
if (_turns <= 0)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "endure")]
public class EndureEffect : Script
public class EndureEffect : Script, IScriptOnEndTurn
{
/// <inheritdoc />
public override void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
@@ -11,5 +11,5 @@ public class EndureEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle) => RemoveSelf();
public void OnEndTurn(IScriptSource owner, IBattle battle) => RemoveSelf();
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "fire_spin")]
public class FireSpinEffect : Script
public class FireSpinEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon _owner;
@@ -11,7 +11,7 @@ public class FireSpinEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_owner.Damage(_owner.BoostedStats.Hp / 8, DamageSource.Misc);
}

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "flash_fire_effect")]
public class FlashFireEffect : Script
public class FlashFireEffect : Script, IScriptChangeOffensiveStatValue
{
/// <inheritdoc />
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
{
if (move.GetHitData(target, hit).Type?.Name == "fire")

View File

@@ -3,7 +3,7 @@ using PkmnLib.Static.Libraries;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "foresight")]
public class ForesightEffect : Script
public class ForesightEffect : Script, IScriptPreventStatBoostChange
{
private readonly TypeIdentifier _normalType;
private readonly TypeIdentifier _fightingType;
@@ -17,7 +17,7 @@ public class ForesightEffect : Script
}
/// <inheritdoc />
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
public void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
ref bool prevent)
{
if (stat == Statistic.Evasion)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "ghostcurse")]
public class GhostCurseEffect : Script
public class GhostCurseEffect : Script, IScriptOnEndTurn
{
private IPokemon _pokemon;
@@ -11,7 +11,7 @@ public class GhostCurseEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_pokemon.Damage(_pokemon.CurrentHealth / 4, DamageSource.Misc);
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "heal_block")]
public class HealBlockEffect : Script, IScriptPreventMoveSelection, IScriptPreventMove
public class HealBlockEffect : Script, IScriptPreventMoveSelection, IScriptPreventMove, IScriptOnEndTurn
{
private int _duration;
@@ -11,7 +11,7 @@ public class HealBlockEffect : Script, IScriptPreventMoveSelection, IScriptPreve
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_duration--;
if (_duration <= 0)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "heal_each_end_of_turn_effect")]
public class HealEachEndOfTurnEffect : Script
public class HealEachEndOfTurnEffect : Script, IScriptOnEndTurn
{
private readonly float _healPercentage;
private readonly IPokemon? _pokemon;
@@ -19,7 +19,7 @@ public class HealEachEndOfTurnEffect : Script
/// <param name="owner"></param>
/// <param name="battle"></param>
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon is null)
return;

View File

@@ -1,11 +1,11 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public class HelpingHandEffect : Script, IScriptChangeBasePower
public class HelpingHandEffect : Script, IScriptChangeBasePower, IScriptOnEndTurn
{
/// <inheritdoc />
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) =>
basePower = basePower.MultiplyOrMax(1.5f);
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle) => RemoveSelf();
public void OnEndTurn(IScriptSource owner, IBattle battle) => RemoveSelf();
}

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "ice_ball")]
public class IceBallEffect : Script, IScriptForceTurnSelection, IScriptOnMoveMiss
public class IceBallEffect : Script, IScriptForceTurnSelection, IScriptOnMoveMiss, IScriptOnEndTurn
{
private readonly IPokemon _owner;
private readonly StringKey _moveName;
@@ -30,7 +30,7 @@ public class IceBallEffect : Script, IScriptForceTurnSelection, IScriptOnMoveMis
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (TurnCount < 5)
TurnCount++;

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "infestation")]
public class InfestationEffect : Script
public class InfestationEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon _owner;
private int _turns;
@@ -19,7 +19,7 @@ public class InfestationEffect : Script
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
var damage = _owner.BoostedStats.Hp / 8;
_owner.Damage(damage, DamageSource.Misc);

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "ingrain")]
public class IngrainEffect : Script, IScriptFailIncomingMove
public class IngrainEffect : Script, IScriptFailIncomingMove, IScriptOnEndTurn
{
private readonly IPokemon _owner;
@@ -17,7 +17,7 @@ public class IngrainEffect : Script, IScriptFailIncomingMove
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
var heal = _owner.BoostedStats.Hp / 16;
_owner.Heal(heal);

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "leech_seed")]
public class LeechSeedEffect : Script
public class LeechSeedEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon _owner;
private readonly IPokemon _placer;
@@ -13,7 +13,7 @@ public class LeechSeedEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
var damage = _owner.BoostedStats.Hp / 8;
if (_owner.CurrentHealth <= damage)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "lock_on")]
public class LockOnEffect : Script
public class LockOnEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon _placer;
@@ -20,7 +20,7 @@ public class LockOnEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
RemoveSelf();
}

View File

@@ -1,6 +1,6 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public class LuckyChantEffect : Script, IScriptBlockCriticalHit
public class LuckyChantEffect : Script, IScriptBlockCriticalHit, IScriptOnEndTurn
{
private int _turnsLeft = 5;
@@ -11,7 +11,7 @@ public class LuckyChantEffect : Script, IScriptBlockCriticalHit
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turnsLeft--;
if (_turnsLeft > 0)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "magma_storm")]
public class MagmaStormEffect : Script
public class MagmaStormEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon _owner;
@@ -11,7 +11,7 @@ public class MagmaStormEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_owner.Damage(_owner.BoostedStats.Hp / 16, DamageSource.Misc);
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "magnet_rise")]
public class MagnetRiseEffect : Script, IScriptChangeEffectiveness
public class MagnetRiseEffect : Script, IScriptChangeEffectiveness, IScriptOnEndTurn
{
private int _turnsRemaining = 5;
@@ -15,7 +15,7 @@ public class MagnetRiseEffect : Script, IScriptChangeEffectiveness
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_turnsRemaining > 0)
_turnsRemaining--;

View File

@@ -1,10 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "miracle_eye")]
public class MiracleEyeEffect : Script
public class MiracleEyeEffect : Script, IScriptPreventStatBoostChange
{
/// <inheritdoc />
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
public void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
ref bool prevent)
{
if (stat == Statistic.Evasion && amount > 0)

View File

@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Status;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "nightmare")]
public class NightmareEffect : Script
public class NightmareEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon _owner;
@@ -13,7 +13,7 @@ public class NightmareEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (!_owner.HasStatus(ScriptUtils.ResolveName<Sleep>()))
{

View File

@@ -2,7 +2,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public abstract class OutrageLikeEffect : Script, IScriptForceTurnSelection
public abstract class OutrageLikeEffect : Script, IScriptForceTurnSelection, IScriptOnAfterHits
{
private readonly IPokemon _owner;
private int _turns;
@@ -26,7 +26,7 @@ public abstract class OutrageLikeEffect : Script, IScriptForceTurnSelection
}
/// <inheritdoc />
public override void OnAfterHits(IExecutingMove move, IPokemon target)
public void OnAfterHits(IExecutingMove move, IPokemon target)
{
_turns--;
if (_turns <= 0)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "perish_song")]
public class PerishSongEffect : Script
public class PerishSongEffect : Script, IScriptOnEndTurn
{
private int _turns;
private IPokemon _owner;
@@ -13,7 +13,7 @@ public class PerishSongEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turns--;
if (_turns <= 0)

View File

@@ -1,17 +1,17 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "power_trick")]
public class PowerTrickEffect : Script
public class PowerTrickEffect : Script, IScriptChangeOffensiveStatValue, IScriptChangeDefensiveStatValue
{
/// <inheritdoc />
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
{
value = defensiveStat;
}
/// <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 = offensiveStat;

View File

@@ -5,7 +5,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
/// or protect-like moves.
/// </summary>
[Script(ScriptCategory.Pokemon, "protection_failure")]
public class ProtectionFailureScript : Script, IScriptOnBeforeTurnStart
public class ProtectionFailureScript : Script, IScriptOnBeforeTurnStart, IScriptOnEndTurn
{
public int ProtectTurns { get; set; }
public bool UsedProtect { get; set; }
@@ -17,7 +17,7 @@ public class ProtectionFailureScript : Script, IScriptOnBeforeTurnStart
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (!UsedProtect)
{

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "rage")]
public class RageEffect : Script, IScriptOnIncomingHit
public class RageEffect : Script, IScriptOnIncomingHit, IScriptOnEndTurn
{
/// <inheritdoc />
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
@@ -10,7 +10,7 @@ public class RageEffect : Script, IScriptOnIncomingHit
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
RemoveSelf();
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "roost_effect")]
public class RoostEffect : Script
public class RoostEffect : Script, IScriptOnEndTurn
{
/// <inheritdoc />
public override void ChangeTypesForIncomingMove(IExecutingMove executingMove, IPokemon target, byte hitIndex,
@@ -11,5 +11,5 @@ public class RoostEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle) => RemoveSelf();
public void OnEndTurn(IScriptSource owner, IBattle battle) => RemoveSelf();
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "slow_start")]
public class SlowStartEffect : Script, IScriptChangeSpeed
public class SlowStartEffect : Script, IScriptChangeSpeed, IScriptChangeOffensiveStatValue, IScriptOnEndTurn
{
private int _turnsRemaining = 5;
@@ -12,7 +12,7 @@ public class SlowStartEffect : Script, IScriptChangeSpeed
}
/// <inheritdoc />
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
{
if (stat == Statistic.Attack)
@@ -20,7 +20,7 @@ public class SlowStartEffect : Script, IScriptChangeSpeed
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_turnsRemaining <= 0)
return;

View File

@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "taunt")]
public class TauntEffect(int turns) : Script, IScriptPreventMoveSelection, IScriptFailMove
public class TauntEffect(int turns) : Script, IScriptPreventMoveSelection, IScriptFailMove, IScriptOnEndTurn
{
private int _turns = turns;
@@ -25,7 +25,7 @@ public class TauntEffect(int turns) : Script, IScriptPreventMoveSelection, IScri
}
}
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turns--;
if (_turns <= 0)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "throat_chop")]
public class ThroatChopEffect : Script, IScriptPreventMoveSelection, IScriptFailMove
public class ThroatChopEffect : Script, IScriptPreventMoveSelection, IScriptFailMove, IScriptOnEndTurn
{
private int _turns = 3;
@@ -20,7 +20,7 @@ public class ThroatChopEffect : Script, IScriptPreventMoveSelection, IScriptFail
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turns--;
if (_turns <= 0)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "whirlpool")]
public class WhirlpoolEffect : Script
public class WhirlpoolEffect : Script, IScriptOnEndTurn
{
public record PokemonTurn
{
@@ -56,7 +56,7 @@ public class WhirlpoolEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_user == null)
return;

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "wish")]
public class WishEffect : Script
public class WishEffect : Script, IScriptOnEndTurn
{
private IPokemon? _pokemon;
private bool _hasDoneFirstTurn;
@@ -17,7 +17,7 @@ public class WishEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon == null)
return;

View File

@@ -1,12 +1,12 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "yawn")]
public class YawnEffect : Script
public class YawnEffect : Script, IScriptOnEndTurn
{
private bool _hasDoneFirstTurn;
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (owner is not IPokemon pokemon)
return;