mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-22 07:25:28 -05:00
- Centiskorch was misspelled in formats-data, causing a crash in the egg validator - A few validation errors were due to Gen 6 not inheriting from Gen 7, Gen 7 not having a scripts file, and Gen 8 having a gen of 7 - Intimidate (Gen 7) wasn't inheriting from Intimidate (Gen 8), giving it no name, causing a few validation errors (Technically not a build error, but I also added Keen Eye to the list of Intimidate immunities, as reported by SadisticMystic.) - A lot of tests relied on Teleport always failing; these have been switched to Gen 7 or swapped Teleport for Celebrate - Inverse Mod suddenly stopped working; its implementation was a huge hack and I can't figure out what went wrong, so I've switched it to using the same system the other mod tests use. It's still a huge hack, but I don't have the free time to fix it right now.
82 lines
4.0 KiB
JavaScript
82 lines
4.0 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('./../../assert');
|
|
const common = require('./../../common');
|
|
|
|
let battle;
|
|
|
|
describe('Inverse Battle', function () {
|
|
beforeEach(() => (battle = common.createBattle({inverseMod: true})));
|
|
afterEach(() => battle.destroy());
|
|
|
|
it('should change natural resistances into weaknesses', function () {
|
|
battle.setPlayer('p1', {team: [{species: "Hariyama", ability: 'guts', moves: ['vitalthrow']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Scyther", ability: 'swarm', moves: ['roost']}]});
|
|
battle.makeChoices('move vitalthrow', 'move roost');
|
|
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-supereffective|'));
|
|
});
|
|
|
|
it('should change natural weaknesses into resistances', function () {
|
|
battle.setPlayer('p1', {team: [{species: "Hariyama", ability: 'guts', moves: ['vitalthrow']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Absol", ability: 'pressure', moves: ['leer']}]});
|
|
battle.makeChoices('move vitalthrow', 'move leer');
|
|
battle.makeChoices('move vitalthrow', 'move leer');
|
|
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-resisted|'));
|
|
});
|
|
|
|
it('should negate natural immunities and make them weaknesses', function () {
|
|
battle.setPlayer('p1', {team: [{species: "Hariyama", ability: 'guts', moves: ['vitalthrow']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Dusknoir", ability: 'frisk', moves: ['rest']}]});
|
|
battle.makeChoices('move vitalthrow', 'move rest');
|
|
battle.makeChoices('move vitalthrow', 'move rest');
|
|
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-supereffective|'));
|
|
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
|
|
});
|
|
|
|
it('should affect Stealth Rock damage', function () {
|
|
battle.setPlayer('p1', {team: [{species: "Smeargle", moves: ['splash', 'stealthrock']}]});
|
|
battle.setPlayer('p2', {team: [
|
|
{species: "Ninjask", moves: ['protect']},
|
|
{species: "Steelix", moves: ['rest']},
|
|
{species: "Hitmonchan", moves: ['rest']},
|
|
{species: "Chansey", moves: ['wish']},
|
|
{species: "Staraptor", moves: ['roost']},
|
|
{species: "Volcarona", moves: ['roost']},
|
|
]});
|
|
battle.makeChoices('move stealthrock', 'move protect');
|
|
let pokemon;
|
|
for (let i = 2; i <= 6; i++) {
|
|
battle.makeChoices('move splash', 'switch ' + i);
|
|
pokemon = battle.p2.active[0];
|
|
const expectedPercent = Math.pow(0.5, i - 1);
|
|
const expectedDamage = Math.floor(pokemon.maxhp * expectedPercent);
|
|
assert.strictEqual(pokemon.maxhp - pokemon.hp, expectedDamage, `${pokemon.name} should take ${expectedPercent * 100}%`);
|
|
}
|
|
});
|
|
|
|
it('should not affect ability-based immunities', function () {
|
|
battle.setPlayer('p1', {team: [{species: "Hariyama", ability: 'guts', moves: ['earthquake']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Mismagius", ability: 'levitate', moves: ['shadowsneak']}]});
|
|
battle.makeChoices('move earthquake', 'move shadowsneak');
|
|
battle.makeChoices('move earthquake', 'move shadowsneak');
|
|
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
|
|
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
|
|
});
|
|
|
|
it('should not affect the type effectiveness of Freeze Dry on Water-type Pokemon', function () {
|
|
battle.setPlayer('p1', {team: [{species: "Lapras", ability: 'waterabsorb', moves: ['freezedry']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Floatzel", ability: 'waterveil', moves: ['aquajet']}]});
|
|
battle.makeChoices('move freezedry', 'move aquajet');
|
|
battle.makeChoices('move freezedry', 'move aquajet');
|
|
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-supereffective|'));
|
|
});
|
|
|
|
it('should not affect the "ungrounded" state of Flying-type Pokemon', function () {
|
|
battle.setPlayer('p1', {team: [{species: "Parasect", ability: 'dryskin', moves: ['spore']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Talonflame", ability: 'galewings', moves: ['mistyterrain']}]});
|
|
battle.makeChoices('move spore', 'move mistyterrain');
|
|
battle.makeChoices('move spore', 'move mistyterrain');
|
|
assert.strictEqual(battle.p2.active[0].status, 'slp');
|
|
});
|
|
});
|