Spaces:
Running
Running
File size: 9,352 Bytes
5c2ed06 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Encore', () => {
afterEach(() => {
battle.destroy();
});
it(`should cause the target to be forced to repeat its move`, () => {
battle = common.createBattle([[
{ species: 'slowbro', moves: ['tackle', 'irondefense'] },
], [
{ species: 'whimsicott', moves: ['encore', 'sleeptalk'] },
]]);
const whims = battle.p2.active[0];
battle.makeChoices('move irondefense', 'move sleeptalk');
battle.makeChoices('move tackle', 'move encore');
assert.fullHP(whims);
assert.cantMove(() => battle.choose('p1', 'move tackle'));
});
it(`should cause the target to move with its Encored attack at the priority of the originally selected move once`, () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: 'regieleki', moves: ['sleeptalk', 'substitute'] },
{ species: 'pichu', moves: ['sleeptalk'] },
], [
{ species: 'whimsicott', ability: 'prankster', moves: ['sleeptalk', 'encore'] },
{ species: 'terrakion', moves: ['quickattack', 'headlongrush'] },
]]);
const eleki = battle.p1.active[0];
battle.makeChoices('auto', 'move sleeptalk, move headlongrush 2');
battle.makeChoices('move substitute', 'move encore -2, move quickattack 1');
assert.fainted(eleki, `Encore + Quick Attack being selected gives Headlong Rush priority.`);
});
it(`should cause the target to move with its Encored attack at the priority of the originally selected move once and get blocked when appropriate`, () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: 'regieleki', moves: ['psychicterrain'] },
{ species: 'pichu', moves: ['sleeptalk'] },
], [
{ species: 'whimsicott', ability: 'prankster', moves: ['sleeptalk', 'encore'] },
{ species: 'terrakion', moves: ['quickattack', 'headlongrush'] },
]]);
const eleki = battle.p1.active[0];
battle.makeChoices('auto', 'move sleeptalk, move headlongrush 2');
battle.makeChoices('auto', 'move encore -2, move quickattack 1');
assert.false.fainted(eleki, `Psychic Terrain should have prevented the priority Headlong Rush from doing damage.`);
battle.makeChoices();
assert.fainted(eleki, `Headlong Rush should no longer be moving with priority.`);
});
it('should not affect Focus Punch if the the user\'s decision is not changed', () => {
battle = common.createBattle({ gameType: 'doubles' }, [
[
{ species: "Smeargle", level: 50, ability: 'owntempo', moves: ['splash', 'focuspunch'] },
{ species: "Abra", level: 1, ability: 'innerfocus', moves: ['knockoff', 'teleport'] },
],
[
{ species: "Smeargle", ability: 'owntempo', item: 'laggingtail', moves: ['encore', 'splash'] },
{ species: "Zigzagoon", level: 1, ability: 'pickup', moves: ['extremespeed'] },
],
]);
// If the Focus Punch user is not interrupted the attack is expected to be successful.
battle.makeChoices('move focuspunch 1, move knockoff 1', 'move splash, move extremespeed 2');
const hp = battle.p2.active[0].hp;
assert.notEqual(hp, battle.p2.active[0].maxhp);
// 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.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.equal(battle.p2.active[0].hp, hp);
});
it(`should make Focus Punch always succeed if it changes the user's decision`, () => {
// Hardcoded RNG seed so the random target from Encored Focus Punch will not attack Zigzagoon
battle = common.createBattle({ gameType: 'doubles', seed: [1, 2, 3, 4] }, [[
{ species: 'Smeargle', level: 50, moves: ['splash', 'focuspunch'] },
{ species: 'Abra', level: 1, moves: ['knockoff', 'teleport'] },
], [
{ species: 'Smeargle', item: 'laggingtail', moves: ['encore', 'splash'] },
{ species: 'Zigzagoon', level: 1, moves: ['extremespeed'] },
]]);
battle.makeChoices('move focuspunch 1, move knockoff 1', 'move splash, move extremespeed 2');
const p2smeargle = battle.p2.active[0];
let hp = p2smeargle.hp;
assert.false.fullHP(p2smeargle);
// The Pokemon Encored into Focus Punch is not subject to the negative effects of Focus Punch; that is,
// if it is hit at any time before or after the Encore, it still uses Focus Punch like normal. It doesn't matter
// in the case of Focus Punch if the user was hit before or after the Encore; Focus Punch will still always work.
battle.makeChoices('move splash, move teleport', 'move encore 1, move extremespeed 1');
assert.notEqual(p2smeargle.hp, hp);
hp = p2smeargle.hp;
// During subsequent turns the normal Focus Punch behavior applies.
battle.makeChoices('move focuspunch 1, move teleport', 'move splash, move extremespeed 1');
assert.equal(p2smeargle.hp, hp);
});
it('should not affect Shell Trap if the user\'s decision is not changed', () => {
battle = common.createBattle({ gameType: 'doubles' }, [
[
{ species: "Smeargle", level: 99, ability: 'owntempo', moves: ['shelltrap', 'splash'] },
{ species: "Abra", level: 1, ability: 'innerfocus', moves: ['knockoff', 'teleport'] },
],
[
{ species: "Smeargle", ability: 'owntempo', item: 'laggingtail', moves: ['encore', 'splash'] },
{ species: "Zigzagoon", ability: 'pickup', item: 'assaultvest', moves: ['quickattack'] },
],
]);
// If the Shell Trap user is hit the attack is expected to be successful.
battle.makeChoices('move shelltrap, move knockoff 1', 'move splash, move quickattack 1');
let hp = battle.p2.active[0].hp;
assert.notEqual(hp, battle.p2.active[0].maxhp);
// If a user's previous move was Shell Trap and it is Encored into Shell Trap while attempting to
// execute the move, the regular "you must be hit" effect for Shell Trap will be enforced
battle.makeChoices('move shelltrap, move teleport', 'move encore 1, move quickattack 1');
assert.notEqual(battle.p2.active[0].hp, hp);
hp = battle.p2.active[0].hp;
// During subesquent turns the normal Shell Trap behavior applies.
battle.makeChoices('move shelltrap, move teleport', 'move splash, move quickattack 1');
assert.notEqual(battle.p2.active[0].hp, hp);
});
it('should make Shell Trap always fail if the user\'s decision is changed', () => {
battle = common.createBattle({ gameType: 'doubles' }, [
[
{ species: "Smeargle", level: 99, ability: 'owntempo', moves: ['splash', 'shelltrap'] },
{ species: "Abra", level: 1, ability: 'innerfocus', moves: ['knockoff', 'teleport'] },
],
[
{ species: "Smeargle", ability: 'owntempo', item: 'laggingtail', moves: ['encore', 'splash'] },
{ species: "Zigzagoon", ability: 'pickup', item: 'assaultvest', moves: ['quickattack'] },
],
]);
// If the Shell Trap user is hit the attack is expected to be successful.
battle.makeChoices('move shelltrap, move knockoff 1', 'move splash, move quickattack 1');
const hp = battle.p2.active[0].hp;
assert.notEqual(hp, battle.p2.active[0].maxhp);
// Shell Trap which has been encored will never be successful - even if it is hit with contact moves, it will never
// 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.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');
assert.notEqual(battle.p2.active[0].hp, hp);
});
it(`should not cause self-targeting moves to redirect to the opponent`, () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: "Wynaut", moves: ['destinybond', 'counter'] },
{ species: "Octillery", moves: ['sleeptalk'] },
], [
{ species: "Raichu", moves: ['sleeptalk', 'encore'] },
{ species: "Raichu", moves: ['sleeptalk', 'aerialace'] },
]]);
battle.makeChoices();
// This causes the Counter redirection and Encore redirection to screw up somehow
battle.makeChoices('move counter, move sleeptalk', 'move encore 1, move aerialace 1');
assert(battle.log.every(line => !line.includes('Raichu|Destiny Bond')));
});
});
describe('Encore [Gen 2]', () => {
afterEach(() => {
battle.destroy();
});
it(`[Gen 2] Encore succeeds when used against an opponent that last attacked before the Encore user switched in`, () => {
battle = common.gen(2).createBattle({ forceRandomChance: true }, [[
{ species: 'slowbro', moves: ['glare'] },
{ species: 'fearow', moves: ['encore'] },
], [
{ species: 'chansey', moves: ['seismictoss'] },
]]);
const chansey = battle.p2.active[0];
battle.makeChoices();
battle.makeChoices('switch 2', 'auto');
// Chansey is fully paralysed
assert.fullHP(battle.p1.active[0]);
battle.makeChoices();
assert.equal(chansey.volatiles['encore'].move, 'seismictoss');
});
});
|