Files
pokemon-showdown/test/sim/items/mirrorherb.js
Guangcong Luo 78439b4a02 Update to ESLint 9 (#10926)
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.
2025-02-25 20:03:46 -08:00

61 lines
2.7 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe("Mirror Herb", () => {
afterEach(() => battle.destroy());
it("should copy Anger Point", () => {
battle = common.createBattle([[
{ species: 'Snorlax', item: 'Mirror Herb', moves: ['stormthrow'] },
], [
{ species: 'Primeape', ability: 'Anger Point', moves: ['sleeptalk'] },
]]);
battle.makeChoices();
assert.statStage(battle.p1.active[0], 'atk', 6);
});
it("should only copy the effective boost after the +6 cap", () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: 'Snorlax', item: 'Mirror Herb', moves: ['sleeptalk'] },
{ species: 'Froslass', ability: 'Snow Cloak', moves: ['frostbreath'] },
], [
{ species: 'Primeape', ability: 'Anger Point', moves: ['sleeptalk'] },
{ species: 'Gyarados', ability: 'Intimidate', moves: ['sleeptalk'] },
]]);
assert.statStage(battle.p1.active[0], 'atk', -1);
battle.makeChoices();
assert.statStage(battle.p1.active[0], 'atk', -1 + 6);
});
it("should copy all 'simultaneous' boosts from multiple opponents", () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: 'Electrode', ability: 'No Guard', item: 'Mirror Herb', moves: ['recycle'] },
{ species: 'Gyarados', ability: 'Intimidate', item: 'Wide Lens', moves: ['sleeptalk', 'air cutter'] },
], [
{ species: 'Primeape', ability: 'Defiant', item: 'Weakness Policy', moves: ['sleeptalk', 'haze'] },
{ species: 'Annihilape', ability: 'Defiant', item: 'Weakness Policy', moves: ['sleeptalk', 'howl'] },
]]);
const electrode = battle.p1.active[0];
assert.statStage(electrode, 'atk', 4, `Mirror Herb should have copied both Defiant boosts but only boosted atk by ${electrode.boosts.atk}`);
battle.makeChoices('auto', 'move haze, move howl');
assert.statStage(electrode, 'atk', 2, `Mirror Herb should have copied both Howl boosts but only boosted atk by ${electrode.boosts.atk}`);
battle.makeChoices('move recycle, move air cutter', 'auto');
assert.statStage(electrode, 'spa', 4, `Mirror Herb should have copied all Weakness Policy boosts but only boosted spa by ${electrode.boosts.spa}`);
});
it("should wait for most entrance abilities before copying all their (opposing) boosts", () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: 'Electrode', item: 'Mirror Herb', moves: ['recycle'] },
{ species: 'Gyarados', ability: 'Intimidate', moves: ['sleeptalk'] },
], [
{ species: 'Zacian', ability: 'Intrepid Sword', moves: ['sleeptalk'] },
{ species: 'Annihilape', ability: 'Defiant', moves: ['sleeptalk'] },
]]);
assert.statStage(battle.p1.active[0], 'atk', 3);
});
});