Fix Psychic Noise's interaction with Life Dew (#10892)

* Fix Psychic Noise's interaction with Life Dew

* Add FIXME comment

* Remove unreachable code

* Update to ESLint 9
This commit is contained in:
André Bastos Dias 2025-03-09 18:05:02 +00:00 committed by GitHub
parent 4346e3d34c
commit f2736e1a3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 14 deletions

View File

@ -8623,7 +8623,13 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
this.add('-end', pokemon, 'move: Heal Block');
},
onTryHeal(damage, target, source, effect) {
if ((effect?.id === 'zpower') || this.effectState.isZ) return damage;
if (effect && (effect.id === 'zpower' || (effect as Move).isZ)) return damage;
if (target !== source && target.hp !== target.maxhp) {
this.attrLastMove('[still]');
// FIXME: Wrong error message, correct one not supported yet
this.add('cant', source, 'move: Heal Block', effect);
return null;
}
return false;
},
onRestart(target, source, effect) {
@ -14071,13 +14077,6 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
onHit(target, source, move) {
if (source.isAlly(target)) {
if (!this.heal(Math.floor(target.baseMaxhp * 0.5))) {
if (target.volatiles['healblock'] && target.hp !== target.maxhp) {
this.attrLastMove('[still]');
// Wrong error message, correct one not supported yet
this.add('cant', source, 'move: Heal Block', move);
} else {
this.add('-immune', target);
}
return this.NOT_FAIL;
}
}

View File

@ -1221,16 +1221,17 @@ export class BattleActions {
continue;
}
const amount = target.baseMaxhp * moveData.heal[0] / moveData.heal[1];
const d = target.heal((this.battle.gen < 5 ? Math.floor : Math.round)(amount));
const d = this.battle.heal((this.battle.gen < 5 ? Math.floor : Math.round)(amount), target, source, move);
if (!d && d !== 0) {
this.battle.add('-fail', source);
this.battle.attrLastMove('[still]');
if (d !== null) {
this.battle.add('-fail', source);
this.battle.attrLastMove('[still]');
}
this.battle.debug('heal interrupted');
damage[i] = this.combineResults(damage[i], false);
didAnything = this.combineResults(didAnything, null);
continue;
}
this.battle.add('-heal', target, target.getHealth);
didSomething = true;
}
if (moveData.status) {

View File

@ -106,7 +106,7 @@ export interface EventMethods {
) => boolean | null | void;
onTryEatItem?: boolean | ((this: Battle, item: Item, pokemon: Pokemon) => boolean | void);
onTryHeal?: (
((this: Battle, relayVar: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | void)
((this: Battle, relayVar: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | null | void)
);
onTryHit?: MoveEventMethods['onTryHit'];
onTryHitField?: MoveEventMethods['onTryHitField'];

View File

@ -22,7 +22,7 @@ describe('Psychic Noise', () => {
assert.cantMove(() => battle.choose('p1', 'move softboiled'));
});
it.skip(`should prevent the target's ally from healing it with Life Dew`, () => {
it(`should prevent the target's ally from healing it with Life Dew`, () => {
battle = common.createBattle({ gameType: 'doubles' }, [[
{ species: 'Wynaut', ability: 'battlearmor', moves: ['sleeptalk'] },
{ species: 'Blissey', ability: 'battlearmor', moves: ['lifedew'] },