pokemon-showdown/test/sim/misc/dynamax.js
Leonard Craft III bed1f4ac99
Add various mechanics tests (#7857)
* Improve Volcalith tests readability

* Add G-Max Volcalith recoil damage order test

* Add 1 HP priority tests

* Add charge move targeting test

* Correct assertions of Ripen / Sturdy

* Skip failing tests

* Add Volcalith Black Sludge test

* Add Pressure Max / Z-move tests

* Add Pressure submove test

* Add NGas speed test

* Skip NGas speed test

* Add White Herb double Intimidate test

* Remove debug log

* Remove duplicate Pressure test

* Improve White Herb Intimidate test title

* Add Rollout Storage tests

* Add spread move Rollout storage test

* Add Magician Weakness Policy test

* Add Sleep tests

* Add Shell Bell spread move test

* Add Synchronize Lum Berry test

* oh yeah it doesn't work

* Remove duplicate test

* Add Sunsteel Strike tests

* Add Leech Seed ally switch test

* Add Primal weather Natural Gift test

* Add Emergency Exit hazards test

* Add generic hazards tests

* Add and standardize Arceus tests

* Add Transform ability test

* Add and standardize Parting Shot tests

* Add Memento tests

* Add Me First test

* Add Cursed Body Z-move test

* Add Assurance targeting test

* Clarify Assurance test description

* Add double faint switch test

* Add Receiver KO boost ability

* Add double Unnerve test

* Add Dynamax Eject Pack test

* Improve Dynamax forced switchout test

* Add Protective Pads Perish Body test

* Add Sticky Web Pressure test

* Add Speed modifier lower bound test

* Add Cloud Nine Hydration test

* Correct Cursed Body test

* Add Grassy Terrain Leftovers test

* Remove leftover debug

* Add additional Receiver and Soul-Heart tests

* Add Spite tests

* mish

* Add Shell Bell multihit test

* Add WP Dragon Tail test

Co-authored-by: The Immortal <the_immortal123@live.com>
2021-01-04 23:47:10 -08:00

183 lines
7.1 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe("Dynamax", function () {
afterEach(function () {
battle.destroy();
});
it('Max Move effects should not be suppressed by Sheer Force', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [
{species: 'Braviary', ability: 'sheerforce', moves: ['heatwave', 'facade', 'superpower']},
]});
battle.setPlayer('p2', {team: [
{species: 'Shedinja', ability: 'sturdy', item: 'ringtarget', moves: ['splash']},
]});
battle.makeChoices('move heatwave dynamax', 'auto');
assert.equal(battle.field.weather, 'sunnyday');
battle.makeChoices('move facade', 'auto');
assert.statStage(battle.p2.active[0], 'spe', -1);
battle.makeChoices('move superpower', 'auto');
assert.statStage(battle.p1.active[0], 'atk', 1);
});
it('Max Move versions of disabled moves should not be disabled, except by Assault Vest', function () {
battle = common.createBattle([[
{species: 'Mew', item: 'assaultvest', moves: ['watergun', 'protect']},
], [
{species: 'Mew', item: 'choiceband', moves: ['watergun', 'protect']},
]]);
battle.makeChoices('move 1 dynamax', 'move 1 dynamax');
assert.throws(() => {
battle.makeChoices('move 2', 'move 1');
});
battle.makeChoices('move 1', 'move 2');
});
it('Max Move weather activates even if foe faints', function () {
battle = common.createBattle([[
{species: 'Shedinja', moves: ['splash']},
], [
{species: 'Mew', moves: ['watergun']},
]]);
battle.makeChoices('move 1', 'move 1 dynamax');
assert.equal(battle.field.weather, 'raindance');
});
it('Max Move weather activates before Sand Spit', function () {
battle = common.createBattle([[
{species: 'Shedinja', ability: 'sandspit', moves: ['splash']},
], [
{species: 'Mew', moves: ['watergun']},
]]);
battle.makeChoices('move 1', 'move 1 dynamax');
assert.equal(battle.field.weather, 'sandstorm');
});
it('makes Liquid Voice stop working', function () {
battle = common.createBattle([[
{species: 'Primarina', ability: 'liquidvoice', moves: ['hypervoice']},
], [
{species: 'Rhyhorn', ability: 'wonderguard', moves: ['splash']},
]]);
battle.makeChoices('move 1 dynamax', 'move 1');
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('G-Max Steelsurge hazard should deal 2x damage to Eiscue', function () {
battle = common.createBattle([[
{species: "Copperajah", moves: ['ironhead'], gigantamax: true},
], [
{species: "Pyukumuku", moves: ['uturn']},
{species: "Eiscue", ability: 'iceface', moves: ['splash']},
]]);
battle.makeChoices('move ironhead dynamax', 'move uturn');
battle.makeChoices('', 'switch eiscue');
const pokemon = battle.p2.active[0];
const expectedPercent = Math.pow(0.5, 2);
const expectedDamage = Math.floor(pokemon.maxhp * expectedPercent);
assert.equal(pokemon.maxhp - pokemon.hp, expectedDamage, `${pokemon.name} should take ${expectedPercent * 100}%`);
});
it.skip('should revert before the start of the 4th turn, not as an end-of-turn effect on the 3rd turn', function () {
battle = common.createBattle([[
{species: 'wynaut', moves: ['sleeptalk', 'psychic']},
], [
{species: 'weedle', level: 1, moves: ['sleeptalk']},
{species: 'weedle', moves: ['sleeptalk']},
]]);
battle.makeChoices('move sleep talk dynamax');
const dynamaxedHP = battle.p1.active[0].hp;
battle.makeChoices();
battle.makeChoices('move psychic');
assert.equal(battle.requestState, 'switch');
assert.equal(battle.p1.active[0].hp, dynamaxedHP);
});
it('should be impossible to Dynamax when all the base moves are disabled', function () {
battle = common.createBattle([[
{species: "Feebas", moves: ['splash']},
], [
{species: "Wynaut", moves: ['taunt', 'splash']},
]]);
battle.makeChoices();
assert.cantMove(() => battle.choose('p1', 'move splash dynamax'));
battle = common.createBattle([[
{species: "Feebas", moves: ['splash']},
], [
{species: "Wynaut", moves: ['imprison', 'splash']},
]]);
battle.makeChoices();
battle.makeChoices('move 1', 'auto');
assert.cantMove(() => battle.choose('p1', 'move splash dynamax'));
});
it(`should not allow the user to select max moves with 0 base PP remaining`, function () {
battle = common.createBattle([[
{species: 'pichu', ability: 'prankster', level: 1, moves: ['grudge']},
{species: 'noibat', ability: 'prankster', level: 1, moves: ['grudge']},
{species: 'azurill', moves: ['sleeptalk']},
], [
{species: 'wynaut', moves: ['earthquake', 'icebeam']},
]]);
battle.makeChoices('auto', 'move earthquake dynamax');
battle.makeChoices();
assert.cantMove(() => battle.p2.chooseMove('earthquake'), 'wynaut', 'Max Quake');
battle.makeChoices(); // Noibat uses Grudge and Wynaut uses Max Hailstorm
assert.fainted(battle.p1.active[0]);
battle.makeChoices();
assert.cantMove(() => battle.p2.chooseMove('icebeam'), 'wynaut', 'icebeam');
battle.makeChoices('auto', 'move struggle'); // will throw an error if Wynaut isn't forced to use Struggle
});
it(`should force the user to use Struggle if certain effects are disabling all of its base moves`, function () {
battle = common.createBattle([[
{species: "Skwovet", item: 'oranberry', moves: ['sleeptalk', 'belch', 'stuffcheeks']},
], [
{species: "Calyrex-Shadow", moves: ['disable', 'trick']},
]]);
battle.makeChoices();
// Skwovet's Sleep Talk and Belch are disabled, but Stuff Cheeks isn't so Skwovet can still use Max Ooze
battle.makeChoices('move belch dynamax', 'auto');
assert.equal(battle.p1.active[0].boosts.spa, 1);
battle.makeChoices('move belch', 'move trick');
assert.equal(battle.p1.active[0].boosts.spa, 2);
// Now Skwovet's berry is gone, so Stuff Cheeks is disabled too
battle.makeChoices('move struggle', 'auto'); // will throw an error if Skwovet isn't forced to use Struggle
battle = common.createBattle([[
{species: "Feebas", moves: ['splash']},
], [
{species: "Clefairy", moves: ['imprison', 'gravity', 'splash']},
]]);
battle.makeChoices('move splash dynamax', 'auto');
battle.makeChoices('move splash', 'move gravity'); // will throw an error if Feebas is forced to use Struggle by Imprison
battle.makeChoices('move splash', 'auto'); // will throw an error if Feebas is forced to use Struggle by Gravity
});
it.skip(`should not remove the variable to Dynamax on forced switches`, function () {
battle = common.createBattle([[
{species: 'wynaut', item: 'ejectpack', moves: ['ironhead']},
{species: 'audino', item: 'ejectpack', moves: ['sleeptalk']},
], [
{species: 'vikavolt', moves: ['stickyweb']},
{species: 'incineroar', ability: 'intimidate', moves: ['sleeptalk']},
]]);
battle.makeChoices();
battle.makeChoices('move ironhead dynamax', 'switch 2');
battle.makeChoices('switch 2'); // Eject Pack to Audino
battle.makeChoices('switch 2'); // Eject Pack back to Wynaut, to Dynamax
const wynaut = battle.p1.active[0];
assert.statStage(wynaut, 'def', 0, 'Wynaut should not have used Max Steelspike this turn.');
assert(wynaut.volatiles['dynamax'], 'Wynaut should be currently Dynamaxed.');
});
});