pokemon-showdown/test/sim/misc/hazards.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

86 lines
3.6 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Hazards', function () {
afterEach(function () {
battle.destroy();
});
it(`should damage Pokemon before regular entrance Abilities`, function () {
battle = common.createBattle([[
{species: 'wynaut', moves: ['uturn']},
{species: 'shedinja', ability: 'electricsurge', moves: ['sleeptalk']},
], [
{species: 'landorus', moves: ['stealthrock']},
]]);
battle.makeChoices();
battle.makeChoices('switch 2');
assert.false(battle.field.isTerrain('electricterrain'));
});
it(`should damage multiple Pokemon switching in simulatenously by Speed order`, function () {
battle = common.createBattle([[
{species: 'wynaut', moves: ['stealthrock', 'sleeptalk']},
{species: 'kyogre', ability: 'drizzle', item: 'choicescarf', moves: ['sleeptalk']},
], [
{species: 'miltank', moves: ['stealthrock', 'finalgambit']},
{species: 'landorus-therian', ability: 'intimidate', moves: ['sleeptalk']},
]]);
battle.makeChoices();
battle.makeChoices('move sleeptalk', 'move finalgambit');
battle.makeChoices('switch 2', 'switch 2');
const log = battle.getDebugLog();
const rocksKyogreIndex = log.indexOf('|-damage|p1a: Kyogre|299/341|[from] Stealth Rock');
const abilityKyogreIndex = log.indexOf('ability: Drizzle|[of] p1a: Kyogre');
const rocksLandorusIndex = log.indexOf('|-damage|p2a: Landorus|280/319|[from] Stealth Rock');
const abilityLandorusIndex = log.indexOf('|-ability|p2a: Landorus|Intimidate');
assert(rocksKyogreIndex < abilityKyogreIndex, 'Stealth Rock should damage Kyogre before Drizzle activates.');
assert(abilityKyogreIndex < rocksLandorusIndex, 'Kyogre should activate Drizzle before Landorus takes rocks damage.');
assert(rocksLandorusIndex < abilityLandorusIndex, 'Stealth Rock should damage Landorus before Intimidate activates.');
});
it.skip(`should apply hazards in the order they were set up`, function () {
battle = common.createBattle([[
{species: 'wynaut', moves: ['sleeptalk', 'uturn']},
{species: 'whismur', moves: ['sleeptalk']},
], [
{species: 'landorus', moves: ['stealthrock', 'spikes', 'stickyweb', 'toxicspikes']},
]]);
battle.makeChoices('move sleeptalk', 'move toxicspikes');
battle.makeChoices('move sleeptalk', 'move stickyweb');
battle.makeChoices('move sleeptalk', 'move spikes');
battle.makeChoices('move sleeptalk', 'move toxicspikes');
battle.makeChoices('move uturn', 'move stealthrock');
battle.makeChoices('switch 2');
const log = battle.getDebugLog();
const tSpikeIndex = log.indexOf('|-status|p1a: Whismur|tox');
const websIndex = log.indexOf('|-activate|p1a: Whismur|move: Sticky Web');
const spikesIndex = log.indexOf('|[from] Spikes');
const rocksIndex = log.indexOf('[from] Stealth Rock');
assert(tSpikeIndex < websIndex, 'Toxic Spikes should have poisoned before Sticky Web lowered speed.');
assert(websIndex < spikesIndex, 'Sticky Web should have lowered speed before Spikes damage.');
assert(spikesIndex < rocksIndex, 'Spikes should have damaged before Stealth Rock.');
});
it(`should allow Berries to trigger between hazards`, function () {
battle = common.createBattle([[
{species: 'wynaut', moves: ['sleeptalk', 'uturn']},
{species: 'shedinja', item: 'lumberry', moves: ['sleeptalk']},
], [
{species: 'landorus', moves: ['toxicspikes', 'stealthrock']},
]]);
battle.makeChoices();
battle.makeChoices('move uturn', 'move stealthrock');
battle.makeChoices('switch 2');
const shedinja = battle.p1.active[0];
assert.false.holdsItem(shedinja, 'Shedinja should have lost Lum Berry before fainting to rocks.');
});
});