Spaces:
Running
Running
File size: 11,162 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Heal Block', () => {
afterEach(() => {
battle.destroy();
});
it('should prevent Pokemon from gaining HP from residual recovery items', () => {
battle = common.createBattle();
battle.setPlayer('p1', { team: [{ species: 'Hippowdon', ability: 'sandstream', moves: ['healblock'] }] });
battle.setPlayer('p2', { team: [{ species: 'Spiritomb', ability: 'pressure', item: 'leftovers', moves: ['calmmind'] }] });
battle.makeChoices('move healblock', 'move calmmind');
assert.notEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should prevent Pokemon from consuming HP recovery items', () => {
battle = common.createBattle();
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.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', () => {
battle = common.createBattle();
battle.setPlayer('p1', { team: [{ species: 'Spiritomb', ability: 'pressure', moves: ['healblock'] }] });
battle.setPlayer('p2', { team: [{ species: 'Cresselia', ability: 'levitate', moves: ['recover'] }] });
battle.makeChoices('move healblock', 'move recover');
assert.cantMove(() => battle.makeChoices('move healblock', 'move recover'), 'Cresselia', 'Recover');
});
it('should prevent Pokemon from using draining moves', () => {
battle = common.createBattle();
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.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should prevent abilities from recovering HP', () => {
battle = common.createBattle();
battle.setPlayer('p1', { team: [{ species: 'Sableye', ability: 'prankster', moves: ['healblock', 'surf'] }] });
battle.setPlayer('p2', { team: [{ species: 'Quagsire', ability: 'waterabsorb', moves: ['bellydrum', 'calmmind'] }] });
battle.makeChoices('move healblock', 'move bellydrum');
const hp = battle.p2.active[0].hp;
battle.makeChoices('move surf', 'move calmmind');
assert.equal(battle.p2.active[0].hp, hp);
});
it('should prevent Leech Seed from healing HP', () => {
battle = common.createBattle();
battle.setPlayer('p1', { team: [{ species: 'Starmie', ability: 'noguard', moves: ['healblock'] }] });
battle.setPlayer('p2', { team: [{ species: 'Venusaur', ability: 'overgrow', moves: ['substitute', 'leechseed'] }] });
battle.makeChoices('move healblock', 'move substitute');
const hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move leechseed');
assert.equal(battle.p2.active[0].hp, hp);
assert.notEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should not prevent the target from using Z-Powered healing status moves or healing from Z Power', () => {
battle = common.createBattle();
battle.setPlayer('p1', { team: [{ species: 'Beheeyem', ability: 'telepathy', item: 'normaliumz', moves: ['psychic', 'healblock', 'recover'] }] });
battle.setPlayer('p2', { team: [{ species: 'Elgyem', ability: 'telepathy', item: 'psychiumz', moves: ['psychic', 'healblock', 'teleport'] }] });
battle.makeChoices('move psychic', 'move psychic');
battle.makeChoices('move healblock', 'move healblock');
battle.makeChoices('move recover zmove', 'move teleport zmove');
assert.fullHP(battle.p1.active[0]);
assert.fullHP(battle.p2.active[0]);
});
});
describe('Heal Block [Gen 5]', () => {
afterEach(() => {
battle.destroy();
});
it('should prevent Pokemon from gaining HP from residual recovery items', () => {
battle = common.gen(5).createBattle([
[{ species: 'Hippowdon', ability: 'sandstream', moves: ['healblock'] }],
[{ species: 'Spiritomb', ability: 'pressure', item: 'leftovers', moves: ['calmmind'] }],
]);
battle.makeChoices('move healblock', 'move calmmind');
assert.notEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
it('should prevent Pokemon from consuming HP recovery items', () => {
battle = common.gen(5).createBattle([
[{ species: 'Sableye', ability: 'prankster', moves: ['healblock'] }],
[{ species: 'Pansage', ability: 'gluttony', item: 'sitrusberry', moves: ['bellydrum'] }],
]);
battle.makeChoices('move healblock', 'move bellydrum');
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', () => {
battle = common.gen(5).createBattle([
[{ species: 'Spiritomb', ability: 'pressure', moves: ['healblock'] }],
[{ species: 'Cresselia', ability: 'levitate', moves: ['recover'] }],
]);
battle.makeChoices('move healblock', 'move recover');
assert.cantMove(() => battle.makeChoices('move healblock', 'move recover'), 'Cresselia', 'Recover');
});
it('should prevent abilities from recovering HP', () => {
battle = common.gen(5).createBattle([
[{ species: 'Sableye', ability: 'prankster', moves: ['healblock', 'surf'] }],
[{ species: 'Quagsire', ability: 'waterabsorb', moves: ['bellydrum', 'calmmind'] }],
]);
battle.makeChoices('move healblock', 'move bellydrum');
const hp = battle.p2.active[0].hp;
battle.makeChoices('move surf', 'move calmmind');
assert.equal(battle.p2.active[0].hp, hp);
});
it('should prevent draining moves from healing HP', () => {
battle = common.gen(5).createBattle([
[{ species: 'Sableye', ability: 'prankster', moves: ['healblock'] }],
[{ species: 'Venusaur', ability: 'overgrow', moves: ['substitute', 'gigadrain'] }],
]);
battle.makeChoices('move healblock', 'move substitute');
const hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move gigadrain');
assert.equal(battle.p2.active[0].hp, hp);
assert.notEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should prevent Leech Seed from healing HP', () => {
battle = common.gen(5).createBattle([
[{ species: 'Starmie', ability: 'noguard', moves: ['healblock'] }],
[{ species: 'Venusaur', ability: 'overgrow', moves: ['substitute', 'leechseed'] }],
]);
const hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move leechseed');
assert.equal(battle.p2.active[0].hp, hp);
assert.notEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
});
describe('Heal Block [Gen 4]', () => {
afterEach(() => {
battle.destroy();
});
it('should disable the use of healing moves', () => {
battle = common.gen(4).createBattle([
[{ species: 'Spiritomb', ability: 'pressure', moves: ['healblock'] }],
[{ species: 'Cresselia', ability: 'levitate', moves: ['recover'] }],
]);
battle.makeChoices('move healblock', 'move recover');
assert.cantMove(() => battle.makeChoices('move healblock', 'move recover'), 'Cresselia', 'Recover');
});
it('should block the effect of Wish', () => {
battle = common.gen(4).createBattle([
[{ species: 'Spiritomb', ability: 'pressure', moves: ['healblock'] }],
[{ species: 'Deoxys', ability: 'pressure', moves: ['wish'] }],
]);
battle.makeChoices('move healblock', 'move wish');
assert.cantMove(() => battle.makeChoices('move healblock', 'move wish'), 'Deoxys', 'Wish');
});
it('should prevent draining moves from healing HP', () => {
battle = common.gen(4).createBattle([
[{ species: 'Sableye', ability: 'prankster', moves: ['healblock'] }],
[{ species: 'Venusaur', ability: 'overgrow', moves: ['substitute', 'gigadrain'] }],
]);
battle.makeChoices('move healblock', 'move substitute');
const hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move gigadrain');
assert.equal(battle.p2.active[0].hp, hp);
assert.notEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should allow HP recovery items to activate', () => {
battle = common.gen(4).createBattle([
[{ species: 'Spiritomb', ability: 'pressure', moves: ['healblock', 'shadowball'] }],
[{ species: 'Abra', level: 1, ability: 'synchronize', item: 'leftovers', moves: ['celebrate', 'endure'] }, { species: 'Abra', level: 1, ability: 'synchronize', item: 'sitrusberry', moves: ['celebrate', 'endure'] }],
]);
battle.makeChoices('move healblock', 'move celebrate');
battle.makeChoices('move shadowball', 'move endure');
assert.notEqual(battle.p2.active[0].hp, 1);
battle.makeChoices('move healblock', 'switch 2');
battle.makeChoices('move shadowball', 'move endure');
assert.equal(battle.p2.active[0].item, '');
assert.notEqual(battle.p2.active[0].hp, 1);
});
it('should allow abilities that recover HP to activate', () => {
battle = common.gen(4).createBattle([
[{ species: 'Sableye', ability: 'keeneye', moves: ['healblock', 'surf'] }],
[{ species: 'Quagsire', ability: 'waterabsorb', moves: ['bellydrum', 'calmmind'] }],
]);
battle.makeChoices('move healblock', 'move bellydrum');
const hp = battle.p2.active[0].hp;
battle.makeChoices('move surf', 'move calmmind');
assert.notEqual(battle.p2.active[0].hp, hp);
});
it('should prevent Leech Seed from healing HP', () => {
battle = common.gen(4).createBattle([
[{ species: 'Starmie', ability: 'noguard', moves: ['healblock'] }],
[{ species: 'Venusaur', ability: 'overgrow', moves: ['substitute', 'leechseed'] }],
]);
battle.makeChoices('move healblock', 'move substitute');
const hp = battle.p2.active[0].hp;
battle.makeChoices('move healblock', 'move leechseed');
assert.equal(battle.p2.active[0].hp, hp);
assert.notEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it('should fail indepedently on each target', () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: 'porygon2', moves: ['sleeptalk'] },
{ species: 'marshadow', moves: ['sleeptalk'] },
{ species: 'mew', moves: ['sleeptalk'] },
], [
{ species: 'zapdos', moves: ['sleeptalk'] },
{ species: 'skitty', moves: ['healblock'] },
]]);
battle.makeChoices('move sleeptalk, move sleeptalk', 'move sleeptalk, move healblock');
battle.makeChoices('move sleeptalk, move sleeptalk', 'move sleeptalk, move healblock');
assert.equal(battle.p2.active[1].moveLastTurnResult, false, 'should fail when fails on all targets');
assert.equal(battle.log[battle.lastMoveLine + 1].startsWith('|-fail'), true);
assert.equal(battle.log[battle.lastMoveLine + 2].startsWith('|-fail'), true);
assert.notEqual(battle.log[battle.lastMoveLine + 3].startsWith('|-fail'), true);
battle.makeChoices('move sleeptalk, switch 3', 'move sleeptalk, move healblock');
assert.equal(battle.p2.active[1].moveLastTurnResult, true, 'should succeed if succeeds on at least one target');
});
});
|