Further work on the script interface rework
This commit is contained in:
@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aftermath_(Ability)">Bulbapedia - Aftermath</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "aftermath")]
|
||||
public class Aftermath : Script, IScriptOnIncomingHit
|
||||
public class Aftermath : Script, IScriptOnIncomingHit, IScriptOnFaint
|
||||
{
|
||||
private IExecutingMove? _lastAttack;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Aftermath : Script, IScriptOnIncomingHit
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnFaint(IPokemon pokemon, DamageSource source)
|
||||
public void OnFaint(IPokemon pokemon, DamageSource source)
|
||||
{
|
||||
if (source != DamageSource.MoveDamage)
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Anticipation_(Ability)">Bulbapedia - Anticipation</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "anticipation")]
|
||||
public class Anticipation : Script
|
||||
public class Anticipation : Script, IScriptOnOpponentSwitchIn
|
||||
{
|
||||
private IPokemon? _owner;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Anticipation : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnOpponentSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnOpponentSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
if (_owner is null)
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Arena_Trap_(Ability)">Bulbapedia - Arena Trap</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "arena_trap")]
|
||||
public class ArenaTrap : Script
|
||||
public class ArenaTrap : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||
{
|
||||
private IPokemon? _owner;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ArenaTrap : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||
{
|
||||
if (choice.User.IsFloating)
|
||||
return;
|
||||
@@ -30,7 +30,7 @@ public class ArenaTrap : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||
{
|
||||
if (choice.User.IsFloating)
|
||||
return;
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aroma_Veil_(Ability)">Bulbapedia - Aroma Veil</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "aroma_veil")]
|
||||
public class AromaVeil : Script
|
||||
public class AromaVeil : Script, IScriptOnSwitchIn, IScriptOnSwitchOut
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var side = pokemon.BattleData?.BattleSide;
|
||||
var effect = side?.VolatileScripts.Add(new Side.AromaVeilEffect())?.Script as Side.AromaVeilEffect;
|
||||
@@ -18,7 +18,7 @@ public class AromaVeil : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
{
|
||||
var side = oldPokemon.BattleData?.BattleSide;
|
||||
var effect = side?.VolatileScripts.Get<Side.AromaVeilEffect>();
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Battery_(Ability)">Bulbapedia - Battery</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "battery")]
|
||||
public class Battery : Script
|
||||
public class Battery : Script, IScriptOnSwitchIn, IScriptOnSwitchOut
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var side = pokemon.BattleData?.BattleSide;
|
||||
var effect = side?.VolatileScripts.Add(new Side.BatteryAbilityEffect())?.Script as Side.BatteryAbilityEffect;
|
||||
@@ -18,7 +18,7 @@ public class Battery : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
{
|
||||
var side = oldPokemon.BattleData?.BattleSide;
|
||||
var effect = side?.VolatileScripts.Get<Side.BatteryAbilityEffect>();
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Berserk_(Ability)">Bulbapedia - Berserk</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "berserk")]
|
||||
public class Berserk : Script
|
||||
public class Berserk : Script, IScriptOnDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
{
|
||||
if (source is not DamageSource.MoveDamage)
|
||||
return;
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cheek_Pouch_(Ability)">Bulbapedia - Cheek Pouch</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "cheek_pouch")]
|
||||
public class CheekPouch : Script
|
||||
public class CheekPouch : Script, IScriptOnAfterItemConsume
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterItemConsume(IPokemon pokemon, IItem item)
|
||||
public void OnAfterItemConsume(IPokemon pokemon, IItem item)
|
||||
{
|
||||
if (item.Category == ItemCategory.Berry)
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Delta_Stream_(Ability)">Bulbapedia - Delta Stream</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "delta_stream")]
|
||||
public class DeltaStreamAbility : Script
|
||||
public class DeltaStreamAbility : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battle = pokemon.BattleData?.Battle;
|
||||
if (battle == null)
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Desolate_Land_(Ability)">Bulbapedia - Desolate Land</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "desolate_land")]
|
||||
public class DesolateLandAbility : Script
|
||||
public class DesolateLandAbility : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battle = pokemon.BattleData?.Battle;
|
||||
if (battle == null)
|
||||
|
||||
@@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Disguise_(Ability)">Bulbapedia - Disguise</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "disguise")]
|
||||
public class Disguise : Script
|
||||
public class Disguise : Script, IScriptChangeIncomingDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||
public void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||
{
|
||||
if (pokemon.BattleData == null)
|
||||
return;
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Download_(Ability)">Bulbapedia - Download</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "download")]
|
||||
public class Download : Script
|
||||
public class Download : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drizzle_(Ability)">Bulbapedia - Drizzle</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "drizzle")]
|
||||
public class Drizzle : Script
|
||||
public class Drizzle : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drought_(Ability)">Bulbapedia - Drought</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "drought")]
|
||||
public class Drought : Script
|
||||
public class Drought : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Electric_Surge_(Ability)">Bulbapedia - Electric Surge</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "electric_surge")]
|
||||
public class ElectricSurge : Script
|
||||
public class ElectricSurge : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Emergency_Exit_(Ability)">Bulbapedia - Emergency Exit</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "emergency_exit")]
|
||||
public class EmergencyExit : Script
|
||||
public class EmergencyExit : Script, IScriptOnDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
{
|
||||
if (pokemon.BattleData is null)
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Forecast_(Ability)">Bulbapedia - Forecast</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "forecast")]
|
||||
public class Forecast : Script
|
||||
public class Forecast : Script, IScriptOnSwitchIn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Forecast : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
ChangeForm(pokemon, pokemon.BattleData?.Battle.WeatherName);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Forewarn_(Ability)">Bulbapedia - Forewarn</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "forewarn")]
|
||||
public class Forewarn : Script
|
||||
public class Forewarn : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Frisk_(Ability)">Bulbapedia - Frisk</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "frisk")]
|
||||
public class Frisk : Script
|
||||
public class Frisk : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
if (pokemon.BattleData?.BattleSide is null)
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Gluttony_(Ability)">Bulbapedia - Gluttony</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "gluttony")]
|
||||
public class Gluttony : Script
|
||||
public class Gluttony : Script, IScriptOnDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
{
|
||||
if (pokemon.BattleData is null)
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Grassy_Surge_(Ability)">Bulbapedia - Grassy Surge</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "grassy_surge")]
|
||||
public class GrassySurge : Script
|
||||
public class GrassySurge : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Illusion_(Ability)">Bulbapedia - Illusion</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "illusion")]
|
||||
public class Illusion : Script, IScriptOnIncomingHit
|
||||
public class Illusion : Script, IScriptOnIncomingHit, IScriptOnSwitchIn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Illusion : Script, IScriptOnIncomingHit
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData is null)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Innards_Out_(Ability)">Bulbapedia - Innards Out</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "innards_out")]
|
||||
public class InnardsOut : Script, IScriptOnIncomingHit
|
||||
public class InnardsOut : Script, IScriptOnIncomingHit, IScriptOnDamage
|
||||
{
|
||||
private IPokemon? _lastPokemonToHit;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class InnardsOut : Script, IScriptOnIncomingHit
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
{
|
||||
if (newHealth != 0 || source is not DamageSource.MoveDamage)
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Intimidate_(Ability)">Bulbapedia - Intimidate</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "intimidate")]
|
||||
public class Intimidate : Script
|
||||
public class Intimidate : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battle = pokemon.BattleData?.Battle;
|
||||
if (battle is null)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Klutz_(Ability)">Bulbapedia - Klutz</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "klutz")]
|
||||
public class Klutz : Script, IScriptOnBeforeAnyHookInvoked
|
||||
public class Klutz : Script, IScriptOnBeforeAnyHookInvoked, IScriptPreventHeldItemConsume
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
||||
@@ -16,7 +16,7 @@ public class Klutz : Script, IScriptOnBeforeAnyHookInvoked
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
||||
public void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
||||
{
|
||||
prevented = true;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability)">Bulbapedia - Magic Guard</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "magic_guard")]
|
||||
public class MagicGuard : Script
|
||||
public class MagicGuard : Script, IScriptChangeIncomingDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||
public void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||
{
|
||||
// Magic Guard doesn't work if the Pokémon is not in battle.
|
||||
if (pokemon.BattleData is null)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magma_Armor_(Ability)">Bulbapedia - Magma Armor</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "magma_armor")]
|
||||
public class MagmaArmor : Script
|
||||
public class MagmaArmor : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
@@ -20,7 +20,7 @@ public class MagmaArmor : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
if (pokemon.HasStatus(ScriptUtils.ResolveName<Status.Frozen>()))
|
||||
{
|
||||
|
||||
@@ -6,17 +6,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magnet_Pull_(Ability)">Bulbapedia - Magnet Pull</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "magnet_pull")]
|
||||
public class MagnetPull : Script
|
||||
public class MagnetPull : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||
{
|
||||
if (choice.User.Types.Any(x => x.Name == "steel"))
|
||||
prevent = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||
{
|
||||
if (choice.User.Types.Any(x => x.Name == "steel"))
|
||||
prevent = true;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Misty_Surge_(Ability)">Bulbapedia - Misty Surge</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "misty_surge")]
|
||||
public class MistySurge : Script
|
||||
public class MistySurge : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
if (pokemon.BattleData?.Battle is null)
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Natural_Cure_(Ability)">Bulbapedia - Natural Cure</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "natural_cure")]
|
||||
public class NaturalCure : Script
|
||||
public class NaturalCure : Script, IScriptOnSwitchOut
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
{
|
||||
if (!oldPokemon.StatusScript.IsEmpty)
|
||||
{
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Power_of_Alchemy_(Ability)">Bulbapedia - Power of Alchemy</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "power_of_alchemy")]
|
||||
public class PowerOfAlchemy : Script
|
||||
public class PowerOfAlchemy : Script, IScriptOnAllyFaint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
||||
public void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
||||
{
|
||||
if (faintedPokemon.ActiveAbility?.HasFlag("cant_be_copied") != true)
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Primordial_Sea_(Ability)">Bulbapedia - Primordial Sea</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "primordial_sea")]
|
||||
public class PrimordialSeaAbility : Script
|
||||
public class PrimordialSeaAbility : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battle = pokemon.BattleData?.Battle;
|
||||
if (battle == null)
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Psychic_Surge_(Ability)">Bulbapedia - Psychic Surge</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "psychic_surge")]
|
||||
public class PsychicSurge : Script
|
||||
public class PsychicSurge : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
if (pokemon.BattleData?.Battle is null)
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Regenerator_(Ability)">Bulbapedia - Regenerator</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "regenerator")]
|
||||
public class Regenerator : Script
|
||||
public class Regenerator : Script, IScriptOnSwitchOut
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
{
|
||||
if (!oldPokemon.IsUsable)
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Stream_(Ability)">Bulbapedia - Sand Stream</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sand_stream")]
|
||||
public class SandStream : Script
|
||||
public class SandStream : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -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, IScriptOnEndTurn
|
||||
public class Schooling : Script, IScriptOnEndTurn, IScriptOnSwitchIn
|
||||
{
|
||||
private IPokemon? _owningPokemon;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Schooling : Script, IScriptOnEndTurn
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
|
||||
|
||||
@@ -6,11 +6,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shadow_Tag_(Ability)">Bulbapedia - Shadow Tag</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "shadow_tag")]
|
||||
public class ShadowTag : Script
|
||||
public class ShadowTag : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||
}
|
||||
@@ -6,10 +6,10 @@ 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, IScriptOnEndTurn
|
||||
public class ShieldsDown : Script, IScriptOnEndTurn, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||
|
||||
@@ -8,12 +8,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Slow_Start_(Ability)">Bulbapedia - Slow Start</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "slow_start")]
|
||||
public class SlowStart : Script
|
||||
public class SlowStart : Script, IScriptOnSwitchIn
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
_pokemon = pokemon;
|
||||
pokemon.Volatile.Add(new SlowStartEffect());
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Snow_Warning_(Ability)">Bulbapedia - Snow Warning</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "snow_warning")]
|
||||
public class SnowWarning : Script
|
||||
public class SnowWarning : Script, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soul-Heart_(Ability)">Bulbapedia - Soul-Heart</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "soul_heart")]
|
||||
public class SoulHeart : Script, IScriptOnOpponentFaints
|
||||
public class SoulHeart : Script, IScriptOnOpponentFaints, IScriptOnAllyFaint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
||||
public void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
||||
{
|
||||
ally.ChangeStatBoost(Statistic.SpecialAttack, 1, true, false);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Air_Lock_(Ability)">Bulbapedia - Air Lock</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "suppress_weather")]
|
||||
public class SuppressWeatherAbility : Script, IScriptOnBeforeAnyHookInvoked
|
||||
public class SuppressWeatherAbility : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
||||
@@ -19,7 +19,7 @@ public class SuppressWeatherAbility : Script, IScriptOnBeforeAnyHookInvoked
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Wonder_Guard_(Ability)">Bulbapedia - Wonder Guard</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "wonder_guard")]
|
||||
public class WonderGuard : Script
|
||||
public class WonderGuard : Script, IScriptBlockIncomingHit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
var effectiveness = executingMove.GetHitData(target, hitIndex).Effectiveness;
|
||||
if (!(effectiveness <= 1.0))
|
||||
|
||||
@@ -6,10 +6,10 @@ 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, IScriptOnEndTurn
|
||||
public class ZenMode : Script, IScriptOnEndTurn, IScriptOnSwitchIn
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||
|
||||
Reference in New Issue
Block a user