diff --git a/Plugins/PkmnLib.Plugin.Gen7/Data/Abilities.jsonc b/Plugins/PkmnLib.Plugin.Gen7/Data/Abilities.jsonc index c1bc5a1..227de6a 100755 --- a/Plugins/PkmnLib.Plugin.Gen7/Data/Abilities.jsonc +++ b/Plugins/PkmnLib.Plugin.Gen7/Data/Abilities.jsonc @@ -397,15 +397,33 @@ "no_guard": { "effect": "no_guard" }, - "normalize": {}, - "oblivious": {}, - "overcoat": {}, - "overgrow": {}, - "own_tempo": {}, - "parental_bond": {}, - "pickpocket": {}, - "pickup": {}, - "pixilate": {}, + "normalize": { + "effect": "normalize" + }, + "oblivious": { + "effect": "oblivious" + }, + "overcoat": { + "effect": "overcoat" + }, + "overgrow": { + "effect": "overgrow" + }, + "own_tempo": { + "effect": "own_tempo" + }, + "parental_bond": { + "effect": "parental_bond" + }, + "pickpocket": { + "effect": "pickpocket" + }, + "pickup": { + "effect": "pickup" + }, + "pixilate": { + "effect": "pixilate" + }, "plus": {}, "poison_heal": {}, "poison_point": {}, diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Normalize.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Normalize.cs new file mode 100644 index 0000000..30970d1 --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Normalize.cs @@ -0,0 +1,25 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Normalize is an ability that changes all moves used by the Pokémon to Normal type. +/// +/// Bulbapedia - Normalize +/// +[Script(ScriptCategory.Ability, "normalize")] +public class Normalize : Script +{ + /// + public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, + ref TypeIdentifier? typeIdentifier) + { + if (move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("normal", out var normalType)) + typeIdentifier = normalType; + } + + /// + public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) + { + if (move.GetHitData(target, hit).Type?.Name == "normal") + basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30% + } +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Oblivious.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Oblivious.cs new file mode 100644 index 0000000..7a3f8c0 --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Oblivious.cs @@ -0,0 +1,22 @@ +using PkmnLib.Plugin.Gen7.Scripts.Pokemon; + +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Oblivious is an ability that prevents the Pokémon from being infatuated or taunted. +/// +/// Bulbapedia - Oblivious +/// +[Script(ScriptCategory.Ability, "oblivious")] +public class Oblivious : Script +{ + /// + public override void PreventVolatileAdd(Script script, ref bool preventVolatileAdd) + { + preventVolatileAdd = script switch + { + Infatuated or TauntEffect => true, + _ => preventVolatileAdd, + }; + } +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overcoat.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overcoat.cs new file mode 100644 index 0000000..efe7d60 --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overcoat.cs @@ -0,0 +1,29 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Overcoat is an ability that protects the Pokémon from weather damage and powder moves. +/// +/// Bulbapedia - Overcoat +/// +[Script(ScriptCategory.Ability, "overcoat")] +public class Overcoat : Script +{ + /// + public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args) + { + if (eventName == CustomTriggers.IgnoreHail && args is CustomTriggers.IgnoreHailArgs hailArgs) + { + hailArgs.Ignore = true; + } + // TODO: Ignore sandstorm damage + } + + /// + public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) + { + if (move.UseMove.HasFlag("powder")) + { + invulnerable = true; + } + } +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overgrow.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overgrow.cs new file mode 100644 index 0000000..b305efe --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overgrow.cs @@ -0,0 +1,17 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Overgrow is an ability that boosts the power of Grass-type moves when the Pokémon's HP is low. +/// +/// Bulbapedia - Overgrow +/// +[Script(ScriptCategory.Ability, "overgrow")] +public class Overgrow : Script +{ + /// + public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) + { + if (move.GetHitData(target, hit).Type?.Name == "grass" && target.CurrentHealth <= target.BoostedStats.Hp / 3) + basePower = basePower.MultiplyOrMax(1.5f); + } +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/OwnTempo.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/OwnTempo.cs new file mode 100644 index 0000000..cf61eb8 --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/OwnTempo.cs @@ -0,0 +1,17 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Own Tempo is an ability that prevents the Pokémon from becoming confused. +/// +/// Bulbapedia - Own Tempo +/// +[Script(ScriptCategory.Ability, "own_tempo")] +public class OwnTempo : Script +{ + /// + public override void PreventVolatileAdd(Script script, ref bool preventVolatileAdd) + { + if (script is Pokemon.Confusion) + preventVolatileAdd = true; + } +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/ParentalBond.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/ParentalBond.cs new file mode 100644 index 0000000..2a7c2ef --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/ParentalBond.cs @@ -0,0 +1,12 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Parental Bond is an ability that allows the Pokémon to hit twice with most moves. +/// +/// Bulbapedia - Parental Bond +/// +[Script(ScriptCategory.Ability, "parental_bond")] +public class ParentalBond : Script +{ + // TODO: Implement Parental Bond effect. +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickpocket.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickpocket.cs new file mode 100644 index 0000000..c33b852 --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickpocket.cs @@ -0,0 +1,20 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Pickpocket is an ability that steals an item from a Pokémon that makes contact. +/// +/// Bulbapedia - Pickpocket +/// +[Script(ScriptCategory.Ability, "pickpocket")] +public class Pickpocket : Script +{ + /// + public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) + { + if (move.GetHitData(target, hit).IsContact && target.HeldItem is null && move.User.HeldItem is not null) + { + move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)); + _ = target.SetHeldItem(move.User.RemoveHeldItemForBattle()); + } + } +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickup.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickup.cs new file mode 100644 index 0000000..a8a6a59 --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickup.cs @@ -0,0 +1,12 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Pickup is an ability that allows the Pokémon to pick up items after battle. +/// +/// Bulbapedia - Pickup +/// +[Script(ScriptCategory.Ability, "pickup")] +public class Pickup : Script +{ + // TODO: Implement Pickup effect. +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pixilate.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pixilate.cs new file mode 100644 index 0000000..33b0f1e --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pixilate.cs @@ -0,0 +1,26 @@ +namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; + +/// +/// Pixilate is an ability that turns Normal-type moves into Fairy-type moves and boosts their power. +/// +/// Bulbapedia - Pixilate +/// +[Script(ScriptCategory.Ability, "pixilate")] +public class Pixilate : Script +{ + /// + public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, + ref TypeIdentifier? typeIdentifier) + { + if (typeIdentifier?.Name == "normal" && + move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("fairy", out var fairyType)) + typeIdentifier = fairyType; + } + + /// + public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) + { + if (move.GetHitData(target, hit).Type?.Name == "fairy") + basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30% + } +} \ No newline at end of file