mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-09-12 03:05:36 -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.
98 lines
3.1 KiB
JavaScript
98 lines
3.1 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('../../assert');
|
|
const common = require('../../common');
|
|
|
|
let battle;
|
|
|
|
// tests are derived from the following post and related quotes:
|
|
// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9417627
|
|
describe('Stone Axe', () => {
|
|
afterEach(() => {
|
|
battle.destroy();
|
|
});
|
|
|
|
it(`should set up Stealth Rock on the side of the opponent`, () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'kleavor', ability: 'noguard', moves: ['stoneaxe'] },
|
|
], [
|
|
{ species: 'registeel', moves: ['splash'] },
|
|
]]);
|
|
|
|
battle.makeChoices();
|
|
assert(battle.p2.sideConditions.stealthrock);
|
|
});
|
|
|
|
it(`should set up Stealth Rock on the side of the opponent, not necessarily the target, in a double battle`, () => {
|
|
battle = common.createBattle({ gameType: 'doubles' }, [[
|
|
{ species: 'kleavor', ability: 'noguard', moves: ['stoneaxe'] },
|
|
{ species: 'pikachu', moves: ['splash'] },
|
|
], [
|
|
{ species: 'squirtle', moves: ['splash'] },
|
|
{ species: 'bulbasaur', moves: ['splash'] },
|
|
]]);
|
|
|
|
battle.makeChoices('move stoneaxe -2, move splash', 'move splash, move splash');
|
|
|
|
assert.equal(!!(battle.p1.sideConditions.stealthrock), false);
|
|
assert(battle.p2.sideConditions.stealthrock);
|
|
});
|
|
|
|
it(`should still set up Stealth Rock on the side of the opponent that is behind a Substitute`, () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'kleavor', ability: 'noguard', moves: ['stoneaxe'] },
|
|
], [
|
|
{ species: 'regieleki', moves: ['substitute'] },
|
|
]]);
|
|
|
|
battle.makeChoices();
|
|
assert(battle.p2.sideConditions.stealthrock);
|
|
});
|
|
|
|
it(`should not set up Stealth Rock if the move does not hit opponent or its Substitute`, () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'kleavor', moves: ['stoneaxe'] },
|
|
], [
|
|
{ species: 'regieleki', moves: ['protect'] },
|
|
]]);
|
|
|
|
battle.makeChoices();
|
|
assert.equal(!!(battle.p2.sideConditions.stealthrock), false);
|
|
});
|
|
|
|
it('should not be bounced back by Magic Bounce', () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'kleavor', ability: 'noguard', moves: ['stoneaxe'] },
|
|
], [
|
|
{ species: 'registeel', ability: 'magicbounce', moves: ['splash'] },
|
|
]]);
|
|
|
|
battle.makeChoices();
|
|
assert.equal(!!(battle.p1.sideConditions.stealthrock), false);
|
|
assert(battle.p2.sideConditions.stealthrock);
|
|
});
|
|
|
|
it('should have its Stealth Rock prevented by Sheer Force', () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'kleavor', ability: 'sheerforce', moves: ['stoneaxe'] },
|
|
], [
|
|
{ species: 'registeel', ability: 'noguard', moves: ['splash'] },
|
|
]]);
|
|
|
|
battle.makeChoices();
|
|
assert.equal(!!(battle.p2.sideConditions.stealthrock), false);
|
|
});
|
|
|
|
it(`should not set Stealth Rock when the user faints from Rocky Helmet`, () => {
|
|
battle = common.createBattle([[
|
|
{ species: 'kleavor', ability: 'noguard', item: 'focussash', moves: ['stoneaxe'] },
|
|
{ species: 'wynaut', moves: ['sleeptalk'] },
|
|
], [
|
|
{ species: 'regieleki', item: 'rockyhelmet', moves: ['sheercold'] },
|
|
]]);
|
|
|
|
battle.makeChoices(); // Kleavor will faint to the Rocky Helmet
|
|
assert.equal(!!(battle.p2.sideConditions.stealthrock), false);
|
|
});
|
|
});
|