pokemon-showdown/test/sim/abilities/desolateland.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

158 lines
7.8 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Desolate Land', function () {
afterEach(function () {
battle.destroy();
});
it('should activate the Desolate Land weather upon switch-in', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]});
battle.setPlayer('p2', {team: [{species: "Abra", ability: 'magicguard', moves: ['teleport']}]});
assert(battle.field.isWeather('desolateland'));
});
it('should increase the damage (not the basePower) of Fire-type attacks', function () {
battle = common.createBattle();
battle.randomizer = dmg => dmg; // max damage
battle.setPlayer('p1', {team: [{species: 'Ninetales', ability: 'desolateland', moves: ['incinerate']}]});
battle.setPlayer('p2', {team: [{species: 'Cryogonal', ability: 'levitate', moves: ['splash']}]});
const attacker = battle.p1.active[0];
const defender = battle.p2.active[0];
assert.hurtsBy(defender, 152, () => battle.makeChoices('move incinerate', 'move splash'));
const move = Dex.getMove('incinerate');
const basePower = battle.runEvent('BasePower', attacker, defender, move, move.basePower, true);
assert.equal(basePower, move.basePower);
});
it('should cause Water-type attacks to fail', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]});
battle.setPlayer('p2', {team: [{species: "Blastoise", ability: 'torrent', moves: ['surf']}]});
battle.makeChoices('move helpinghand', 'move surf');
assert.fullHP(battle.p1.active[0]);
});
it('should not cause Water-type Status moves to fail', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]});
battle.setPlayer('p2', {team: [{species: "Blastoise", ability: 'torrent', moves: ['soak']}]});
const soakTarget = battle.p1.active[0];
assert.sets(() => soakTarget.getTypes().join('/'), 'Water', () => battle.makeChoices('move helpinghand', 'move soak'));
});
it('should prevent moves and abilities from setting the weather to Sunny Day, Rain Dance, Sandstorm, or Hail', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]});
battle.setPlayer('p2', {team: [
{species: "Abra", ability: 'magicguard', moves: ['teleport']},
{species: "Kyogre", ability: 'drizzle', moves: ['raindance']},
{species: "Groudon", ability: 'drought', moves: ['sunnyday']},
{species: "Tyranitar", ability: 'sandstream', moves: ['sandstorm']},
{species: "Abomasnow", ability: 'snowwarning', moves: ['hail']},
]});
for (let i = 2; i <= 5; i++) {
battle.makeChoices('move helpinghand', 'switch ' + i);
assert(battle.field.isWeather('desolateland'));
battle.makeChoices('move helpinghand', 'move 1');
assert(battle.field.isWeather('desolateland'));
}
});
it('should be treated as Sunny Day for any forme, move or ability that requires it', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand', 'solarbeam']}]});
battle.setPlayer('p2', {team: [
{species: "Castform", ability: 'forecast', moves: ['weatherball']},
{species: "Cherrim", ability: 'flowergift', moves: ['growth']},
{species: "Charizard", ability: 'solarpower', moves: ['roost']},
{species: "Venusaur", ability: 'chlorophyll', moves: ['growth']},
{species: "Toxicroak", ability: 'dryskin', moves: ['bulkup']},
]});
battle.onEvent('Hit', battle.format, (target, pokemon, move) => {
if (move.id === 'weatherball') {
assert.equal(move.type, 'Fire');
}
});
const myActive = battle.p2.active;
battle.makeChoices('move helpinghand', 'move weatherball');
assert.species(myActive[0], 'Castform-Sunny');
battle.makeChoices('move helpinghand', 'switch 2');
assert.species(myActive[0], 'Cherrim-Sunshine');
battle.makeChoices('move helpinghand', 'switch 3');
assert.false.fullHP(myActive[0], "Charizard should be hurt by Solar Power");
battle.makeChoices('move solarbeam', 'switch 4');
assert.equal(myActive[0].getStat('spe'), 2 * myActive[0].storedStats['spe'], "Venusaur's speed should be doubled by Chlorophyll");
assert.false.fullHP(myActive[0], "Solar Beam should skip its charge turn");
battle.makeChoices('move helpinghand', 'switch 5');
assert.false.fullHP(myActive[0], "Toxicroak should be hurt by Dry Skin");
});
it('should cause the Desolate Land weather to fade if it switches out and no other Desolate Land Pokemon are active', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [
{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']},
{species: "Ho-Oh", ability: 'pressure', moves: ['roost']},
]});
battle.setPlayer('p2', {team: [{species: "Lugia", ability: 'pressure', moves: ['roost']}]});
assert.sets(() => battle.field.isWeather('desolateland'), false, () => battle.makeChoices('switch 2', 'move roost'));
});
it('should not cause the Desolate Land weather to fade if it switches out and another Desolate Land Pokemon is active', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [
{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']},
{species: "Ho-Oh", ability: 'pressure', moves: ['roost']},
]});
battle.setPlayer('p2', {team: [{species: "Groudon", ability: 'desolateland', moves: ['bulkup']}]});
assert.constant(() => battle.field.isWeather('desolateland'), () => battle.makeChoices('switch 2', 'move bulkup'));
});
it('should cause the Desolate Land weather to fade if its ability is suppressed and no other Desolate Land Pokemon are active', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]});
battle.setPlayer('p2', {team: [{species: "Lugia", ability: 'pressure', moves: ['gastroacid']}]});
assert.sets(() => battle.field.isWeather('desolateland'), false, () => battle.makeChoices('move helpinghand', 'move gastroacid'));
});
it('should not cause the Desolate Land weather to fade if its ability is suppressed and another Desolate Land Pokemon is active', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]});
battle.setPlayer('p2', {team: [{species: "Groudon", ability: 'desolateland', moves: ['gastroacid']}]});
assert.constant(() => battle.field.isWeather('desolateland'), () => battle.makeChoices('move helpinghand', 'move gastroacid'));
});
it('should cause the Desolate Land weather to fade if its ability is changed and no other Desolate Land Pokemon are active', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]});
battle.setPlayer('p2', {team: [{species: "Lugia", ability: 'pressure', moves: ['entrainment']}]});
assert.sets(() => battle.field.isWeather('desolateland'), false, () => battle.makeChoices('move helpinghand', 'move entrainment'));
});
it('should fade after being forced out via Roar', function () {
battle = common.createBattle([[
{species: 'Groudon', item: "Red Orb", moves: ['sleeptalk']},
{species: 'Wynaut', moves: ['sleeptalk']},
], [
{species: 'Wynaut', moves: ['roar']},
]]);
battle.makeChoices();
assert.false(battle.field.isWeather('desolateland'));
});
it(`should cause Water-type Natural Gift to fail`, function () {
battle = common.createBattle([[
{species: 'Groudon', item: 'Red Orb', moves: ['sleeptalk']},
], [
{species: 'Wynaut', moves: ['naturalgift']},
]]);
battle.makeChoices();
assert.fullHP(battle.p1.active[0]);
});
});