From 6eba332096b4de89a2499d9250584b888a6a21a9 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 26 Jul 2025 14:36:47 +0200 Subject: [PATCH] Make moveflags of gen 7 plugin shared statically --- .../AI/Explicit/ExplicitAI.Utilities.cs | 2 +- PkmnLib.Static/Moves/MoveData.cs | 8 + .../DataTests/MoveDataTests.cs | 22 ++ .../Scripts/Abilities/MegaLauncherTests.cs | 3 +- .../AI/AIDamageFunctions.cs | 2 +- .../PkmnLib.Plugin.Gen7/Common/MoveFlags.cs | 37 +++ Plugins/PkmnLib.Plugin.Gen7/Data/Moves.jsonc | 216 +++++++++--------- Plugins/PkmnLib.Plugin.Gen7/GlobalUsings.cs | 3 +- .../Scripts/Abilities/Bulletproof.cs | 4 +- .../Scripts/Abilities/IronFist.cs | 2 +- .../Scripts/Abilities/LiquidVoice.cs | 2 +- .../Scripts/Abilities/MagicBounce.cs | 2 +- .../Scripts/Abilities/MegaLauncher.cs | 4 +- .../Scripts/Abilities/Overcoat.cs | 2 +- .../Scripts/Abilities/Reckless.cs | 2 +- .../Scripts/Abilities/Soundproof.cs | 2 +- .../Scripts/Abilities/StrongJaw.cs | 4 +- .../Scripts/Abilities/Triage.cs | 2 +- .../Scripts/Battle/Gravity.cs | 2 +- .../Scripts/Battle/SnatchEffect.cs | 2 +- .../Scripts/Moves/Sketch.cs | 2 +- .../Scripts/Pokemon/ChargeBounceEffect.cs | 4 +- .../Scripts/Pokemon/ChargeFlyEffect.cs | 4 +- .../Scripts/Pokemon/ChargeSkyDropEffect.cs | 4 +- .../Scripts/Pokemon/DigEffect.cs | 4 +- .../Scripts/Pokemon/DiveEffect.cs | 4 +- .../Scripts/Pokemon/HealBlockEffect.cs | 4 +- .../Scripts/Pokemon/ProtectionEffectScript.cs | 4 +- .../Scripts/Pokemon/SubstituteEffect.cs | 2 +- .../Scripts/Pokemon/ThroatChopEffect.cs | 4 +- .../Scripts/Side/AromaVeilEffect.cs | 4 +- .../Scripts/Status/Frozen.cs | 4 +- .../Scripts/Status/Sleep.cs | 2 +- 33 files changed, 223 insertions(+), 146 deletions(-) create mode 100644 Plugins/PkmnLib.Plugin.Gen7/Common/MoveFlags.cs diff --git a/PkmnLib.Dynamic/AI/Explicit/ExplicitAI.Utilities.cs b/PkmnLib.Dynamic/AI/Explicit/ExplicitAI.Utilities.cs index 26e59aa..c91db12 100644 --- a/PkmnLib.Dynamic/AI/Explicit/ExplicitAI.Utilities.cs +++ b/PkmnLib.Dynamic/AI/Explicit/ExplicitAI.Utilities.cs @@ -65,7 +65,7 @@ public partial class ExplicitAI var abilityName = pokemon.ActiveAbility.Name; if (abilityName == BulletproofName) - return move.HasFlag("bomb"); + return move.HasFlag("ballistics"); if (abilityName == FlashFireName) return moveType.Name == FireName; if (abilityName == LightningRodName || abilityName == MotorDriveName || abilityName == VoltAbsorbName) diff --git a/PkmnLib.Static/Moves/MoveData.cs b/PkmnLib.Static/Moves/MoveData.cs index 359d07c..70e9c39 100644 --- a/PkmnLib.Static/Moves/MoveData.cs +++ b/PkmnLib.Static/Moves/MoveData.cs @@ -143,6 +143,11 @@ public interface IMoveData : INamedValue /// Arbitrary flags that can be applied to the move. /// bool HasFlag(StringKey key); + + /// + /// A readonly list of all flags on the move. + /// + IReadOnlyCollection Flags { get; } } /// @@ -196,6 +201,9 @@ public class MoveDataImpl : IMoveData /// public bool HasFlag(StringKey key) => _flags.Contains(key); + + /// + public IReadOnlyCollection Flags => _flags; } public static class MoveTargetHelpers diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs index c4652d4..3f1eb4f 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs @@ -4,7 +4,9 @@ using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Plugins; using PkmnLib.Dynamic.ScriptHandling; using PkmnLib.Dynamic.ScriptHandling.Registry; +using PkmnLib.Plugin.Gen7.Common; using PkmnLib.Static.Moves; +using PkmnLib.Static.Utils; namespace PkmnLib.Plugin.Gen7.Tests.DataTests; @@ -89,6 +91,26 @@ public class MoveDataTests await Assert.That(test.Library.ScriptResolver.TryResolve(ScriptCategory.Status, status, null, out _)).IsTrue(); } + public static IEnumerable> AllMoveFlagsAreIncludedInMoveFlagsData() + { + var library = LibraryHelpers.LoadLibrary(); + var moveLibrary = library.StaticLibrary.Moves; + foreach (var flag in moveLibrary.SelectMany(x => x.Flags).Distinct()) + { + yield return () => flag; + } + } + + private static readonly HashSet CompileTimeMoveFlags = typeof(MoveFlags).GetFields() + .Where(x => x is { IsStatic: true, IsPublic: true } && x.FieldType == typeof(StringKey)) + .Select(x => (StringKey)x.GetValue(null)!).ToHashSet(); + + [Test, MethodDataSource(nameof(AllMoveFlagsAreIncludedInMoveFlagsData))] + public async Task AllMoveFlagsAreIncludedInMoveFlagsClass(StringKey flag) + { + await Assert.That(CompileTimeMoveFlags.Contains(flag)).IsTrue(); + } + public record HasEitherEffectOrComment(string MoveName, bool HasEffect, bool HasComment) { /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/MegaLauncherTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/MegaLauncherTests.cs index 3a5d326..cc7215d 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/MegaLauncherTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/MegaLauncherTests.cs @@ -1,5 +1,6 @@ using PkmnLib.Dynamic.Models; using PkmnLib.Dynamic.ScriptHandling; +using PkmnLib.Plugin.Gen7.Common; using PkmnLib.Plugin.Gen7.Scripts.Abilities; using PkmnLib.Plugin.Gen7.Scripts.Moves; using PkmnLib.Static; @@ -20,7 +21,7 @@ public class MegaLauncherTests var user = Substitute.For(); move.User.Returns(user); move.UseMove.Category.Returns(MoveCategory.Special); - move.UseMove.HasFlag("pulse").Returns(true); + move.UseMove.HasFlag(MoveFlags.Pulse).Returns(true); var megaLauncher = new ScriptContainer(new MegaLauncher()); move.User.AbilityScript.Returns(megaLauncher); move.GetScripts().Returns(new ScriptIterator([megaLauncher])); diff --git a/Plugins/PkmnLib.Plugin.Gen7/AI/AIDamageFunctions.cs b/Plugins/PkmnLib.Plugin.Gen7/AI/AIDamageFunctions.cs index 6c33659..9bbc5bb 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/AI/AIDamageFunctions.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/AI/AIDamageFunctions.cs @@ -26,7 +26,7 @@ public static class AIDamageFunctions if (damage > target.CurrentHealth * 1.1f) { score += 10; - if ((option.Move.Move.HasFlag("multi_hit") && target.CurrentHealth == target.MaxHealth && + if ((option.Move.Move.HasFlag(MoveFlags.MultiHit) && target.CurrentHealth == target.MaxHealth && target.ActiveAbility?.Name == "sturdy") || target.HasHeldItem("focus_sash")) { score += 8; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Common/MoveFlags.cs b/Plugins/PkmnLib.Plugin.Gen7/Common/MoveFlags.cs new file mode 100644 index 0000000..cd1c3f3 --- /dev/null +++ b/Plugins/PkmnLib.Plugin.Gen7/Common/MoveFlags.cs @@ -0,0 +1,37 @@ +namespace PkmnLib.Plugin.Gen7.Common; + +public static class MoveFlags +{ + public static readonly StringKey Ballistics = "ballistics"; + public static readonly StringKey Bite = "bite"; + public static readonly StringKey Charge = "charge"; + public static readonly StringKey Contact = "contact"; + public static readonly StringKey Dance = "dance"; + public static readonly StringKey Defrost = "defrost"; + public static readonly StringKey Distance = "distance"; + public static readonly StringKey EffectiveAgainstFly = "effective_against_fly"; + public static readonly StringKey EffectiveAgainstUnderground = "effective_against_underground"; + public static readonly StringKey EffectiveAgainstUnderwater = "effective_against_underwater"; + public static readonly StringKey Gravity = "gravity"; + public static readonly StringKey Heal = "heal"; + public static readonly StringKey HitFlying = "hit_flying"; + public static readonly StringKey HitUnderground = "hit_underground"; + public static readonly StringKey HitUnderwater = "hit_underwater"; + public static readonly StringKey IgnoreSubstitute = "ignore_substitute"; + public static readonly StringKey LimitMoveChoice = "limit_move_choice"; + public static readonly StringKey Mental = "mental"; + public static readonly StringKey Mirror = "mirror"; + public static readonly StringKey MultiHit = "multi_hit"; + public static readonly StringKey NonSkyBattle = "non_sky_battle"; + public static readonly StringKey NotSketchable = "not_sketchable"; + public static readonly StringKey Powder = "powder"; + public static readonly StringKey Protect = "protect"; + public static readonly StringKey Pulse = "pulse"; + public static readonly StringKey Punch = "punch"; + public static readonly StringKey Recoil = "recoil"; + public static readonly StringKey Recharge = "recharge"; + public static readonly StringKey Reflectable = "reflectable"; + public static readonly StringKey Snatch = "snatch"; + public static readonly StringKey Sound = "sound"; + public static readonly StringKey UsableWhileAsleep = "usable_while_asleep"; +} \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Data/Moves.jsonc b/Plugins/PkmnLib.Plugin.Gen7/Data/Moves.jsonc index 0649d1b..ab20505 100755 --- a/Plugins/PkmnLib.Plugin.Gen7/Data/Moves.jsonc +++ b/Plugins/PkmnLib.Plugin.Gen7/Data/Moves.jsonc @@ -218,7 +218,7 @@ "target": "Any", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "after_you" @@ -472,7 +472,7 @@ "target": "AdjacentAlly", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_special_defense", @@ -562,7 +562,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute", + "ignore_substitute", "mental" ], "effect": { @@ -822,7 +822,7 @@ "category": "status", "flags": [ "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "bestow" @@ -1043,7 +1043,7 @@ "contact", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "set_status", @@ -1141,7 +1141,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ] // No secondary effect }, @@ -1337,7 +1337,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_special_defense", @@ -1379,7 +1379,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "change_target_speed", @@ -1596,7 +1596,7 @@ "mirror", "sound", "distance", - "ignore-substitute", + "ignore_substitute", "not_sketchable" ], "effect": { @@ -1670,7 +1670,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_user_defense", @@ -1772,7 +1772,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_special_attack", @@ -1889,7 +1889,7 @@ "target": "Any", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "conversion_2" @@ -2191,7 +2191,7 @@ "target": "Self", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "curse" @@ -2339,7 +2339,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "defog" @@ -2355,7 +2355,7 @@ "target": "Self", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "destiny_bond" @@ -2434,7 +2434,7 @@ "charge", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "dig" @@ -2453,7 +2453,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute", + "ignore_substitute", "limit_move_choice" ], "effect": { @@ -2473,7 +2473,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ] // No secondary effect }, @@ -2512,7 +2512,7 @@ "charge", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "dive" @@ -2987,7 +2987,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "change_target_special_defense", @@ -3009,7 +3009,7 @@ "flags": [ "protect", "mirror", - "nonskybattle", + "non_sky_battle", "hit_underground", "effective_against_underground" ] @@ -3028,7 +3028,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "echoed_voice" @@ -3081,7 +3081,7 @@ "target": "All", "category": "status", "flags": [ - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "electric_terrain" @@ -3194,7 +3194,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute", + "ignore_substitute", "mental", "limit_move_choice" ], @@ -3388,7 +3388,7 @@ "category": "status", "flags": [ "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "fairy_lock" @@ -3649,7 +3649,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "fire_pledge" @@ -3726,7 +3726,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "one_hit_ko" @@ -4018,7 +4018,7 @@ "mirror", "gravity", "distance", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "flying_press" @@ -4129,7 +4129,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "foresight" @@ -4219,7 +4219,7 @@ "recharge", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "requires_recharge" @@ -4412,7 +4412,7 @@ "category": "status", "flags": [ "snatch", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "gear_up" @@ -4443,7 +4443,7 @@ "category": "status", "flags": [ "charge", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "geomancy" @@ -4567,7 +4567,7 @@ "contact", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "grass_knot" @@ -4585,7 +4585,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "grass_pledge" @@ -4605,7 +4605,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "set_status", @@ -4624,7 +4624,7 @@ "target": "All", "category": "status", "flags": [ - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "grassy_terrain" @@ -4640,7 +4640,7 @@ "target": "All", "category": "status", "flags": [ - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "gravity" @@ -4660,7 +4660,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_attack", @@ -4696,7 +4696,7 @@ "target": "Self", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "grudge" @@ -4730,7 +4730,7 @@ "flags": [ "protect", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "guard_swap" @@ -4908,7 +4908,7 @@ "target": "All", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "reset_target_stats" @@ -4990,7 +4990,7 @@ "snatch", "sound", "distance", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "heal_bell" @@ -5106,7 +5106,7 @@ "flags": [ "protect", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "heart_swap" @@ -5125,7 +5125,7 @@ "contact", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "heat_crash" @@ -5165,7 +5165,7 @@ "contact", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "heat_crash" @@ -5181,7 +5181,7 @@ "target": "AdjacentAlly", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "helping_hand" @@ -5285,7 +5285,7 @@ "target": "AdjacentAlly", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ] // No secondary effect }, @@ -5510,7 +5510,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ] // No secondary effect }, @@ -5525,7 +5525,7 @@ "category": "physical", "flags": [ "mirror", - "ignore-substitute", + "ignore_substitute", "protect" ], "effect": { @@ -5543,7 +5543,7 @@ "category": "special", "flags": [ "mirror", - "ignore-substitute", + "ignore_substitute", "protect" ], "effect": { @@ -5776,7 +5776,7 @@ "category": "status", "flags": [ "snatch", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "imprison" @@ -5873,7 +5873,7 @@ "category": "status", "flags": [ "snatch", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "ingrain" @@ -5890,7 +5890,7 @@ "category": "status", "flags": [ "protect", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "instruct" @@ -6090,7 +6090,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ] // No secondary effect }, @@ -6643,7 +6643,7 @@ "flags": [ "snatch", "distance", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "magnetic_flux" @@ -6661,7 +6661,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "magnitude" @@ -6692,7 +6692,7 @@ "category": "status", "flags": [ "snatch", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "mat_block" @@ -6709,7 +6709,7 @@ "category": "status", "flags": [ "protect", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "me_first" @@ -6891,7 +6891,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_special_defense", @@ -6968,7 +6968,7 @@ "category": "status", "flags": [ "protect", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "mimic" @@ -7023,7 +7023,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "miracle_eye" @@ -7127,7 +7127,7 @@ "target": "All", "category": "status", "flags": [ - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "misty_terrain" @@ -7277,7 +7277,7 @@ "target": "All", "category": "status", "flags": [ - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "mud_sport" @@ -7295,7 +7295,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "change_target_accuracy", @@ -7540,7 +7540,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_multiple_target_stat_boosts", @@ -7640,7 +7640,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "foresight" @@ -7769,7 +7769,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "parting_shot" @@ -7839,7 +7839,7 @@ "flags": [ "sound", "distance", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "perish_song" @@ -7927,7 +7927,7 @@ "flags": [ "reflectable", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_attack", @@ -8149,7 +8149,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute", + "ignore_substitute", "powder" ], "effect": { @@ -8220,7 +8220,7 @@ "flags": [ "protect", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "power_swap" @@ -8310,7 +8310,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ] // No secondary effect }, @@ -8391,7 +8391,7 @@ "target": "Any", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "psych_up" @@ -8446,7 +8446,7 @@ "target": "All", "category": "status", "flags": [ - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "psychic_terrain" @@ -8882,7 +8882,7 @@ "category": "status", "flags": [ "protect", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "reflect_type" @@ -8917,7 +8917,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "set_status", @@ -9047,7 +9047,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "roar" @@ -9231,7 +9231,7 @@ "target": "Any", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "role_play" @@ -9302,7 +9302,7 @@ "category": "status", "flags": [ "distance", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "rototiller" @@ -9321,7 +9321,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "round" @@ -9534,7 +9534,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_defense", @@ -9648,7 +9648,7 @@ "contact", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "night_shade" @@ -10002,7 +10002,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "set_status", @@ -10033,7 +10033,7 @@ "target": "Any", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "sketch" @@ -10051,7 +10051,7 @@ "flags": [ "protect", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "skill_swap" @@ -10167,7 +10167,7 @@ "contact", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ] // No secondary effect }, @@ -10303,7 +10303,7 @@ "flags": [ "protect", "mirror", - "nonskybattle", + "non_sky_battle", "hit_flying" ], "effect": { @@ -10399,7 +10399,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "change_target_special_attack", @@ -10418,7 +10418,7 @@ "target": "Self", "category": "status", "flags": [ - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "snatch" @@ -10437,7 +10437,7 @@ "protect", "mirror", "sound", - "ignore-substitute", + "ignore_substitute", "usable_while_asleep" ], "effect": { @@ -10606,7 +10606,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "sparkling_aria" @@ -10625,7 +10625,7 @@ "contact", "protect", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "spectral_thief" @@ -10643,7 +10643,7 @@ "flags": [ "protect", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "speed_swap" @@ -10696,7 +10696,7 @@ "category": "status", "flags": [ "reflectable", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "spikes" @@ -10762,7 +10762,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "spite" @@ -10961,7 +10961,7 @@ "contact", "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "flinch", @@ -11169,7 +11169,7 @@ "category": "status", "flags": [ "snatch", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "substitute" @@ -11302,7 +11302,7 @@ "reflectable", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "confuse" @@ -11344,7 +11344,7 @@ "flags": [ "protect", "mirror", - "nonskybattle", + "non_sky_battle", "effective_against_underwater" ] // No secondary effect @@ -11635,7 +11635,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute", + "ignore_substitute", "mental", "limit_move_choice" ], @@ -11786,7 +11786,7 @@ "flags": [ "protect", "mirror", - "nonskybattle", + "non_sky_battle", "hit_flying" ], "effect": { @@ -11805,7 +11805,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "thousand_waves" @@ -12027,7 +12027,7 @@ "protect", "reflectable", "mirror", - "ignore-substitute", + "ignore_substitute", "mental", "limit_move_choice" ], @@ -12067,7 +12067,7 @@ "category": "status", "flags": [ "reflectable", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "toxic_spikes" @@ -12324,7 +12324,7 @@ "protect", "mirror", "sound", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "uproar" @@ -12532,7 +12532,7 @@ "flags": [ "protect", "mirror", - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "water_pledge" @@ -12586,7 +12586,7 @@ "target": "All", "category": "status", "flags": [ - "nonskybattle" + "non_sky_battle" ], "effect": { "name": "water_sport" @@ -12678,7 +12678,7 @@ "flags": [ "reflectable", "mirror", - "ignore-substitute" + "ignore_substitute" ], "effect": { "name": "roar" diff --git a/Plugins/PkmnLib.Plugin.Gen7/GlobalUsings.cs b/Plugins/PkmnLib.Plugin.Gen7/GlobalUsings.cs index c420465..4740f4d 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/GlobalUsings.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/GlobalUsings.cs @@ -4,4 +4,5 @@ global using PkmnLib.Dynamic.Events; global using PkmnLib.Dynamic.Models; global using PkmnLib.Dynamic.Models.Choices; global using PkmnLib.Static; -global using PkmnLib.Static.Utils; \ No newline at end of file +global using PkmnLib.Static.Utils; +global using PkmnLib.Plugin.Gen7.Common; \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs index cbe3b00..2753c5f 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs @@ -1,3 +1,5 @@ +using PkmnLib.Plugin.Gen7.Common; + namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// @@ -12,7 +14,7 @@ public class Bulletproof : Script, IScriptFailIncomingMove /// public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) { - if (move.UseMove.HasFlag("ballistics")) + if (move.UseMove.HasFlag(MoveFlags.Ballistics)) fail = true; } } \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/IronFist.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/IronFist.cs index 25240cf..25769b8 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/IronFist.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/IronFist.cs @@ -11,7 +11,7 @@ public class IronFist : Script, IScriptChangeBasePower /// public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) { - if (move.UseMove.HasFlag("punch")) + if (move.UseMove.HasFlag(MoveFlags.Punch)) basePower = basePower.MultiplyOrMax(1.2f); } } \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/LiquidVoice.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/LiquidVoice.cs index 9ae3d41..3e3083b 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/LiquidVoice.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/LiquidVoice.cs @@ -11,7 +11,7 @@ public class LiquidVoice : Script, IScriptChangeMoveType /// public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier) { - if (move.UseMove.HasFlag("sound") && + if (move.UseMove.HasFlag(MoveFlags.Sound) && move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("water", out var waterType)) { typeIdentifier = waterType; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MagicBounce.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MagicBounce.cs index b4f7917..06e2239 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MagicBounce.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MagicBounce.cs @@ -11,7 +11,7 @@ public class MagicBounce : Script, IScriptChangeIncomingTargets /// public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList targets) { - if (moveChoice.ChosenMove.MoveData.HasFlag("reflectable")) + if (moveChoice.ChosenMove.MoveData.HasFlag(MoveFlags.Reflectable)) { var target = targets[0]; target?.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)); diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MegaLauncher.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MegaLauncher.cs index be82ff1..011d8d3 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MegaLauncher.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MegaLauncher.cs @@ -11,7 +11,7 @@ public class MegaLauncher : Script, IScriptChangeBasePower, IScriptCustomTrigger /// public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) { - if (move.UseMove.HasFlag("pulse")) + if (move.UseMove.HasFlag(MoveFlags.Pulse)) { basePower = basePower.MultiplyOrMax(1.5f); } @@ -23,7 +23,7 @@ public class MegaLauncher : Script, IScriptChangeBasePower, IScriptCustomTrigger if (eventName != CustomTriggers.ModifyHealPercent || args is not CustomTriggers.ModifyHealPercentArgs healArgs) return; - if (healArgs.Move.UseMove.HasFlag("pulse")) + if (healArgs.Move.UseMove.HasFlag(MoveFlags.Pulse)) healArgs.HealPercent *= 1.5f; } } \ 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 index 8c8fc13..73f1995 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overcoat.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Overcoat.cs @@ -25,7 +25,7 @@ public class Overcoat : Script, IScriptIsInvulnerableToMove, IScriptCustomTrigge /// public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) { - if (move.UseMove.HasFlag("powder")) + if (move.UseMove.HasFlag(MoveFlags.Powder)) { invulnerable = true; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Reckless.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Reckless.cs index 7d87583..35be39a 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Reckless.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Reckless.cs @@ -11,7 +11,7 @@ public class Reckless : Script, IScriptChangeBasePower /// public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) { - if (move.UseMove.HasFlag("recoil")) + if (move.UseMove.HasFlag(MoveFlags.Recoil)) { basePower = basePower.MultiplyOrMax(1.2f); } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Soundproof.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Soundproof.cs index 680d806..c1c16a0 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Soundproof.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Soundproof.cs @@ -11,7 +11,7 @@ public class Soundproof : Script, IScriptIsInvulnerableToMove /// public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) { - if (move.UseMove.HasFlag("sound")) + if (move.UseMove.HasFlag(MoveFlags.Sound)) invulnerable = true; } } \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs index 96df122..3172707 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs @@ -1,3 +1,5 @@ +using PkmnLib.Plugin.Gen7.Common; + namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// @@ -11,7 +13,7 @@ public class StrongJaw : Script, IScriptChangeBasePower /// public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) { - if (move.UseMove.HasFlag("bite")) + if (move.UseMove.HasFlag(MoveFlags.Bite)) { basePower = basePower.MultiplyOrMax(1.5f); } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Triage.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Triage.cs index 33aaba7..cc1bbb4 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Triage.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Triage.cs @@ -11,7 +11,7 @@ public class Triage : Script, IScriptChangePriority /// public void ChangePriority(IMoveChoice choice, ref sbyte priority) { - if (!choice.ChosenMove.MoveData.HasFlag("heal")) + if (!choice.ChosenMove.MoveData.HasFlag(MoveFlags.Heal)) return; if (priority == sbyte.MaxValue) return; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/Gravity.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/Gravity.cs index a49066c..970eee6 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/Gravity.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/Gravity.cs @@ -21,7 +21,7 @@ public class Gravity : Script, IScriptFailIncomingMove, IScriptOnEndTurn, IScrip /// public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) { - if (move.UseMove.HasFlag("gravity")) + if (move.UseMove.HasFlag(MoveFlags.Gravity)) fail = true; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/SnatchEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/SnatchEffect.cs index f4f636b..aeccc38 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/SnatchEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/SnatchEffect.cs @@ -35,7 +35,7 @@ public class SnatchEffect : Script, IScriptStopBeforeMove, IScriptOnEndTurn /// public void StopBeforeMove(IExecutingMove move, ref bool stop) { - if (move.UseMove.HasFlag("snatch") && TryGetSnatcher(out var snatcher)) + if (move.UseMove.HasFlag(MoveFlags.Snatch) && TryGetSnatcher(out var snatcher)) { stop = true; var battleData = snatcher.BattleData; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Sketch.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Sketch.cs index 6a7ffea..c38698b 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Sketch.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Sketch.cs @@ -22,7 +22,7 @@ public class Sketch : Script, IScriptOnSecondaryEffect } var lastMove = target.BattleData?.LastMoveChoice; - if (lastMove == null || lastMove.ChosenMove.MoveData.HasFlag("not_sketchable")) + if (lastMove == null || lastMove.ChosenMove.MoveData.HasFlag(MoveFlags.NotSketchable)) { move.GetHitData(target, hit).Fail(); return; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeBounceEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeBounceEffect.cs index 92271ef..38e1d36 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeBounceEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeBounceEffect.cs @@ -23,14 +23,14 @@ public class ChargeBounceEffect : Script, IScriptForceTurnSelection, IScriptChan /// public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block) { - if (!executingMove.UseMove.HasFlag("hit_flying")) + if (!executingMove.UseMove.HasFlag(MoveFlags.HitFlying)) block = true; } /// public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage) { - if (!move.UseMove.HasFlag("effective_against_fly")) + if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly)) damage *= 2; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeFlyEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeFlyEffect.cs index 89e3c91..940bbd5 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeFlyEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeFlyEffect.cs @@ -23,14 +23,14 @@ public class ChargeFlyEffect : Script, IScriptForceTurnSelection, IScriptChangeI /// public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block) { - if (!executingMove.UseMove.HasFlag("hit_flying")) + if (!executingMove.UseMove.HasFlag(MoveFlags.HitFlying)) block = true; } /// public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage) { - if (!move.UseMove.HasFlag("effective_against_fly")) + if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly)) damage *= 2; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeSkyDropEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeSkyDropEffect.cs index deb7cea..0ef1aec 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeSkyDropEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ChargeSkyDropEffect.cs @@ -23,14 +23,14 @@ public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection, IScriptCha /// public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block) { - if (!executingMove.UseMove.HasFlag("hit_flying")) + if (!executingMove.UseMove.HasFlag(MoveFlags.HitFlying)) block = true; } /// public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage) { - if (!move.UseMove.HasFlag("effective_against_fly")) + if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly)) damage *= 2; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DigEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DigEffect.cs index a921d3f..73deb6f 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DigEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DigEffect.cs @@ -23,14 +23,14 @@ public class DigEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomin /// public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block) { - if (!executingMove.UseMove.HasFlag("hit_underground")) + if (!executingMove.UseMove.HasFlag(MoveFlags.HitUnderground)) block = true; } /// public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage) { - if (!move.UseMove.HasFlag("effective_against_underground")) + if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstUnderground)) damage *= 2; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DiveEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DiveEffect.cs index 9878409..483c17d 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DiveEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DiveEffect.cs @@ -23,14 +23,14 @@ public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomi /// public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block) { - if (!executingMove.UseMove.HasFlag("hit_underwater")) + if (!executingMove.UseMove.HasFlag(MoveFlags.HitUnderwater)) block = true; } /// public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage) { - if (!move.UseMove.HasFlag("effective_against_underwater")) + if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstUnderwater)) damage *= 2; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/HealBlockEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/HealBlockEffect.cs index 3f57b29..e05109a 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/HealBlockEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/HealBlockEffect.cs @@ -22,14 +22,14 @@ public class HealBlockEffect : Script, IScriptPreventMoveSelection, IScriptPreve /// public void PreventMoveSelection(IMoveChoice choice, ref bool prevent) { - if (choice.ChosenMove.MoveData.HasFlag("heal")) + if (choice.ChosenMove.MoveData.HasFlag(MoveFlags.Heal)) prevent = true; } /// public void PreventMove(IExecutingMove move, ref bool prevent) { - if (move.ChosenMove.MoveData.HasFlag("heal")) + if (move.ChosenMove.MoveData.HasFlag(MoveFlags.Heal)) prevent = true; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs index 597964a..c7d81b7 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs @@ -1,3 +1,5 @@ +using PkmnLib.Plugin.Gen7.Common; + namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; [Script(ScriptCategory.Pokemon, "protect")] @@ -9,7 +11,7 @@ public class ProtectionEffectScript : Script, IScriptBlockIncomingHit if (target.BattleData == null) return; - if (!executingMove.UseMove.HasFlag("protect")) + if (!executingMove.UseMove.HasFlag(MoveFlags.Protect)) return; var args = new CustomTriggers.BypassProtectionArgs(executingMove, target, hitIndex, false); executingMove.User.RunScriptHook(x => diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/SubstituteEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/SubstituteEffect.cs index b524834..0b33d76 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/SubstituteEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/SubstituteEffect.cs @@ -8,7 +8,7 @@ public class SubstituteEffect(uint health) : Script, IScriptBlockIncomingHit /// public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block) { - if (executingMove.UseMove.HasFlag("ignore-substitute")) + if (executingMove.UseMove.HasFlag(MoveFlags.IgnoreSubstitute)) return; var args = new CustomTriggers.BypassSubstituteArgs(executingMove, target, hitIndex, false); diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ThroatChopEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ThroatChopEffect.cs index b4d7fc9..6bfde7e 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ThroatChopEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ThroatChopEffect.cs @@ -8,14 +8,14 @@ public class ThroatChopEffect : Script, IScriptPreventMoveSelection, IScriptFail /// public void PreventMoveSelection(IMoveChoice choice, ref bool prevent) { - if (choice.ChosenMove.MoveData.HasFlag("sound")) + if (choice.ChosenMove.MoveData.HasFlag(MoveFlags.Sound)) prevent = true; } /// public void FailMove(IExecutingMove move, ref bool fail) { - if (move.UseMove.HasFlag("sound")) + if (move.UseMove.HasFlag(MoveFlags.Sound)) fail = true; } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/AromaVeilEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/AromaVeilEffect.cs index ca12461..fd13d21 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/AromaVeilEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/AromaVeilEffect.cs @@ -19,14 +19,14 @@ public class AromaVeilEffect : Script, IScriptFailIncomingMove, IScriptPreventIn /// public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail) { - if (move.UseMove.HasFlag("mental") && move.UseMove.Category == MoveCategory.Status) + if (move.UseMove.HasFlag(MoveFlags.Mental) && move.UseMove.Category == MoveCategory.Status) fail = true; } /// public void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent) { - if (move.UseMove.HasFlag("mental")) + if (move.UseMove.HasFlag(MoveFlags.Mental)) prevent = true; } } \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs index 2f20631..1deaf9e 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs @@ -1,3 +1,5 @@ +using PkmnLib.Plugin.Gen7.Common; + namespace PkmnLib.Plugin.Gen7.Scripts.Status; [Script(ScriptCategory.Status, "frozen")] @@ -18,7 +20,7 @@ public class Frozen : Script, IScriptPreventMove, IScriptOnEndTurn /// public void PreventMove(IExecutingMove move, ref bool prevent) { - if (move.UseMove.MoveType.Name == "fire" || move.UseMove.HasFlag("defrost")) + if (move.UseMove.MoveType.Name == "fire" || move.UseMove.HasFlag(MoveFlags.Defrost)) { _pokemon?.ClearStatus(); return; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Sleep.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Sleep.cs index e096c2e..174d169 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Sleep.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Sleep.cs @@ -36,7 +36,7 @@ public class Sleep : Script, IScriptPreventMove, IAIInfoScriptNumberTurnsLeft return; } - if (move.UseMove.HasFlag("usable_while_asleep")) + if (move.UseMove.HasFlag(MoveFlags.UsableWhileAsleep)) return; var args = new CustomTriggers.BypassSleepArgs(move, false);