mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-08-03 17:19:39 -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.
87 lines
3.2 KiB
JavaScript
87 lines
3.2 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('./../../assert');
|
|
const common = require('./../../common');
|
|
|
|
let battle;
|
|
|
|
describe('Comatose', () => {
|
|
afterEach(() => {
|
|
battle.destroy();
|
|
});
|
|
|
|
it('should make the user immune to status conditions', () => {
|
|
battle = common.createBattle([[
|
|
{ species: "Komala", ability: 'comatose', moves: ['shadowclaw'] },
|
|
], [
|
|
{ species: "Smeargle", ability: 'noguard', moves: ['spore', 'glare', 'willowisp', 'toxic'] },
|
|
]]);
|
|
const comatoseMon = battle.p1.active[0];
|
|
for (let i = 1; i <= 4; i++) {
|
|
assert.constant(() => comatoseMon.status, () => battle.makeChoices('move shadowclaw', 'move ' + i));
|
|
}
|
|
});
|
|
|
|
it('should not have its status immunity bypassed by Mold Breaker', () => {
|
|
battle = common.createBattle([[
|
|
{ species: "Komala", ability: 'comatose', moves: ['shadowclaw'] },
|
|
], [
|
|
{ species: "Smeargle", ability: 'moldbreaker', moves: ['spore', 'glare', 'willowisp', 'toxic'] },
|
|
]]);
|
|
const comatoseMon = battle.p1.active[0];
|
|
for (let i = 1; i <= 4; i++) {
|
|
assert.constant(() => comatoseMon.status, () => battle.makeChoices('move shadowclaw', 'move ' + i));
|
|
}
|
|
});
|
|
|
|
it('should cause Rest to fail', () => {
|
|
battle = common.createBattle([[
|
|
{ species: "Komala", ability: 'comatose', moves: ['rest'] },
|
|
], [
|
|
{ species: "Smeargle", ability: 'technician', moves: ['aquajet'] },
|
|
]]);
|
|
const comatoseMon = battle.p1.active[0];
|
|
assert.hurts(comatoseMon, () => battle.makeChoices('move rest', 'move aquajet'));
|
|
assert.constant(() => comatoseMon.status, () => battle.makeChoices('move rest', 'move aquajet'));
|
|
});
|
|
|
|
it('should allow the use of Snore and Sleep Talk as if the user were asleep', () => {
|
|
battle = common.createBattle([[
|
|
{ species: "Komala", item: 'normaliumz', ability: 'comatose', moves: ['snore', 'sleeptalk', 'brickbreak'] },
|
|
], [
|
|
{ species: "Smeargle", moves: ['endure'] },
|
|
]]);
|
|
const defender = battle.p2.active[0];
|
|
assert.hurts(defender, () => battle.makeChoices('move snore', 'move endure'), "Expected damage from Snore.");
|
|
assert.hurts(defender, () => battle.makeChoices('move sleeptalk', 'move endure'), "Expected damage from Sleep Talk calling Brick Break.");
|
|
});
|
|
|
|
it('should cause the user to be damaged by Dream Eater as if it were asleep', () => {
|
|
battle = common.createBattle([[
|
|
{ species: "Komala", ability: 'comatose', moves: ['shadowclaw'] },
|
|
], [
|
|
{ species: "Smeargle", ability: 'technician', moves: ['dreameater'] },
|
|
]]);
|
|
assert.hurts(battle.p1.active[0], () => battle.makeChoices('move shadowclaw', 'move dreameater'));
|
|
});
|
|
|
|
it('should cause Wake-Up Slap and Hex to have doubled base power when used against the user', () => {
|
|
battle = common.createBattle([[
|
|
{ species: "Komala", ability: 'comatose', item: 'ringtarget', moves: ['endure'] },
|
|
], [
|
|
{ species: "Smeargle", ability: 'technician', moves: ['hex', 'wakeupslap'] },
|
|
]]);
|
|
|
|
let bp = 0;
|
|
battle.onEvent('BasePower', battle.format, (basePower, pokemon, target, move) => {
|
|
bp = basePower;
|
|
});
|
|
|
|
battle.makeChoices('move endure', 'move hex');
|
|
assert.equal(bp, battle.dex.moves.get('hex').basePower * 2);
|
|
|
|
battle.makeChoices('move endure', 'move wakeupslap');
|
|
assert.equal(bp, battle.dex.moves.get('wakeupslap').basePower * 2);
|
|
});
|
|
});
|