pokemon-showdown/test/sim/items/weaknesspolicy.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

109 lines
3.5 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Weakness Policy', function () {
afterEach(function () {
battle.destroy();
});
it('should be triggered by super effective hits', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [
{species: "Lucario", ability: 'justified', moves: ['aurasphere']},
]});
battle.setPlayer('p2', {team: [
{species: "Blissey", ability: 'naturalcure', item: 'weaknesspolicy', moves: ['softboiled']},
]});
const holder = battle.p2.active[0];
battle.makeChoices('move aurasphere', 'move softboiled');
assert.false.holdsItem(holder);
assert.statStage(holder, 'atk', 2);
assert.statStage(holder, 'spa', 2);
});
it('should respect individual type effectivenesses in doubles', function () {
battle = common.createBattle({gameType: 'doubles'});
battle.setPlayer('p1', {team: [
{species: "Stunfisk", ability: 'limber', moves: ['earthquake', 'surf', 'discharge']},
{species: "Volcarona", ability: 'swarm', item: 'weaknesspolicy', moves: ['roost']},
]});
battle.setPlayer('p2', {team: [
{species: "Zekrom", ability: 'teravolt', item: 'weaknesspolicy', moves: ['roost']},
{species: "Pyukumuku", ability: 'unaware', item: 'weaknesspolicy', moves: ['recover']},
]});
const zekrom = battle.p2.active[0];
const pyuk = battle.p2.active[1];
const volc = battle.p1.active[1];
battle.makeChoices('move earthquake, move roost', 'auto');
assert.false.holdsItem(zekrom);
assert.statStage(zekrom, 'atk', 2);
assert.statStage(zekrom, 'spa', 2);
assert.holdsItem(pyuk);
assert.statStage(pyuk, 'atk', 0);
assert.statStage(pyuk, 'spa', 0);
assert.holdsItem(volc);
assert.statStage(volc, 'atk', 0);
assert.statStage(volc, 'spa', 0);
zekrom.setItem('weaknesspolicy');
zekrom.clearBoosts();
battle.makeChoices('move discharge, move roost', 'auto');
assert.holdsItem(zekrom);
assert.statStage(zekrom, 'atk', 0);
assert.statStage(zekrom, 'spa', 0);
assert.false.holdsItem(pyuk);
assert.statStage(pyuk, 'atk', 2);
assert.statStage(pyuk, 'spa', 2);
assert.holdsItem(volc);
assert.statStage(volc, 'atk', 0);
assert.statStage(volc, 'spa', 0);
pyuk.setItem('weaknesspolicy');
pyuk.clearBoosts();
battle.makeChoices('move surf, move roost', 'auto');
assert.holdsItem(zekrom);
assert.statStage(zekrom, 'atk', 0);
assert.statStage(zekrom, 'spa', 0);
assert.holdsItem(pyuk);
assert.statStage(pyuk, 'atk', 0);
assert.statStage(pyuk, 'spa', 0);
assert.false.holdsItem(volc);
assert.statStage(volc, 'atk', 2);
assert.statStage(volc, 'spa', 2);
});
it('should not be triggered by fixed damage moves', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [
{species: "Lucario", ability: 'justified', moves: ['seismictoss']},
]});
battle.setPlayer('p2', {team: [
{species: "Blissey", ability: 'naturalcure', item: 'weaknesspolicy', moves: ['softboiled']},
]});
const holder = battle.p2.active[0];
battle.makeChoices('move seismictoss', 'move softboiled');
assert.holdsItem(holder);
assert.statStage(holder, 'atk', 0);
assert.statStage(holder, 'spa', 0);
});
it(`should trigger before forced switching moves`, function () {
battle = common.createBattle([[
{species: 'wynaut', ability: 'compoundeyes', moves: ['dragontail']},
], [
{species: 'zygarde', item: 'weaknesspolicy', moves: ['sleeptalk']},
{species: 'aron', moves: ['sleeptalk']},
]]);
const zygarde = battle.p2.active[0];
battle.makeChoices();
assert.false.holdsItem(zygarde);
});
});