namespace Gen7{ [Move effect=Acupressure] class Acupressure : PkmnScript { void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override { if (attack.User is target){ attack.GetHitData(target, hit).Fail(); return; } auto randStat = Statistic(target.Battle.Random.Get(1, 6)); target.ChangeStatBoost(randStat, 2, false); }; } } #if TESTS void TestWithRandomSeed(uint seed, Statistic stat){ auto battle = CreateSimpleBattle(seed, "charizard", "venusaur", 100); auto mon1 = battle.GetBattleSide(0).GetPokemon(0); auto mon2 = battle.GetBattleSide(1).GetPokemon(0); auto script = cast(CreateMoveScript("Acupressure")); auto executingMove = CreateExecutingMove("Acupressure", mon1, mon2); script.OnSecondaryEffect(executingMove, mon2, 0x0); RequireEquals(2, mon2.GetStatBoost(stat)); } [Test name="Acupressure: Random stat increases by two"] void Acupressure_RandomStatIncreasesBy2(){ TestWithRandomSeed(684, Statistic::SpecialDefense); TestWithRandomSeed(1037038, Statistic::SpecialDefense); TestWithRandomSeed(3572948, Statistic::Attack); TestWithRandomSeed(4087125, Statistic::SpecialDefense); TestWithRandomSeed(4199056, Statistic::Speed); TestWithRandomSeed(7291450, Statistic::Attack); TestWithRandomSeed(8639137, Statistic::SpecialAttack); TestWithRandomSeed(8918584, Statistic::Attack); TestWithRandomSeed(9564376, Statistic::Defense); TestWithRandomSeed(9859436, Statistic::SpecialDefense); } [Test name="Acupressure: Fails When Targets Self"] void Acupressure_FailsOnSelfTarget(){ auto battle = CreateSimpleBattle(684, "charizard", "venusaur", 100); auto mon1 = battle.GetBattleSide(0).GetPokemon(0); auto script = cast(CreateMoveScript("Acupressure")); auto executingMove = CreateExecutingMove("Acupressure", mon1, mon1); script.OnSecondaryEffect(executingMove, mon1, 0x0); Require(executingMove.GetHitData(mon1, 0x0).HasFailed); } #endif