Use assert in strict mode

This makes it so we can use `assert.equal` instead of
`assert.strictEqual`, which I think is more readable.
This commit is contained in:
Guangcong Luo
2020-02-20 00:39:31 -08:00
parent 0df0d234f2
commit 229f5f809d
128 changed files with 776 additions and 776 deletions

View File

@@ -401,7 +401,7 @@ export const State = new class {
if (skip.has(key)) continue;
const val = this.serializeWithRefs(value, battle);
// JSON.stringify will get rid of keys with undefined values anyway, but
// we also do it here so that assert.deepStrictEqual works on battle.toJSON().
// we also do it here so that assert.deepEqual works on battle.toJSON().
if (typeof val !== 'undefined') state[key] = val;
}
return state;

View File

@@ -5,8 +5,8 @@
* @license MIT
*/
import assert = require('assert');
import fs = require('fs');
import {strict as assert} from 'assert';
import * as fs from 'fs';
import {ObjectReadWriteStream} from '../../lib/streams';
import {Battle} from '../battle';
@@ -156,7 +156,7 @@ class DualStream {
get rawInputLog() {
const control = this.control.rawInputLog;
const test = this.test.rawInputLog;
assert.deepStrictEqual(test, control);
assert.deepEqual(test, control);
return control;
}
@@ -165,7 +165,7 @@ class DualStream {
const test = await this.test.read();
// In debug mode, wait to catch this as a difference in the inputLog
// and error there so we get the full battle state dumped instead.
if (!this.debug) assert.strictEqual(test, control);
if (!this.debug) assert.equal(test, control);
return control;
}
@@ -188,7 +188,7 @@ class DualStream {
const control = this.control.battle.toJSON();
const test = this.test.battle.toJSON();
try {
assert.deepStrictEqual(test, control);
assert.deepEqual(test, control);
} catch (err) {
if (this.debug) {
// NOTE: diffing these directly won't work because the key ordering isn't stable.

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const Sim = require('./../.sim-dist');
const Dex = Sim.Dex;

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const Dashycode = require('./../../.lib-dist/dashycode');
describe('Dashycode', function () {
@@ -16,18 +16,18 @@ describe('Dashycode', function () {
const encode = (codepoint) => {
const character = String.fromCodePoint(codepoint);
const dashycode = Dashycode.encode(character);
assert.strictEqual(encoded.has(dashycode), false);
assert.equal(encoded.has(dashycode), false);
encoded.set(dashycode, character);
};
const decode = (dashycode) => {
const character = Dashycode.decode(dashycode);
assert.strictEqual(encoded.get(dashycode), character);
assert.equal(encoded.get(dashycode), character);
};
const transcode = (plaintext) => function () {
const ciphertext = Dashycode.encode(plaintext);
assert.strictEqual(Dashycode.decode(ciphertext), plaintext);
assert.equal(Dashycode.decode(ciphertext), plaintext);
};
const transcodeWithSets = (set1, set2) => function () {
@@ -51,7 +51,7 @@ describe('Dashycode', function () {
plaintext += (bitmask & 0x8000) ? set1[15] : set2[15];
const ciphertext = Dashycode.encode(plaintext);
assert.strictEqual(Dashycode.decode(ciphertext), plaintext);
assert.equal(Dashycode.decode(ciphertext), plaintext);
}
};

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const userUtils = require('../../users-utils');
const User = userUtils.User;
@@ -70,13 +70,13 @@ describe('Trivia', function () {
it('should add new players', function () {
this.game.addPlayer(this.user);
assert.strictEqual(this.game.playerCount, 1);
assert.equal(this.game.playerCount, 1);
});
it('should not add a player if they have already joined', function () {
this.game.addPlayer(this.user);
this.game.addPlayer(this.user);
assert.strictEqual(this.game.playerCount, 1);
assert.equal(this.game.playerCount, 1);
});
it('should not add a player if another one on the same IP has joined', function () {
@@ -85,7 +85,7 @@ describe('Trivia', function () {
let user2 = makeUser('Not Morfent', new Connection('127.0.0.1'));
this.game.addPlayer(user2);
assert.strictEqual(this.game.playerCount, 1);
assert.equal(this.game.playerCount, 1);
destroyUser(user2);
});
@@ -99,27 +99,27 @@ describe('Trivia', function () {
let user2 = makeUser(name, new Connection('127.0.0.3'));
this.game.addPlayer(user2);
assert.strictEqual(this.game.playerCount, 1);
assert.equal(this.game.playerCount, 1);
destroyUser(user2);
});
it('should not add a player if they were kicked from the game', function () {
this.game.kickedUsers.add(this.tarUser.id);
this.game.addPlayer(this.tarUser);
assert.strictEqual(this.game.playerCount, 0);
assert.equal(this.game.playerCount, 0);
});
it('should kick players from the game', function () {
this.game.addPlayer(this.tarUser);
this.game.kick(this.tarUser, this.user);
assert.strictEqual(this.game.playerCount, 0);
assert.equal(this.game.playerCount, 0);
});
it('should not kick players already kicked from the game', function () {
this.game.addPlayer(this.tarUser);
this.game.kick(this.tarUser, this.user);
let res = this.game.kick(this.tarUser, this.user);
assert.strictEqual(typeof res, 'string');
assert.equal(typeof res, 'string');
});
it('should not kick users who were kicked under another name', function () {
@@ -131,7 +131,7 @@ describe('Trivia', function () {
this.tarUser.forceRename('Not Morfent', true);
this.tarUser.prevNames[userid] = name;
this.game.addPlayer(this.tarUser);
assert.strictEqual(this.game.playerCount, 0);
assert.equal(this.game.playerCount, 0);
});
it('should not add users who were kicked under another IP', function () {
@@ -143,31 +143,31 @@ describe('Trivia', function () {
let user2 = makeUser(name, new Connection('127.0.0.2'));
this.game.addPlayer(user2);
assert.strictEqual(this.game.playerCount, 0);
assert.equal(this.game.playerCount, 0);
destroyUser(user2);
});
it('should not kick users that aren\'t players in the game', function () {
this.game.kick(this.tarUser, this.user);
assert.strictEqual(this.game.playerCount, 0);
assert.equal(this.game.playerCount, 0);
});
it('should make players leave the game', function () {
this.game.leave(this.user);
assert.strictEqual(this.game.playerTable[this.user.id], undefined);
assert.equal(this.game.playerTable[this.user.id], undefined);
});
it('should not make users who are not players leave the game', function () {
this.game.leave(this.user);
let res = this.game.leave(this.user);
assert.strictEqual(typeof res, 'string');
assert.equal(typeof res, 'string');
});
it('should verify answers correctly', function () {
this.game.askQuestion();
assert.strictEqual(this.game.verifyAnswer('answer'), true);
assert.strictEqual(this.game.verifyAnswer('anser'), true);
assert.strictEqual(this.game.verifyAnswer('not the right answer'), false);
assert.equal(this.game.verifyAnswer('answer'), true);
assert.equal(this.game.verifyAnswer('anser'), true);
assert.equal(this.game.verifyAnswer('not the right answer'), false);
});
it('should not throw when attempting to broadcast after the game has ended', function () {
@@ -212,16 +212,16 @@ describe('Trivia', function () {
it('should mark a player absent on leave and pause the game', function () {
this.user.leaveRoom(this.room);
assert.strictEqual(this.player.isAbsent, true);
assert.strictEqual(this.game.phase, 'limbo');
assert.strictEqual(this.game.phaseTimeout, null);
assert.equal(this.player.isAbsent, true);
assert.equal(this.game.phase, 'limbo');
assert.equal(this.game.phaseTimeout, null);
});
it('should unpause the game once enough players have returned', function () {
this.user.leaveRoom(this.room);
this.user.joinRoom(this.room);
assert.strictEqual(this.player.isAbsent, false);
assert.strictEqual(this.game.phase, 'question');
assert.equal(this.player.isAbsent, false);
assert.equal(this.game.phase, 'question');
assert.ok(this.game.phaseTimeout);
});
});
@@ -258,29 +258,29 @@ describe('Trivia', function () {
it('should calculate player points correctly', function () {
let points = this.game.calculatePoints();
assert.strictEqual(points, 5);
assert.equal(points, 5);
});
it('should allow users to answer questions correctly', function () {
this.game.answerQuestion('answer', this.user);
assert.strictEqual(this.player.correctAnswers, 1);
assert.equal(this.player.correctAnswers, 1);
});
it('should mark players who answer incorrectly', function () {
this.game.answerQuestion('not the right answer', this.user);
assert.strictEqual(this.player.correctAnswers, 0);
assert.equal(this.player.correctAnswers, 0);
});
it('should only reward a player points once per question', function () {
this.game.answerQuestion('answer', this.user);
this.game.answerQuestion('answer', this.user);
assert.strictEqual(this.player.correctAnswers, 1);
assert.equal(this.player.correctAnswers, 1);
});
it('should clear player answers if none answer correctly', function () {
this.game.answerQuestion('not the right answer', this.user);
this.game.tallyAnswers();
assert.strictEqual(this.player.answer, '');
assert.equal(this.player.answer, '');
});
it('should not give NaN points to correct responders', function () {
@@ -326,21 +326,21 @@ describe('Trivia', function () {
for (let i = 6; i--;) {
diff += totalDiff / 5;
let points = this.game.calculatePoints(diff, totalDiff);
assert.strictEqual(points, i);
assert.equal(points, i);
}
});
it('should set players as having answered correctly or incorrectly', function () {
this.game.answerQuestion('not the right answer', this.user);
assert.strictEqual(this.player.isCorrect, false);
assert.equal(this.player.isCorrect, false);
this.game.answerQuestion('answer', this.user);
assert.strictEqual(this.player.isCorrect, true);
assert.equal(this.player.isCorrect, true);
});
it('should give points for correct answers', function () {
this.game.answerQuestion('answer', this.user);
this.game.tallyAnswers();
assert.strictEqual(this.player.correctAnswers, 1);
assert.equal(this.player.correctAnswers, 1);
});
it('should choose the quicker answerer on tie', function (done) {
@@ -398,7 +398,7 @@ describe('Trivia', function () {
it('should calculate points correctly', function () {
this.game.playerCount = 5;
for (let i = 1; i <= 5; i++) {
assert.strictEqual(this.game.calculatePoints(i), 6 - i);
assert.equal(this.game.calculatePoints(i), 6 - i);
}
});
@@ -408,13 +408,13 @@ describe('Trivia', function () {
it('should not give points for answering incorrectly', function () {
this.game.answerQuestion('not the right answer', this.user);
this.game.tallyAnswers();
assert.strictEqual(this.player.correctAnswers, 0);
assert.equal(this.player.correctAnswers, 0);
});
it('should give points for answering correctly', function () {
this.game.answerQuestion('answer', this.user);
this.game.tallyAnswers();
assert.strictEqual(this.player.correctAnswers, 1);
assert.equal(this.player.correctAnswers, 1);
});
it('should not give NaN points to correct responders', function () {

View File

@@ -1,90 +1,90 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
describe('Chat', function () {
it('should run formatText correctly', function () {
assert.strictEqual(
assert.equal(
Chat.formatText(`hi **__bold italics__** ^^superscript^^ \\\\subscript\\\\ normal ~~strikethrough~~ bye`),
`hi <b><i>bold italics</i></b> <sup>superscript</sup> <sub>subscript</sub> normal <s>strikethrough</s> bye`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`__**reverse nesting**__`),
`<i><b>reverse nesting</b></i>`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`__**bad nesting__**`),
`<i>**bad nesting</i>**`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`spaced ** out ** no __also no __ ~~ also no~~ ok`),
`spaced ** out ** no __also no __ ~~ also no~~ ok`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`hi \`\` \` \`\` bye`),
`hi <code>\`</code> bye`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`hi \`\`inside __not__ formatted\`\` bye`),
`hi <code>inside __not__ formatted</code> bye`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`<<roomid-1-2-3>> <<roomid_1_2_3>>`),
`&laquo;<a href="/roomid-1-2-3" target="_blank">roomid-1-2-3</a>&raquo; &lt;&lt;roomid_1_2_3&gt;&gt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`hi __spoiler: bye__ hi again (parenthetical spoiler: bye again (or not!!!!)) that was fun`),
`hi <i>spoiler: <span class="spoiler">bye</span></i> hi again (parenthetical spoiler: <span class="spoiler">bye again (or not!!!!)</span>) that was fun`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`hi google.com/__a__ bye >w<`),
`hi <a href="http://google.com/__a__" rel="noopener" target="_blank">google.com/__a__</a> bye &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`(https://en.wikipedia.org/wiki/Pokémon_(video_game_series))`),
`(<a href="https://en.wikipedia.org/wiki/Pokémon_(video_game_series)" rel="noopener" target="_blank">https://en.wikipedia.org/wiki/Pokémon_(video_game_series)</a>)`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`hi email@email.com bye >w<`),
`hi <a href="mailto:email@email.com" rel="noopener" target="_blank">email@email.com</a> bye &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`hi email@email.example bye >w<`),
`hi <a href="mailto:email@email.example" rel="noopener" target="_blank">email@email.example</a> bye &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`>greentext`),
`<span class="greentext">&gt;greentext</span>`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`>w< not greentext >also not greentext`),
`&gt;w&lt; not greentext &gt;also not greentext`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`[[Google <http://www.google.com/>]] >w<`),
`<a href="http://www.google.com/" rel="noopener" target="_blank">Google<small> &lt;google.com&gt;</small></a> &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`[[Google <google.com>]] >w<`, true),
`<a href="http://google.com" target="_blank">Google</a> &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`[[wiki: Pokemon]] >w<`, true),
`<a href="//en.wikipedia.org/w/index.php?title=Special:Search&search=Pokemon" target="_blank">wiki: Pokemon</a> &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`[[wiki: D&D D&amp;D]] [[A>B A&gt;B]] &amp;`, true),
`<a href="//en.wikipedia.org/w/index.php?title=Special:Search&search=D%26D%20D%26amp%3BD" target="_blank">wiki: D&amp;D D&amp;amp;D</a> <a href="//www.google.com/search?ie=UTF-8&btnI&q=A%3EB%20A%26gt%3BB" target="_blank">A&gt;B A&amp;gt;B</a> &amp;amp;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`[[pokemon: Oshawott]] >w<`, true),
`<a href="//dex.pokemonshowdown.com/pokemon/oshawott" target="_blank"><psicon pokemon="Oshawott"/></a> &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`[[item: Beast ball]] >w<`),
`<a href="//dex.pokemonshowdown.com/items/beastball" target="_blank">[Beast ball]</a> &gt;w&lt;`
);
assert.strictEqual(
assert.equal(
Chat.formatText(`:)`, true),
`:)`
);

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
global.Ladders = require('../../.server-dist/ladders').Ladders;
const {Connection, User} = require('../users-utils');
@@ -49,46 +49,46 @@ describe('Matchmaker', function () {
let formatSearches = Ladders.searches.get(FORMATID);
assert.ok(formatSearches instanceof Map);
assert.strictEqual(formatSearches.size, 1);
assert.strictEqual(s1.userid, this.p1.id);
assert.strictEqual(s1.team, this.p1.team);
assert.strictEqual(s1.rating, 1000);
assert.equal(formatSearches.size, 1);
assert.equal(s1.userid, this.p1.id);
assert.equal(s1.team, this.p1.team);
assert.equal(s1.rating, 1000);
});
it('should matchmake users when appropriate', function () {
addSearch(this.p1);
addSearch(this.p2);
assert.strictEqual(Ladders.searches.get(FORMATID).size, 0);
assert.equal(Ladders.searches.get(FORMATID).size, 0);
});
it('should matchmake users within a reasonable rating range', function () {
addSearch(this.p1);
addSearch(this.p2, 2000);
assert.strictEqual(Ladders.searches.get(FORMATID).size, 2);
assert.equal(Ladders.searches.get(FORMATID).size, 2);
});
it('should cancel searches', function () {
addSearch(this.p1);
Ladders(FORMATID).cancelSearch(this.p1);
Ladders.cancelSearches(this.p2);
assert.strictEqual(Ladders.searches.get(FORMATID).size, 0);
assert.equal(Ladders.searches.get(FORMATID).size, 0);
});
it('should periodically matchmake users when appropriate', function () {
addSearch(this.p1);
let s2 = addSearch(this.p2, 2000);
assert.strictEqual(Ladders.searches.get(FORMATID).size, 2);
assert.equal(Ladders.searches.get(FORMATID).size, 2);
s2.rating = 1000;
Ladders.Ladder.periodicMatch();
assert.strictEqual(Ladders.searches.get(FORMATID).size, 0);
assert.equal(Ladders.searches.get(FORMATID).size, 0);
});
it('should create a new battle room after matchmaking', function () {
assert.strictEqual(this.p1.games.size, 0);
assert.equal(this.p1.games.size, 0);
addSearch(this.p1);
addSearch(this.p2);
assert.strictEqual(this.p1.games.size, 1);
assert.equal(this.p1.games.size, 1);
for (const roomid of this.p1.games) {
assert.ok(Rooms.get(roomid).battle);
}
@@ -97,13 +97,13 @@ describe('Matchmaker', function () {
it('should cancel search on disconnect', function () {
addSearch(this.p1);
this.p1.onDisconnect(this.p1.connections[0]);
assert.strictEqual(Ladders.searches.get(FORMATID).size, 0);
assert.equal(Ladders.searches.get(FORMATID).size, 0);
});
it('should cancel search on merge', function () {
addSearch(this.p1);
this.p2.merge(this.p1);
assert.strictEqual(Ladders.searches.get(FORMATID).size, 0);
assert.equal(Ladders.searches.get(FORMATID).size, 0);
});
describe('#startBattle', function () {
@@ -123,7 +123,7 @@ describe('Matchmaker', function () {
try {
room = Rooms.createBattle(FORMATID, {p1: this.p1, p2: this.p1, p1team: this.s1.team, p2team: this.s2.team, rated: 1000});
} catch (e) {}
assert.strictEqual(room, undefined);
assert.equal(room, undefined);
});
before(function () {
@@ -138,7 +138,7 @@ describe('Matchmaker', function () {
it('should prevent battles from starting if the server is in lockdown', function () {
let room = Rooms.createBattle(FORMATID, {p1: this.p1, p2: this.p2, p1team: this.s1.team, p2team: this.s2.team, rated: 1000});
assert.strictEqual(room, undefined);
assert.equal(room, undefined);
});
});
});

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const {User} = require('../users-utils');
@@ -29,7 +29,7 @@ describe('Simulator abstraction layer features', function () {
room = Rooms.createBattle('', {p1, p2, p1team: packedTeam, p2team: packedTeam, allowRenames: false});
p1.resetName();
for (const player of room.battle.players) {
assert.strictEqual(player, room.battle.playerTable[toID(player.name)]);
assert.equal(player, room.battle.playerTable[toID(player.name)]);
}
});
});

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const {User} = require('../users-utils');
@@ -8,7 +8,7 @@ describe('Rooms features', function () {
describe('Rooms', function () {
describe('Rooms.get', function () {
it('should be a function', function () {
assert.strictEqual(typeof Rooms.get, 'function');
assert.equal(typeof Rooms.get, 'function');
});
});
describe('Rooms.rooms', function () {
@@ -26,8 +26,8 @@ describe('Rooms features', function () {
const room = Rooms.createChatRoom('r/relationshipadvice');
const game = new Hangman(room, new User(), 'There\'s a lot of red flags here');
room.game = game;
assert.strictEqual(room.getGame(Hangman), game);
assert.strictEqual(room.getGame(Uno), null);
assert.equal(room.getGame(Hangman), game);
assert.equal(room.getGame(Uno), null);
});
});
});
@@ -79,7 +79,7 @@ describe('Rooms features', function () {
},
};
room = Rooms.createBattle('customgame', options);
assert.strictEqual(room.getAuth(new User()), '%');
assert.equal(room.getAuth(new User()), '%');
});
it('should prevent overriding tournament room auth by a tournament player', function () {
@@ -107,11 +107,11 @@ describe('Rooms features', function () {
room = Rooms.createBattle('customgame', options);
roomStaff.joinRoom(room);
administrator.joinRoom(room);
assert.strictEqual(room.getAuth(roomStaff), '%', 'before promotion attempt');
assert.equal(room.getAuth(roomStaff), '%', 'before promotion attempt');
Chat.parse("/roomvoice Room auth", room, p1, p1.connections[0]);
assert.strictEqual(room.getAuth(roomStaff), '%', 'after promotion attempt');
assert.equal(room.getAuth(roomStaff), '%', 'after promotion attempt');
Chat.parse("/roomvoice Room auth", room, administrator, administrator.connections[0]);
assert.strictEqual(room.getAuth(roomStaff), '+', 'after being promoted by an administrator');
assert.equal(room.getAuth(roomStaff), '+', 'after being promoted by an administrator');
});
});
});

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const cluster = require('cluster');
describe.skip('Sockets', function () {
@@ -27,25 +27,25 @@ describe.skip('Sockets', function () {
describe('master', function () {
it('should be able to spawn workers', function () {
Sockets.spawnWorker();
assert.strictEqual(Sockets.workers.size, 1);
assert.equal(Sockets.workers.size, 1);
});
it('should be able to spawn workers on listen', function () {
Sockets.listen(0, '127.0.0.1', 1);
assert.strictEqual(Sockets.workers.size, 1);
assert.equal(Sockets.workers.size, 1);
});
it('should be able to kill workers', function () {
return spawnWorker().then(worker => {
Sockets.killWorker(worker);
assert.strictEqual(Sockets.workers.size, 0);
assert.equal(Sockets.workers.size, 0);
});
});
it('should be able to kill workers by PID', function () {
return spawnWorker().then(worker => {
Sockets.killPid(worker.process.pid);
assert.strictEqual(Sockets.workers.size, 0);
assert.equal(Sockets.workers.size, 0);
});
});
});
@@ -75,10 +75,10 @@ describe.skip('Sockets', function () {
return spawnSocket(worker => data => {
let cmd = data.charAt(0);
let [sid, ip, protocol] = data.substr(1).split('\n');
assert.strictEqual(cmd, '*');
assert.strictEqual(sid, '1');
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(protocol, 'websocket');
assert.equal(cmd, '*');
assert.equal(sid, '1');
assert.equal(ip, '127.0.0.1');
assert.equal(protocol, 'websocket');
});
});
@@ -102,7 +102,7 @@ describe.skip('Sockets', function () {
let sid = data.substr(1, data.indexOf('\n'));
socketSend = `>${sid}\n${msg}`;
}).then(chain(worker => data => {
assert.strictEqual(data, msg);
assert.equal(data, msg);
}, socketSend));
});
@@ -119,9 +119,9 @@ describe.skip('Sockets', function () {
}).then(chain(worker => data => {
let cmd = data.charAt(0);
let params = data.substr(1).split('\n');
assert.strictEqual(cmd, '<');
assert.strictEqual(sid, params[0]);
assert.strictEqual(msg, params[1]);
assert.equal(cmd, '<');
assert.equal(sid, params[0]);
assert.equal(msg, params[1]);
}, mockReceive));
});
@@ -161,7 +161,7 @@ describe.skip('Sockets', function () {
let sid = data.substr(1, data.indexOf('\n'));
Sockets.roomAdd(worker, cid, sid);
}).then(chain(worker => data => {
assert.strictEqual(data, msg);
assert.equal(data, msg);
}, roomSend));
});
@@ -205,7 +205,7 @@ describe.skip('Sockets', function () {
let scid = '1';
Sockets.channelMove(worker, cid, scid, sid);
}).then(chain(worker => data => {
assert.strictEqual(data, msg);
assert.equal(data, msg);
}, buf));
});
});

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
let userUtils = require('../users-utils');
let Connection = userUtils.Connection;
@@ -10,7 +10,7 @@ describe('Users features', function () {
describe('Users', function () {
describe('get', function () {
it('should be a function', function () {
assert.strictEqual(typeof Users.get, 'function');
assert.equal(typeof Users.get, 'function');
});
});
describe('connections', function () {
@@ -32,16 +32,16 @@ describe('Users features', function () {
it('should remove the connection from Users.connections', function () {
let connectionid = this.connection.id;
this.connection.destroy();
assert.strictEqual(Users.connections.has(connectionid), false);
assert.equal(Users.connections.has(connectionid), false);
});
it('should destroy any user on the connection as well', function () {
let user = new User(this.connection);
let userid = user.id;
assert.strictEqual(Users.users.has(userid), true, 'before disconnecting');
assert.equal(Users.users.has(userid), true, 'before disconnecting');
user.disconnectAll();
user.destroy();
assert.strictEqual(Users.users.has(userid), false, 'after disconnecting');
assert.equal(Users.users.has(userid), false, 'after disconnecting');
});
});
@@ -86,8 +86,8 @@ describe('Users features', function () {
while (--iterations) user.mergeConnection(new Connection());
user.disconnectAll();
assert.strictEqual(user.connections.length, 0);
assert.strictEqual(user.connected, false);
assert.equal(user.connections.length, 0);
assert.equal(user.connected, false);
});
it('should unref all ' + totalConnections + ' connection(s)', function () {
@@ -111,7 +111,7 @@ describe('Users features', function () {
user.disconnectAll();
for (let i = 0; i < totalConnections; i++) {
assert.strictEqual(connections[i].user, null);
assert.equal(connections[i].user, null);
}
});
}
@@ -127,21 +127,21 @@ describe('Users features', function () {
Punishments.sharedIps = new Map();
let users = ['127.0.0.1', '127.0.0.1'].map(ip => new User(new Connection(ip)));
Punishments.ban(users[0]);
assert.strictEqual(users[0].connected, false);
assert.strictEqual(users[1].connected, false);
assert.equal(users[0].connected, false);
assert.equal(users[1].connected, false);
});
it('should not disconnect users at other IPs', function () {
let users = ['127.0.0.1', '127.0.0.2'].map(ip => new User(new Connection(ip)));
Punishments.ban(users[0]);
assert.strictEqual(users[1].connected, true);
assert.equal(users[1].connected, true);
});
it('should update IP count properly', function () {
let user = new User();
Punishments.ban(user);
for (let ip in user.ips) {
assert.strictEqual(user.ips[ip], 0);
assert.equal(user.ips[ip], 0);
}
});
});
@@ -160,28 +160,28 @@ describe('Users features', function () {
it(`should allow 's' permissions only on self`, function () {
const user = new User();
user.group = '+';
assert.strictEqual(user.can('alts', user), true, 'targeting self');
assert.equal(user.can('alts', user), true, 'targeting self');
const target = new User();
target.group = ' ';
assert.strictEqual(user.can('alts', target), false, 'targeting lower rank');
assert.equal(user.can('alts', target), false, 'targeting lower rank');
target.group = '+';
assert.strictEqual(user.can('alts', target), false, 'targeting same rank');
assert.equal(user.can('alts', target), false, 'targeting same rank');
target.group = '%';
assert.strictEqual(user.can('alts', target), false, 'targeting higher rank');
assert.equal(user.can('alts', target), false, 'targeting higher rank');
});
it(`should allow 'u' permissions on lower ranked users`, function () {
const user = new User();
user.group = '&';
assert.strictEqual(user.can('promote', user), false, 'targeting self');
assert.equal(user.can('promote', user), false, 'targeting self');
const target = new User();
target.group = ' ';
assert.strictEqual(user.can('promote', target), true, 'targeting lower rank');
assert.equal(user.can('promote', target), true, 'targeting lower rank');
target.group = '&';
assert.strictEqual(user.can('promote', target), false, 'targeting same rank');
assert.equal(user.can('promote', target), false, 'targeting same rank');
target.group = '~';
assert.strictEqual(user.can('promote', target), false, 'targeting higher rank');
assert.equal(user.can('promote', target), false, 'targeting higher rank');
});
it(`should not allow users to demote themselves`, function () {
room = Rooms.createChatRoom("test");
@@ -191,9 +191,9 @@ describe('Users features', function () {
user.joinRoom(room);
for (const group of [' ', '+', '@']) {
room.auth[user.id] = group;
assert.strictEqual(room.getAuth(user), group, 'before demotion attempt');
assert.equal(room.getAuth(user), group, 'before demotion attempt');
Chat.parse("/roomdeauth User", room, user, user.connections[0]);
assert.strictEqual(room.getAuth(user), group, 'after demotion attempt');
assert.equal(room.getAuth(user), group, 'after demotion attempt');
}
});
});

View File

@@ -16,6 +16,6 @@ describe('Aftermath', function () {
battle.setPlayer('p2', {team: [{species: 'Shiftry', ability: 'aftermath', moves: ['sleeptalk']}]});
battle.makeChoices('move lunge', 'move sleeptalk');
const attacker = battle.p1.active[0];
assert.strictEqual(attacker.hp, attacker.maxhp - Math.floor(attacker.maxhp / 4));
assert.equal(attacker.hp, attacker.maxhp - Math.floor(attacker.maxhp / 4));
});
});

View File

@@ -35,7 +35,7 @@ describe('Arena Trap', function () {
assert.species(p2active[0], 'Magnezone'); // Magnezone is trapped
assert.strictEqual(p2active[0].name, "Magnezone");
assert.equal(p2active[0].name, "Magnezone");
battle.makeChoices('default', 'move magnetrise');
battle.makeChoices('move snore', 'switch 6');

View File

@@ -28,10 +28,10 @@ describe('Cloud Nine', function () {
battle.makeChoices('move rest', 'move calmmind');
move = Dex.getMove('firepledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
move = Dex.getMove('waterpledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should negate the effects of Rain on Fire-type and Water-type attacks', function () {
@@ -42,10 +42,10 @@ describe('Cloud Nine', function () {
battle.makeChoices('move rest', 'move calmmind');
move = Dex.getMove('firepledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
move = Dex.getMove('waterpledge');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should negate the damage-dealing effects of Sandstorm', function () {
@@ -88,11 +88,11 @@ describe('Cloud Nine', function () {
battle.setPlayer('p1', {team: [{species: 'Golduck', ability: 'cloudnine', moves: ['calmmind']}]});
battle.setPlayer('p2', {team: [{species: 'Sunkern', ability: 'solarpower', moves: ['sunnyday']}]});
battle.makeChoices('move calmmind', 'move sunnyday');
assert.strictEqual(battle.log[battle.lastMoveLine + 1], '|-weather|SunnyDay');
assert.equal(battle.log[battle.lastMoveLine + 1], '|-weather|SunnyDay');
for (let i = 0; i < 4; i++) {
assert.strictEqual(battle.log[battle.lastMoveLine + 3], '|-weather|SunnyDay|[upkeep]');
assert.equal(battle.log[battle.lastMoveLine + 3], '|-weather|SunnyDay|[upkeep]');
battle.makeChoices('move calmmind', 'move sunnyday');
}
assert.strictEqual(battle.log[battle.lastMoveLine + 3], '|-weather|none');
assert.equal(battle.log[battle.lastMoveLine + 3], '|-weather|none');
});
});

View File

@@ -67,9 +67,9 @@ describe('Comatose', function () {
});
battle.makeChoices('move endure', 'move hex');
assert.strictEqual(bp, battle.dex.getMove('hex').basePower * 2);
assert.equal(bp, battle.dex.getMove('hex').basePower * 2);
battle.makeChoices('move endure', 'move wakeupslap');
assert.strictEqual(bp, battle.dex.getMove('wakeupslap').basePower * 2);
assert.equal(bp, battle.dex.getMove('wakeupslap').basePower * 2);
});
});

View File

@@ -27,7 +27,7 @@ describe('Desolate Land', function () {
assert.hurtsBy(defender, 152, () => battle.makeChoices('move incinerate', 'move splash'));
const move = Dex.getMove('incinerate');
const basePower = battle.runEvent('BasePower', attacker, defender, move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should cause Water-type attacks to fail', function () {
@@ -76,7 +76,7 @@ describe('Desolate Land', function () {
]});
battle.onEvent('Hit', battle.format, (target, pokemon, move) => {
if (move.id === 'weatherball') {
assert.strictEqual(move.type, 'Fire');
assert.equal(move.type, 'Fire');
}
});
const myActive = battle.p2.active;
@@ -87,7 +87,7 @@ describe('Desolate Land', function () {
battle.makeChoices('move helpinghand', 'switch 3');
assert.false.fullHP(myActive[0], "Charizard should be hurt by Solar Power");
battle.makeChoices('move solarbeam', 'switch 4');
assert.strictEqual(myActive[0].getStat('spe'), 2 * myActive[0].storedStats['spe'], "Venusaur's speed should be doubled by Chlorophyll");
assert.equal(myActive[0].getStat('spe'), 2 * myActive[0].storedStats['spe'], "Venusaur's speed should be doubled by Chlorophyll");
assert.false.fullHP(myActive[0], "Solar Beam should skip its charge turn");
battle.makeChoices('move helpinghand', 'switch 5');
assert.false.fullHP(myActive[0], "Toxicroak should be hurt by Dry Skin");

View File

@@ -18,9 +18,9 @@ describe(`Emergency Exit`, function () {
const eePokemon = battle.p1.active[0];
const foePokemon = battle.p2.active[0];
battle.makeChoices('move superfang', 'move superfang');
assert.strictEqual(foePokemon.hp, foePokemon.maxhp);
assert.equal(foePokemon.hp, foePokemon.maxhp);
assert.atMost(eePokemon.hp, eePokemon.maxhp / 2);
assert.strictEqual(battle.requestState, 'switch');
assert.equal(battle.requestState, 'switch');
});
it(`should request switch-out at the end of a multi-hit move`, function () {
@@ -30,7 +30,7 @@ describe(`Emergency Exit`, function () {
]);
battle.makeChoices('move bulletseed', 'move sleeptalk');
battle.makeChoices('move bulletseed', 'move sleeptalk');
assert.strictEqual(battle.requestState, 'switch');
assert.equal(battle.requestState, 'switch');
});
it(`should not request switch-out if attacked and healed by berry`, function () {
@@ -39,7 +39,7 @@ describe(`Emergency Exit`, function () {
[{species: "Raticate", ability: 'guts', moves: ['superfang']}],
]);
battle.makeChoices('move sleeptalk', 'move superfang');
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
});
it(`should not request switch-out if fainted`, function () {
@@ -69,7 +69,7 @@ describe(`Emergency Exit`, function () {
battle.makeChoices('move splash', 'move spikes');
battle.makeChoices('move splash', 'move spikes');
battle.makeChoices('switch 2', 'move protect');
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
});
it(`should not request switch-out on usage of Substitute`, function () {
@@ -82,7 +82,7 @@ describe(`Emergency Exit`, function () {
assert.false.atMost(eePokemon.hp, eePokemon.maxhp / 2);
battle.makeChoices('move substitute', 'move thunderbolt');
assert.atMost(eePokemon.hp, eePokemon.maxhp / 2);
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
});
it(`should prevent Volt Switch after-switches`, function () {
@@ -95,7 +95,7 @@ describe(`Emergency Exit`, function () {
assert.atMost(eePokemon.hp, eePokemon.maxhp / 2);
assert.false.holdsItem(eePokemon);
assert.strictEqual(battle.requestState, 'switch');
assert.equal(battle.requestState, 'switch');
battle.makeChoices('default', '');
assert.species(battle.p1.active[0], 'Clefable');
@@ -112,7 +112,7 @@ describe(`Emergency Exit`, function () {
assert.atMost(eePokemon.hp, eePokemon.maxhp / 2);
assert.false.holdsItem(eePokemon);
assert.strictEqual(battle.requestState, 'switch');
assert.equal(battle.requestState, 'switch');
battle.makeChoices('auto', '');
assert.species(battle.p1.active[0], 'Clefable');
@@ -129,7 +129,7 @@ describe(`Emergency Exit`, function () {
assert.atMost(eePokemon.hp, eePokemon.maxhp / 2);
assert.false.holdsItem(eePokemon);
assert.strictEqual(battle.requestState, 'switch');
assert.equal(battle.requestState, 'switch');
battle.makeChoices('auto', '');
assert.species(battle.p1.active[0], 'Clefable');
@@ -143,6 +143,6 @@ describe(`Emergency Exit`, function () {
const eePokemon = battle.p1.active[0];
battle.makeChoices('move sleeptalk', 'move thunder');
assert.atMost(eePokemon.hp, eePokemon.maxhp / 2);
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
});
});

View File

@@ -23,10 +23,10 @@ describe('Flower Gift', function () {
// Set the weather to sun and re-check
battle.field.setWeather('sunnyday', 'debug');
assert.strictEqual(battle.p1.active[0].getStat('atk'), battle.modify(cherAtk, 1.5));
assert.strictEqual(battle.p1.active[0].getStat('spd'), battle.modify(cherSpd, 1.5));
assert.strictEqual(battle.p1.active[1].getStat('atk'), battle.modify(baseAtk, 1.5));
assert.strictEqual(battle.p1.active[1].getStat('spd'), battle.modify(baseSpd, 1.5));
assert.equal(battle.p1.active[0].getStat('atk'), battle.modify(cherAtk, 1.5));
assert.equal(battle.p1.active[0].getStat('spd'), battle.modify(cherSpd, 1.5));
assert.equal(battle.p1.active[1].getStat('atk'), battle.modify(baseAtk, 1.5));
assert.equal(battle.p1.active[1].getStat('spd'), battle.modify(baseSpd, 1.5));
});
it('should still work if Cherrim transforms into something with Flower Gift without originally having it', function () {
@@ -43,9 +43,9 @@ describe('Flower Gift', function () {
// Set the weather to sun and re-check
battle.field.setWeather('sunnyday', 'debug');
assert.strictEqual(battle.p1.active[0].getStat('atk'), battle.modify(cherAtk, 1.5));
assert.strictEqual(battle.p1.active[0].getStat('spd'), battle.modify(cherSpd, 1.5));
assert.strictEqual(battle.p1.active[1].getStat('atk'), battle.modify(baseAtk, 1.5));
assert.strictEqual(battle.p1.active[1].getStat('spd'), battle.modify(baseSpd, 1.5));
assert.equal(battle.p1.active[0].getStat('atk'), battle.modify(cherAtk, 1.5));
assert.equal(battle.p1.active[0].getStat('spd'), battle.modify(cherSpd, 1.5));
assert.equal(battle.p1.active[1].getStat('atk'), battle.modify(baseAtk, 1.5));
assert.equal(battle.p1.active[1].getStat('spd'), battle.modify(baseSpd, 1.5));
});
});

View File

@@ -31,7 +31,7 @@ describe('Immunity', function () {
battle.setPlayer('p1', {team: [{species: 'Snorlax', ability: 'immunity', moves: ['curse']}]});
battle.setPlayer('p2', {team: [{species: 'Crobat', ability: 'moldbreaker', moves: ['toxic']}]});
battle.makeChoices('move curse', 'move toxic');
assert.strictEqual(battle.log.filter(line => line.match(/-status\|.*\|tox/)).length, 1);
assert.strictEqual(battle.p1.active[0].status, '');
assert.equal(battle.log.filter(line => line.match(/-status\|.*\|tox/)).length, 1);
assert.equal(battle.p1.active[0].status, '');
});
});

View File

@@ -47,7 +47,7 @@ describe('Intimidate', function () {
battle.makeChoices('', 'switch 3, pass');
const activate = '|-ability|p2a: Gyarados|Intimidate|boost';
assert.strictEqual(battle.log.filter(m => m === activate).length, 0);
assert.equal(battle.log.filter(m => m === activate).length, 0);
assert.statStage(battle.p1.active[0], 'atk', 0);
assert.statStage(battle.p1.active[1], 'atk', 0);
@@ -86,7 +86,7 @@ describe('Intimidate', function () {
intimidateCount++;
});
battle.makeChoices('default', 'default'); // Finish Team Preview, switch both Pokemon in
assert.strictEqual(intimidateCount, 2);
assert.equal(intimidateCount, 2);
assert.statStage(battle.p1.active[0], 'atk', -1);
assert.statStage(battle.p2.active[0], 'atk', -1);
@@ -101,7 +101,7 @@ describe('Intimidate', function () {
intimidateCount++;
});
battle.makeChoices('default', 'default'); // Finish Team Preview, switch both Pokemon in
assert.strictEqual(intimidateCount, 2);
assert.equal(intimidateCount, 2);
assert.statStage(battle.p1.active[0], 'atk', -1);
assert.statStage(battle.p2.active[0], 'atk', -1);
});
@@ -130,13 +130,13 @@ describe('Intimidate', function () {
battle.makeChoices('switch arcanine', 'switch gyarados');
// Both Pokemon switched in at the same time
assert.strictEqual(intimidateCount, 2);
assert.equal(intimidateCount, 2);
assert.statStage(p1active[0], 'atk', -1);
assert.statStage(p2active[0], 'atk', -1);
// Do it again with the Pokemon in reverse order
battle.makeChoices('move healingwish', 'move healingwish');
battle.makeChoices('switch gyarados', 'switch arcanine');
assert.strictEqual(intimidateCount, 4);
assert.equal(intimidateCount, 4);
assert.statStage(p1active[0], 'atk', -1);
assert.statStage(p2active[0], 'atk', -1);
});

View File

@@ -24,7 +24,7 @@ describe('Klutz', function () {
battle.setPlayer('p2', {team: [{species: "Deoxys", ability: 'noguard', moves: ['psychic']}]});
const klutzMon = battle.p1.active[0];
assert.constant(() => klutzMon.item, () => battle.makeChoices('move endure', 'move psychic'));
assert.strictEqual(klutzMon.hp, 1);
assert.equal(klutzMon.hp, 1);
});
it('should ignore the effects of items that disable moves', function () {
@@ -32,7 +32,7 @@ describe('Klutz', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'klutz', item: 'assaultvest', moves: ['protect']}]});
battle.setPlayer('p2', {team: [{species: "Deoxys", ability: 'noguard', moves: ['psychic']}]});
battle.makeChoices('move protect', 'move psychic');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'protect');
assert.equal(battle.p1.active[0].lastMove.id, 'protect');
});
it('should not ignore item effects that prevent item removal', function () {

View File

@@ -22,7 +22,7 @@ describe('Levitate', function () {
battle.setPlayer('p1', {team: [{species: 'Unown', ability: 'levitate', moves: ['spore']}]});
battle.setPlayer('p2', {team: [{species: 'Espeon', ability: 'magicbounce', moves: ['electricterrain']}]});
battle.makeChoices('move spore', 'move electricterrain');
assert.strictEqual(battle.p1.active[0].status, 'slp', "Levitate Pokémon should not be awaken by Electric Terrain");
assert.equal(battle.p1.active[0].status, 'slp', "Levitate Pokémon should not be awaken by Electric Terrain");
});
it('should have its Ground immunity suppressed by Mold Breaker', function () {

View File

@@ -19,7 +19,7 @@ describe('Magic Guard', function () {
battle.setPlayer('p2', {team: [{species: 'Crobat', ability: 'roughskin', moves: ['spikes', 'toxic', 'protect']}]});
battle.makeChoices('move splash', 'move spikes');
battle.makeChoices('switch 2', 'move toxic');
assert.strictEqual(battle.p1.active[0].status, 'tox');
assert.equal(battle.p1.active[0].status, 'tox');
assert.fullHP(battle.p1.active[0]);
battle.makeChoices('move mindblown', 'move toxic');
battle.makeChoices('move doubleedge', 'move spikes');

View File

@@ -21,7 +21,7 @@ describe('Multiscale', function () {
curhp = pokemon.hp;
battle.resetRNG();
battle.makeChoices('move splash', 'move incinerate');
assert.strictEqual(damage, battle.modify(curhp - pokemon.hp, 0.5));
assert.equal(damage, battle.modify(curhp - pokemon.hp, 0.5));
});
it('should be suppressed by Mold Breaker', function () {
@@ -35,6 +35,6 @@ describe('Multiscale', function () {
curhp = pokemon.hp;
battle.resetRNG();
battle.makeChoices('move splash', 'move incinerate');
assert.strictEqual(curhp - pokemon.hp, damage);
assert.equal(curhp - pokemon.hp, damage);
});
});

View File

@@ -15,7 +15,7 @@ describe('Mummy', function () {
battle.setPlayer('p1', {team: [{species: 'Cofagrigus', ability: 'mummy', moves: ['calmmind']}]});
battle.setPlayer('p2', {team: [{species: 'Mew', ability: 'synchronize', moves: ['aerialace']}]});
battle.makeChoices('move calmmind', 'move aerialace');
assert.strictEqual(battle.p2.active[0].ability, 'mummy');
assert.equal(battle.p2.active[0].ability, 'mummy');
});
it("should not change certain abilities", function () {
@@ -23,7 +23,7 @@ describe('Mummy', function () {
battle.setPlayer('p1', {team: [{species: 'Cofagrigus', ability: 'mummy', moves: ['calmmind']}]});
battle.setPlayer('p2', {team: [{species: 'Greninja', ability: 'battlebond', moves: ['aerialace']}]});
battle.makeChoices('move calmmind', 'move aerialace');
assert.strictEqual(battle.p2.active[0].ability, 'battlebond');
assert.equal(battle.p2.active[0].ability, 'battlebond');
});
it(`should not activate before all damage calculation is complete`, function () {

View File

@@ -59,7 +59,7 @@ describe('Neutralizing Gas', function () {
battle.makeChoices('move toxic', 'move uturn');
battle.makeChoices('', 'switch 2');
battle.makeChoices('switch 2', 'switch 2');
assert.strictEqual(battle.p2.active[0].status, 'tox');
assert.equal(battle.p2.active[0].status, 'tox');
});
it('should negate abilities that modify move type', function () {

View File

@@ -25,17 +25,17 @@ describe('Parental Bond', function () {
it('should cause single-hit attacks to strike twice, with the second hit at 0.25 power', function () {
battle.makeChoices('move falseswipe', 'move rest');
assert.deepStrictEqual(basePowers, [40, 10]);
assert.deepEqual(basePowers, [40, 10]);
});
it('should not have any effect on moves with multiple hits', function () {
battle.makeChoices('move doublehit', 'move rest');
assert.deepStrictEqual(basePowers, [35, 35]);
assert.deepEqual(basePowers, [35, 35]);
});
it('should not have any effect Z-Moves', function () {
battle.makeChoices('move falseswipe zmove', 'move rest');
assert.deepStrictEqual(basePowers, [100]);
assert.deepEqual(basePowers, [100]);
});
});
@@ -58,11 +58,11 @@ describe('Parental Bond [Gen 6]', function () {
it('should cause single-hit attacks to strike twice, with the second hit at 0.5 power', function () {
battle.makeChoices('move falseswipe', 'move rest');
assert.deepStrictEqual(basePowers, [40, 20]);
assert.deepEqual(basePowers, [40, 20]);
});
it('should not have any effect on moves with multiple hits', function () {
battle.makeChoices('move doublehit', 'move rest');
assert.deepStrictEqual(basePowers, [35, 35]);
assert.deepEqual(basePowers, [35, 35]);
});
});

View File

@@ -39,7 +39,7 @@ describe('Pickpocket', function () {
battle.makeChoices('move agility', 'move quickattack');
assert.holdsItem(battle.p1.active[0], "The foe should have their item stolen");
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
it('should not steal a foe\'s item if forced to switch out', function () {

View File

@@ -17,8 +17,8 @@ describe('Pressure', function () {
]);
battle.makeChoices('move rest, move peck -1', 'move rest, move peck 1');
let move = Dex.getMove('peck');
assert.strictEqual(battle.p1.active[1].getMoveData(move).pp, 55);
assert.strictEqual(battle.p2.active[1].getMoveData(move).pp, 54);
assert.equal(battle.p1.active[1].getMoveData(move).pp, 55);
assert.equal(battle.p2.active[1].getMoveData(move).pp, 54);
});
it('should deduct PP if moves are redirected to the user', function () {
@@ -31,8 +31,8 @@ describe('Pressure', function () {
]]);
battle.makeChoices('move followme, move peck 2', 'move followme, move peck 2');
let move = Dex.getMove('peck');
assert.strictEqual(battle.p1.active[1].getMoveData(move).pp, 55);
assert.strictEqual(battle.p2.active[1].getMoveData(move).pp, 54);
assert.equal(battle.p1.active[1].getMoveData(move).pp, 55);
assert.equal(battle.p2.active[1].getMoveData(move).pp, 54);
});
it('should deduct PP even if the move fails or misses', function () {
@@ -40,13 +40,13 @@ describe('Pressure', function () {
battle.setPlayer('p1', {team: [{species: "Giratina", ability: 'pressure', item: 'laggingtail', moves: ['mistyterrain', 'shadowforce']}]});
battle.setPlayer('p2', {team: [{species: "Smeargle", ability: 'desolateland', moves: ['doubleedge', 'spore', 'moonblast', 'surf']}]});
battle.makeChoices('auto', 'auto');
assert.strictEqual(battle.p2.active[0].getMoveData(Dex.getMove('doubleedge')).pp, 22);
assert.equal(battle.p2.active[0].getMoveData(Dex.getMove('doubleedge')).pp, 22);
battle.makeChoices('move shadowforce', 'move spore');
assert.strictEqual(battle.p2.active[0].getMoveData(Dex.getMove('spore')).pp, 22);
assert.equal(battle.p2.active[0].getMoveData(Dex.getMove('spore')).pp, 22);
battle.makeChoices('auto', 'move moonblast');
assert.strictEqual(battle.p2.active[0].getMoveData(Dex.getMove('moonblast')).pp, 22);
assert.equal(battle.p2.active[0].getMoveData(Dex.getMove('moonblast')).pp, 22);
battle.makeChoices('auto', 'move surf');
assert.strictEqual(battle.p2.active[0].getMoveData(Dex.getMove('surf')).pp, 22);
assert.equal(battle.p2.active[0].getMoveData(Dex.getMove('surf')).pp, 22);
});
it('should deduct PP for each Pressure Pokemon targetted', function () {
@@ -63,9 +63,9 @@ describe('Pressure', function () {
{species: "Reshiram", ability: 'turboblaze', moves: ['rockslide']},
]});
battle.makeChoices('move rest, move rest, move rest', 'move hail, move spikes, move rockslide');
assert.strictEqual(battle.p2.active[0].getMoveData(Dex.getMove('hail')).pp, 12);
assert.strictEqual(battle.p2.active[1].getMoveData(Dex.getMove('spikes')).pp, 28);
assert.strictEqual(battle.p2.active[2].getMoveData(Dex.getMove('rockslide')).pp, 13);
assert.equal(battle.p2.active[0].getMoveData(Dex.getMove('hail')).pp, 12);
assert.equal(battle.p2.active[1].getMoveData(Dex.getMove('spikes')).pp, 28);
assert.equal(battle.p2.active[2].getMoveData(Dex.getMove('rockslide')).pp, 13);
});
it('should deduct PP for each opposing Pressure Pokemon when Snatch of Imprison are used', function () {
@@ -82,8 +82,8 @@ describe('Pressure', function () {
{species: "Reshiram", ability: 'turboblaze', moves: ['rest']},
]});
battle.makeChoices('move rest, move rest, move rest', 'move snatch, move imprison, move rest');
assert.strictEqual(battle.p2.active[0].getMoveData(Dex.getMove('snatch')).pp, 12);
assert.strictEqual(battle.p2.active[1].getMoveData(Dex.getMove('imprison')).pp, 12);
assert.equal(battle.p2.active[0].getMoveData(Dex.getMove('snatch')).pp, 12);
assert.equal(battle.p2.active[1].getMoveData(Dex.getMove('imprison')).pp, 12);
});
});
@@ -99,8 +99,8 @@ describe('Pressure [Gen 4]', function () {
]);
battle.makeChoices('move rest, move peck -1', 'move rest, move peck 1');
let move = Dex.getMove('peck');
assert.strictEqual(battle.p1.active[1].getMoveData(move).pp, 54);
assert.strictEqual(battle.p2.active[1].getMoveData(move).pp, 54);
assert.equal(battle.p1.active[1].getMoveData(move).pp, 54);
assert.equal(battle.p2.active[1].getMoveData(move).pp, 54);
});
it('should deduct PP if moves are redirected to the user', function () {
@@ -110,8 +110,8 @@ describe('Pressure [Gen 4]', function () {
]);
battle.makeChoices('move followme, move peck 2', 'move followme, move peck 2');
let move = Dex.getMove('peck');
assert.strictEqual(battle.p1.active[1].getMoveData(move).pp, 55);
assert.strictEqual(battle.p2.active[1].getMoveData(move).pp, 54);
assert.equal(battle.p1.active[1].getMoveData(move).pp, 55);
assert.equal(battle.p2.active[1].getMoveData(move).pp, 54);
});
it('should deduct PP even if the move fails or misses', function () {
@@ -121,9 +121,9 @@ describe('Pressure [Gen 4]', function () {
]);
const attacker = battle.p2.active[0];
battle.makeChoices('move shadowforce', 'move doubleedge');
assert.strictEqual(attacker.getMoveData(Dex.getMove('doubleedge')).pp, 22);
assert.equal(attacker.getMoveData(Dex.getMove('doubleedge')).pp, 22);
battle.makeChoices('move shadowforce', 'move dragonpulse');
assert.strictEqual(attacker.getMoveData(Dex.getMove('dragonpulse')).pp, 14);
assert.equal(attacker.getMoveData(Dex.getMove('dragonpulse')).pp, 14);
});
it('should deduct PP for each Pressure Pokemon targetted', function () {
@@ -132,8 +132,8 @@ describe('Pressure [Gen 4]', function () {
[{species: "Lugia", ability: 'pressure', moves: ['hail']}, {species: "Ho-Oh", ability: 'pressure', moves: ['earthquake']}],
]);
battle.makeChoices('move rest, move rest', 'move hail, move earthquake');
assert.strictEqual(battle.p2.active[0].getMoveData(Dex.getMove('hail')).pp, 12);
assert.strictEqual(battle.p2.active[1].getMoveData(Dex.getMove('earthquake')).pp, 12);
assert.equal(battle.p2.active[0].getMoveData(Dex.getMove('hail')).pp, 12);
assert.equal(battle.p2.active[1].getMoveData(Dex.getMove('earthquake')).pp, 12);
});
it('should not deduct PP from self-targeting moves', function () {
@@ -143,7 +143,7 @@ describe('Pressure [Gen 4]', function () {
]);
battle.makeChoices('move calmmind', 'move calmmind');
let move = Dex.getMove('calmmind');
assert.strictEqual(battle.p1.active[0].getMoveData(move).pp, 31);
assert.strictEqual(battle.p1.active[0].getMoveData(move).pp, 31);
assert.equal(battle.p1.active[0].getMoveData(move).pp, 31);
assert.equal(battle.p1.active[0].getMoveData(move).pp, 31);
});
});

View File

@@ -27,7 +27,7 @@ describe('Primordial Sea', function () {
assert.hurtsBy(defender, 104, () => battle.makeChoices('move waterpledge', 'move splash'));
const move = Dex.getMove('waterpledge');
const basePower = battle.runEvent('BasePower', attacker, defender, move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should cause Fire-type attacks to fail', function () {
@@ -75,21 +75,21 @@ describe('Primordial Sea', function () {
]});
battle.onEvent('Hit', battle.format, (target, pokemon, move) => {
if (move.id === 'weatherball') {
assert.strictEqual(move.type, 'Water');
assert.equal(move.type, 'Water');
}
});
const myActive = battle.p2.active;
battle.makeChoices('move sonicboom', 'move weatherball');
assert.species(myActive[0], 'Castform-Rainy');
battle.makeChoices('move sonicboom', 'switch 2');
assert.strictEqual(myActive[0].getStat('spe'), 2 * myActive[0].storedStats['spe'], "Kingdra's Speed should be doubled by Swift Swim");
assert.equal(myActive[0].getStat('spe'), 2 * myActive[0].storedStats['spe'], "Kingdra's Speed should be doubled by Swift Swim");
battle.makeChoices('move sonicboom', 'switch 3');
assert.notStrictEqual(myActive[0].maxhp - myActive[0].hp, 20);
battle.makeChoices('move sonicboom', 'switch 4');
assert.notStrictEqual(myActive[0].maxhp - myActive[0].hp, 20);
battle.makeChoices('move sonicboom', 'switch 5');
battle.makeChoices('move sonicboom', 'move rest');
assert.strictEqual(myActive[0].status, '');
assert.equal(myActive[0].status, '');
});
it('should cause the Primordial Sea weather to fade if it switches out and no other Primordial Sea Pokemon are active', function () {

View File

@@ -17,6 +17,6 @@ describe('Rough Skin', function () {
battle.setPlayer('p2', {team: [{species: 'Pachirisu', ability: 'voltabsorb', moves: ['nuzzle']}]});
battle.makeChoices('auto', 'move nuzzle');
const pachi = battle.p2.active[0];
assert.strictEqual(pachi.hp, Math.ceil(pachi.maxhp - pachi.maxhp / 8));
assert.equal(pachi.hp, Math.ceil(pachi.maxhp - pachi.maxhp / 8));
});
});

View File

@@ -15,7 +15,7 @@ describe('Sheer Force', function () {
battle.setPlayer('p1', {team: [{species: 'Tauros', ability: 'sheerforce', item: 'lifeorb', moves: ['earthquake']}]});
battle.setPlayer('p2', {team: [{species: 'Lapras', ability: 'shellarmor', item: 'laggingtail', moves: ['rest']}]});
battle.makeChoices('move earthquake', 'move rest');
assert.strictEqual(battle.p1.active[0].hp, 262);
assert.equal(battle.p1.active[0].hp, 262);
});
it('should eliminate secondary effects from moves', function () {
@@ -23,7 +23,7 @@ describe('Sheer Force', function () {
battle.setPlayer('p1', {team: [{species: 'Tauros', ability: 'sheerforce', moves: ['zapcannon']}]});
battle.setPlayer('p2', {team: [{species: 'Machamp', ability: 'noguard', moves: ['bulkup']}]});
battle.makeChoices('move zapcannon', 'move bulkup');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
});
it('should not eliminate Life Orb recoil if the ability is disabled/removed mid-attack', function () {
@@ -33,7 +33,7 @@ describe('Sheer Force', function () {
battle.makeChoices('move lockon', 'move irondefense');
battle.makeChoices('move dynamicpunch', 'move irondefense');
assert.false(battle.p2.active[0].volatiles['confusion']);
assert.strictEqual(battle.p1.active[0].hp, 262);
assert.equal(battle.p1.active[0].hp, 262);
});
it('should eliminate Life Orb recoil in a move with secondary effects', function () {
@@ -41,6 +41,6 @@ describe('Sheer Force', function () {
battle.setPlayer('p1', {team: [{species: 'Tauros', ability: 'sheerforce', item: 'lifeorb', moves: ['bodyslam']}]});
battle.setPlayer('p2', {team: [{species: 'Lapras', ability: 'shellarmor', item: 'laggingtail', moves: ['rest']}]});
battle.makeChoices('move bodyslam', 'move rest');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
});

View File

@@ -44,8 +44,8 @@ describe('Simple [Gen 4]', function () {
]);
battle.makeChoices('move batonpass', 'move splash');
battle.makeChoices('switch 2', '');
assert.strictEqual(battle.p1.active[0].boosts['atk'], -1);
assert.strictEqual(battle.p1.active[0].getStat('atk'), Math.floor(0.5 * battle.p1.active[0].getStat('atk', true)));
assert.equal(battle.p1.active[0].boosts['atk'], -1);
assert.equal(battle.p1.active[0].getStat('atk'), Math.floor(0.5 * battle.p1.active[0].getStat('atk', true)));
});
it('should be suppressed by Mold Breaker', function () {

View File

@@ -21,7 +21,7 @@ describe('Sticky Hold', function () {
]});
const itemHolder = battle.p1.active[0];
battle.makeChoices('move recover', 'move grassknot');
assert.strictEqual(itemHolder.item, 'razzberry', "Shuckle should hold a Razz Berry");
assert.equal(itemHolder.item, 'razzberry', "Shuckle should hold a Razz Berry");
battle.makeChoices('move recover', 'switch 2');
for (const moveid of STEAL_MOVES) {

View File

@@ -22,7 +22,7 @@ describe('Sturdy', function () {
battle.setPlayer('p1', {team: [{species: 'Paras', ability: 'sturdy', moves: ['sleeptalk']}]});
battle.setPlayer('p2', {team: [{species: 'Charizard', ability: 'drought', moves: ['fusionflare']}]});
battle.makeChoices('move sleeptalk', 'move fusionflare');
assert.strictEqual(battle.p1.active[0].hp, 1);
assert.equal(battle.p1.active[0].hp, 1);
});
it('should allow its user to survive a confusion damage hit from full HP', function () {
@@ -30,7 +30,7 @@ describe('Sturdy', function () {
battle.setPlayer('p1', {team: [{species: 'Shedinja', ability: 'sturdy', moves: ['absorb']}]});
battle.setPlayer('p2', {team: [{species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]});
battle.makeChoices('move absorb', 'move confuseray');
assert.strictEqual(battle.p1.active[0].hp, 1);
assert.equal(battle.p1.active[0].hp, 1);
});
it('should not trigger on recoil damage', function () {

View File

@@ -20,10 +20,10 @@ describe('Suction Cups', function () {
const [cupsMon, redCardHolder] = [battle.p1.active[0], battle.p2.active[0]];
battle.makeChoices('move rapidspin', 'move healpulse');
assert.false.holdsItem(redCardHolder, "Red Card should activate");
assert.strictEqual(cupsMon, battle.p1.active[0]);
assert.equal(cupsMon, battle.p1.active[0]);
for (let i = 2; i <= 4; i++) {
battle.makeChoices('move rapidspin', 'move ' + i);
assert.strictEqual(cupsMon, battle.p1.active[0]);
assert.equal(cupsMon, battle.p1.active[0]);
}
});

View File

@@ -16,8 +16,8 @@ describe('Symbiosis', function () {
[{species: 'Smeargle', moves: ['snarl']}, {species: 'Smeargle', moves: ['snarl']}],
]);
battle.makeChoices('move snarl, move snarl', 'move snarl, move snarl');
assert.strictEqual(battle.p1.active[0].item, '');
assert.strictEqual(battle.p1.active[1].item, '');
assert.equal(battle.p1.active[0].item, '');
assert.equal(battle.p1.active[1].item, '');
});
it('should not share an item required to change forme', function () {
@@ -26,7 +26,7 @@ describe('Symbiosis', function () {
[{species: 'Smeargle', moves: ['snarl']}, {species: 'Smeargle', moves: ['snarl']}],
]);
battle.makeChoices('move snarl, move snarl', 'move snarl, move snarl');
assert.strictEqual(battle.p1.active[0].item, 'latiasite');
assert.strictEqual(battle.p1.active[1].item, '');
assert.equal(battle.p1.active[0].item, 'latiasite');
assert.equal(battle.p1.active[1].item, '');
});
});

View File

@@ -21,7 +21,7 @@ describe('Unaware', function () {
battle.makeChoices('move softboiled', 'move bellydrum');
battle.resetRNG();
battle.makeChoices('move softboiled', 'move vitalthrow');
assert.strictEqual(pokemon.maxhp - pokemon.hp, damage);
assert.equal(pokemon.maxhp - pokemon.hp, damage);
});
it('should not ignore attack stage changes when Pokemon with it attack', function () {
@@ -49,7 +49,7 @@ describe('Unaware', function () {
pokemon.hp = pokemon.maxhp;
battle.resetRNG();
battle.makeChoices('move moonblast', 'move amnesia');
assert.strictEqual(pokemon.maxhp - pokemon.hp, damage);
assert.equal(pokemon.maxhp - pokemon.hp, damage);
});
it('should not ignore defense stage changes when Pokemon with it are attacked', function () {

View File

@@ -64,8 +64,8 @@ describe('Unburden', function () {
battle.setPlayer('p2', {team: [{species: 'Togekiss', ability: 'serenegrace', item: 'laggingtail', moves: ['bestow', 'followme']}]});
const originalSpeed = battle.p1.active[0].getStat('spe');
battle.makeChoices('move machpunch', 'move followme');
assert.strictEqual(battle.p1.active[0].getStat('spe'), 2 * originalSpeed);
assert.equal(battle.p1.active[0].getStat('spe'), 2 * originalSpeed);
battle.makeChoices('move machpunch', 'move bestow');
assert.strictEqual(battle.p1.active[0].getStat('spe'), originalSpeed);
assert.equal(battle.p1.active[0].getStat('spe'), originalSpeed);
});
});

View File

@@ -16,7 +16,7 @@ describe('Wonder Guard', function () {
battle.setPlayer('p2', {team: [{species: "Smeargle", ability: 'owntempo', moves: ['knockoff', 'flamethrower', 'thousandarrows', 'moonblast']}]});
for (let i = 1; i <= 4; i++) {
battle.makeChoices('move sleeptalk', 'move ' + i);
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
}
// Thousand Arrows shouldn't add the Smack Down volatile if blocked by Wonder Guard
assert.false.hurts(battle.p1.active[0], () => battle.makeChoices('move sleeptalk', 'move thousandarrows'));
@@ -28,7 +28,7 @@ describe('Wonder Guard', function () {
battle.setPlayer('p2', {team: [{species: "Smeargle", ability: 'noguard', moves: ['poisongas', 'screech', 'healpulse', 'gastroacid']}]});
const wwTarget = battle.p1.active[0];
battle.makeChoices('move teleport', 'move poisongas');
assert.strictEqual(wwTarget.status, 'psn');
assert.equal(wwTarget.status, 'psn');
battle.makeChoices('move teleport', 'move screech');
assert.statStage(wwTarget, 'def', -2);
assert.hurtsBy(wwTarget, -Math.floor(wwTarget.maxhp / 8), () => battle.makeChoices('move teleport', 'move healpulse'));

View File

@@ -187,14 +187,14 @@ describe('Choice parser', function () {
]});
assert(battle.choose('p1', `move 1, move Conversion 2 2`));
assert.strictEqual(battle.p1.getChoice(), `move conversion, move conversion2 2`);
assert.equal(battle.p1.getChoice(), `move conversion, move conversion2 2`);
battle.p1.clearChoice();
assert.throws(() => battle.choose('p1', `move 1, move Conversion -2`));
battle.p1.clearChoice();
assert(battle.choose('p1', `move Conversion 2 zmove 2, move 1`));
assert.strictEqual(battle.p1.getChoice(), `move conversion2 2 zmove, move conversion`);
assert.equal(battle.p1.getChoice(), `move conversion2 2 zmove, move conversion`);
battle.p1.clearChoice();
});
});
@@ -245,7 +245,7 @@ describe('Choice parser', function () {
assert.false.fainted(p1.active[1]);
assert(battle.choose('p1', 'move smog 2'));
assert.strictEqual(battle.p1.getChoice(), `pass, move smog 2`, `Choice mismatch`);
assert.equal(battle.p1.getChoice(), `pass, move smog 2`, `Choice mismatch`);
});
});
@@ -361,16 +361,16 @@ describe('Choice parser', function () {
const validChoices = ['move spikes', 'move 1'];
for (const action of validChoices) {
battle.choose('p1', action);
assert.strictEqual(battle.p1.getChoice(), `pass, move spikes, pass`);
assert.equal(battle.p1.getChoice(), `pass, move spikes, pass`);
battle.p1.clearChoice();
battle.choose('p1', `pass, ${action}, pass`);
assert.strictEqual(battle.p1.getChoice(), `pass, move spikes, pass`);
assert.equal(battle.p1.getChoice(), `pass, move spikes, pass`);
battle.p1.clearChoice();
battle.choose('p1', `pass, ${action}`);
assert.strictEqual(battle.p1.getChoice(), `pass, move spikes, pass`);
assert.equal(battle.p1.getChoice(), `pass, move spikes, pass`);
battle.p1.clearChoice();
battle.choose('p1', `${action}, pass`);
assert.strictEqual(battle.p1.getChoice(), `pass, move spikes, pass`);
assert.equal(battle.p1.getChoice(), `pass, move spikes, pass`);
battle.p1.clearChoice();
}
});

View File

@@ -114,7 +114,7 @@ describe('Choices', function () {
}, 20);
setTimeout(() => {
battle.choose('p1', 'move 1');
assert.strictEqual(battle.turn, 2);
assert.equal(battle.turn, 2);
done();
}, 40);
});
@@ -134,21 +134,21 @@ describe('Choices', function () {
const beforeHP = activeMons.map(pokemon => pokemon.hp);
const beforeAtk = activeMons.map(pokemon => pokemon.boosts.atk);
battle.makeChoices('move ' + (i + 1), 'move ' + (j + 1));
assert.strictEqual(activeMons[0].lastMove.id, MOVES[0][i]);
assert.strictEqual(activeMons[1].lastMove.id, MOVES[1][j]);
assert.equal(activeMons[0].lastMove.id, MOVES[0][i]);
assert.equal(activeMons[1].lastMove.id, MOVES[1][j]);
if (i >= 1) { // p1 used a damaging move
assert.atMost(activeMons[1].hp, beforeHP[1] - 1);
assert.statStage(activeMons[1], beforeAtk[1]);
} else {
assert.strictEqual(activeMons[1].hp, beforeHP[1]);
assert.equal(activeMons[1].hp, beforeHP[1]);
assert.statStage(activeMons[1], beforeAtk[1] - 1);
}
if (j >= 1) { // p2 used a damaging move
assert.atMost(activeMons[0].hp, beforeHP[0] - 1);
assert.statStage(activeMons[0], beforeAtk[0]);
} else {
assert.strictEqual(activeMons[0].hp, beforeHP[0]);
assert.equal(activeMons[0].hp, beforeHP[0]);
assert.statStage(activeMons[0], beforeAtk[0] - 1);
}
}
@@ -163,12 +163,12 @@ describe('Choices', function () {
const p2active = battle.p2.active;
battle.makeChoices('move gastroacid 1, move leechseed 2', 'move knockoff -2, move thunderwave -1');
assert.strictEqual(battle.turn, 2);
assert.equal(battle.turn, 2);
assert(p2active[0].volatiles['gastroacid']);
assert(p2active[1].volatiles['leechseed']);
assert.false.holdsItem(p2active[1]);
assert.strictEqual(p2active[0].status, 'par');
assert.equal(p2active[0].status, 'par');
});
it('should disallow specifying move targets for targetless moves (randomNormal)', function () {
@@ -282,8 +282,8 @@ describe('Choices', function () {
assert.cantMove(() => battle.makeChoices('move recover', 'move sketch'), 'Rhydon', 'Sketch');
battle.makeChoices('move recover', 'move 1');
assert.strictEqual(battle.turn, 3);
assert.strictEqual(battle.p2.active[0].lastMove.id, 'struggle');
assert.equal(battle.turn, 3);
assert.equal(battle.p2.active[0].lastMove.id, 'struggle');
});
it('should not force Struggle usage on move attempt for valid moves', function () {
@@ -293,7 +293,7 @@ describe('Choices', function () {
battle.makeChoices('move recover', 'move surf');
assert.strictEqual(battle.turn, 2);
assert.equal(battle.turn, 2);
assert.notStrictEqual(battle.p2.active[0].lastMove.id, 'struggle');
});
@@ -305,11 +305,11 @@ describe('Choices', function () {
battle.p2.chooseMove(1);
assert.cantMove(() => battle.p1.chooseMove(1), 'Mew', 'Recover', true);
assert.strictEqual(battle.turn, 1);
assert.equal(battle.turn, 1);
assert.notStrictEqual(failingAttacker.lastMove && failingAttacker.lastMove.id, 'struggle');
assert.cantMove(() => battle.p1.chooseMove(1), 'Mew', 'Recover');
assert.strictEqual(battle.turn, 1);
assert.equal(battle.turn, 1);
assert.notStrictEqual(failingAttacker.lastMove && failingAttacker.lastMove.id, 'struggle');
});
@@ -380,7 +380,7 @@ describe('Choices', function () {
]]);
battle.makeChoices('move lunardance, move lunardance', 'move lunardance, move lunardance');
assert.strictEqual(battle.getAllActive().length, 0, `All active Pok\u00E9mon should have fainted`);
assert.equal(battle.getAllActive().length, 0, `All active Pok\u00E9mon should have fainted`);
battle.makeChoices('pass, switch 3', 'switch 3, pass');
@@ -435,7 +435,7 @@ describe('Choices', function () {
]]);
battle.makeChoices('move lunardance, move lunardance', 'move lunardance, move lunardance');
assert.strictEqual(battle.getAllActive().length, 0, `All active Pok\u00E9mon should have fainted`);
assert.equal(battle.getAllActive().length, 0, `All active Pok\u00E9mon should have fainted`);
assert.constant(() => battle.turn, () => {
assert.throws(() => battle.p1.choosePass(),
@@ -450,7 +450,7 @@ describe('Choices', function () {
);
});
assert.strictEqual(battle.getAllActive().length, 0, `All active Pok\u00E9mon should have fainted`);
assert.equal(battle.getAllActive().length, 0, `All active Pok\u00E9mon should have fainted`);
});
});
@@ -724,9 +724,9 @@ describe('Choice extensions', function () {
if (mode === 'revoke') battle.undoChoice('p1');
battle.choose('p1', 'move growl');
assert.strictEqual(battle.turn, 2);
assert.strictEqual(battle.p1.active[0].lastMove.id, 'tackle');
assert.strictEqual(battle.p2.active[0].lastMove.id, 'growl');
assert.equal(battle.turn, 2);
assert.equal(battle.p1.active[0].lastMove.id, 'tackle');
assert.equal(battle.p2.active[0].lastMove.id, 'growl');
});
it(`should support to ${mode} move decisions`, function () {
@@ -739,8 +739,8 @@ describe('Choice extensions', function () {
if (mode === 'revoke') battle.undoChoice('p1');
battle.makeChoices('move growl', 'move growl');
assert.strictEqual(battle.turn, 2);
assert.strictEqual(battle.p1.active[0].lastMove.id, 'growl');
assert.equal(battle.turn, 2);
assert.equal(battle.p1.active[0].lastMove.id, 'growl');
});
it(`should disallow to ${mode} move decisions for maybe-disabled Pokémon`, function () {
@@ -759,7 +759,7 @@ describe('Choice extensions', function () {
assert.cantUndo(() => battle.choose('p1', 'move growl'));
battle.choose('p2', 'move scratch');
assert.strictEqual(target.lastMove.id, 'tackle');
assert.equal(target.lastMove.id, 'tackle');
});
it(`should disallow to ${mode} move decisions by default`, function () {
@@ -773,9 +773,9 @@ describe('Choice extensions', function () {
assert.cantUndo(() => battle.choose('p1', 'move growl'));
battle.choose('p2', 'move growl');
assert.strictEqual(battle.turn, 2);
assert.strictEqual(battle.p1.active[0].lastMove.id, 'tackle');
assert.strictEqual(battle.p2.active[0].lastMove.id, 'growl');
assert.equal(battle.turn, 2);
assert.equal(battle.p1.active[0].lastMove.id, 'tackle');
assert.equal(battle.p2.active[0].lastMove.id, 'growl');
});
it(`should support to ${mode} switch decisions on move requests`, function () {
@@ -796,7 +796,7 @@ describe('Choice extensions', function () {
for (const [index, species] of ['Bulbasaur', 'Ivysaur', 'Venusaur'].entries()) {
assert.species(battle.p1.pokemon[index], species);
}
assert.strictEqual(battle.p1.active[0].lastMove.id, 'synthesis');
assert.equal(battle.p1.active[0].lastMove.id, 'synthesis');
battle.destroy();
battle = common.createBattle({cancel: true}, TEAMS);
@@ -850,7 +850,7 @@ describe('Choice extensions', function () {
// The real Gengar comes in, but p1 only sees a Gengar being switched by another Gengar, implying Illusion.
// For a naive client, Starmie turns into Ghost/Poison, and it will be correct.
assert.strictEqual(target.getTypes().join('/'), 'Ghost/Poison');
assert.equal(target.getTypes().join('/'), 'Ghost/Poison');
// Trapping with Gengar-Mega is a guaranteed trapping, so we are going to get a very meta
// Competitive Gothitelle into the battle field (Frisk is revealed on switch-in).
@@ -922,7 +922,7 @@ describe('Choice extensions', function () {
for (const [index, species] of ['Bulbasaur', 'Ivysaur', 'Venusaur'].entries()) {
assert.species(battle.p1.active[index], species);
}
assert.strictEqual(battle.p1.active[0].lastMove.id, 'synthesis');
assert.equal(battle.p1.active[0].lastMove.id, 'synthesis');
battle.destroy();
battle = common.gen(5).createBattle({gameType: 'triples', cancel: true}, TEAMS);
@@ -935,7 +935,7 @@ describe('Choice extensions', function () {
for (const [index, species] of ['Bulbasaur', 'Ivysaur', 'Venusaur'].entries()) {
assert.species(battle.p1.active[index], species);
}
assert.strictEqual(battle.p1.active[2].lastMove.id, 'synthesis');
assert.equal(battle.p1.active[2].lastMove.id, 'synthesis');
});
it(`should disallow to ${mode} shift decisions by default`, function () {
@@ -959,7 +959,7 @@ describe('Choice extensions', function () {
for (const [index, species] of ['Ivysaur', 'Bulbasaur', 'Venusaur'].entries()) {
assert.species(battle.p1.active[index], species);
}
assert.strictEqual(battle.p1.active[0].lastMove.id, 'growth');
assert.equal(battle.p1.active[0].lastMove.id, 'growth');
battle.destroy();
battle = common.gen(5).createBattle({gameType: 'triples'}, TEAMS);
@@ -973,7 +973,7 @@ describe('Choice extensions', function () {
for (const [index, species] of ['Bulbasaur', 'Venusaur', 'Ivysaur'].entries()) {
assert.species(battle.p1.active[index], species);
}
assert.strictEqual(battle.p1.active[2].lastMove.id, 'growth');
assert.equal(battle.p1.active[2].lastMove.id, 'growth');
});
it(`should support to ${mode} switch decisions on double switch requests`, function () {
@@ -995,9 +995,9 @@ describe('Choice extensions', function () {
if (mode === 'revoke') battle.undoChoice('p1');
battle.makeChoices('switch 3', 'switch 2');
assert.strictEqual(battle.turn, 2);
assert.strictEqual(battle.p1.active[0].template.species, 'Chikorita');
assert.strictEqual(battle.p2.active[0].template.species, 'Charmander');
assert.equal(battle.turn, 2);
assert.equal(battle.p1.active[0].template.species, 'Chikorita');
assert.equal(battle.p2.active[0].template.species, 'Charmander');
});
it(`should support to ${mode} pass decisions on double switch requests`, function () {
@@ -1198,7 +1198,7 @@ describe('Choice internals', function () {
]});
const [p1, p2] = battle.sides;
assert.strictEqual(battle.turn, 1);
assert.equal(battle.turn, 1);
p1.chooseMove(1);
p1.chooseMove(1);
@@ -1206,7 +1206,7 @@ describe('Choice internals', function () {
p2.chooseMove(1);
battle.commitDecisions();
assert.strictEqual(battle.turn, 2);
assert.equal(battle.turn, 2);
assert.statStage(p2.active[0], 'atk', -1);
p1.chooseMove('recover');
@@ -1215,7 +1215,7 @@ describe('Choice internals', function () {
p2.chooseMove('calmmind');
battle.commitDecisions();
assert.strictEqual(battle.turn, 3);
assert.equal(battle.turn, 3);
assert.fullHP(p1.active[1]);
p1.chooseMove('recover');
@@ -1224,7 +1224,7 @@ describe('Choice internals', function () {
p2.chooseMove('calmmind');
battle.commitDecisions();
assert.strictEqual(battle.turn, 4);
assert.equal(battle.turn, 4);
assert.fullHP(p1.active[1]);
});
@@ -1242,7 +1242,7 @@ describe('Choice internals', function () {
]});
const [p1, p2] = battle.sides;
assert.strictEqual(battle.turn, 1);
assert.equal(battle.turn, 1);
p1.chooseMove('selfdestruct');
p1.chooseMove('selfdestruct');
p2.chooseMove('recover');
@@ -1254,9 +1254,9 @@ describe('Choice internals', function () {
p1.chooseSwitch(4);
p1.chooseSwitch(3);
battle.commitDecisions();
assert.strictEqual(battle.turn, 2);
assert.strictEqual(p1.active[0].name, 'Ekans');
assert.strictEqual(p1.active[1].name, 'Koffing');
assert.equal(battle.turn, 2);
assert.equal(p1.active[0].name, 'Ekans');
assert.equal(p1.active[1].name, 'Koffing');
});
it('should allow input of move and switch commands in a per Pokémon basis', function () {
@@ -1273,7 +1273,7 @@ describe('Choice internals', function () {
]});
const [p1, p2] = battle.sides;
assert.strictEqual(battle.turn, 1);
assert.equal(battle.turn, 1);
p1.choose('move recover, switch 4');
assert.throws(() => p2.choose('switch 3'),
/\[Invalid choice\] Can't switch: You do not have a Pokémon in slot 3 to switch to/,
@@ -1282,9 +1282,9 @@ describe('Choice internals', function () {
p2.choose('move recover, move recover');
battle.commitDecisions();
assert.strictEqual(battle.turn, 2);
assert.strictEqual(p1.active[0].name, 'Mew');
assert.strictEqual(p1.active[1].name, 'Ekans');
assert.equal(battle.turn, 2);
assert.equal(p1.active[0].name, 'Mew');
assert.equal(p1.active[1].name, 'Ekans');
p1.choose('switch 4, move leer');
assert.throws(() => p2.choose('switch 3'),
@@ -1294,9 +1294,9 @@ describe('Choice internals', function () {
p2.choose('move recover, move recover');
battle.commitDecisions();
assert.strictEqual(battle.turn, 3);
assert.strictEqual(p1.active[0].name, 'Bulbasaur');
assert.strictEqual(p1.active[1].name, 'Ekans');
assert.equal(battle.turn, 3);
assert.equal(p1.active[0].name, 'Bulbasaur');
assert.equal(p1.active[1].name, 'Ekans');
});
it('should empty the actions list when undoing a move', function () {

View File

@@ -7,23 +7,23 @@ describe('Mod loader', function () {
{
Chat.uncacheTree('./.sim-dist/dex');
let Dex = require('./../../../.sim-dist/dex').Dex;
assert.strictEqual(Dex.mod('gen2').getTemplate('nidoking').learnset.bubblebeam.join(','), '1M');
assert.strictEqual(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
assert.equal(Dex.mod('gen2').getTemplate('nidoking').learnset.bubblebeam.join(','), '1M');
assert.equal(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
}
{
Chat.uncacheTree('./.sim-dist/dex');
let Dex = require('./../../../.sim-dist/dex').Dex;
Dex.mod('gen2').getTemplate('nidoking');
Dex.mod('gen4').getMove('crunch');
assert.strictEqual(Dex.mod('gen2').getTemplate('nidoking').learnset.bubblebeam.join(','), '1M');
assert.strictEqual(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
assert.equal(Dex.mod('gen2').getTemplate('nidoking').learnset.bubblebeam.join(','), '1M');
assert.equal(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
}
});
});
describe('Dex#getEffect', function () {
it('returns the same object for the same id', function () {
assert.strictEqual(Dex.getEffect('Stealth Rock'), Dex.getEffect('stealthrock'));
assert.equal(Dex.getEffect('Stealth Rock'), Dex.getEffect('stealthrock'));
assert.notStrictEqual(Dex.getEffect('move: Stealth Rock'), Dex.getEffect('stealthrock'));
});

View File

@@ -28,9 +28,9 @@ describe('Battle#on', function () {
return 5;
});
battle.makeChoices('move bulkup', 'move peck');
assert.strictEqual(eventCount, 4);
assert.strictEqual(eventCount2, 2);
assert.strictEqual(battle.p1.active[0].maxhp - battle.p1.active[0].hp, 5);
assert.equal(eventCount, 4);
assert.equal(eventCount2, 2);
assert.equal(battle.p1.active[0].maxhp - battle.p1.active[0].hp, 5);
});
it('should support and resolve priorities correctly', function () {
@@ -41,7 +41,7 @@ describe('Battle#on', function () {
let eventCount = 0;
let modHandler = function (count) {
return function () {
assert.strictEqual(eventCount, count);
assert.equal(eventCount, count);
eventCount++;
};
};
@@ -49,7 +49,7 @@ describe('Battle#on', function () {
battle.onEvent('ModifyDamage', battle.format, -i, modHandler(i));
}
battle.makeChoices('move bulkup', 'move peck');
assert.strictEqual(eventCount, 9);
assert.equal(eventCount, 9);
});
it('should throw if a callback is not given for the event handler', function () {

View File

@@ -20,6 +20,6 @@ describe('Eject Pack', function () {
{species: 'Mew', ability: 'noability', moves: ['protect']},
]});
battle.makeChoices();
assert.strictEqual(battle.requestState, 'switch');
assert.equal(battle.requestState, 'switch');
});
});

View File

@@ -18,7 +18,7 @@ describe('Focus Sash', function () {
battle.makeChoices('move sleeptalk', 'move incinerate');
assert.false.holdsItem(holder);
assert.false.fainted(holder);
assert.strictEqual(holder.hp, 1);
assert.equal(holder.hp, 1);
});
it('should be consumed and allow its user to survive a confusion damage hit from full HP', function () {
@@ -29,7 +29,7 @@ describe('Focus Sash', function () {
battle.makeChoices('move absorb', 'move confuseray');
assert.false.holdsItem(holder);
assert.false.fainted(holder);
assert.strictEqual(holder.hp, 1);
assert.equal(holder.hp, 1);
});
it('should not trigger on recoil damage', function () {

View File

@@ -75,6 +75,6 @@ describe('Iron Ball', function () {
battle.setPlayer('p1', {team: [{species: "Smeargle", ability: 'owntempo', moves: ['spore']}]});
battle.setPlayer('p2', {team: [{species: "Thundurus", ability: 'prankster', item: 'ironball', moves: ['electricterrain']}]});
battle.makeChoices('move spore', 'move electricterrain');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
});
});

View File

@@ -30,14 +30,14 @@ describe('Lansat Berry', function () {
let i = 0;
let expectedRatio = [1, 1, 1, 1, 1, 3];
battle.onEvent('ModifyCritRatio', battle.format, -99, function (critRatio, pokemon) {
assert.strictEqual(critRatio, expectedRatio[i++]);
assert.equal(critRatio, expectedRatio[i++]);
});
battle.makeChoices('move triplekick', 'move acidarmor');
battle.makeChoices('move triplekick', 'move acidarmor');
assert.false.holdsItem(holder);
assert.strictEqual(holder.hp, 3);
assert.strictEqual(i, 6);
assert.equal(holder.hp, 3);
assert.equal(i, 6);
});
});

View File

@@ -21,10 +21,10 @@ describe('Leftovers [Gen 2]', function () {
]});
const holder = battle.p1.active[0];
battle.makeChoices('move healbell', 'move seismictoss');
assert.strictEqual(holder.hp, 590);
assert.equal(holder.hp, 590);
battle.makeChoices('switch 2', 'move seismictoss');
battle.makeChoices('switch 2', '');
assert.strictEqual(holder.hp, 630);
assert.equal(holder.hp, 630);
});
});

View File

@@ -21,7 +21,7 @@ describe('Leppa Berry', function () {
battle.makeChoices('move sleeptalk', 'move sleeptalk');
battle.makeChoices('move splash', 'move fling');
assert.strictEqual(pokemon.getMoveData('sleeptalk').pp, 16);
assert.equal(pokemon.getMoveData('sleeptalk').pp, 16);
assert.false.strictEqual(pokemon.getMoveData('splash').pp, 64);
});
});

View File

@@ -16,9 +16,9 @@ describe('Protective Pads', function () {
battle.setPlayer('p2', {team: [{species: "Hariyama", ability: 'thickfat', item: 'protectivepads', moves: ['bulletpunch']}]});
const attacker = battle.p2.active[0];
battle.makeChoices();
assert.strictEqual(attacker.ability, 'thickfat');
assert.equal(attacker.ability, 'thickfat');
const mummyActivationMessages = battle.log.filter(logStr => logStr.startsWith('|-activate|') && logStr.includes('Mummy'));
assert.strictEqual(mummyActivationMessages.length, 1, "Mummy should activate only once");
assert.equal(mummyActivationMessages.length, 1, "Mummy should activate only once");
assert.ok(mummyActivationMessages[0].includes('Cofagrigus'), "Source of Mummy activation should be included");
assert.false(mummyActivationMessages[0].includes('Thick Fat'), "Attacker's ability should not be revealed");
});
@@ -45,7 +45,7 @@ describe('Protective Pads', function () {
battle.setPlayer('p2', {team: [{species: "Liepard", ability: 'prankster', item: 'protectivepads', moves: ['scratch']}]});
battle.makeChoices();
assert.false(battle.p2.active[0].item, "Attacker should lose their item");
assert.strictEqual(battle.p1.active[0].item, 'protectivepads', "Target should receive stolen item");
assert.equal(battle.p1.active[0].item, 'protectivepads', "Target should receive stolen item");
});
it('should prevent item effects triggered by contact from acting', function () {

View File

@@ -16,6 +16,6 @@ describe('Rocky Helmet', function () {
battle.setPlayer('p2', {team: [{species: "Drampa", item: 'rockyhelmet', moves: ['sleeptalk']}]});
battle.makeChoices('move outrage', 'move sleeptalk');
const attacker = battle.p1.active[0];
assert.strictEqual(attacker.hp, attacker.maxhp - Math.floor(attacker.maxhp / 6));
assert.equal(attacker.hp, attacker.maxhp - Math.floor(attacker.maxhp / 6));
});
});

View File

@@ -29,6 +29,6 @@ describe('Seeds', function () {
]);
battle.makeChoices('move protect', 'move magicroom');
battle.makeChoices('switch 2', 'move magicroom');
assert.strictEqual(battle.p1.active[0].item, 'electricseed');
assert.equal(battle.p1.active[0].item, 'electricseed');
});
});

View File

@@ -17,7 +17,7 @@ describe('Sitrus Berry', function () {
const holder = battle.p1.active[0];
battle.makeChoices('move sleeptalk', 'move aurasphere');
assert.false.holdsItem(holder);
assert.strictEqual(holder.hp, Math.floor(holder.maxhp / 4) + 1);
assert.equal(holder.hp, Math.floor(holder.maxhp / 4) + 1);
});
it('should be eaten immediately if (re)gained on low hp', function () {
@@ -29,7 +29,7 @@ describe('Sitrus Berry', function () {
const hpgain = Math.floor(holder.maxhp / 4);
battle.makeChoices('move recycle', 'move earthquake');
assert.false.holdsItem(holder);
assert.strictEqual(holder.hp, hpgain + hpgain + 1);
assert.equal(holder.hp, hpgain + hpgain + 1);
});
it('should not heal if Knocked Off', function () {
@@ -38,7 +38,7 @@ describe('Sitrus Berry', function () {
[{species: 'Krookodile', ability: 'intimidate', moves: ['knockoff']}],
]);
battle.makeChoices('move sleeptalk', 'move knockoff');
assert.strictEqual(battle.p1.active[0].hp, 1);
assert.equal(battle.p1.active[0].hp, 1);
});
it.skip('should not heal 25% hp if a confusion self-hit triggers the healing', function () {

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const common = require('./../../common');
const unimportantPokemon = {species: 'magikarp', moves: ['splash']};
@@ -11,7 +11,7 @@ describe(`[Hackmons] Arceus`, function () {
[{species: 'arceus', ability: 'multitype', item: 'flameplate', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Fire"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Fire"]);
});
it(`in Steel forme should should be Water-typed to match the held Splash Plate`, function () {
@@ -19,7 +19,7 @@ describe(`[Hackmons] Arceus`, function () {
[{species: 'arceussteel', ability: 'multitype', item: 'splashplate', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Water"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Water"]);
});
it(`in a typed forme should be Normal-typed if no plate is held`, function () {
@@ -27,7 +27,7 @@ describe(`[Hackmons] Arceus`, function () {
[{species: 'Arceusfire', ability: 'multitype', item: 'leftovers', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Normal"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Normal"]);
});
it(`in a typed forme should be Normal-typed despite holding a plate if Arceus does not have the Multitype ability`, function () {
@@ -35,6 +35,6 @@ describe(`[Hackmons] Arceus`, function () {
[{species: 'arceusfire', ability: 'truant', item: 'flameplate', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Normal"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Normal"]);
});
});

View File

@@ -23,7 +23,7 @@ describe('Fainting', function () {
]);
battle.makeChoices('move Explosion', 'move Substitute');
battle.makeChoices('switch Pikachu', '');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should end the turn in Gen 3', function () {
@@ -38,7 +38,7 @@ describe('Fainting', function () {
]);
battle.makeChoices('move Explosion', 'move Substitute');
battle.makeChoices('switch Pikachu', '');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should not end the turn in Gen 4', function () {

View File

@@ -27,8 +27,8 @@ describe('Fusion Bolt + Fusion Flare', function () {
});
battle.makeChoices('move fusionbolt 1, move fusionflare 1', 'default');
assert.strictEqual(bpModifiers.get('fusionbolt'), 2);
assert.strictEqual(bpModifiers.get('fusionflare'), 2);
assert.equal(bpModifiers.get('fusionbolt'), 2);
assert.equal(bpModifiers.get('fusionflare'), 2);
});
it('should boost the second move if the first was used by the same pokemon', function () {
@@ -45,8 +45,8 @@ describe('Fusion Bolt + Fusion Flare', function () {
});
battle.makeChoices('move fusionflare 2, move instruct -1', 'default');
assert.strictEqual(bpModifiers.get('fusionbolt'), 1);
assert.strictEqual(bpModifiers.get('fusionflare'), 2);
assert.equal(bpModifiers.get('fusionbolt'), 1);
assert.equal(bpModifiers.get('fusionflare'), 2);
});
it('should not boost the second move if another move was used between them', function () {
@@ -63,6 +63,6 @@ describe('Fusion Bolt + Fusion Flare', function () {
});
battle.makeChoices('move fusionbolt 1, move fusionflare 1', 'default');
assert.strictEqual(bpModifiers.get('fusionflare'), 1);
assert.equal(bpModifiers.get('fusionflare'), 1);
});
});

View File

@@ -50,7 +50,7 @@ describe('Inverse Battle', function () {
pokemon = battle.p2.active[0];
const expectedPercent = Math.pow(0.5, i - 1);
const expectedDamage = Math.floor(pokemon.maxhp * expectedPercent);
assert.strictEqual(pokemon.maxhp - pokemon.hp, expectedDamage, `${pokemon.name} should take ${expectedPercent * 100}%`);
assert.equal(pokemon.maxhp - pokemon.hp, expectedDamage, `${pokemon.name} should take ${expectedPercent * 100}%`);
}
});
@@ -60,7 +60,7 @@ describe('Inverse Battle', function () {
battle.makeChoices('move earthquake', 'move shadowsneak');
battle.makeChoices('move earthquake', 'move shadowsneak');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should not affect the type effectiveness of Freeze Dry on Water-type Pokemon', function () {
@@ -76,6 +76,6 @@ describe('Inverse Battle', function () {
battle.setPlayer('p2', {team: [{species: "Talonflame", ability: 'galewings', moves: ['mistyterrain']}]});
battle.makeChoices('move spore', 'move mistyterrain');
battle.makeChoices('move spore', 'move mistyterrain');
assert.strictEqual(battle.p2.active[0].status, 'slp');
assert.equal(battle.p2.active[0].status, 'slp');
});
});

View File

@@ -10,7 +10,7 @@ describe(`PRNG`, function () {
it(`should always return false`, function () {
const prng = new PRNG(testSeed);
for (let i = 0; i < 100; ++i) {
assert.strictEqual(prng.randomChance(0, 1), false);
assert.equal(prng.randomChance(0, 1), false);
}
});
});
@@ -18,7 +18,7 @@ describe(`PRNG`, function () {
it(`should always return true`, function () {
const prng = new PRNG(testSeed);
for (let i = 0; i < 100; ++i) {
assert.strictEqual(prng.randomChance(1, 1), true);
assert.equal(prng.randomChance(1, 1), true);
}
});
});
@@ -26,7 +26,7 @@ describe(`PRNG`, function () {
it(`should always return true`, function () {
const prng = new PRNG(testSeed);
for (let i = 0; i < 100; ++i) {
assert.strictEqual(prng.randomChance(256, 256), true);
assert.equal(prng.randomChance(256, 256), true);
}
});
});
@@ -46,7 +46,7 @@ describe(`PRNG`, function () {
const coinPRNG = new PRNG(testSeed);
const numberPRNG = new PRNG(testSeed);
for (let i = 0; i < 10; ++i) {
assert.strictEqual(numberPRNG.next(2) === 0, coinPRNG.randomChance(1, 2));
assert.equal(numberPRNG.next(2) === 0, coinPRNG.randomChance(1, 2));
}
});
});
@@ -66,7 +66,7 @@ describe(`PRNG`, function () {
const coinPRNG = new PRNG(testSeed);
const numberPRNG = new PRNG(testSeed);
for (let i = 0; i < 10; ++i) {
assert.strictEqual(numberPRNG.next(256) < 217, coinPRNG.randomChance(217, 256));
assert.equal(numberPRNG.next(256) < 217, coinPRNG.randomChance(217, 256));
}
});
});
@@ -101,7 +101,7 @@ describe(`PRNG`, function () {
const prng = new PRNG(testSeed);
for (let i = 0; i < 10; ++i) {
const sample = prng.sample([item]);
assert.strictEqual(sample, item);
assert.equal(sample, item);
}
});
it(`should return items with equal probability for a five-item array`, function () {
@@ -135,7 +135,7 @@ describe(`PRNG`, function () {
const samplePRNG = new PRNG(testSeed);
const randomIntegerPRNG = new PRNG(testSeed);
for (let i = 0; i < 10; ++i) {
assert.strictEqual(items[randomIntegerPRNG.next(items.length)], samplePRNG.sample(items));
assert.equal(items[randomIntegerPRNG.next(items.length)], samplePRNG.sample(items));
}
});
});

View File

@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const common = require('./../../common');
const unimportantPokemon = {species: 'magikarp', moves: ['splash']};
@@ -11,7 +11,7 @@ describe(`[Hackmons] Silvally`, function () {
[{species: 'silvally', ability: 'rkssystem', item: 'firememory', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Fire"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Fire"]);
});
it(`in Steel forme should should be Water-typed to match the held Water Memory`, function () {
@@ -19,7 +19,7 @@ describe(`[Hackmons] Silvally`, function () {
[{species: 'silvallysteel', ability: 'rkssystem', item: 'watermemory', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Water"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Water"]);
});
it(`in a typed forme should be Normal-typed if no memory is held`, function () {
@@ -27,7 +27,7 @@ describe(`[Hackmons] Silvally`, function () {
[{species: 'silvallyfire', ability: 'rkssystem', item: 'leftovers', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Normal"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Normal"]);
});
it(`[Gen 7] in a typed forme should be Normal-typed despite holding a memory if Silvally does not have the RKS System ability`, function () {
@@ -35,6 +35,6 @@ describe(`[Hackmons] Silvally`, function () {
[{species: 'silvallyfire', ability: 'truant', item: 'firememory', moves: ['rest']}],
[unimportantPokemon],
]);
assert.deepStrictEqual(battle.p1.active[0].getTypes(), ["Normal"]);
assert.deepEqual(battle.p1.active[0].getTypes(), ["Normal"]);
});
});

View File

@@ -13,9 +13,9 @@ describe('Sleep Clause Mod', () => {
battle.setPlayer('p1', {team: [{species: "Paras", moves: ['spore']}]});
battle.setPlayer('p2', {team: [{species: "Magikarp", moves: ['splash']}, {species: "Feebas", moves: ['splash']}]});
battle.makeChoices('move spore', 'switch 2');
assert.strictEqual(battle.p2.active[0].status, 'slp');
assert.equal(battle.p2.active[0].status, 'slp');
battle.makeChoices('move spore', 'switch 2');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
});
it('should not prevent Rest', () => {
@@ -23,10 +23,10 @@ describe('Sleep Clause Mod', () => {
battle.setPlayer('p1', {team: [{species: "Paras", moves: ['spore', 'tackle']}]});
battle.setPlayer('p2', {team: [{species: "Feebas", moves: ['rest']}, {species: "Magikarp", moves: ['splash']}]});
battle.makeChoices('move spore', 'switch 2');
assert.strictEqual(battle.p2.active[0].status, 'slp');
assert.equal(battle.p2.active[0].status, 'slp');
battle.makeChoices('move tackle', 'switch 2');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
battle.makeChoices('move tackle', 'move rest');
assert.strictEqual(battle.p2.active[0].status, 'slp');
assert.equal(battle.p2.active[0].status, 'slp');
});
});

View File

@@ -30,7 +30,7 @@ describe('State', function () {
control.makeChoices();
test.makeChoices();
assert.deepStrictEqual(test.toJSON(), control.toJSON());
assert.deepEqual(test.toJSON(), control.toJSON());
// Roundtrip the test battle to confirm it still works.
const send = test.send;

View File

@@ -50,7 +50,7 @@ describe('Paralysis', function () {
battle.setPlayer('p2', {team: [{species: 'Jolteon', ability: 'voltabsorb', moves: ['thunderwave']}]});
let speed = battle.p1.active[0].getStat('spe');
battle.makeChoices('move aquaring', 'move thunderwave');
assert.strictEqual(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.5));
assert.equal(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.5));
});
it('should reduce speed to 25% of its original value in Gen 6', function () {
@@ -59,7 +59,7 @@ describe('Paralysis', function () {
battle.setPlayer('p2', {team: [{species: 'Jolteon', ability: 'voltabsorb', moves: ['thunderwave']}]});
let speed = battle.p1.active[0].getStat('spe');
battle.makeChoices('move aquaring', 'move thunderwave');
assert.strictEqual(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
assert.equal(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
});
it('should reduce speed to 25% of its original value in Gen 2', function () {
@@ -68,7 +68,7 @@ describe('Paralysis', function () {
battle.setPlayer('p2', {team: [{species: 'Jolteon', ability: 'voltabsorb', moves: ['thunderwave']}]});
let speed = battle.p1.active[0].getStat('spe');
battle.makeChoices('move aquaring', 'move thunderwave');
assert.strictEqual(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
assert.equal(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
});
it('should reduce speed to 25% of its original value in Stadium', function () {
@@ -78,7 +78,7 @@ describe('Paralysis', function () {
]);
let speed = battle.p1.active[0].getStat('spe');
battle.makeChoices('move growl', 'move thunderwave');
assert.strictEqual(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
assert.equal(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
});
it('should reapply its speed drop when an opponent uses a stat-altering move in Gen 1', function () {
@@ -89,7 +89,7 @@ describe('Paralysis', function () {
battle.makeChoices('move rest', 'move thunderwave');
let speed = battle.p1.active[0].getStat('spe');
battle.makeChoices('move rest', 'move amnesia');
assert.strictEqual(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
assert.equal(battle.p1.active[0].getStat('spe'), battle.modify(speed, 0.25));
});
it('should not reapply its speed drop when an opponent uses a failed stat-altering move in Gen 1', function () {
@@ -103,7 +103,7 @@ describe('Paralysis', function () {
battle.makeChoices('move rest', 'move thunderwave');
let speed = battle.p1.active[0].getStat('spe');
battle.makeChoices('move rest', 'move amnesia');
assert.strictEqual(battle.p1.active[0].getStat('spe'), speed);
assert.equal(battle.p1.active[0].getStat('spe'), speed);
});
});
@@ -120,7 +120,7 @@ describe('Toxic Poison', function () {
const target = battle.p1.active[0];
for (let i = 1; i <= 8; i++) {
battle.makeChoices('move softboiled', 'move toxic');
assert.strictEqual(target.maxhp - target.hp, Math.floor(target.maxhp / 16) * i);
assert.equal(target.maxhp - target.hp, Math.floor(target.maxhp / 16) * i);
}
});
@@ -135,7 +135,7 @@ describe('Toxic Poison', function () {
let pokemon = battle.p1.active[0];
pokemon.hp = pokemon.maxhp;
battle.makeChoices('switch 2', 'move whirlwind');
assert.strictEqual(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
assert.equal(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
});
});
@@ -159,8 +159,8 @@ describe('Freeze', function () {
}
});
battle.makeChoices('move icebeam', 'move sleeptalk');
assert.strictEqual(battle.p2.active[0].status, 'frz');
assert.strictEqual(battle.p2.active[0].template.species, 'Shaymin');
assert.equal(battle.p2.active[0].status, 'frz');
assert.equal(battle.p2.active[0].template.species, 'Shaymin');
});
it('should not cause an afflicted Pokemon transformed into Shaymin-Sky to change to Shaymin', function () {
@@ -177,8 +177,8 @@ describe('Freeze', function () {
}
});
battle.makeChoices('move sleeptalk', 'move icebeam');
assert.strictEqual(battle.p1.active[0].status, 'frz');
assert.strictEqual(battle.p1.active[0].template.species, 'Shaymin-Sky');
assert.equal(battle.p1.active[0].status, 'frz');
assert.equal(battle.p1.active[0].template.species, 'Shaymin-Sky');
});
});
@@ -209,10 +209,10 @@ describe('Toxic Poison [Gen 1]', function () {
]);
battle.makeChoices('move toxic', 'move splash');
let pokemon = battle.p2.active[0];
assert.strictEqual(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
assert.equal(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
battle.makeChoices('move leechseed', 'move splash');
// (1/16) + (2/16) + (3/16) = (6/16)
assert.strictEqual(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 6);
assert.equal(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 6);
});
});
@@ -229,10 +229,10 @@ describe('Toxic Poison [Gen 2]', function () {
]);
battle.makeChoices('move toxic', 'move splash');
let pokemon = battle.p2.active[0];
assert.strictEqual(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
assert.equal(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
battle.makeChoices('move leechseed', 'move splash');
// (1/16) + (2/16) + (1/8) = (5/16)
assert.strictEqual(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 5);
assert.equal(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 5);
});
it('should pass the damage counter to Pokemon with Baton Pass', function () {
@@ -254,16 +254,16 @@ describe('Toxic Poison [Gen 2]', function () {
battle.makeChoices('', 'switch 2');
let hp = pokemon.hp;
battle.makeChoices('move splash', 'move splash');
assert.strictEqual(hp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 4);
assert.equal(hp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 4);
// Only hint about this once per battle, not every turn.
assert.strictEqual(battle.log.filter(m => m.startsWith('|-hint')).length, 1);
assert.equal(battle.log.filter(m => m.startsWith('|-hint')).length, 1);
// Damage counter should be removed on regular switch out
battle.makeChoices('move splash', 'switch 2');
hp = pokemon.hp;
battle.makeChoices('move splash', 'switch 2');
assert.strictEqual(hp - pokemon.hp, Math.floor(pokemon.maxhp / 8));
assert.equal(hp - pokemon.hp, Math.floor(pokemon.maxhp / 8));
});
it('should revert to regular poison on switch in, even for Poison types', function () {
@@ -280,7 +280,7 @@ describe('Toxic Poison [Gen 2]', function () {
// We could check 'psn' at this point, but the following line caused crashes
// before #5463 was fixed so its useful to execute for regression testing purposes.
battle.makeChoices('move splash', 'move splash');
assert.strictEqual(battle.p2.active[0].status, 'psn');
assert.equal(battle.p2.active[0].status, 'psn');
});
it('should not have its damage counter affected by Heal Bell', function () {
@@ -295,13 +295,13 @@ describe('Toxic Poison [Gen 2]', function () {
battle.makeChoices('move sacredfire', 'move splash');
let hp = pokemon.hp;
battle.makeChoices('move splash', 'move splash');
assert.strictEqual(hp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 3);
assert.equal(hp - pokemon.hp, Math.floor(pokemon.maxhp / 16) * 3);
hp = pokemon.hp;
battle.makeChoices('move splash', 'move healbell');
battle.resetRNG(); // Guarantee Toxic hits
battle.makeChoices('move toxic', 'move splash');
// Toxic counter should be reset by a successful Toxic
assert.strictEqual(hp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
assert.equal(hp - pokemon.hp, Math.floor(pokemon.maxhp / 16));
});
});

View File

@@ -23,7 +23,7 @@ describe('Most status moves', function () {
battle.makeChoices('move gastroacid', 'move return');
assert.false.holdsItem(battle.p2.active[0]); // Klefki's Magician suppressed by Gastro Acid.
battle.makeChoices('move glare', 'switch 2'); // Dusknoir
assert.strictEqual(battle.p2.active[0].status, 'par');
assert.equal(battle.p2.active[0].status, 'par');
battle.makeChoices('move confuseray', 'switch 3'); // Slaking
assert.ok(battle.p2.active[0].volatiles['confusion']);
battle.makeChoices('move sandattack', 'switch 4'); // Tornadus
@@ -45,27 +45,27 @@ describe('Most status moves', function () {
]});
battle.makeChoices('move thunderwave', 'move charge');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.makeChoices('move willowisp', 'switch 2'); // Emboar
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.makeChoices('move poisongas', 'switch 3'); // Muk
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.makeChoices('move toxic', 'move shadowsneak');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.makeChoices('move poisongas', 'switch 4'); // Aron
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.makeChoices('move toxic', 'move magnetrise');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
});
});

View File

@@ -38,7 +38,7 @@ describe('Target Resolution', function () {
battle.makeChoices('move watergun -2, auto', 'auto');
const newHps = activePokemonList.map(pokemon => pokemon.hp);
assert.deepStrictEqual(prevHps, newHps);
assert.deepEqual(prevHps, newHps);
assert(battle.log.includes('|move|p1a: Wailord|Water Gun|p1: Latias|[notarget]'));
assert(battle.log.includes('|-fail|p1a: Wailord'));
});
@@ -135,7 +135,7 @@ describe('Target Resolution', function () {
battle.makeChoices('move watergun -2, pass', 'move watergun -2, pass');
const newHps = attackers.map(pokemon => pokemon.hp);
assert.deepStrictEqual(prevHps, newHps);
assert.deepEqual(prevHps, newHps);
assert(battle.log.includes('|move|p1a: Wailord|Water Gun|p1: Shedinja|[notarget]'));
assert(battle.log.includes('|-fail|p1a: Wailord'));
assert(battle.log.includes('|move|p2a: Wailord|Water Gun|p2: Shedinja|[notarget]'));

View File

@@ -22,7 +22,7 @@ describe('Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move swordsdance');
assert.trapped(() => battle.makeChoices('move ' + toID(move), 'switch 2'));
assert.strictEqual(battle.p2.active[0].template.speciesid, 'tangrowth');
assert.equal(battle.p2.active[0].template.speciesid, 'tangrowth');
});
it('should not prevent Pokemon from switching out using moves', function () {
@@ -34,7 +34,7 @@ describe('Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move batonpass');
battle.makeChoices('', 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
it('should not prevent Pokemon immune to trapping from switching out', function () {
@@ -46,7 +46,7 @@ describe('Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move synthesis');
battle.makeChoices('move ' + toID(move), 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
it('should stop trapping the Pokemon if the user is no longer active', function () {
@@ -61,7 +61,7 @@ describe('Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move roar');
battle.makeChoices('move rest', 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
it('should free all trapped Pokemon if the user is no longer active', function () {
@@ -83,8 +83,8 @@ describe('Trapping Moves', function () {
battle.makeChoices('move ' + toID(move) + ', move closecombat -1', 'move synthesis, move recover');
}
battle.makeChoices('move swordsdance', 'switch 3, switch 4');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'cradily');
assert.strictEqual(battle.p2.active[1].template.speciesid, 'hippowdon');
assert.equal(battle.p2.active[0].template.speciesid, 'cradily');
assert.equal(battle.p2.active[1].template.speciesid, 'hippowdon');
});
if (trappers.indexOf(move) < 3) {
@@ -102,10 +102,10 @@ describe('Trapping Moves', function () {
battle.makeChoices('move ' + toID(move), 'move synthesis');
battle.makeChoices('move batonpass', 'move synthesis');
battle.makeChoices('switch 2', '');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'tangrowth');
assert.equal(battle.p2.active[0].template.speciesid, 'tangrowth');
battle.makeChoices('move rest', 'move roar');
battle.makeChoices('move batonpass', 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
}
}
@@ -125,7 +125,7 @@ describe('Partial Trapping Moves', function () {
let pokemon = battle.p2.active[0];
pokemon.heal(pokemon.maxhp);
battle.makeChoices('move rest', 'move healbell');
assert.strictEqual(pokemon.maxhp - pokemon.hp, battle.modify(pokemon.maxhp, 1 / 8));
assert.equal(pokemon.maxhp - pokemon.hp, battle.modify(pokemon.maxhp, 1 / 8));
});
it('should prevent Pokemon from switching out normally', function () {
@@ -137,7 +137,7 @@ describe('Partial Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move healbell');
assert.trapped(() => battle.makeChoices('move ' + toID(move), 'switch 2'));
assert.strictEqual(battle.p2.active[0].template.speciesid, 'blissey');
assert.equal(battle.p2.active[0].template.speciesid, 'blissey');
});
it('should not prevent Pokemon from switching out using moves', function () {
@@ -149,7 +149,7 @@ describe('Partial Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move batonpass');
battle.makeChoices('', 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
it('should not prevent Pokemon immune to trapping from switching out', function () {
@@ -161,7 +161,7 @@ describe('Partial Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move sleeptalk');
battle.makeChoices('move ' + toID(move), 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
it('should stop trapping the Pokemon if the user is no longer active', function () {
@@ -176,7 +176,7 @@ describe('Partial Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move roar');
battle.makeChoices('move rest', 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
it('should stop trapping the Pokemon if the target uses Rapid Spin', function () {
@@ -191,7 +191,7 @@ describe('Partial Trapping Moves', function () {
]});
battle.makeChoices('move ' + toID(move), 'move rapidspin');
battle.makeChoices('move ' + toID(move), 'switch 2');
assert.strictEqual(battle.p2.active[0].template.speciesid, 'starmie');
assert.equal(battle.p2.active[0].template.speciesid, 'starmie');
});
}
});

View File

@@ -55,7 +55,7 @@ describe('Mega Evolution', function () {
battle.setPlayer('p2', {team: [{species: 'Hoopa-Unbound', ability: 'magician', moves: ['darkpulse']}]});
const fastBase = battle.p2.active[0];
battle.makeChoices('move xscissor ultra', 'move darkpulse');
assert.strictEqual(fastBase.hp, 0);
assert.equal(fastBase.hp, 0);
});
});
@@ -169,6 +169,6 @@ describe('Switching', function () {
battle.setPlayer('p2', {team: p2team});
battle.makeChoices('switch 2', 'switch 2');
assert.strictEqual(battle.p2.pokemon[0].boosts.atk, 0);
assert.equal(battle.p2.pokemon[0].boosts.atk, 0);
});
});

View File

@@ -20,7 +20,7 @@ describe('Weather damage calculation', function () {
assert.hurtsBy(defender, 152, () => battle.makeChoices('move incinerate', 'move splash'));
const move = Dex.getMove('incinerate');
const basePower = battle.runEvent('BasePower', attacker, defender, move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should reduce the damage (not the basePower) in unfavorable weather', function () {
@@ -33,7 +33,7 @@ describe('Weather damage calculation', function () {
assert.hurtsBy(defender, 50, () => battle.makeChoices('move incinerate', 'move splash'));
const move = Dex.getMove('incinerate');
const basePower = battle.runEvent('BasePower', attacker, defender, move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should make Hail/Sandstorm damage some pokemon but not others', function () {
@@ -44,7 +44,7 @@ describe('Weather damage calculation', function () {
battle.makeChoices('move protect', 'move protect');
const p1active = battle.p1.active[0];
const p2active = battle.p2.active[0];
assert.strictEqual(p1active.hp, p1active.maxhp);
assert.equal(p1active.hp, p1active.maxhp);
assert.notEqual(p2active.hp, p2active.maxhp);
});
});

View File

@@ -22,7 +22,7 @@ describe('Heavy Metal', function () {
}
});
battle.makeChoices('move nastyplot', 'move grassknot');
assert.strictEqual(basePower, 80);
assert.equal(basePower, 80);
});
it('should be negated by Mold Breaker', function () {
@@ -37,7 +37,7 @@ describe('Heavy Metal', function () {
}
});
battle.makeChoices('move nastyplot', 'move grassknot');
assert.strictEqual(basePower, 60);
assert.equal(basePower, 60);
});
});
@@ -58,7 +58,7 @@ describe('Light Metal', function () {
}
});
battle.makeChoices('move curse', 'move grassknot');
assert.strictEqual(basePower, 100);
assert.equal(basePower, 100);
});
it('should be negated by Mold Breaker', function () {
@@ -73,7 +73,7 @@ describe('Light Metal', function () {
}
});
battle.makeChoices('move splash', 'move grassknot');
assert.strictEqual(basePower, 120);
assert.equal(basePower, 120);
});
});
@@ -94,7 +94,7 @@ describe('Float Stone', function () {
}
});
battle.makeChoices('move curse', 'move grassknot');
assert.strictEqual(basePower, 100);
assert.equal(basePower, 100);
});
});
@@ -115,9 +115,9 @@ describe('Autotomize', function () {
}
});
battle.makeChoices('move autotomize', 'move grassknot');
assert.strictEqual(basePower, 100);
assert.equal(basePower, 100);
battle.makeChoices('move autotomize', 'move grassknot');
assert.strictEqual(basePower, 20);
assert.equal(basePower, 20);
});
it('should factor into weight before Heavy Metal does', function () {
@@ -132,7 +132,7 @@ describe('Autotomize', function () {
}
});
battle.makeChoices('move autotomize', 'move grassknot');
assert.strictEqual(basePower, 60);
assert.equal(basePower, 60);
});
it('should reset after a forme change', function () {
@@ -148,6 +148,6 @@ describe('Autotomize', function () {
});
battle.makeChoices('move autotomize', 'move grassknot');
battle.makeChoices('move shadowsneak', 'move grassknot');
assert.strictEqual(basePower, 80);
assert.equal(basePower, 80);
});
});

View File

@@ -15,9 +15,9 @@ describe('Belch', function () {
battle.setPlayer('p1', {team: [{species: 'Swalot', ability: 'gluttony', item: 'lumberry', moves: ['belch', 'stockpile']}]});
battle.setPlayer('p2', {team: [{species: 'Registeel', ability: 'clearbody', item: 'laggingtail', moves: ['thunderwave']}]});
battle.makeChoices('move Stockpile', 'move Thunderwave');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'stockpile');
assert.equal(battle.p1.active[0].lastMove.id, 'stockpile');
battle.makeChoices('move Belch', 'move Thunderwave');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'belch');
assert.equal(battle.p1.active[0].lastMove.id, 'belch');
});
it('should count berries as consumed with Bug Bite or Pluck', function () {
@@ -26,8 +26,8 @@ describe('Belch', function () {
battle.setPlayer('p2', {team: [{species: 'Swalot', ability: 'gluttony', item: 'salacberry', moves: ['belch', 'pluck']}]});
battle.makeChoices('move Bugbite', 'move Pluck');
battle.makeChoices('move Belch', 'move Belch');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'belch');
assert.strictEqual(battle.p2.active[0].lastMove.id, 'belch');
assert.equal(battle.p1.active[0].lastMove.id, 'belch');
assert.equal(battle.p2.active[0].lastMove.id, 'belch');
});
it('should count berries as consumed when they are Flung', function () {
@@ -36,7 +36,7 @@ describe('Belch', function () {
battle.setPlayer('p2', {team: [{species: 'Machamp', ability: 'noguard', item: 'salacberry', moves: ['fling']}]});
battle.makeChoices('move Stockpile', 'move Fling');
battle.makeChoices('move Belch', 'move Fling');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'belch');
assert.equal(battle.p1.active[0].lastMove.id, 'belch');
});
it('should still count berries as consumed after switch out', function () {
@@ -52,6 +52,6 @@ describe('Belch', function () {
battle.makeChoices('switch 2', ''); // For U-Turn
battle.makeChoices('switch 2', 'move Will-o-Wisp');
battle.makeChoices('move Belch', 'move Will-o-Wisp');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'belch');
assert.equal(battle.p1.active[0].lastMove.id, 'belch');
});
});

View File

@@ -14,7 +14,7 @@ describe('Belly Drum', function () {
battle.setPlayer('p2', {team: [{species: "Terrakion", ability: 'justified', moves: ['bulkup']}]});
const user = battle.p1.active[0];
battle.makeChoices('move bellydrum', 'move bulkup');
assert.strictEqual(user.hp, Math.ceil(user.maxhp / 2));
assert.equal(user.hp, Math.ceil(user.maxhp / 2));
assert.statStage(user, 'atk', 6);
});
@@ -24,7 +24,7 @@ describe('Belly Drum', function () {
battle.setPlayer('p2', {team: [{species: "Terrakion", ability: 'justified', moves: ['closecombat']}]});
const user = battle.p1.active[0];
battle.makeChoices('move bellydrum', 'move closecombat');
assert.strictEqual(user.hp, 1);
assert.equal(user.hp, 1);
assert.statStage(user, 'atk', 0);
});
});
@@ -38,7 +38,7 @@ describe('Z-Belly Drum', function () {
battle.setPlayer('p2', {team: [{species: "Rattata", ability: 'guts', moves: ['quickattack']}]});
const user = battle.p1.active[0];
battle.makeChoices('move bellydrum zmove', 'move quickattack');
assert.strictEqual(user.hp, Math.ceil(user.maxhp / 2));
assert.equal(user.hp, Math.ceil(user.maxhp / 2));
assert.statStage(user, 'atk', 6);
});
@@ -48,7 +48,7 @@ describe('Z-Belly Drum', function () {
battle.setPlayer('p2', {team: [{species: "Terrakion", ability: 'justified', moves: ['closecombat']}]});
const user = battle.p1.active[0];
battle.makeChoices('move bellydrum zmove', 'move closecombat');
assert.strictEqual(user.hp, Math.ceil(user.maxhp / 2));
assert.equal(user.hp, Math.ceil(user.maxhp / 2));
assert.statStage(user, 'atk', 6);
});
});

View File

@@ -16,6 +16,6 @@ describe('Boomburst', function () {
battle.setPlayer('p2', {team: [{species: "Caterpie", level: 2, ability: 'naturalcure', item: 'focussash', moves: ['substitute', 'rest']}]});
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move boomburst', 'move rest');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
});

View File

@@ -16,7 +16,7 @@ describe('Bug Buzz', function () {
battle.setPlayer('p2', {team: [{species: "Caterpie", level: 2, ability: 'naturalcure', item: 'focussash', moves: ['substitute', 'rest']}]});
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move bugbuzz', 'move rest');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
});
@@ -32,6 +32,6 @@ describe('Bug Buzz [Gen 5]', function () {
]);
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move bugbuzz', 'move rest');
assert.strictEqual(battle.p2.active[0].item, 'focussash');
assert.equal(battle.p2.active[0].item, 'focussash');
});
});

View File

@@ -16,7 +16,7 @@ describe('Chatter', function () {
battle.setPlayer('p2', {team: [{species: "Caterpie", level: 2, ability: 'naturalcure', item: 'focussash', moves: ['substitute', 'rest']}]});
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move chatter', 'move rest');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
});
@@ -32,6 +32,6 @@ describe('Chatter [Gen 5]', function () {
]);
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move chatter', 'move rest');
assert.strictEqual(battle.p2.active[0].item, 'focussash');
assert.equal(battle.p2.active[0].item, 'focussash');
});
});

View File

@@ -17,8 +17,8 @@ describe('Clear Smog', function () {
battle.makeChoices('move clearsmog', 'move calmmind');
assert.strictEqual(battle.p2.pokemon[0].boosts['spa'], 0);
assert.strictEqual(battle.p2.pokemon[0].boosts['spd'], 0);
assert.equal(battle.p2.pokemon[0].boosts['spa'], 0);
assert.equal(battle.p2.pokemon[0].boosts['spd'], 0);
});
it('should not remove stat boosts from a target behind a substitute', function () {
@@ -29,8 +29,8 @@ describe('Clear Smog', function () {
battle.makeChoices('move toxic', 'move substitute');
battle.makeChoices('move clearsmog', 'move calmmind');
assert.strictEqual(battle.p2.pokemon[0].boosts['spa'], 1);
assert.strictEqual(battle.p2.pokemon[0].boosts['spd'], 1);
assert.equal(battle.p2.pokemon[0].boosts['spa'], 1);
assert.equal(battle.p2.pokemon[0].boosts['spd'], 1);
});
it('should not remove stat boosts if the target is immune to its attack type', function () {
@@ -40,7 +40,7 @@ describe('Clear Smog', function () {
battle.makeChoices('move clearsmog', 'move irondefense');
assert.strictEqual(battle.p2.pokemon[0].boosts['def'], 2);
assert.equal(battle.p2.pokemon[0].boosts['def'], 2);
});
it('should not remove stat boosts from the user', function () {
@@ -50,7 +50,7 @@ describe('Clear Smog', function () {
battle.makeChoices('move clearsmog', 'move morningsun');
assert.strictEqual(battle.p1.pokemon[0].boosts['atk'], -1);
assert.equal(battle.p1.pokemon[0].boosts['atk'], -1);
});
it('should trigger before Anger Point activates during critical hits', function () {
@@ -59,11 +59,11 @@ describe('Clear Smog', function () {
battle.setPlayer('p2', {team: [{species: "Primeape", ability: 'angerpoint', moves: ['bulkup']}]});
battle.makeChoices('move focusenergy', 'move bulkup');
assert.strictEqual(battle.p2.pokemon[0].boosts['atk'], 1);
assert.strictEqual(battle.p2.pokemon[0].boosts['def'], 1);
assert.equal(battle.p2.pokemon[0].boosts['atk'], 1);
assert.equal(battle.p2.pokemon[0].boosts['def'], 1);
battle.makeChoices('move clearsmog', 'move bulkup');
assert.strictEqual(battle.p2.pokemon[0].boosts['atk'], 6);
assert.strictEqual(battle.p2.pokemon[0].boosts['def'], 0);
assert.equal(battle.p2.pokemon[0].boosts['atk'], 6);
assert.equal(battle.p2.pokemon[0].boosts['def'], 0);
});
});

View File

@@ -29,7 +29,7 @@ describe('Counter', function () {
});
battle.makeChoices();
assert.strictEqual(battle.p1.active[0].maxhp - battle.p1.active[0].hp, 2 * lastDamage);
assert.equal(battle.p1.active[0].maxhp - battle.p1.active[0].hp, 2 * lastDamage);
});
it('should fail if user is not damaged by Physical attacks this turn', function () {
@@ -97,7 +97,7 @@ describe('Mirror Coat', function () {
});
battle.makeChoices();
assert.strictEqual(battle.p1.active[0].maxhp - battle.p1.active[0].hp, 2 * lastDamage);
assert.equal(battle.p1.active[0].maxhp - battle.p1.active[0].hp, 2 * lastDamage);
});
it('should fail if user is not damaged by Special attacks this turn', function () {

View File

@@ -14,7 +14,7 @@ describe('Curse', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Gengar", ability: 'levitate', item: '', moves: ['curse']}]});
battle.setPlayer('p2', {team: [{species: "Caterpie", ability: 'shedskin', item: '', moves: ['stringshot']}]});
assert.strictEqual(battle.p1.active[0].getRequestData().moves[0].target, 'normal');
assert.equal(battle.p1.active[0].getRequestData().moves[0].target, 'normal');
});
it('should request the Ghost target after the user becomes Ghost', function () {
@@ -22,9 +22,9 @@ describe('Curse', function () {
battle.setPlayer('p1', {team: [{species: "Rapidash", ability: 'levitate', item: '', moves: ['curse']}]});
battle.setPlayer('p2', {team: [{species: "Trevenant", ability: 'shedskin', item: 'laggingtail', moves: ['trickortreat']}]});
assert.strictEqual(battle.p1.active[0].getRequestData().moves[0].target, 'self');
assert.equal(battle.p1.active[0].getRequestData().moves[0].target, 'self');
battle.makeChoices('auto', 'auto');
assert.strictEqual(battle.p1.active[0].getRequestData().moves[0].target, 'normal');
assert.equal(battle.p1.active[0].getRequestData().moves[0].target, 'normal');
});
it('should not request a target after the user stops being Ghost', function () {
@@ -32,16 +32,16 @@ describe('Curse', function () {
battle.setPlayer('p1', {team: [{species: "Gengar", ability: 'levitate', item: '', moves: ['curse']}]});
battle.setPlayer('p2', {team: [{species: "Jellicent", ability: 'waterabsorb', item: '', moves: ['soak']}]});
assert.strictEqual(battle.p1.active[0].getRequestData().moves[0].target, 'normal');
assert.equal(battle.p1.active[0].getRequestData().moves[0].target, 'normal');
battle.makeChoices('auto', 'auto');
assert.strictEqual(battle.p1.active[0].getRequestData().moves[0].target, 'self');
assert.equal(battle.p1.active[0].getRequestData().moves[0].target, 'self');
});
it('should not request a target if the user is a known non-Ghost', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Blastoise", ability: 'torrent', item: '', moves: ['curse']}]});
battle.setPlayer('p2', {team: [{species: "Caterpie", ability: 'shedskin', item: '', moves: ['stringshot']}]});
assert.strictEqual(battle.p1.active[0].getRequestData().moves[0].target, 'self');
assert.equal(battle.p1.active[0].getRequestData().moves[0].target, 'self');
});
it('should not request a target if the user is an unknown non-Ghost', function () {
@@ -54,7 +54,7 @@ describe('Curse', function () {
battle.makeChoices('move reflecttype', 'auto'); // Reflect Type!
assert.deepEqual(battle.p1.active[0].getTypes(), ["Dark"]); // Copied Zoroark's type instead of Gengar's
assert.strictEqual(battle.p1.active[0].getRequestData().moves[0].target, 'self');
assert.equal(battle.p1.active[0].getRequestData().moves[0].target, 'self');
});
it('should curse a non-Ghost user with Protean', function () {
@@ -65,11 +65,11 @@ describe('Curse', function () {
battle.makeChoices('auto', 'auto');
let hps = [battle.p1.active[0].hp, battle.p2.active[0].hp];
assert.notStrictEqual(hps[0], battle.p1.active[0].maxhp); // Curse user cut its HP down + residual damage
assert.strictEqual(hps[1], battle.p2.active[0].maxhp); // Foe unaffected
assert.equal(hps[1], battle.p2.active[0].maxhp); // Foe unaffected
battle.makeChoices('move spite', 'auto');
assert.notStrictEqual(hps[0], battle.p1.active[0].hp); // Curse user is hurt by residual damage
assert.strictEqual(hps[1], battle.p2.active[0].hp); // Foe unaffected
assert.equal(hps[1], battle.p2.active[0].hp); // Foe unaffected
});
it('should curse the target if a Ghost user has Protean', function () {
@@ -84,7 +84,7 @@ describe('Curse', function () {
battle.makeChoices('move spite', 'auto');
// Check residual damage
assert.strictEqual(hps[0], battle.p1.active[0].hp); // Curse user unaffected
assert.equal(hps[0], battle.p1.active[0].hp); // Curse user unaffected
assert.notStrictEqual(hps[1], battle.p2.active[0].hp); // Curse residual damage
});
});
@@ -129,7 +129,7 @@ describe('XY/ORAS Curse targetting when becoming Ghost the same turn', function
assert.notStrictEqual(curseUser.hp, curseUser.maxhp); // Curse user cut its HP down
if (curseUser.position === 0) {
// Expected behavior
assert.strictEqual(cursePartner.hp, cursePartner.maxhp); // Partner unaffected by Curse
assert.equal(cursePartner.hp, cursePartner.maxhp); // Partner unaffected by Curse
assert.ok(foeHP[0] !== p2active[0].maxhp || foeHP[1] !== p2active[1].maxhp); // Foe afflicted by Curse
} else {
// Cartridge glitch
@@ -158,7 +158,7 @@ describe('XY/ORAS Curse targetting when becoming Ghost the same turn', function
if (allyPokemon === curseUser) {
assert.notStrictEqual(allyPokemon.hp, allyPokemon.maxhp); // Curse user cut its HP down
} else {
assert.strictEqual(allyPokemon.hp, allyPokemon.maxhp); // Partners unaffected by Curse
assert.equal(allyPokemon.hp, allyPokemon.maxhp); // Partners unaffected by Curse
}
let foePokemon = p2active[i];

View File

@@ -16,7 +16,7 @@ describe('Echoed Voice', function () {
battle.setPlayer('p2', {team: [{species: "Caterpie", level: 2, ability: 'naturalcure', item: 'focussash', moves: ['substitute', 'rest']}]});
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move echoedvoice', 'move rest');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
});
@@ -32,6 +32,6 @@ describe('Echoed Voice [Gen 5]', function () {
]);
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move echoedvoice', 'move rest');
assert.strictEqual(battle.p2.active[0].item, 'focussash');
assert.equal(battle.p2.active[0].item, 'focussash');
});
});

View File

@@ -34,9 +34,9 @@ describe('Electric Terrain', function () {
let basePower;
let move = Dex.getMove('thunderbolt');
basePower = battle.runEvent('BasePower', battle.p1.active[0], battle.p2.active[0], move, move.basePower, true);
assert.strictEqual(basePower, battle.modify(move.basePower, 1.5));
assert.equal(basePower, battle.modify(move.basePower, 1.5));
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should prevent moves from putting grounded Pokemon to sleep', function () {
@@ -45,8 +45,8 @@ describe('Electric Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Abra", ability: 'magicguard', moves: ['telekinesis', 'spore']}]});
battle.makeChoices('move electricterrain', 'move telekinesis');
battle.makeChoices('move spore', 'move spore');
assert.strictEqual(battle.p1.active[0].status, 'slp');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p1.active[0].status, 'slp');
assert.equal(battle.p2.active[0].status, '');
});
it('should not remove active non-volatile statuses from grounded Pokemon', function () {
@@ -54,7 +54,7 @@ describe('Electric Terrain', function () {
battle.setPlayer('p1', {team: [{species: "Jolteon", ability: 'voltabsorb', moves: ['sleeptalk', 'electricterrain']}]});
battle.setPlayer('p2', {team: [{species: "Whimsicott", ability: 'prankster', moves: ['spore']}]});
battle.makeChoices('move sleeptalk', 'move spore');
assert.strictEqual(battle.p1.active[0].status, 'slp');
assert.equal(battle.p1.active[0].status, 'slp');
});
it('should prevent Yawn from putting grounded Pokemon to sleep, and cause Yawn to fail', function () {
@@ -63,7 +63,7 @@ describe('Electric Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Sableye", ability: 'prankster', moves: ['yawn']}]});
battle.makeChoices('move electricterrain', 'move yawn');
battle.makeChoices('move yawn', 'move yawn');
assert.strictEqual(battle.p1.active[0].status, '');
assert.equal(battle.p1.active[0].status, '');
assert.ok(!battle.p2.active[0].volatiles['yawn']);
});
@@ -74,7 +74,7 @@ describe('Electric Terrain', function () {
battle.makeChoices('move electricterrain', 'move doubleedge');
battle.makeChoices('move rest', 'move rest');
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should not affect Pokemon in a semi-invulnerable state', function () {
@@ -83,8 +83,8 @@ describe('Electric Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Sableye", ability: 'prankster', moves: ['yawn', 'electricterrain']}]});
battle.makeChoices('move yawn', 'move yawn');
battle.makeChoices('move skydrop', 'move electricterrain');
assert.strictEqual(battle.p1.active[0].status, 'slp');
assert.strictEqual(battle.p2.active[0].status, 'slp');
assert.equal(battle.p1.active[0].status, 'slp');
assert.equal(battle.p2.active[0].status, 'slp');
});
it('should cause Nature Power to become Thunderbolt', function () {
@@ -93,6 +93,6 @@ describe('Electric Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Shuckle", ability: 'sturdy', moves: ['naturepower']}]});
battle.makeChoices('move electricterrain', 'move naturepower');
let resultMove = toID(battle.log[battle.lastMoveLine].split('|')[3]);
assert.strictEqual(resultMove, 'thunderbolt');
assert.equal(resultMove, 'thunderbolt');
});
});

View File

@@ -15,7 +15,7 @@ describe('Embargo', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'limber', item: 'leftovers', moves: ['bellydrum']}]});
battle.setPlayer('p2', {team: [{species: "Giratina", ability: 'pressure', moves: ['embargo']}]});
battle.makeChoices('move bellydrum', 'move embargo');
assert.strictEqual(battle.p1.active[0].hp, Math.ceil(battle.p1.active[0].maxhp / 2));
assert.equal(battle.p1.active[0].hp, Math.ceil(battle.p1.active[0].maxhp / 2));
});
it('should prevent items from being consumed', function () {
@@ -24,7 +24,7 @@ describe('Embargo', function () {
battle.setPlayer('p2', {team: [{species: "Golem", ability: 'noguard', moves: ['embargo', 'lowkick']}]});
battle.makeChoices('move bulkup', 'move embargo');
battle.makeChoices('move bulkup', 'move lowkick');
assert.strictEqual(battle.p1.active[0].item, 'chopleberry');
assert.equal(battle.p1.active[0].item, 'chopleberry');
});
it('should ignore the effects of items that disable moves', function () {
@@ -32,9 +32,9 @@ describe('Embargo', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'limber', item: 'assaultvest', moves: ['protect']}]});
battle.setPlayer('p2', {team: [{species: "Golem", ability: 'noguard', moves: ['embargo']}]});
battle.makeChoices('default', 'move embargo');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'struggle');
assert.equal(battle.p1.active[0].lastMove.id, 'struggle');
battle.makeChoices('default', 'move embargo');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'protect');
assert.equal(battle.p1.active[0].lastMove.id, 'protect');
});
it('should cause Fling to fail', function () {
@@ -42,7 +42,7 @@ describe('Embargo', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'limber', item: 'seaincense', moves: ['fling']}]});
battle.setPlayer('p2', {team: [{species: "Sableye", ability: 'prankster', moves: ['embargo']}]});
battle.makeChoices('move fling', 'move embargo');
assert.strictEqual(battle.p1.active[0].item, 'seaincense');
assert.equal(battle.p1.active[0].item, 'seaincense');
});
it('should not prevent Pokemon from Mega Evolving', function () {
@@ -51,6 +51,6 @@ describe('Embargo', function () {
battle.setPlayer('p2', {team: [{species: "Golem", ability: 'noguard', moves: ['embargo', 'rest']}]});
battle.makeChoices('move bulkup', 'move embargo');
battle.makeChoices('move bulkup mega', 'move rest');
assert.strictEqual(battle.p1.active[0].template.speciesid, 'lopunnymega');
assert.equal(battle.p1.active[0].template.speciesid, 'lopunnymega');
});
});

View File

@@ -30,11 +30,11 @@ describe('Encore', function () {
// If a user's previous move was Focus Punch and it is Encored into Focus Punch while attempting to
// execute the move, the regular "you can't be hit" effect for Focus Punch will be enforced.
battle.makeChoices('move focuspunch 1, move teleport', 'move encore 1, move extremespeed 1');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
// During subsequent turns the normal Focus Punch behavior applies.
battle.makeChoices('move focuspunch 1, move teleport', 'move splash, move extremespeed 1');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
});
it('should make Focus Punch always succeed if it changes the user\'s decision', function () {
@@ -62,7 +62,7 @@ describe('Encore', function () {
// During subsequent turns the normal Focus Punch behavior applies.
battle.makeChoices('move focuspunch 1, move teleport', 'move splash, move extremespeed 1');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
});
it('should not affect Shell Trap if the user\'s decision is not changed', function () {
@@ -114,7 +114,7 @@ describe('Encore', function () {
// attack, and will always say "<Pokemon>'s shell trap didn't work. It doesn't matter in the case of Shell Trap if
// the user was hit before or after the Encore; Shell Trap will still always fail.
battle.makeChoices('move splash, move teleport', 'move encore 1, move quickattack 1');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
// During subsequent turns the normal Shell Trap behavior applies.
battle.makeChoices('move shelltrap, move teleport', 'move splash, move quickattack 1');

View File

@@ -15,7 +15,7 @@ describe('Fake Out', function () {
battle.setPlayer('p1', {team: [{species: 'Chansey', ability: 'naturalcure', moves: ['fakeout']}]});
battle.setPlayer('p2', {team: [{species: 'Venusaur', ability: 'overgrow', moves: ['swift']}]});
battle.makeChoices('move fakeout', 'move swift');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should not flinch on the second turn out', function () {
@@ -23,7 +23,7 @@ describe('Fake Out', function () {
battle.setPlayer('p1', {team: [{species: 'Chansey', ability: 'naturalcure', moves: ['fakeout']}]});
battle.setPlayer('p2', {team: [{species: 'Venusaur', ability: 'overgrow', moves: ['swift']}]});
battle.makeChoices('move fakeout', 'move swift');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
battle.makeChoices('move fakeout', 'move swift');
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
@@ -39,7 +39,7 @@ describe('Fake Out', function () {
battle.makeChoices('switch 2', 'move sleeptalk');
battle.makeChoices('switch 2', 'move sleeptalk');
battle.makeChoices('move fakeout', 'move swift');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should not flinch if the user has already used a Dancer move first', function () {

View File

@@ -15,7 +15,7 @@ describe('Focus Punch', function () {
battle.setPlayer('p1', {team: [{species: 'Chansey', ability: 'naturalcure', moves: ['focuspunch']}]});
battle.setPlayer('p2', {team: [{species: 'Venusaur', ability: 'overgrow', moves: ['magicalleaf']}]});
battle.makeChoices('move focuspunch', 'move magicalleaf');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should not cause the user to lose focus if hit by a status move', function () {
@@ -40,7 +40,7 @@ describe('Focus Punch', function () {
battle.setPlayer('p1', {team: [{species: 'Chansey', ability: 'naturalcure', moves: ['focuspunch']}]});
battle.setPlayer('p2', {team: [{species: 'Venusaur', ability: 'overgrow', moves: ['naturepower']}]});
battle.makeChoices('move focuspunch', 'move naturepower');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should not cause the user to lose focus on later uses of Focus Punch if hit', function () {
@@ -48,7 +48,7 @@ describe('Focus Punch', function () {
battle.setPlayer('p1', {team: [{species: 'Chansey', ability: 'naturalcure', moves: ['focuspunch']}]});
battle.setPlayer('p2', {team: [{species: 'Venusaur', ability: 'overgrow', moves: ['magicalleaf', 'toxic']}]});
battle.makeChoices('move focuspunch', 'move magicalleaf');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
battle.makeChoices('move focuspunch', 'move toxic');
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
@@ -59,8 +59,8 @@ describe('Focus Punch', function () {
[{species: 'Venusaur', ability: 'overgrow', moves: ['magicalleaf']}, {species: 'Ivysaur', ability: 'overgrow', moves: ['toxic']}],
]);
battle.makeChoices('move focuspunch 1, move softboiled', 'move magicalleaf 1, move toxic 1');
assert.strictEqual(battle.p1.active[0].status, 'tox');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p1.active[0].status, 'tox');
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should not deduct PP if the user lost focus', function () {
@@ -70,9 +70,9 @@ describe('Focus Punch', function () {
const move = battle.p1.active[0].getMoveData(Dex.getMove('focuspunch'));
battle.makeChoices('move focuspunch', 'move magicalleaf');
assert.strictEqual(move.pp, move.maxpp);
assert.equal(move.pp, move.maxpp);
battle.makeChoices('move focuspunch', 'move toxic');
assert.strictEqual(move.pp, move.maxpp - 1);
assert.equal(move.pp, move.maxpp - 1);
});
it('should deduct PP if the user lost focus before Gen 5', function () {
@@ -82,9 +82,9 @@ describe('Focus Punch', function () {
const move = battle.p1.active[0].getMoveData(Dex.getMove('focuspunch'));
battle.makeChoices('move focuspunch', 'move magicalleaf');
assert.strictEqual(move.pp, move.maxpp - 1);
assert.equal(move.pp, move.maxpp - 1);
battle.makeChoices('move focuspunch', 'move toxic');
assert.strictEqual(move.pp, move.maxpp - 2);
assert.equal(move.pp, move.maxpp - 2);
});
it('should not tighten the pokemon\'s focus when Dynamaxing', function () {
@@ -95,7 +95,7 @@ describe('Focus Punch', function () {
battle.makeChoices('move focuspunch dynamax', 'move magicalleaf');
const tighteningFocusMessage = battle.log.filter(str => str === '|-singleturn|p1a: Chansey|move: Focus Punch');
assert.strictEqual(tighteningFocusMessage.length, 0);
assert.equal(tighteningFocusMessage.length, 0);
});
it('should not tighten the pokemon\'s focus when already Dynamaxed', function () {
@@ -106,7 +106,7 @@ describe('Focus Punch', function () {
battle.makeChoices('move focuspunch dynamax', 'move magicalleaf');
battle.makeChoices('move focuspunch', 'move magicalleaf');
const tighteningFocusMessage = battle.log.filter(str => str === '|-singleturn|p1a: Chansey|move: Focus Punch');
assert.strictEqual(tighteningFocusMessage.length, 0);
assert.equal(tighteningFocusMessage.length, 0);
});
it('should tighten the pokemon\'s focus when not Dynamaxed', function () {
@@ -116,6 +116,6 @@ describe('Focus Punch', function () {
battle.makeChoices('move focuspunch', 'move magicalleaf');
const tighteningFocusMessage = battle.log.filter(str => str === '|-singleturn|p1a: Chansey|move: Focus Punch');
assert.strictEqual(tighteningFocusMessage.length, 1);
assert.equal(tighteningFocusMessage.length, 1);
});
});

View File

@@ -31,7 +31,7 @@ describe('Follow Me', function () {
}
});
battle.makeChoices('move followme, move calmmind, move calmmind', 'move lowkick 2, move lowkick 2, move lowkick 2');
assert.strictEqual(hitCount, 2);
assert.equal(hitCount, 2);
});
it('should not redirect self-targetting moves', function () {
@@ -45,8 +45,8 @@ describe('Follow Me', function () {
{species: 'Kadabra', ability: 'synchronize', moves: ['honeclaws']},
]});
battle.makeChoices('move followme, move softboiled', 'move honeclaws, move honeclaws');
assert.strictEqual(battle.p1.active[0].boosts['atk'], 0);
assert.strictEqual(battle.p2.active[0].boosts['atk'], 1);
assert.strictEqual(battle.p2.active[1].boosts['atk'], 1);
assert.equal(battle.p1.active[0].boosts['atk'], 0);
assert.equal(battle.p2.active[0].boosts['atk'], 1);
assert.equal(battle.p2.active[1].boosts['atk'], 1);
});
});

View File

@@ -15,11 +15,11 @@ describe('Future Sight', function () {
battle.setPlayer('p1', {team: [{species: "Sneasel", ability: 'innerfocus', moves: ['odorsleuth', 'futuresight', 'protect']}]});
battle.setPlayer('p2', {team: [{species: "Girafarig", ability: 'innerfocus', moves: ['odorsleuth', 'futuresight', 'protect']}]});
battle.makeChoices('move Future Sight', 'move Future Sight');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
battle.makeChoices('auto', 'auto');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
battle.makeChoices('auto', 'move Protect');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
@@ -38,9 +38,9 @@ describe('Future Sight', function () {
battle.setPlayer('p2', {team: [{species: "Girafarig", moves: ['odorsleuth', 'futuresight', 'protect', 'sweetscent']}]});
battle.makeChoices('move Sweet Scent', 'move Sweet Scent'); // counteract imperfect accuracy
battle.makeChoices('move Future Sight', 'move Future Sight');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
battle.makeChoices('auto', 'auto');
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
battle.makeChoices('auto', 'move Protect');
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);

View File

@@ -15,7 +15,7 @@ describe('Glare', function () {
battle.setPlayer('p1', {team: [{species: "Arbok", ability: 'noguard', moves: ['glare']}]});
battle.setPlayer('p2', {team: [{species: "Ekans", ability: 'sturdy', moves: ['bulkup']}]});
battle.makeChoices('move glare', 'move bulkup');
assert.strictEqual(battle.p2.active[0].status, 'par');
assert.equal(battle.p2.active[0].status, 'par');
});
it('should ignore natural type immunities', function () {
@@ -23,7 +23,7 @@ describe('Glare', function () {
battle.setPlayer('p1', {team: [{species: "Arbok", ability: 'noguard', moves: ['glare']}]});
battle.setPlayer('p2', {team: [{species: "Gengar", ability: 'blaze', moves: ['bulkup']}]});
battle.makeChoices('move glare', 'move bulkup');
assert.strictEqual(battle.p2.active[0].status, 'par');
assert.equal(battle.p2.active[0].status, 'par');
});
});
@@ -38,6 +38,6 @@ describe('Glare [Gen 3]', function () {
[{species: "Gengar", ability: 'blaze', moves: ['bulkup']}],
]);
battle.makeChoices('move glare', 'move bulkup');
assert.strictEqual(battle.p2.active[0].status, '');
assert.equal(battle.p2.active[0].status, '');
});
});

View File

@@ -31,10 +31,10 @@ describe('Grassy Terrain', function () {
battle.setPlayer('p1', {team: [{species: "Shaymin", ability: 'naturalcure', moves: ['grassyterrain']}]});
battle.setPlayer('p2', {team: [{species: "Shaymin-Sky", ability: 'serenegrace', moves: ['leechseed']}]});
battle.makeChoices('move grassyterrain', 'move leechseed');
assert.strictEqual(battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], Dex.getMove('earthquake'), 100, true), 50);
assert.strictEqual(battle.runEvent('BasePower', battle.p1.active[0], battle.p2.active[0], Dex.getMove('earthquake'), 100, true), 50);
assert.strictEqual(battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], Dex.getMove('bulldoze'), 60, true), 30);
assert.strictEqual(battle.runEvent('BasePower', battle.p1.active[0], battle.p2.active[0], Dex.getMove('bulldoze'), 60, true), 30);
assert.equal(battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], Dex.getMove('earthquake'), 100, true), 50);
assert.equal(battle.runEvent('BasePower', battle.p1.active[0], battle.p2.active[0], Dex.getMove('earthquake'), 100, true), 50);
assert.equal(battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], Dex.getMove('bulldoze'), 60, true), 30);
assert.equal(battle.runEvent('BasePower', battle.p1.active[0], battle.p2.active[0], Dex.getMove('bulldoze'), 60, true), 30);
});
it('should increase the base power of Grass-type attacks used by grounded Pokemon', function () {
@@ -45,9 +45,9 @@ describe('Grassy Terrain', function () {
let basePower;
let move = Dex.getMove('gigadrain');
basePower = battle.runEvent('BasePower', battle.p1.active[0], battle.p2.active[0], move, move.basePower, true);
assert.strictEqual(basePower, battle.modify(move.basePower, 1.5));
assert.equal(basePower, battle.modify(move.basePower, 1.5));
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should heal grounded Pokemon by 1/16 of their max HP', function () {
@@ -56,8 +56,8 @@ describe('Grassy Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Magneton", ability: 'magnetpull', moves: ['magnetrise', 'dragonrage']}]});
battle.makeChoices('move grassyterrain', 'move magnetrise');
battle.makeChoices('move dragonrage', 'move dragonrage');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp - 40 + Math.floor(battle.p1.active[0].maxhp / 16));
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp - 40);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp - 40 + Math.floor(battle.p1.active[0].maxhp / 16));
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp - 40);
});
it('should not affect Pokemon in a semi-invulnerable state', function () {
@@ -66,8 +66,8 @@ describe('Grassy Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Sableye", ability: 'prankster', moves: ['dragonrage', 'grassyterrain']}]});
battle.makeChoices('move dragonrage', 'move dragonrage');
battle.makeChoices('move skydrop', 'move grassyterrain');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp - 40);
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp - 40);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp - 40);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp - 40);
});
it('should cause Nature Power to become Energy Ball', function () {
@@ -76,6 +76,6 @@ describe('Grassy Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Shuckle", ability: 'sturdy', moves: ['naturepower']}]});
battle.makeChoices('move grassyterrain', 'move naturepower');
let resultMove = toID(battle.log[battle.lastMoveLine].split('|')[3]);
assert.strictEqual(resultMove, 'energyball');
assert.equal(resultMove, 'energyball');
});
});

View File

@@ -17,12 +17,12 @@ describe('Haze - RBY', function () {
]);
battle.makeChoices('move agility', 'move swordsdance');
assert.strictEqual(battle.p1.active[0].boosts.spe, 2);
assert.strictEqual(battle.p2.active[0].boosts.atk, 2);
assert.equal(battle.p1.active[0].boosts.spe, 2);
assert.equal(battle.p2.active[0].boosts.atk, 2);
battle.makeChoices('move haze', 'move splash');
assert.strictEqual(battle.p1.active[0].boosts.spe, 0);
assert.strictEqual(battle.p2.active[0].boosts.atk, 0);
assert.equal(battle.p1.active[0].boosts.spe, 0);
assert.equal(battle.p2.active[0].boosts.atk, 0);
});
it('should remove opponent\'s status', function () {
@@ -32,7 +32,7 @@ describe('Haze - RBY', function () {
]);
battle.makeChoices('move thunderwave', 'move splash');
assert.strictEqual(battle.p2.active[0].status, 'par');
assert.equal(battle.p2.active[0].status, 'par');
battle.makeChoices('move haze', 'move splash');
assert.notStrictEqual(battle.p2.active[0].status, 'par');
@@ -45,10 +45,10 @@ describe('Haze - RBY', function () {
]);
battle.makeChoices('move thunderwave', 'move haze');
assert.strictEqual(battle.p2.active[0].status, 'par');
assert.equal(battle.p2.active[0].status, 'par');
battle.makeChoices('move thunderwave', 'move haze');
assert.strictEqual(battle.p2.active[0].status, 'par');
assert.equal(battle.p2.active[0].status, 'par');
});
it('should remove focus energy', function () {
@@ -61,7 +61,7 @@ describe('Haze - RBY', function () {
assert.ok(battle.p2.active[0].volatiles['focusenergy']);
battle.makeChoices('move splash', 'move haze');
assert.strictEqual(typeof battle.p2.active[0].volatiles['focusenergy'], 'undefined');
assert.equal(typeof battle.p2.active[0].volatiles['focusenergy'], 'undefined');
});
it('should remove reflect and light screen', function () {
@@ -77,7 +77,7 @@ describe('Haze - RBY', function () {
assert.ok(battle.p1.active[0].volatiles['lightscreen']);
battle.makeChoices('move haze', 'move splash');
assert.strictEqual(typeof battle.p1.active[0].volatiles['reflect'], 'undefined');
assert.strictEqual(typeof battle.p1.active[0].volatiles['lightscreen'], 'undefined');
assert.equal(typeof battle.p1.active[0].volatiles['reflect'], 'undefined');
assert.equal(typeof battle.p1.active[0].volatiles['lightscreen'], 'undefined');
});
});

View File

@@ -23,8 +23,8 @@ describe('Heal Block', function () {
battle.setPlayer('p1', {team: [{species: 'Sableye', ability: 'prankster', moves: ['healblock']}]});
battle.setPlayer('p2', {team: [{species: 'Pansage', ability: 'gluttony', item: 'berryjuice', moves: ['bellydrum']}]});
battle.makeChoices('move healblock', 'move bellydrum');
assert.strictEqual(battle.p2.active[0].item, 'berryjuice');
assert.strictEqual(battle.p2.active[0].hp, Math.ceil(battle.p2.active[0].maxhp / 2));
assert.equal(battle.p2.active[0].item, 'berryjuice');
assert.equal(battle.p2.active[0].hp, Math.ceil(battle.p2.active[0].maxhp / 2));
});
it('should disable the use of healing moves', function () {
@@ -40,7 +40,7 @@ describe('Heal Block', function () {
battle.setPlayer('p1', {team: [{species: 'Sableye', ability: 'prankster', moves: ['healblock']}]});
battle.setPlayer('p2', {team: [{species: 'Venusaur', ability: 'overgrow', moves: ['gigadrain']}]});
battle.makeChoices('move healblock', 'move gigadrain');
assert.strictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should prevent abilities from recovering HP', function () {
@@ -50,7 +50,7 @@ describe('Heal Block', function () {
battle.makeChoices('move healblock', 'move bellydrum');
let hp = battle.p2.active[0].hp;
battle.makeChoices('move surf', 'move calmmind');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
});
it('should prevent Leech Seed from healing HP', function () {
@@ -60,7 +60,7 @@ describe('Heal Block', function () {
battle.makeChoices('move healblock', 'move substitute');
let hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move leechseed');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
@@ -96,8 +96,8 @@ describe('Heal Block [Gen 5]', function () {
[{species: 'Pansage', ability: 'gluttony', item: 'sitrusberry', moves: ['bellydrum']}],
]);
battle.makeChoices('move healblock', 'move bellydrum');
assert.strictEqual(battle.p2.active[0].item, 'sitrusberry');
assert.strictEqual(battle.p2.active[0].hp, Math.ceil(battle.p2.active[0].maxhp / 2));
assert.equal(battle.p2.active[0].item, 'sitrusberry');
assert.equal(battle.p2.active[0].hp, Math.ceil(battle.p2.active[0].maxhp / 2));
});
it('should disable the use of healing moves', function () {
@@ -117,7 +117,7 @@ describe('Heal Block [Gen 5]', function () {
battle.makeChoices('move healblock', 'move bellydrum');
let hp = battle.p2.active[0].hp;
battle.makeChoices('move surf', 'move calmmind');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
});
it('should prevent draining moves from healing HP', function () {
@@ -128,7 +128,7 @@ describe('Heal Block [Gen 5]', function () {
battle.makeChoices('move healblock', 'move substitute');
let hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move gigadrain');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
@@ -139,7 +139,7 @@ describe('Heal Block [Gen 5]', function () {
]);
let hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move leechseed');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
});
@@ -175,7 +175,7 @@ describe('Heal Block [Gen 4]', function () {
battle.makeChoices('move healblock', 'move substitute');
let hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move gigadrain');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
@@ -189,7 +189,7 @@ describe('Heal Block [Gen 4]', function () {
assert.notStrictEqual(battle.p2.active[0].hp, 1);
battle.makeChoices('move healblock', 'switch 2');
battle.makeChoices('move shadowball', 'move endure');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
assert.notStrictEqual(battle.p2.active[0].hp, 1);
});
@@ -212,7 +212,7 @@ describe('Heal Block [Gen 4]', function () {
battle.makeChoices('move healblock', 'move substitute');
let hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move leechseed');
assert.strictEqual(battle.p2.active[0].hp, hp);
assert.equal(battle.p2.active[0].hp, hp);
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
});

View File

@@ -31,8 +31,8 @@ describe('Healing Wish', function () {
// sand happens after Jirachi faints and before any switch-in
battle.makeChoices('switch Caterpie', ''); // Caterpie heals before taking SR damage
assert.strictEqual(battle.p1.active[0].hp, 174);
assert.strictEqual(battle.p1.active[0].moveSlots[0].pp, 63);
assert.equal(battle.p1.active[0].hp, 174);
assert.equal(battle.p1.active[0].moveSlots[0].pp, 63);
});
it('should not be consumed if a switch-in is fully healed already', function () {
@@ -72,7 +72,7 @@ describe('Healing Wish', function () {
// Caterpie gets healed by Healing Wish triggered by Ally Switch
battle.makeChoices('move Ally Switch, move String Shot', 'move Sleep Talk, move Protect');
assert.strictEqual(battle.p1.active[0].hp, 231); // Caterpie start in slot 1 -> Ally Switch-ed to slot 0
assert.equal(battle.p1.active[0].hp, 231); // Caterpie start in slot 1 -> Ally Switch-ed to slot 0
assert.false(battle.p1.slotConditions[0]['healingwish']);
});
@@ -99,11 +99,11 @@ describe('Healing Wish', function () {
battle.makeChoices('move Healing Wish', 'move Seismic Toss');
battle.makeChoices('switch Caterpie', ''); // Caterpie faints from hazards
assert.strictEqual(battle.p1.active[0].hp, 0);
assert.equal(battle.p1.active[0].hp, 0);
battle.makeChoices('switch Raichu', ''); // Raichu fully heals and takes stoss + Sandstorm damage
assert.strictEqual(battle.turn, 6);
assert.strictEqual(battle.p1.active[0].hp, 145); // after stoss + Sandstorm
assert.strictEqual(battle.p1.active[0].moveSlots[0].pp, 63);
assert.equal(battle.turn, 6);
assert.equal(battle.p1.active[0].hp, 145); // after stoss + Sandstorm
assert.equal(battle.p1.active[0].moveSlots[0].pp, 63);
});
});

View File

@@ -16,7 +16,7 @@ describe('Hyper Voice', function () {
battle.setPlayer('p2', {team: [{species: "Caterpie", level: 2, ability: 'naturalcure', item: 'focussash', moves: ['substitute', 'rest']}]});
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move hypervoice', 'move rest');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
});
@@ -32,6 +32,6 @@ describe('Hyper Voice [Gen 5]', function () {
]);
battle.makeChoices('move splash', 'move substitute');
battle.makeChoices('move hypervoice', 'move rest');
assert.strictEqual(battle.p2.active[0].item, 'focussash');
assert.equal(battle.p2.active[0].item, 'focussash');
});
});

View File

@@ -20,21 +20,21 @@ describe('Ingrain', function () {
{species: 'Miltank', ability: 'thickfat', moves: ['seismictoss', 'protect']},
]});
battle.makeChoices('move ingrain', 'move seismictoss');
assert.strictEqual(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 100);
assert.equal(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 100);
// should be passed by Baton Pass
battle.makeChoices('move batonpass', 'move seismictoss');
battle.makeChoices('switch 2', '');
assert.strictEqual(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 100);
assert.equal(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 100);
// should not be passed by U-turn
battle.makeChoices('move uturn', 'move seismictoss');
battle.makeChoices('switch 2', '');
assert.strictEqual(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 100);
assert.equal(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 100);
// should be gone after switching out and back in
battle.makeChoices('switch 2', 'move protect');
assert.strictEqual(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 200);
assert.equal(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 200);
});
it('should prevent the user from being forced out or switching out', function () {
@@ -45,9 +45,9 @@ describe('Ingrain', function () {
]});
battle.setPlayer('p2', {team: [{species: 'Arcanine', ability: 'flashfire', moves: ['sleeptalk', 'roar']}]});
battle.makeChoices('move ingrain', 'move roar');
assert.strictEqual(battle.p1.active[0].speciesid, 'cradily');
assert.equal(battle.p1.active[0].speciesid, 'cradily');
assert.trapped(() => battle.makeChoices('switch pikachu', 'move sleeptalk'));
assert.strictEqual(battle.p1.active[0].speciesid, 'cradily');
assert.equal(battle.p1.active[0].speciesid, 'cradily');
});
it('should remove the users\' Ground immunities', function () {

View File

@@ -15,7 +15,7 @@ describe('Knock Off', function () {
battle.setPlayer('p1', {team: [{species: "Mew", ability: 'synchronize', moves: ['knockoff']}]});
battle.setPlayer('p2', {team: [{species: "Blissey", ability: 'naturalcure', item: 'shedshell', moves: ['softboiled']}]});
battle.makeChoices('move knockoff', 'move softboiled');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
it('should not remove items when hitting Sub', function () {
@@ -23,7 +23,7 @@ describe('Knock Off', function () {
battle.setPlayer('p1', {team: [{species: "Mew", ability: 'noability', moves: ['knockoff']}]});
battle.setPlayer('p2', {team: [{species: "Ninjask", ability: 'noability', item: 'shedshell', moves: ['substitute']}]});
battle.makeChoices();
assert.strictEqual(battle.p2.active[0].item, 'shedshell');
assert.equal(battle.p2.active[0].item, 'shedshell');
});
it('should not remove plates from Arceus', function () {
@@ -31,7 +31,7 @@ describe('Knock Off', function () {
battle.setPlayer('p1', {team: [{species: "Mew", ability: 'synchronize', moves: ['knockoff']}]});
battle.setPlayer('p2', {team: [{species: "Arceus", ability: 'download', item: 'flameplate', moves: ['swordsdance']}]});
battle.makeChoices('move knockoff', 'move swordsdance');
assert.strictEqual(battle.p2.active[0].item, 'flameplate');
assert.equal(battle.p2.active[0].item, 'flameplate');
});
it('should not remove drives from Genesect', function () {
@@ -39,7 +39,7 @@ describe('Knock Off', function () {
battle.setPlayer('p1', {team: [{species: "Mew", ability: 'synchronize', moves: ['knockoff']}]});
battle.setPlayer('p2', {team: [{species: "Genesect", ability: 'download', item: 'dousedrive', moves: ['shiftgear']}]});
battle.makeChoices('move knockoff', 'move shiftgear');
assert.strictEqual(battle.p2.active[0].item, 'dousedrive');
assert.equal(battle.p2.active[0].item, 'dousedrive');
});
it('should not remove correctly held mega stones', function () {
@@ -47,7 +47,7 @@ describe('Knock Off', function () {
battle.setPlayer('p1', {team: [{species: "Mew", ability: 'synchronize', moves: ['knockoff']}]});
battle.setPlayer('p2', {team: [{species: "Scizor", ability: 'technician', item: 'scizorite', moves: ['swordsdance']}]});
battle.makeChoices('move knockoff', 'move swordsdance');
assert.strictEqual(battle.p2.active[0].item, 'scizorite');
assert.equal(battle.p2.active[0].item, 'scizorite');
});
it('should remove wrong mega stones', function () {
@@ -55,7 +55,7 @@ describe('Knock Off', function () {
battle.setPlayer('p1', {team: [{species: "Mew", ability: 'synchronize', moves: ['knockoff']}]});
battle.setPlayer('p2', {team: [{species: "Scizor", ability: 'technician', item: 'audinite', moves: ['swordsdance']}]});
battle.makeChoices('move knockoff', 'move swordsdance');
assert.strictEqual(battle.p2.active[0].item, '');
assert.equal(battle.p2.active[0].item, '');
});
it('should not remove items if the user faints mid-move', function () {
@@ -63,6 +63,6 @@ describe('Knock Off', function () {
battle.setPlayer('p1', {team: [{species: "Shedinja", ability: 'wonderguard', moves: ['knockoff']}]});
battle.setPlayer('p2', {team: [{species: "Ferrothorn", ability: 'ironbarbs', item: 'rockyhelmet', moves: ['curse']}]});
battle.makeChoices('move knockoff', 'move curse');
assert.strictEqual(battle.p2.active[0].item, 'rockyhelmet');
assert.equal(battle.p2.active[0].item, 'rockyhelmet');
});
});

View File

@@ -15,7 +15,7 @@ describe('Magic Room', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'limber', item: 'leftovers', moves: ['bellydrum']}]});
battle.setPlayer('p2', {team: [{species: "Giratina", ability: 'pressure', moves: ['magicroom']}]});
battle.makeChoices('move bellydrum', 'move magicroom');
assert.strictEqual(battle.p1.active[0].hp, Math.ceil(battle.p1.active[0].maxhp / 2));
assert.equal(battle.p1.active[0].hp, Math.ceil(battle.p1.active[0].maxhp / 2));
});
it('should prevent items from being consumed', function () {
@@ -23,7 +23,7 @@ describe('Magic Room', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'limber', item: 'chopleberry', moves: ['magicroom']}]});
battle.setPlayer('p2', {team: [{species: "Golem", ability: 'noguard', moves: ['lowkick']}]});
battle.makeChoices('move magicroom', 'move lowkick');
assert.strictEqual(battle.p1.active[0].item, 'chopleberry');
assert.equal(battle.p1.active[0].item, 'chopleberry');
});
it('should ignore the effects of items that disable moves', function () {
@@ -31,9 +31,9 @@ describe('Magic Room', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'limber', item: 'assaultvest', moves: ['protect']}]});
battle.setPlayer('p2', {team: [{species: "Golem", ability: 'noguard', moves: ['magicroom']}]});
battle.makeChoices('default', 'move magicroom');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'struggle');
assert.equal(battle.p1.active[0].lastMove.id, 'struggle');
battle.makeChoices('default', 'move magicroom');
assert.strictEqual(battle.p1.active[0].lastMove.id, 'protect');
assert.equal(battle.p1.active[0].lastMove.id, 'protect');
});
it('should cause Fling to fail', function () {
@@ -41,7 +41,7 @@ describe('Magic Room', function () {
battle.setPlayer('p1', {team: [{species: "Lopunny", ability: 'limber', item: 'seaincense', moves: ['fling']}]});
battle.setPlayer('p2', {team: [{species: "Sableye", ability: 'prankster', moves: ['magicroom']}]});
battle.makeChoices('move fling', 'move magicroom');
assert.strictEqual(battle.p1.active[0].item, 'seaincense');
assert.equal(battle.p1.active[0].item, 'seaincense');
});
it('should not prevent Pokemon from Mega Evolving', function () {
@@ -50,7 +50,7 @@ describe('Magic Room', function () {
battle.setPlayer('p2', {team: [{species: "Golem", ability: 'noguard', moves: ['magicroom', 'rest']}]});
battle.makeChoices('move bulkup', 'move magicroom');
battle.makeChoices('move bulkup mega', 'move rest');
assert.strictEqual(battle.p1.active[0].template.speciesid, 'lopunnymega');
assert.equal(battle.p1.active[0].template.speciesid, 'lopunnymega');
});
it('should not prevent Primal Reversion', function () {
@@ -62,6 +62,6 @@ describe('Magic Room', function () {
battle.setPlayer('p2', {team: [{species: "Meowstic", ability: 'prankster', moves: ['magicroom']}]});
battle.makeChoices('move voltswitch', 'move magicroom');
battle.makeChoices('switch groudon', '');
assert.strictEqual(battle.p1.active[0].template.speciesid, 'groudonprimal');
assert.equal(battle.p1.active[0].template.speciesid, 'groudonprimal');
});
});

View File

@@ -34,9 +34,9 @@ describe('Misty Terrain', function () {
let basePower;
let move = Dex.getMove('dragonpulse');
basePower = battle.runEvent('BasePower', battle.p2.active[0], battle.p1.active[0], move, move.basePower, true);
assert.strictEqual(basePower, battle.modify(move.basePower, 0.5));
assert.equal(basePower, battle.modify(move.basePower, 0.5));
basePower = battle.runEvent('BasePower', battle.p1.active[0], battle.p2.active[0], move, move.basePower, true);
assert.strictEqual(basePower, move.basePower);
assert.equal(basePower, move.basePower);
});
it('should prevent moves from setting non-volatile status on grounded Pokemon', function () {
@@ -45,8 +45,8 @@ describe('Misty Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Machamp", ability: 'noguard', item: 'airballoon', moves: ['bulkup', 'toxic']}]});
battle.makeChoices('move mistyterrain', 'move bulkup');
battle.makeChoices('move toxic', 'move toxic');
assert.strictEqual(battle.p1.active[0].status, '');
assert.strictEqual(battle.p2.active[0].status, 'tox');
assert.equal(battle.p1.active[0].status, '');
assert.equal(battle.p2.active[0].status, 'tox');
});
it('should not remove active non-volatile statuses from grounded Pokemon', function () {
@@ -54,7 +54,7 @@ describe('Misty Terrain', function () {
battle.setPlayer('p1', {team: [{species: "Florges", ability: 'symbiosis', moves: ['mistyterrain']}]});
battle.setPlayer('p2', {team: [{species: "Crobat", ability: 'infiltrator', moves: ['toxic']}]});
battle.makeChoices('move mistyterrain', 'move toxic');
assert.strictEqual(battle.p1.active[0].status, 'tox');
assert.equal(battle.p1.active[0].status, 'tox');
});
it('should prevent Yawn from putting grounded Pokemon to sleep, but not cause Yawn to fail', function () {
@@ -63,9 +63,9 @@ describe('Misty Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Sableye", ability: 'prankster', moves: ['yawn']}]});
battle.makeChoices('move mistyterrain', 'move yawn');
battle.makeChoices('move yawn', 'move yawn');
assert.strictEqual(battle.p1.active[0].status, '');
assert.equal(battle.p1.active[0].status, '');
let dataLine = battle.log[battle.lastMoveLine + 1].split('|');
assert.strictEqual(dataLine[1], '-start');
assert.equal(dataLine[1], '-start');
assert.ok(toID(dataLine[3]).endsWith('yawn'));
});
@@ -76,7 +76,7 @@ describe('Misty Terrain', function () {
battle.makeChoices('move mistyterrain', 'move doubleedge');
battle.makeChoices('move rest', 'move rest');
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.strictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
assert.equal(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should not affect Pokemon in a semi-invulnerable state', function () {
@@ -85,8 +85,8 @@ describe('Misty Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Sableye", ability: 'prankster', moves: ['yawn', 'mistyterrain']}]});
battle.makeChoices('move yawn', 'move yawn');
battle.makeChoices('move skydrop', 'move mistyterrain');
assert.strictEqual(battle.p1.active[0].status, 'slp');
assert.strictEqual(battle.p2.active[0].status, 'slp');
assert.equal(battle.p1.active[0].status, 'slp');
assert.equal(battle.p2.active[0].status, 'slp');
});
it('should cause Nature Power to become Moonblast', function () {
@@ -95,6 +95,6 @@ describe('Misty Terrain', function () {
battle.setPlayer('p2', {team: [{species: "Shuckle", ability: 'sturdy', moves: ['naturepower']}]});
battle.makeChoices('move mistyterrain', 'move naturepower');
let resultMove = toID(battle.log[battle.lastMoveLine].split('|')[3]);
assert.strictEqual(resultMove, 'moonblast');
assert.equal(resultMove, 'moonblast');
});
});

View File

@@ -15,7 +15,7 @@ describe('Pain Split', function () {
battle.setPlayer('p1', {team: [{species: 'Shedinja', ability: 'wonderguard', moves: ['painsplit']}]});
battle.setPlayer('p2', {team: [{species: 'Arceus', ability: 'multitype', moves: ['judgment']}]});
battle.makeChoices('move painsplit', 'move judgment');
assert.strictEqual(battle.p2.active[0].hp, (battle.p2.active[0].maxhp + 1) / 2);
assert.equal(battle.p2.active[0].hp, (battle.p2.active[0].maxhp + 1) / 2);
});
it('should calculate HP changes against a dynamaxed target properly', function () {
@@ -29,7 +29,7 @@ describe('Pain Split', function () {
battle.p1.active[0].sethp(160); // non-dynamaxed
battle.p2.active[0].sethp(174); // dynamaxed
battle.makeChoices('move painsplit', 'move doubleedge');
assert.strictEqual(battle.p1.active[0].hp, 123, 'non-dynamaxed');
assert.strictEqual(battle.p2.active[0].hp, 210, 'dynamaxed');
assert.equal(battle.p1.active[0].hp, 123, 'non-dynamaxed');
assert.equal(battle.p2.active[0].hp, 210, 'dynamaxed');
});
});

View File

@@ -22,23 +22,23 @@ describe(`Parting Shot`, function () {
const p1 = battle.p1;
const p2 = battle.p2;
battle.makeChoices('move partingshot', 'move splash');
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
battle.makeChoices('move partingshot', 'switch 2'); // Solgaleo
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
battle.makeChoices('move partingshot', 'switch 3'); // Torkoal
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
battle.makeChoices('move partingshot', 'switch 4'); // Shaymin
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
battle.makeChoices('move splash', 'switch 5'); // Kingler
p2.active[0].boostBy({spa: -6});
battle.makeChoices('move partingshot', 'move splash');
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
battle.makeChoices('move splash', 'switch 6'); // Spinda
p2.active[0].boostBy({atk: 6, spa: 6});
battle.makeChoices('move partingshot', 'move splash');
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
p1.active[0].boostBy({atk: -6, spa: -6});
battle.makeChoices('move splash', 'move partingshot'); // Parting Shot against Silvally this time
assert.strictEqual(battle.requestState, 'move');
assert.equal(battle.requestState, 'move');
});
});

View File

@@ -54,7 +54,7 @@ describe(`Pursuit`, function () {
let clefable = battle.p2.pokemon[0];
let hpBeforeSwitch = clefable.hp;
battle.makeChoices('switch 2', 'switch 2');
assert.strictEqual(hpBeforeSwitch, clefable.hp);
assert.equal(hpBeforeSwitch, clefable.hp);
});
it(`should not double in power or activate before a switch if targeting an ally`, function () {

View File

@@ -23,7 +23,7 @@ describe('Quash', function () {
]});
battle.makeChoices('move quash 2, move earthquake', 'move voltswitch 2, move swift');
battle.makeChoices('', 'switch 3, pass'); // Volt Switch
assert.strictEqual(battle.log[battle.lastMoveLine].split('|')[3], 'Swift');
assert.equal(battle.log[battle.lastMoveLine].split('|')[3], 'Swift');
});
it('should not cause the target to move again if it has already moved', function () {

View File

@@ -39,9 +39,9 @@ describe('Rage Powder', function () {
return Sim.Pokemon.prototype.damage.apply(this, args);
};
battle.makeChoices('move ragepowder, move growth, move growth', 'move absorb 2, move absorb 2, move absorb 2');
assert.strictEqual(hitCount[0], 2);
assert.strictEqual(hitCount[1], 1);
assert.strictEqual(hitCount[2], 0);
assert.equal(hitCount[0], 2);
assert.equal(hitCount[1], 1);
assert.equal(hitCount[2], 0);
});
it('should not affect Pokemon with Powder immunities', function () {
@@ -70,8 +70,8 @@ describe('Rage Powder', function () {
return Sim.Pokemon.prototype.damage.apply(this, args);
};
battle.makeChoices('move growth, move ragepowder, move growth', 'move absorb 3, move absorb 1, move absorb 1');
assert.strictEqual(hitCount[0], 2);
assert.strictEqual(hitCount[1], 1);
assert.strictEqual(hitCount[2], 0);
assert.equal(hitCount[0], 2);
assert.equal(hitCount[1], 1);
assert.equal(hitCount[2], 0);
});
});

Some files were not shown because too many files have changed in this diff Show More