Spaces:
Sleeping
Sleeping
File size: 5,565 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 |
'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Focus Punch', () => {
afterEach(() => {
battle.destroy();
});
it(`should cause the user to lose focus if hit by an attacking move`, () => {
battle = common.createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['magicalleaf'] },
]]);
battle.makeChoices();
assert.fullHP(battle.p2.active[0]);
});
it(`should not cause the user to lose focus if hit by a status move`, () => {
battle = common.createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['growl'] },
]]);
battle.makeChoices();
assert.false.fullHP(battle.p2.active[0]);
});
it(`should not cause the user to lose focus if hit while behind a substitute`, () => {
battle = common.createBattle([[
{ species: 'Chansey', moves: ['substitute', 'focuspunch'] },
], [
{ species: 'Venusaur', moves: ['magicalleaf'] },
]]);
battle.makeChoices();
battle.makeChoices('move focuspunch', 'auto');
assert.false.fullHP(battle.p2.active[0]);
});
it(`should cause the user to lose focus if hit by a move called by Nature Power`, () => {
battle = common.createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['naturepower'] },
]]);
battle.makeChoices();
assert.fullHP(battle.p2.active[0]);
});
it(`should not cause the user to lose focus on later uses of Focus Punch if hit`, () => {
battle = common.createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['magicalleaf', 'growl'] },
]]);
battle.makeChoices();
assert.fullHP(battle.p2.active[0]);
battle.makeChoices('auto', 'move growl');
assert.false.fullHP(battle.p2.active[0]);
});
it(`should cause the user to lose focus if hit by an attacking move followed by a status move in one turn`, () => {
battle = common.createBattle({ gameType: 'doubles' }, [
[{ species: 'Chansey', ability: 'naturalcure', moves: ['focuspunch'] }, { species: 'Blissey', ability: 'naturalcure', moves: ['softboiled'] }],
[{ 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.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`, () => {
battle = common.createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['magicalleaf', 'growl'] },
]]);
const move = battle.p1.active[0].getMoveData(Dex.moves.get('focuspunch'));
battle.makeChoices();
assert.equal(move.pp, move.maxpp);
battle.makeChoices('auto', 'move growl');
assert.equal(move.pp, move.maxpp - 1);
});
it(`should deduct PP if the user lost focus before Gen 5`, () => {
battle = common.gen(4).createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['magicalleaf', 'growl'] },
]]);
const move = battle.p1.active[0].getMoveData(Dex.moves.get('focuspunch'));
battle.makeChoices();
assert.equal(move.pp, move.maxpp - 1);
battle.makeChoices('auto', 'move growl');
assert.equal(move.pp, move.maxpp - 2);
});
it(`should display a message indicating the Pokemon is tightening focus`, () => {
battle = common.createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['magicalleaf'] },
]]);
battle.makeChoices();
const tighteningFocusMessage = battle.log.indexOf('|-singleturn|p1a: Chansey|move: Focus Punch');
assert(tighteningFocusMessage > 0);
});
it(`should not tighten the Pokemon's focus when Dynamaxing or already Dynamaxed`, () => {
battle = common.gen(8).createBattle([[
{ species: 'Chansey', moves: ['focuspunch'] },
], [
{ species: 'Venusaur', moves: ['magicalleaf'] },
]]);
battle.makeChoices('move focuspunch dynamax', 'auto');
battle.makeChoices('move focuspunch', 'auto');
const tighteningFocusMessage = battle.log.indexOf('|-singleturn|p1a: Chansey|move: Focus Punch');
assert(tighteningFocusMessage < 0);
});
it(`should tighten focus after switches in Gen 5+`, () => {
battle = common.createBattle([[
{ species: 'salamence', moves: ['focuspunch'] },
], [
{ species: 'mew', moves: ['sleeptalk'] },
{ species: 'wynaut', moves: ['sleeptalk'] },
]]);
battle.makeChoices('move focuspunch', 'switch 2');
const log = battle.getDebugLog();
const focusPunchChargeIndex = log.indexOf('|-singleturn|');
const switchIndex = log.indexOf('|switch|p2a: Wynaut');
assert(focusPunchChargeIndex > switchIndex, `Focus Punch's charge message should occur after switches in Gen 5+`);
});
it(`should tighten focus before switches in Gens 3-4`, () => {
battle = common.gen(4).createBattle([[
{ species: 'salamence', moves: ['focuspunch'] },
], [
{ species: 'mew', moves: ['sleeptalk'] },
{ species: 'wynaut', moves: ['sleeptalk'] },
]]);
battle.makeChoices('move focuspunch', 'switch 2');
const log = battle.getDebugLog();
const focusPunchChargeIndex = log.indexOf('|-singleturn|');
const switchIndex = log.indexOf('|switch|p2a: Wynaut');
assert(focusPunchChargeIndex < switchIndex, `Focus Punch's charge message should occur before switches in Gens 3-4`);
});
});
|