More work on refactor to interfaces
All checks were successful
Build / Build (push) Successful in 50s
All checks were successful
Build / Build (push) Successful in 50s
This commit is contained in:
@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "aroma_veil")]
|
||||
public class AromaVeilEffect : Script, IScriptFailIncomingMove
|
||||
public class AromaVeilEffect : Script, IScriptFailIncomingMove, IScriptPreventIncomingSecondaryEffect
|
||||
{
|
||||
private HashSet<IPokemon> _placers = new();
|
||||
|
||||
@@ -24,8 +24,7 @@ public class AromaVeilEffect : Script, IScriptFailIncomingMove
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref bool prevent)
|
||||
public void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
|
||||
{
|
||||
if (move.UseMove.HasFlag("mental"))
|
||||
prevent = true;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
/// 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.Side, "aurora_veil")]
|
||||
public class AuroraVeilEffect : Script
|
||||
public class AuroraVeilEffect : Script, IScriptChangeIncomingMoveDamage, IScriptOnEndTurn
|
||||
{
|
||||
public int NumberOfTurns { get; set; }
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AuroraVeilEffect : 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 (NumberOfTurns > 0)
|
||||
NumberOfTurns--;
|
||||
@@ -46,7 +46,7 @@ public class AuroraVeilEffect : Script
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
var hitData = move.GetHitData(target, hit);
|
||||
if (hitData.IsCritical)
|
||||
|
||||
@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "battery")]
|
||||
public class BatteryAbilityEffect : Script
|
||||
public class BatteryAbilityEffect : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
private HashSet<IPokemon> _placers = new();
|
||||
|
||||
@@ -17,7 +17,7 @@ public class BatteryAbilityEffect : Script
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Special)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "doom_desire_effect")]
|
||||
public class DoomDesireEffect : Script
|
||||
public class DoomDesireEffect : Script, IScriptOnEndTurn
|
||||
{
|
||||
private class Target
|
||||
{
|
||||
@@ -36,7 +36,7 @@ public class DoomDesireEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_side == null)
|
||||
return;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "double_power_if_target_damaged_in_turn_data")]
|
||||
public class DoublePowerIfTargetDamagedInTurnData : Script
|
||||
public class DoublePowerIfTargetDamagedInTurnData : Script, IScriptOnEndTurn
|
||||
{
|
||||
public readonly HashSet<IPokemon> HitPokemon = [];
|
||||
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="battle"></param>
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
/// Just here to indicate that a Pokemon on this side has used Echoed Voice.
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Side, "echoed_voice_data")]
|
||||
public class EchoedVoiceData : Script
|
||||
public class EchoedVoiceData : Script, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "flower_gift")]
|
||||
public class FlowerGiftEffect : Script
|
||||
public class FlowerGiftEffect : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
private readonly HashSet<IPokemon> _placerPokemon = [];
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FlowerGiftEffect : Script
|
||||
}
|
||||
|
||||
/// <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.Battle.WeatherName != ScriptUtils.ResolveName<Weather.HarshSunlight>())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "flower_veil")]
|
||||
public class FlowerVeilEffect : Script
|
||||
public class FlowerVeilEffect : Script, IScriptPreventStatBoostChange
|
||||
{
|
||||
private readonly HashSet<IPokemon> _placerPokemon = [];
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FlowerVeilEffect : 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 (selfInflicted)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "friend_guard")]
|
||||
public class FriendGuardEffect : Script
|
||||
public class FriendGuardEffect : Script, IScriptChangeIncomingMoveDamage
|
||||
{
|
||||
private readonly HashSet<IPokemon> _placerPokemon = [];
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FriendGuardEffect : Script
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
var modifier = Math.Pow(0.75f, _placerPokemon.Count);
|
||||
damage = (uint)(damage * modifier);
|
||||
|
||||
@@ -3,12 +3,12 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "light_screen")]
|
||||
public class LightScreenEffect(int turns) : Script
|
||||
public class LightScreenEffect(int turns) : Script, IScriptChangeIncomingMoveDamage, IScriptOnEndTurn
|
||||
{
|
||||
private int _turns = turns;
|
||||
|
||||
/// <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.Category != MoveCategory.Special ||
|
||||
// Critical hits are not affected by the barrier
|
||||
@@ -23,7 +23,7 @@ public class LightScreenEffect(int turns) : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_turns -= 1;
|
||||
if (_turns <= 0)
|
||||
|
||||
@@ -2,7 +2,7 @@ using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
public class MatBlockEffect : Script
|
||||
public class MatBlockEffect : Script, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
@@ -12,7 +12,7 @@ public class MatBlockEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "mist")]
|
||||
public class MistEffect : Script
|
||||
public class MistEffect : 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 (amount < 0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
public class QuickGuardEffect : Script, IScriptIsInvulnerableToMove
|
||||
public class QuickGuardEffect : Script, IScriptIsInvulnerableToMove, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <inheritdoc />
|
||||
@@ -11,7 +11,7 @@ public class QuickGuardEffect : Script, IScriptIsInvulnerableToMove
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "rage_powder")]
|
||||
public class RagePowderEffect : Script, IScriptChangeIncomingTargets
|
||||
public class RagePowderEffect : Script, IScriptChangeIncomingTargets, IScriptOnEndTurn
|
||||
{
|
||||
public IPokemon User { get; set; }
|
||||
|
||||
@@ -21,7 +21,7 @@ public class RagePowderEffect : Script, IScriptChangeIncomingTargets
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "rainbow_effect")]
|
||||
public class RainbowEffect : Script
|
||||
public class RainbowEffect : Script, IScriptChangeEffectChance, IScriptOnEndTurn
|
||||
{
|
||||
private int _turns = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance)
|
||||
public void ChangeEffectChance(IExecutingMove move, IPokemon target, byte hit, ref float chance)
|
||||
{
|
||||
chance *= 2;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_turns--;
|
||||
if (_turns <= 0)
|
||||
|
||||
@@ -3,12 +3,12 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "reflect")]
|
||||
public class ReflectEffect(int turns) : Script
|
||||
public class ReflectEffect(int turns) : Script, IScriptChangeIncomingMoveDamage, IScriptOnEndTurn
|
||||
{
|
||||
private int _turns = turns;
|
||||
|
||||
/// <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)
|
||||
{
|
||||
var hitData = move.GetHitData(target, hit);
|
||||
if (move.UseMove.Category != MoveCategory.Physical)
|
||||
@@ -27,7 +27,7 @@ public class ReflectEffect(int turns) : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_turns > 0)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "sea_of_fire_effect")]
|
||||
public class SeaOfFireEffect : Script
|
||||
public class SeaOfFireEffect : Script, IScriptOnEndTurn
|
||||
{
|
||||
private int _turns = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (owner is not IBattleSide side)
|
||||
return;
|
||||
|
||||
@@ -2,7 +2,7 @@ using PkmnLib.Dynamic.BattleFlow;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
public class SpotlightEffect : Script, IScriptChangeIncomingTargets
|
||||
public class SpotlightEffect : Script, IScriptChangeIncomingTargets, IScriptOnEndTurn
|
||||
{
|
||||
private readonly byte _position;
|
||||
private readonly IBattleSide _side;
|
||||
@@ -25,7 +25,7 @@ public class SpotlightEffect : Script, IScriptChangeIncomingTargets
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "swamp_effect")]
|
||||
public class SwampEffect : Script, IScriptChangeSpeed
|
||||
public class SwampEffect : Script, IScriptChangeSpeed, IScriptOnEndTurn
|
||||
{
|
||||
private int _turns = 5;
|
||||
|
||||
@@ -12,7 +12,7 @@ public class SwampEffect : Script, IScriptChangeSpeed
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_turns--;
|
||||
if (_turns <= 0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "tailwind")]
|
||||
public class TailwindEffect : Script, IScriptChangeSpeed
|
||||
public class TailwindEffect : Script, IScriptChangeSpeed, IScriptOnEndTurn
|
||||
{
|
||||
private int _duration = 3;
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TailwindEffect : Script, IScriptChangeSpeed
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
_duration--;
|
||||
if (_duration <= 0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "teravolt")]
|
||||
public class TeravoltEffect : Script, IScriptOnBeforeAnyHookInvoked
|
||||
public class TeravoltEffect : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnEndTurn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
||||
@@ -11,7 +11,7 @@ public class TeravoltEffect : Script, IScriptOnBeforeAnyHookInvoked
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "wide_guard")]
|
||||
public class WideGuardEffect : Script, IScriptChangeTargets
|
||||
public class WideGuardEffect : Script, IScriptChangeTargets, IScriptOnEndTurn
|
||||
{
|
||||
private IBattleSide? _side;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class WideGuardEffect : Script, IScriptChangeTargets
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user