mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-20 22:18:18 -05:00
The unwieldy system that is typesData is now removed, and is replaced by the array `types` and the string `addedType`, which track the same amount of information in a much more efficient way. (Roost is now hardcoded, but let's not talk about that.) Incidentally, this now roughly matches client, which tracks typechange and typeadd as volatiles. This allows us to remove ModifyPokemon, which overall provides a 10% performance increase. I was hoping it'd be more substantial, but oh well.
145 lines
6.9 KiB
JavaScript
145 lines
6.9 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
let battle;
|
|
|
|
describe('Desolate Land', function () {
|
|
afterEach(function () {
|
|
battle.destroy();
|
|
});
|
|
|
|
it('should activate the Desolate Land weather upon switch-in', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Abra", ability: 'magicguard', moves: ['teleport']}]);
|
|
assert.ok(battle.isWeather('desolateland'));
|
|
});
|
|
|
|
it('should not increase the base power of Fire-type attacks', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Charizard", ability: 'blaze', moves: ['firepledge']}]);
|
|
battle.commitDecisions();
|
|
let move = Tools.getMove('firepledge');
|
|
let basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
|
|
assert.strictEqual(basePower, move.basePower);
|
|
});
|
|
|
|
it('should cause Water-type attacks to fail', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Blastoise", ability: 'torrent', moves: ['surf']}]);
|
|
battle.commitDecisions();
|
|
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
|
|
});
|
|
|
|
it('should not cause Water-type Status moves to fail', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Blastoise", ability: 'torrent', moves: ['soak']}]);
|
|
battle.commitDecisions();
|
|
assert.strictEqual(battle.p1.active[0].types.join(','), 'Water');
|
|
});
|
|
|
|
it('should prevent moves and abilities from setting the weather to Sunny Day, Rain Dance, Sandstorm, or Hail', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [
|
|
{species: "Abra", ability: 'magicguard', moves: ['teleport']},
|
|
{species: "Kyogre", ability: 'drizzle', moves: ['raindance']},
|
|
{species: "Groudon", ability: 'drought', moves: ['sunnyday']},
|
|
{species: "Tyranitar", ability: 'sandstream', moves: ['sandstorm']},
|
|
{species: "Abomasnow", ability: 'snowwarning', moves: ['hail']},
|
|
]);
|
|
for (let i = 2; i <= 5; i++) {
|
|
battle.choose('p1', 'switch ' + i);
|
|
battle.commitDecisions();
|
|
assert.ok(battle.isWeather('desolateland'));
|
|
battle.commitDecisions();
|
|
assert.ok(battle.isWeather('desolateland'));
|
|
}
|
|
});
|
|
|
|
it('should be treated as Sunny Day for any forme, move or ability that requires it', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand', 'solarbeam']}]);
|
|
battle.join('p2', 'Guest 2', 1, [
|
|
{species: "Castform", ability: 'forecast', moves: ['weatherball']},
|
|
{species: "Cherrim", ability: 'flowergift', moves: ['growth']},
|
|
{species: "Charizard", ability: 'solarpower', moves: ['roost']},
|
|
{species: "Venusaur", ability: 'chlorophyll', moves: ['growth']},
|
|
{species: "Toxicroak", ability: 'dryskin', moves: ['bulkup']},
|
|
]);
|
|
battle.test = true;
|
|
battle.p1.active[0].damage = function () {
|
|
if (battle.activeMove.id === 'weatherball') {
|
|
assert.strictEqual(battle.activeMove.type, 'Fire');
|
|
}
|
|
return BattleEngine.BattlePokemon.prototype.damage.apply(this, arguments);
|
|
};
|
|
battle.commitDecisions();
|
|
assert.strictEqual(battle.p2.active[0].template.speciesid, 'castformsunny');
|
|
battle.choose('p2', 'switch 2');
|
|
battle.commitDecisions();
|
|
assert.strictEqual(battle.p2.active[0].template.speciesid, 'cherrimsunshine');
|
|
battle.choose('p2', 'switch 3');
|
|
battle.commitDecisions();
|
|
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
|
|
battle.choose('p1', 'move 2');
|
|
battle.choose('p2', 'switch 4');
|
|
assert.strictEqual(battle.p2.active[0].getStat('spe'), 2 * battle.p2.active[0].stats['spe']);
|
|
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
|
|
battle.choose('p2', 'switch 5');
|
|
battle.commitDecisions();
|
|
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
|
|
});
|
|
|
|
it('should cause the Desolate Land weather to fade if it switches out and no other Desolate Land Pokemon are active', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [
|
|
{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']},
|
|
{species: "Ho-Oh", ability: 'pressure', moves: ['roost']},
|
|
]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Lugia", ability: 'pressure', moves: ['roost']}]);
|
|
battle.choose('p1', 'switch 2');
|
|
battle.commitDecisions();
|
|
assert.ok(battle.isWeather(''));
|
|
});
|
|
|
|
it('should not cause the Desolate Land weather to fade if it switches out and another Desolate Land Pokemon is active', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [
|
|
{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']},
|
|
{species: "Ho-Oh", ability: 'pressure', moves: ['roost']},
|
|
]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Groudon", ability: 'desolateland', moves: ['bulkup']}]);
|
|
battle.choose('p1', 'switch 2');
|
|
battle.commitDecisions();
|
|
assert.ok(battle.isWeather('desolateland'));
|
|
});
|
|
|
|
it('should cause the Desolate Land weather to fade if its ability is suppressed and no other Desolate Land Pokemon are active', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Lugia", ability: 'pressure', moves: ['gastroacid']}]);
|
|
battle.commitDecisions();
|
|
assert.ok(battle.isWeather(''));
|
|
});
|
|
|
|
it('should not cause the Desolate Land weather to fade if its ability is suppressed and another Desolate Land Pokemon is active', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Groudon", ability: 'desolateland', moves: ['gastroacid']}]);
|
|
battle.commitDecisions();
|
|
assert.ok(battle.isWeather('desolateland'));
|
|
});
|
|
|
|
it('should cause the Desolate Land weather to fade if its ability is changed and no other Desolate Land Pokemon are active', function () {
|
|
battle = BattleEngine.Battle.construct();
|
|
battle.join('p1', 'Guest 1', 1, [{species: "Groudon", ability: 'desolateland', moves: ['helpinghand']}]);
|
|
battle.join('p2', 'Guest 2', 1, [{species: "Lugia", ability: 'pressure', moves: ['entrainment']}]);
|
|
battle.commitDecisions();
|
|
assert.ok(battle.isWeather(''));
|
|
});
|
|
});
|