using PkmnLib.Dynamic.ScriptHandling; using PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves; /// /// Tests for the move script. /// Gen VII Bulbapedia behavior: "Moongeist Beam inflicts damage, ignoring all ignorable Abilities during the /// execution of that move. (Ignorable Abilities are most Abilities that could potentially negatively affect /// the success, damage, or effects of a move if possessed by the target of a move or its allies—such as /// Multiscale and Friend Guard.)" /// public class MoongeistBeamTests { /// /// Bulbapedia: "Moongeist Beam inflicts damage, ignoring all ignorable Abilities during the execution of /// that move." — when no categories are suppressed yet, the script creates the suppression list and adds /// the category to it. /// [Test] public async Task OnBeforeAnyHookInvoked_NullList_CreatesListContainingAbilityCategory() { // Arrange var script = new MoongeistBeam(); List? suppressedCategories = null; // Act script.OnBeforeAnyHookInvoked(ref suppressedCategories); // Assert await Assert.That(suppressedCategories).IsNotNull(); await Assert.That(suppressedCategories!.Contains(ScriptCategory.Ability)).IsTrue(); } /// /// Bulbapedia: "ignoring all ignorable Abilities during the execution of that move" — when other script /// categories are already suppressed, the Ability category is added without removing the existing /// suppressions. /// [Test] public async Task OnBeforeAnyHookInvoked_ExistingList_AddsAbilityCategoryAndKeepsExistingEntries() { // Arrange var script = new MoongeistBeam(); List? suppressedCategories = [ScriptCategory.ItemBattleTrigger]; // Act script.OnBeforeAnyHookInvoked(ref suppressedCategories); // Assert await Assert.That(suppressedCategories!.Contains(ScriptCategory.Ability)).IsTrue(); await Assert.That(suppressedCategories!.Contains(ScriptCategory.ItemBattleTrigger)).IsTrue(); } /// /// Bulbapedia: only "ignorable Abilities" are ignored — Moongeist Beam does not suppress any other kind /// of script (held items, status conditions, side effects, ...), so the script adds exactly the Ability /// category and nothing else. /// [Test] public async Task OnBeforeAnyHookInvoked_NullList_OnlySuppressesAbilityCategory() { // Arrange var script = new MoongeistBeam(); List? suppressedCategories = null; // Act script.OnBeforeAnyHookInvoked(ref suppressedCategories); // Assert await Assert.That(suppressedCategories!.Count).IsEqualTo(1); await Assert.That(suppressedCategories![0]).IsEqualTo(ScriptCategory.Ability); } }