mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-26 10:48:53 -05:00
ESLint has a whole new config format, so I figure it's a good time to make the config system saner. - First, we no longer have separate eslint-no-types configs. Lint performance shouldn't be enough of a problem to justify the relevant maintenance complexity. - Second, our base config should work out-of-the-box now. `npx eslint` will work as expected, without any CLI flags. You should still use `npm run lint` which adds the `--cached` flag for performance. - Third, whatever updates I did fixed style linting, which apparently has been bugged for quite some time, considering all the obvious mixed-tabs-and-spaces issues I found in the upgrade. Also here are some changes to our style rules. In particular: - Curly brackets (for objects etc) now have spaces inside them. Sorry for the huge change. ESLint doesn't support our old style, and most projects use Prettier style, so we might as well match them in this way. See https://github.com/eslint-stylistic/eslint-stylistic/issues/415 - String + number concatenation is no longer allowed. We now consistently use template strings for this.
81 lines
2.9 KiB
JavaScript
81 lines
2.9 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('./../../assert');
|
|
const common = require('./../../common');
|
|
|
|
let battle;
|
|
|
|
describe('Wish', () => {
|
|
afterEach(() => {
|
|
battle.destroy();
|
|
});
|
|
|
|
it(`should heal the Pokemon in the user's slot by 1/2 of the user's max HP 1 turn after use`, () => {
|
|
battle = common.createBattle({ gameType: 'doubles' });
|
|
battle.setPlayer('p1', { team: [
|
|
{ species: "Chansey", moves: ['wish'] },
|
|
{ species: "Chansey", moves: ['wish'] },
|
|
{ species: "Donphan", ability: 'sturdy', moves: ['sleeptalk'] },
|
|
{ species: "Guzzlord", item: 'focussash', moves: ['sleeptalk'] },
|
|
] });
|
|
battle.setPlayer('p2', { team: [
|
|
{ species: "Kyurem", moves: ['icebeam'] },
|
|
{ species: "Diancie", moves: ['moonblast'] },
|
|
] });
|
|
battle.makeChoices('move wish, move wish', 'move icebeam 1, move moonblast 2');
|
|
battle.makeChoices('switch 3, switch 4', 'move icebeam 1, move moonblast 2');
|
|
assert.fullHP(battle.p1.active[0]);
|
|
assert.equal(battle.p1.active[1].hp, 321);
|
|
});
|
|
|
|
it('should progress its duration whether or not the Pokemon in its slot is fainted', () => {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', { team: [
|
|
{ species: "Pichu", ability: 'prankster', moves: ['wish'] },
|
|
{ species: "Parasect", ability: 'effectspore', moves: ['sleeptalk'] },
|
|
] });
|
|
battle.setPlayer('p2', { team: [
|
|
{ species: "Zygarde", ability: 'aurabreak', moves: ['thousandarrows'] },
|
|
] });
|
|
battle.makeChoices('move wish', 'move thousandarrows');
|
|
battle.makeChoices('switch 2');
|
|
battle.makeChoices('auto', 'move thousandarrows');
|
|
assert.fullHP(battle.p1.active[0]);
|
|
});
|
|
|
|
it(`should never resolve when used on a turn that is a multiple of 256n - 1`, () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'Wynaut', moves: ['sleeptalk', 'wish', 'doubleedge'] },
|
|
], [
|
|
{ species: 'Stakataka', moves: ['sleeptalk'] },
|
|
]]);
|
|
|
|
battle.turn = 255; // Showdown turn is +1 from what the games are; this would ordinarily be 254
|
|
battle.makeChoices('move doubleedge', 'auto');
|
|
battle.makeChoices('move wish', 'auto');
|
|
for (let i = 0; i < 5; i++) battle.makeChoices();
|
|
battle.makeChoices('move wish', 'auto');
|
|
battle.makeChoices();
|
|
|
|
const wynaut = battle.p1.active[0];
|
|
assert.false.fullHP(wynaut, `Wish should have never resolved.`);
|
|
});
|
|
|
|
it(`should do nothing if no Pokemon is present to heal from Wish`, () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'Wynaut', moves: ['sleeptalk', 'wish'] },
|
|
{ species: 'Shedinja', moves: ['sleeptalk'] },
|
|
], [
|
|
{ species: 'Happiny', ability: 'noguard', moves: ['sleeptalk', 'stoneaxe'] },
|
|
]]);
|
|
|
|
battle.makeChoices('move wish', 'move stoneaxe');
|
|
battle.makeChoices('switch 2', 'auto');
|
|
battle.makeChoices('switch 2');
|
|
const wynaut = battle.p1.active[0];
|
|
assert.false.fullHP(wynaut, `Wish should not have healed Wynaut even after it was KOed.`);
|
|
battle.makeChoices();
|
|
assert.false.fullHP(wynaut, `Wish should not have healed Wynaut later either.`);
|
|
});
|
|
});
|