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

116 lines
5.8 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Cloud Nine', function () {
afterEach(function () {
battle.destroy();
});
it('should treat the weather as none for the purposes of formes, moves and abilities', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['sunnyday']}]});
battle.setPlayer('p2', {team: [{species: 'Cherrim', ability: 'flowergift', item: 'laggingtail', moves: ['solarbeam']}]});
const [weatherSuppressor, weatherUser] = [battle.p1.active[0], battle.p2.active[0]];
assert.false.hurts(weatherSuppressor, () => battle.makeChoices('move sunnyday', 'move solarbeam')); // Solar Beam must charge
assert(battle.field.isWeather(''));
assert.species(weatherUser, 'Cherrim');
});
it('should negate the effects of Sun on Fire-type and Water-type attacks', function () {
battle = common.createBattle();
let move, basePower;
battle.setPlayer('p1', {team: [{species: 'Groudon', ability: 'drought', moves: ['rest']}]});
battle.setPlayer('p2', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['calmmind']}]});
battle.makeChoices('move rest', 'move calmmind');
move = Dex.getMove('firepledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.equal(basePower, move.basePower);
move = Dex.getMove('waterpledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.equal(basePower, move.basePower);
});
it('should negate the effects of Rain on Fire-type and Water-type attacks', function () {
battle = common.createBattle();
let move, basePower;
battle.setPlayer('p1', {team: [{species: 'Kyogre', ability: 'drizzle', moves: ['rest']}]});
battle.setPlayer('p2', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['calmmind']}]});
battle.makeChoices('move rest', 'move calmmind');
move = Dex.getMove('firepledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.equal(basePower, move.basePower);
move = Dex.getMove('waterpledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.equal(basePower, move.basePower);
});
it('should negate the damage-dealing effects of Sandstorm', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Tyranitar', ability: 'sandstream', moves: ['dragondance']}]});
battle.setPlayer('p2', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['calmmind']}]});
assert.false.hurts(battle.p2.active[0], () => battle.makeChoices('move dragondance', 'move calmmind'));
});
it('should negate the damage-dealing effects of Hail', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Abomasnow', ability: 'snowwarning', moves: ['rest']}]});
battle.setPlayer('p2', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['calmmind']}]});
assert.false.hurts(battle.p2.active[0], () => battle.makeChoices('move rest', 'move calmmind'));
});
it('should not negate Desolate Land\'s ability to prevent other weathers from activating', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['raindance']}]});
battle.setPlayer('p2', {team: [{species: 'Groudon', ability: 'desolateland', moves: ['sunnyday']}]});
assert.constant(() => battle.weather, () => battle.makeChoices('move raindance', 'move sunnyday'));
});
it('should not negate Primordial Sea\'s ability to prevent other weathers from activating', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['raindance']}]});
battle.setPlayer('p2', {team: [{species: 'Kyogre', ability: 'primordialsea', moves: ['sunnyday']}]});
assert.constant(() => battle.weather, () => battle.makeChoices('move raindance', 'move sunnyday'));
});
it('should not negate Delta Stream\'s ability to prevent other weathers from activating', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['raindance']}]});
battle.setPlayer('p2', {team: [{species: 'Rayquaza', ability: 'deltastream', moves: ['sunnyday']}]});
assert.constant(() => battle.weather, () => battle.makeChoices('move raindance', 'move sunnyday'));
});
it('should still display status of the weather', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['calmmind']}]});
battle.setPlayer('p2', {team: [{species: 'Sunkern', ability: 'solarpower', moves: ['sunnyday']}]});
battle.makeChoices('move calmmind', 'move sunnyday');
assert.equal(battle.log[battle.lastMoveLine + 1], '|-weather|SunnyDay');
for (let i = 0; i < 4; i++) {
assert.equal(battle.log[battle.lastMoveLine + 3], '|-weather|SunnyDay|[upkeep]');
battle.makeChoices('move calmmind', 'move sunnyday');
}
assert.equal(battle.log[battle.lastMoveLine + 3], '|-weather|none');
});
it(`should allow Hydration to trigger if the user fainted before Hydration could trigger`, function () {
battle = common.createBattle([[
{species: 'Toxapex', ability: 'cloudnine', moves: ['toxic', 'raindance', 'finalgambit']},
{species: 'Wynaut', moves: ['sleeptalk']},
], [
{species: 'Manaphy', ability: 'hydration', moves: ['sleeptalk']},
]]);
const manaphy = battle.p2.active[0];
battle.makeChoices();
battle.makeChoices('move raindance', 'auto');
assert.equal(manaphy.status, 'tox');
battle.makeChoices('move finalgambit', 'auto');
assert.equal(manaphy.status, '');
});
});