Add Heal Block independent fail message (#7785)

This commit is contained in:
Adam Tran 2020-12-11 19:38:52 -05:00 committed by GitHub
parent 0c6cfbd213
commit f63e7e4a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View File

@ -7722,8 +7722,9 @@ export const Moves: {[moveid: string]: MoveData} = {
}
return 5;
},
onStart(pokemon) {
onStart(pokemon, source) {
this.add('-start', pokemon, 'move: Heal Block');
source.moveThisTurnResult = true;
},
onDisableMove(pokemon) {
for (const moveSlot of pokemon.moveSlots) {
@ -7747,6 +7748,12 @@ export const Moves: {[moveid: string]: MoveData} = {
if ((effect?.id === 'zpower') || this.effectData.isZ) return damage;
return false;
},
onRestart(target, source) {
this.add('-fail', target, 'move: Heal Block'); // Succeeds to supress downstream messages
if (!source.moveThisTurnResult) {
source.moveThisTurnResult = false;
}
},
},
secondary: null,
target: "allAdjacentFoes",

View File

@ -2649,6 +2649,7 @@ export const MovesText: {[k: string]: MoveText} = {
start: " [POKEMON] was prevented from healing!",
end: " [POKEMON]'s Heal Block wore off!",
cant: "[POKEMON] can't use [MOVE] because of Heal Block!",
fail: " But it failed to affect [POKEMON]!",
},
healingwish: {
name: "Healing Wish",

View File

@ -215,4 +215,24 @@ describe('Heal Block [Gen 4]', function () {
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', function () {
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');
});
});