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

@@ -64,7 +64,8 @@ public class Gen7BattleStatCalculator : IBattleStatCalculator
return 255;
var targetEvasion = target.StatBoost.Evasion;
var ignoreEvasion = false;
executingMove.RunScriptHook(x => x.BypassEvasionStatBoosts(executingMove, target, hitIndex, ref ignoreEvasion));
executingMove.RunScriptHookInterface<IScriptBypassEvasionStatBoosts>(x =>
x.BypassEvasionStatBoosts(executingMove, target, hitIndex, ref ignoreEvasion));
if (ignoreEvasion)
targetEvasion = 0;
var userAccuracy = executingMove.User.StatBoost.Accuracy;

View File

@@ -65,9 +65,9 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
if (executingMove is not null)
{
executingMove.RunScriptHook(script =>
executingMove.RunScriptHookInterface<IScriptChangeMoveDamage>(script =>
script.ChangeMoveDamage(executingMove, target, hitNumber, ref damage));
target.RunScriptHook(script =>
target.RunScriptHookInterface<IScriptChangeIncomingMoveDamage>(script =>
script.ChangeIncomingMoveDamage(executingMove, target, hitNumber, ref damage));
}
@@ -120,14 +120,14 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
// move is critical, and the target has a defensive stat boost of > 0, but a script is
// allowed to change this.
var bypassDefense = hitData.IsCritical && target.StatBoost.GetStatistic(defensive) > 0;
executingMove?.RunScriptHook(script =>
executingMove?.RunScriptHookInterface<IScriptBypassDefensiveStatBoosts>(script =>
script.BypassDefensiveStatBoosts(executingMove, target, hitNumber, ref bypassDefense));
// Check if we can bypass the offensive stat boost on the user. We default to this if the
// move is critical, and the user has an offensive stat boost of < 0, but a script is
// allowed to change this.
var bypassOffense = hitData.IsCritical && user.StatBoost.GetStatistic(offensive) < 0;
executingMove?.RunScriptHook(script =>
executingMove?.RunScriptHookInterface<IScriptBypassOffensiveStatBoosts>(script =>
script.BypassOffensiveStatBoosts(executingMove, target, hitNumber, ref bypassOffense));
var userStats = user.BoostedStats;
@@ -143,18 +143,22 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
if (executingMove != null)
{
executingMove.RunScriptHook(script => script.ChangeOffensiveStatValue(executingMove, target, hitNumber,
defensiveStat, targetStats, offensive, ref offensiveStat));
executingMove.RunScriptHook(script => script.ChangeDefensiveStatValue(executingMove, target, hitNumber,
origOffensiveStat, targetStats, defensive, ref defensiveStat));
target.RunScriptHook(script => script.ChangeIncomingMoveOffensiveStatValue(executingMove, target, hitNumber,
defensiveStat, targetStats, offensive, ref offensiveStat));
target.RunScriptHook(script => script.ChangeIncomingMoveDefensiveStatValue(executingMove, target, hitNumber,
origOffensiveStat, targetStats, defensive, ref defensiveStat));
executingMove.RunScriptHookInterface<IScriptChangeOffensiveStatValue>(script =>
script.ChangeOffensiveStatValue(executingMove, target, hitNumber, defensiveStat, targetStats, offensive,
ref offensiveStat));
executingMove.RunScriptHookInterface<IScriptChangeDefensiveStatValue>(script =>
script.ChangeDefensiveStatValue(executingMove, target, hitNumber, origOffensiveStat, targetStats,
defensive, ref defensiveStat));
target.RunScriptHookInterface<IScriptChangeIncomingMoveOffensiveStatValue>(script =>
script.ChangeIncomingMoveOffensiveStatValue(executingMove, target, hitNumber, defensiveStat,
targetStats, offensive, ref offensiveStat));
target.RunScriptHookInterface<IScriptChangeIncomingMoveDefensiveStatValue>(script =>
script.ChangeIncomingMoveDefensiveStatValue(executingMove, target, hitNumber, origOffensiveStat,
targetStats, defensive, ref defensiveStat));
}
var modifier = (float)offensiveStat / defensiveStat;
executingMove?.RunScriptHook(script =>
executingMove?.RunScriptHookInterface<IScriptChangeDamageStatModifier>(script =>
script.ChangeDamageStatModifier(executingMove, target, hitNumber, ref modifier));
return modifier;
@@ -168,9 +172,9 @@ public class Gen7DamageCalculator(Gen7PluginConfiguration configuration) : IDama
{
var modifier = 1.0f;
executingMove.RunScriptHook(script =>
executingMove.RunScriptHookInterface<IScriptChangeDamageModifier>(script =>
script.ChangeDamageModifier(executingMove, target, hitNumber, ref modifier));
target.RunScriptHook(script =>
target.RunScriptHookInterface<IScriptChangeIncomingMoveDamageModifier>(script =>
script.ChangeIncomingMoveDamageModifier(executingMove, target, hitNumber, ref modifier));
return modifier;

View File

@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Analytic_(Ability)">Bulbapedia - Analytic</see>
/// </summary>
[Script(ScriptCategory.Ability, "analytic")]
public class Analytic : Script
public class Analytic : 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)
{
if (move.Battle.ChoiceQueue?.HasNext() == false)
{

View File

@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Bad_Dreams_(Ability)">Bulbapedia - Bad Dreams</see>
/// </summary>
[Script(ScriptCategory.Ability, "bad_dreams")]
public class BadDreams : Script
public class BadDreams : Script, IScriptOnEndTurn
{
private IPokemon? _owner;
@@ -20,7 +20,7 @@ public class BadDreams : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_owner is null)
return;

View File

@@ -7,11 +7,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Competitive_(Ability)">Bulbapedia - Competitive</see>
/// </summary>
[Script(ScriptCategory.Ability, "competitive")]
public class Competitive : Script
public class Competitive : Script, IScriptOnAfterStatBoostChange
{
/// <inheritdoc />
/// <inheritdoc />
public override void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
public void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
{
if (change >= 0)
return;

View File

@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Contrary_(Ability)">Bulbapedia - Contrary</see>
/// </summary>
[Script(ScriptCategory.Ability, "contrary")]
public class Contrary : Script
public class Contrary : Script, IScriptChangeStatBoostChange
{
/// <inheritdoc />
public override void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
public void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
{
// Invert the stat change
amount = (sbyte)-amount;

View File

@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dark_Aura_(Ability)">Bulbapedia - Dark Aura</see>
/// </summary>
[Script(ScriptCategory.Ability, "dark_aura")]
public class DarkAura : Script
public class DarkAura : 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)
{
if (move.GetHitData(target, hit).Type?.Name == "dark")
{

View File

@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Defeatist_(Ability)">Bulbapedia - Defeatist</see>
/// </summary>
[Script(ScriptCategory.Ability, "defeatist")]
public class Defeatist : Script
public class Defeatist : 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)
{
if (move.User.CurrentHealth < move.User.MaxHealth / 2)
{

View File

@@ -7,11 +7,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Defiant_(Ability)">Bulbapedia - Defiant</see>
/// </summary>
[Script(ScriptCategory.Ability, "defiant")]
public class Defiant : Script
public class Defiant : Script, IScriptOnAfterStatBoostChange
{
/// <inheritdoc />
/// <inheritdoc />
public override void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
public void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change)
{
if (change >= 0)
return;

View File

@@ -8,7 +8,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dry_Skin_(Ability)">Bulbapedia - Dry Skin</see>
/// </summary>
[Script(ScriptCategory.Ability, "dry_skin")]
public class DrySkin : Script
public class DrySkin : Script, IScriptChangeDamageModifier, IScriptOnEndTurn
{
private IPokemon? _owningPokemon;
@@ -23,7 +23,7 @@ public class DrySkin : 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)
{
var hitType = move.GetHitData(target, hit).Type;
if (hitType?.Name == "fire")
@@ -39,7 +39,7 @@ public class DrySkin : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_owningPokemon == null)
return;

View File

@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fairy_Aura_(Ability)">Bulbapedia - Fairy Aura</see>
/// </summary>
[Script(ScriptCategory.Ability, "fairy_aura")]
public class FairyAura : Script
public class FairyAura : 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)
{
if (move.GetHitData(target, hit).Type?.Name == "fairy")
{

View File

@@ -7,11 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Filter_(Ability)">Bulbapedia - Filter</see>
/// </summary>
[Script(ScriptCategory.Ability, "filter")]
public class Filter : Script
public class Filter : Script, IScriptChangeIncomingMoveDamageModifier
{
/// <inheritdoc />
public override void ChangeIncomingMoveDamageModifier(IExecutingMove move, IPokemon target, byte hit,
ref float modifier)
public void ChangeIncomingMoveDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{
if (move.GetHitData(target, hit).Effectiveness >= 2.0f)
{

View File

@@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flare_Boost_(Ability)">Bulbapedia - Flare Boost</see>
/// </summary>
[Script(ScriptCategory.Ability, "flare_boost")]
public class FlareBoost : Script
public class FlareBoost : 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)
{
if (!move.User.HasStatus(ScriptUtils.ResolveName<Status.Burned>()))
return;

View File

@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fluffy_(Ability)">Bulbapedia - Fluffy</see>
/// </summary>
[Script(ScriptCategory.Ability, "fluffy")]
public class Fluffy : Script
public class Fluffy : 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)
{
if (move.GetHitData(target, hit).Type?.Name == "fire")
{

View File

@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Full_Metal_Body_(Ability)">Bulbapedia - Full Metal Body</see>
/// </summary>
[Script(ScriptCategory.Ability, "full_metal_body")]
public class FullMetalBody : Script
public class FullMetalBody : 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 (selfInflicted)

View File

@@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fur_Coat_(Ability)">Bulbapedia - Fur Coat</see>
/// </summary>
[Script(ScriptCategory.Ability, "fur_coat")]
public class FurCoat : Script
public class FurCoat : Script, IScriptChangeIncomingMoveDamage
{
/// <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.Physical)
{

View File

@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Galvanize_(Ability)">Bulbapedia - Galvanize</see>
/// </summary>
[Script(ScriptCategory.Ability, "galvanize")]
public class Galvanize : Script, IScriptChangeMoveType
public class Galvanize : Script, IScriptChangeMoveType, IScriptChangeDamageModifier
{
/// <inheritdoc />
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
@@ -20,7 +20,7 @@ public class Galvanize : Script, IScriptChangeMoveType
}
/// <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.GetHitData(target, hit).Type?.Name == "electric")
modifier *= 1.2f;

View File

@@ -7,11 +7,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Grass_Pelt_(Ability)">Bulbapedia - Grass Pelt</see>
/// </summary>
[Script(ScriptCategory.Ability, "grass_pelt")]
public class GrassPelt : Script
public class GrassPelt : Script, IScriptChangeIncomingMoveDefensiveStatValue
{
/// <inheritdoc />
public override void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit,
uint offensiveStat, StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
public void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
{
if (move.Battle.TerrainName == ScriptUtils.ResolveName<Terrain.GrassyTerrain>() && stat == Statistic.Defense)
value = value.MultiplyOrMax(1.5f);

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Guts_(Ability)">Bulbapedia - Guts</see>
/// </summary>
[Script(ScriptCategory.Ability, "guts")]
public class Guts : Script
public class Guts : 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 (target.StatusScript.IsEmpty)

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Harvest_(Ability)">Bulbapedia - Harvest</see>
/// </summary>
[Script(ScriptCategory.Ability, "harvest")]
public class Harvest : Script
public class Harvest : Script, IScriptOnEndTurn
{
private IPokemon? _pokemon;
@@ -19,7 +19,7 @@ public class Harvest : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon?.BattleData is null)
return;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Healer_(Ability)">Bulbapedia - Healer</see>
/// </summary>
[Script(ScriptCategory.Ability, "healer")]
public class Healer : Script
public class Healer : Script, IScriptOnEndTurn
{
private IPokemon? _pokemon;
@@ -19,7 +19,7 @@ public class Healer : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon?.BattleData is null)
return;

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Huge_Power_(Ability)">Bulbapedia - Huge Power</see>
/// </summary>
[Script(ScriptCategory.Ability, "huge_power")]
public class HugePower : Script
public class HugePower : 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 (stat == Statistic.Attack)

View File

@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Hustle_(Ability)">Bulbapedia - Hustle</see>
/// </summary>
[Script(ScriptCategory.Ability, "hustle")]
public class Hustle : Script
public class Hustle : 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 (stat != Statistic.Attack)

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Hydration_(Ability)">Bulbapedia - Hydration</see>
/// </summary>
[Script(ScriptCategory.Ability, "hydration")]
public class Hydration : Script
public class Hydration : Script, IScriptOnEndTurn
{
private IPokemon? _pokemon;
@@ -19,7 +19,7 @@ public class Hydration : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon is null)
return;

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Hyper_Cutter_(Ability)">Bulbapedia - Hyper Cutter</see>
/// </summary>
[Script(ScriptCategory.Ability, "hyper_cutter")]
public class HyperCutter : Script
public class HyperCutter : 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.Attack)

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Ice_Body_(Ability)">Bulbapedia - Ice Body</see>
/// </summary>
[Script(ScriptCategory.Ability, "ice_body")]
public class IceBody : Script
public class IceBody : Script, IScriptOnEndTurn
{
private IPokemon? _pokemon;
@@ -19,7 +19,7 @@ public class IceBody : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon is null)
return;

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Keen_Eye_(Ability)">Bulbapedia - Keen Eye</see>
/// </summary>
[Script(ScriptCategory.Ability, "keen_eye")]
public class KeenEye : Script
public class KeenEye : 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.Accuracy && amount < 0)

View File

@@ -6,11 +6,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Marvel_Scale_(Ability)">Bulbapedia - Marvel Scale</see>
/// </summary>
[Script(ScriptCategory.Ability, "marvel_scale")]
public class MarvelScale : Script
public class MarvelScale : Script, IScriptChangeIncomingMoveDefensiveStatValue
{
/// <inheritdoc />
public override void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit,
uint offensiveStat, StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
public void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
{
if (!target.StatusScript.IsEmpty && stat == Statistic.Defense)
{

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Minus_(Ability)">Bulbapedia - Minus</see>
/// </summary>
[Script(ScriptCategory.Ability, "minus")]
public class Minus : Script
public class Minus : 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)
{
var battleData = move.User.BattleData;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Moody_(Ability)">Bulbapedia - Moody</see>
/// </summary>
[Script(ScriptCategory.Ability, "moody")]
public class Moody : Script
public class Moody : Script, IScriptOnEndTurn
{
private IPokemon? _pokemon;
@@ -19,7 +19,7 @@ public class Moody : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon == null)
return;

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Multiscale_(Ability)">Bulbapedia - Multiscale</see>
/// </summary>
[Script(ScriptCategory.Ability, "multiscale")]
public class Multiscale : Script
public class Multiscale : Script, IScriptChangeIncomingMoveDamage
{
/// <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 (target.CurrentHealth == target.BoostedStats.Hp)
{

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Plus_(Ability)">Bulbapedia - Plus</see>
/// </summary>
[Script(ScriptCategory.Ability, "plus")]
public class Plus : Script
public class Plus : 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)
{
var battleData = move.User.BattleData;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Power_Construct_(Ability)">Bulbapedia - Power Construct</see>
/// </summary>
[Script(ScriptCategory.Ability, "power_construct")]
public class PowerConstruct : Script
public class PowerConstruct : Script, IScriptOnEndTurn
{
private IPokemon? _pokemon;
@@ -19,7 +19,7 @@ public class PowerConstruct : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_pokemon?.BattleData?.Battle == null)
return;

View File

@@ -11,7 +11,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Swarm_(Ability)">Bulbapedia - Swarm</see>
/// </summary>
[Script(ScriptCategory.Ability, "power_up_type_at_low_health")]
public class PowerUpTypeAtLowHealth : Script, IScriptOnInitialize
public class PowerUpTypeAtLowHealth : Script, IScriptOnInitialize, IScriptChangeDamageModifier
{
private StringKey _type;
private float _threshold;
@@ -35,7 +35,7 @@ public class PowerUpTypeAtLowHealth : Script, IScriptOnInitialize
}
/// <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 currentHealthFraction = move.User.CurrentHealth / (float)move.User.MaxHealth;
if (currentHealthFraction <= _threshold && move.GetHitData(target, hit).Type?.Name == _type)

View File

@@ -10,7 +10,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Full_Metal_Body_(Ability)">Bulbapedia - Full Metal Body</see>
/// </summary>
[Script(ScriptCategory.Ability, "prevent_stat_lowering")]
public class PreventStatLowering : Script, IScriptOnInitialize
public class PreventStatLowering : Script, IScriptOnInitialize, IScriptPreventStatBoostChange
{
/// <summary>
/// The statistic that this ability prevents from being lowered.
@@ -32,7 +32,7 @@ public class PreventStatLowering : Script, IScriptOnInitialize
}
/// <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 (_statistic is not null && _statistic != stat)

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Prism_Armor_(Ability)">Bulbapedia - Prism Armor</see>
/// </summary>
[Script(ScriptCategory.Ability, "prism_armor")]
public class PrismArmor : Script
public class PrismArmor : Script, IScriptChangeIncomingMoveDamage
{
/// <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.GetHitData(target, hit).Effectiveness >= 2)
damage = (uint)(damage * 0.75);

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pure_Power_(Ability)">Bulbapedia - Pure Power</see>
/// </summary>
[Script(ScriptCategory.Ability, "pure_power")]
public class PurePower : Script
public class PurePower : 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 (stat == Statistic.Attack)

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rain_Dish_(Ability)">Bulbapedia - Rain Dish</see>
/// </summary>
[Script(ScriptCategory.Ability, "rain_dish")]
public class RainDish : Script
public class RainDish : Script, IScriptOnEndTurn
{
private IPokemon? _owner;
@@ -19,7 +19,7 @@ public class RainDish : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_owner is null)
return;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Schooling_(Ability)">Bulbapedia - Schooling</see>
/// </summary>
[Script(ScriptCategory.Ability, "schooling")]
public class Schooling : Script
public class Schooling : Script, IScriptOnEndTurn
{
private IPokemon? _owningPokemon;
@@ -22,7 +22,7 @@ public class Schooling : Script
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
private static void ChangeFormIfNeeded(IPokemon? pokemon)
{

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Serene_Grace_(Ability)">Bulbapedia - Serene Grace</see>
/// </summary>
[Script(ScriptCategory.Ability, "serene_grace")]
public class SereneGrace : Script
public class SereneGrace : Script, IScriptChangeEffectChance
{
/// <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;
}

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shadow_Shield_(Ability)">Bulbapedia - Shadow Shield</see>
/// </summary>
[Script(ScriptCategory.Ability, "shadow_shield")]
public class ShadowShield : Script, IScriptOnBeforeAnyHookInvoked
public class ShadowShield : Script, IScriptOnBeforeAnyHookInvoked, IScriptChangeIncomingMoveDamage
{
/// <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 (target.CurrentHealth == target.BoostedStats.Hp)
{

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shed_Skin_(Ability)">Bulbapedia - Shed Skin</see>
/// </summary>
[Script(ScriptCategory.Ability, "shed_skin")]
public class ShedSkin : Script
public class ShedSkin : Script, IScriptOnEndTurn
{
private IPokemon? _owningPokemon;
@@ -19,7 +19,7 @@ public class ShedSkin : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_owningPokemon is null || _owningPokemon.StatusScript.IsEmpty)
return;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sheer_Force_(Ability)">Bulbapedia - Sheer Force</see>
/// </summary>
[Script(ScriptCategory.Ability, "sheer_force")]
public class SheerForce : Script, IScriptChangeBasePower
public class SheerForce : Script, IScriptChangeBasePower, IScriptPreventSecondaryEffect
{
/// <inheritdoc />
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
@@ -15,7 +15,7 @@ public class SheerForce : Script, IScriptChangeBasePower
}
/// <inheritdoc />
public override void PreventSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
public void PreventSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
{
prevent = true;
}

View File

@@ -6,11 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shield_Dust_(Ability)">Bulbapedia - Shield Dust</see>
/// </summary>
[Script(ScriptCategory.Ability, "shield_dust")]
public class ShieldDust : Script
public class ShieldDust : Script, IScriptPreventIncomingSecondaryEffect
{
/// <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)
{
prevent = true;
}

View File

@@ -6,13 +6,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shields_Down_(Ability)">Bulbapedia - Shields Down</see>
/// </summary>
[Script(ScriptCategory.Ability, "shields_down")]
public class ShieldsDown : Script
public class ShieldsDown : Script, IScriptOnEndTurn
{
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
private static void ChangeFormIfNeeded(IPokemon? pokemon)
{

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Simple_(Ability)">Bulbapedia - Simple</see>
/// </summary>
[Script(ScriptCategory.Ability, "simple")]
public class Simple : Script
public class Simple : Script, IScriptChangeStatBoostChange
{
/// <inheritdoc />
public override void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
public void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
{
amount = amount.MultiplyOrMax(2);
}

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Solar_Power_(Ability)">Bulbapedia - Solar Power</see>
/// </summary>
[Script(ScriptCategory.Ability, "solar_power")]
public class SolarPower : Script
public class SolarPower : Script, IScriptChangeOffensiveStatValue, IScriptOnEndTurn
{
/// <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.SpecialAttack &&
@@ -21,7 +21,7 @@ public class SolarPower : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (owner is not IPokemon pokemon)
return;

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Solid_Rock_(Ability)">Bulbapedia - Solid Rock</see>
/// </summary>
[Script(ScriptCategory.Ability, "solid_rock")]
public class SolidRock : Script
public class SolidRock : Script, IScriptChangeIncomingMoveDamage
{
/// <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.GetHitData(target, hit).Effectiveness >= 2f)
damage = (uint)(damage * 0.75f);

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Speed_Boost_(Ability)">Bulbapedia - Speed Boost</see>
/// </summary>
[Script(ScriptCategory.Ability, "speed_boost")]
public class SpeedBoost : Script
public class SpeedBoost : Script, IScriptOnEndTurn
{
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (owner is not IPokemon pokemon)
return;

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Steelworker_(Ability)">Bulbapedia - Steelworker</see>
/// </summary>
[Script(ScriptCategory.Ability, "steelworker")]
public class Steelworker : Script
public class Steelworker : 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 == "steel")

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sturdy_(Ability)">Bulbapedia - Sturdy</see>
/// </summary>
[Script(ScriptCategory.Ability, "sturdy")]
public class Sturdy : Script
public class Sturdy : Script, IScriptChangeIncomingMoveDamage
{
/// <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 (damage >= target.MaxHealth && target.CurrentHealth == target.MaxHealth)
{

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Thick_Fat_(Ability)">Bulbapedia - Thick Fat</see>
/// </summary>
[Script(ScriptCategory.Ability, "thick_fat")]
public class ThickFat : Script
public class ThickFat : 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 type = move.GetHitData(target, hit).Type;
if (type is not null && (type.Value.Name == "ice" || type.Value.Name == "fire"))

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Tinted_Lens_(Ability)">Bulbapedia - Tinted Lens</see>
/// </summary>
[Script(ScriptCategory.Ability, "tinted_lens")]
public class TintedLens : Script
public class TintedLens : 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.GetHitData(target, hit).Effectiveness < 1.0f)
{

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Tough_Claws_(Ability)">Bulbapedia - Tough Claws</see>
/// </summary>
[Script(ScriptCategory.Ability, "tough_claws")]
public class ToughClaws : Script
public class ToughClaws : 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.GetHitData(target, hit).IsContact)
{

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Toxic_Boost_(Ability)">Bulbapedia - Toxic Boost</see>
/// </summary>
[Script(ScriptCategory.Ability, "toxic_boost")]
public class ToxicBoost : Script
public class ToxicBoost : 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.HasStatus(ScriptUtils.ResolveName<Status.Poisoned>()) ||
move.User.HasStatus(ScriptUtils.ResolveName<Status.BadlyPoisoned>()))

View File

@@ -6,17 +6,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Unaware_(Ability)">Bulbapedia - Unaware</see>
/// </summary>
[Script(ScriptCategory.Ability, "unaware")]
public class Unaware : Script
public class Unaware : Script, IScriptChangeIncomingMoveOffensiveStatValue, IScriptChangeDefensiveStatValue
{
/// <inheritdoc />
public override void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IPokemon target,
byte hitNumber, uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat)
public void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IPokemon target, byte hitNumber,
uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat)
{
offensiveStat = executingMove.User.FlatStats.GetStatistic(offensive);
}
/// <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 = target.FlatStats.GetStatistic(stat);

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Bubble_(Ability)">Bulbapedia - Water Bubble</see>
/// </summary>
[Script(ScriptCategory.Ability, "water_bubble")]
public class WaterBubble : Script
public class WaterBubble : Script, IScriptChangeIncomingMoveDamage, IScriptChangeMoveDamage
{
/// <inheritdoc />
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
@@ -17,14 +17,14 @@ public class WaterBubble : 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)
{
if (move.GetHitData(target, hit).Type?.Name == "fire")
damage /= 2;
}
/// <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.GetHitData(target, hit).Type?.Name == "water")
damage *= 2;

View File

@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/White_Smoke_(Ability)">Bulbapedia - White Smoke</see>
/// </summary>
[Script(ScriptCategory.Ability, "white_smoke")]
public class WhiteSmoke : Script
public class WhiteSmoke : 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 (selfInflicted || amount >= 0)

View File

@@ -6,13 +6,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Zen_Mode_(Ability)">Bulbapedia - Zen Mode</see>
/// </summary>
[Script(ScriptCategory.Ability, "zen_mode")]
public class ZenMode : Script
public class ZenMode : Script, IScriptOnEndTurn
{
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
private static void ChangeFormIfNeeded(IPokemon? pokemon)
{

View File

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

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "future_sight")]
public class FutureSightEffect : Script
public class FutureSightEffect : Script, IScriptOnEndTurn
{
private int _turnsLeft = 3;
private readonly IMoveChoice _moveChoice;
@@ -12,7 +12,7 @@ public class FutureSightEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
_turnsLeft -= 1;
if (_turnsLeft <= 0)

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "gravity")]
public class Gravity : Script, IScriptFailIncomingMove
public class Gravity : Script, IScriptFailIncomingMove, IScriptOnEndTurn
{
private int _turns = 5;
@@ -32,7 +32,7 @@ public class Gravity : Script, IScriptFailIncomingMove
}
/// <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.Battle;
[Script(ScriptCategory.Battle, "magic_room")]
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnEndTurn
{
private int _turnsLeft = 5;
@@ -19,7 +19,7 @@ public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_turnsLeft > 0)
_turnsLeft--;

View File

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

View File

@@ -4,7 +4,7 @@ using PkmnLib.Dynamic.BattleFlow;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "snatch_effect")]
public class SnatchEffect : Script, IScriptStopBeforeMove
public class SnatchEffect : Script, IScriptStopBeforeMove, IScriptOnEndTurn
{
private Queue<IPokemon> _snatchers = new();
@@ -53,7 +53,7 @@ public class SnatchEffect : Script, IScriptStopBeforeMove
}
/// <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.Battle;
[Script(ScriptCategory.Battle, "trick_room")]
public class TrickRoomEffect : Script, IScriptChangeSpeed
public class TrickRoomEffect : Script, IScriptChangeSpeed, IScriptOnEndTurn
{
private int _turnsLeft = 5;
@@ -12,7 +12,7 @@ public class TrickRoomEffect : Script, IScriptChangeSpeed
}
/// <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.Battle;
[Script(ScriptCategory.Battle, "uproar_effect")]
public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect
public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEffect, IScriptOnEndTurn
{
private IPokemon? _placer;
private bool _hasUsedUproar;
@@ -37,7 +37,7 @@ public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondary
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (!_hasUsedUproar)
{

View File

@@ -1,12 +1,12 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "water_sport")]
public class WaterSportEffect : Script
public class WaterSportEffect : Script, IScriptChangeMoveDamage
{
public readonly HashSet<IPokemon> Placers = new();
/// <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.UseMove.MoveType.Name == "fire")
{

View File

@@ -2,12 +2,12 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
public class WonderRoomEffect : Script
public class WonderRoomEffect : Script, IScriptChangeDefensiveStatValue, IScriptOnEndTurn
{
public int TurnsLeft { get; private set; } = 5;
/// <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 = move.UseMove.Category switch
@@ -19,7 +19,7 @@ public class WonderRoomEffect : Script
}
/// <inheritdoc />
public override void OnEndTurn(IScriptSource owner, IBattle battle)
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
TurnsLeft--;
if (TurnsLeft <= 0)

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

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;

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