74 lines
3.0 KiB
C#
74 lines
3.0 KiB
C#
using PkmnLib.Dynamic.ScriptHandling;
|
|
using PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
|
|
|
/// <summary>
|
|
/// Tests for the <see cref="MoongeistBeam"/> 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.)"
|
|
/// </summary>
|
|
public class MoongeistBeamTests
|
|
{
|
|
/// <summary>
|
|
/// 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 <see cref="ScriptCategory.Ability"/> category to it.
|
|
/// </summary>
|
|
[Test]
|
|
public async Task OnBeforeAnyHookInvoked_NullList_CreatesListContainingAbilityCategory()
|
|
{
|
|
// Arrange
|
|
var script = new MoongeistBeam();
|
|
List<ScriptCategory>? suppressedCategories = null;
|
|
|
|
// Act
|
|
script.OnBeforeAnyHookInvoked(ref suppressedCategories);
|
|
|
|
// Assert
|
|
await Assert.That(suppressedCategories).IsNotNull();
|
|
await Assert.That(suppressedCategories!.Contains(ScriptCategory.Ability)).IsTrue();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
[Test]
|
|
public async Task OnBeforeAnyHookInvoked_ExistingList_AddsAbilityCategoryAndKeepsExistingEntries()
|
|
{
|
|
// Arrange
|
|
var script = new MoongeistBeam();
|
|
List<ScriptCategory>? 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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
[Test]
|
|
public async Task OnBeforeAnyHookInvoked_NullList_OnlySuppressesAbilityCategory()
|
|
{
|
|
// Arrange
|
|
var script = new MoongeistBeam();
|
|
List<ScriptCategory>? suppressedCategories = null;
|
|
|
|
// Act
|
|
script.OnBeforeAnyHookInvoked(ref suppressedCategories);
|
|
|
|
// Assert
|
|
await Assert.That(suppressedCategories!.Count).IsEqualTo(1);
|
|
await Assert.That(suppressedCategories![0]).IsEqualTo(ScriptCategory.Ability);
|
|
}
|
|
} |