From a9251231219a0c5fe05f31835cdb55ac02e39ee2 Mon Sep 17 00:00:00 2001 From: Jesse Chung Date: Mon, 26 Aug 2024 17:17:43 -0700 Subject: [PATCH] #3722 improving code function --- src/data/move.ts | 2 +- src/field/pokemon.ts | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 24651bacb2e..e2fdaff9579 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1945,7 +1945,7 @@ export class StatusEffectAttr extends MoveEffectAttr { } } if ((!pokemon.status || (pokemon.status.effect === this.effect && moveChance < 0)) - && pokemon.trySetStatus(this.effect, true, user, this.cureTurn)) { + && pokemon.trySetStatus(this.effect, false, user, this.cureTurn)) { applyPostAttackAbAttrs(ConfusionOnStatusEffectAbAttr, user, target, move, null, this.effect); return true; } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f56bfdf38df..631fe906b1c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2737,6 +2737,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { break; case StatusEffect.SLEEP: if (this.isGrounded() && this.scene.arena.terrain?.terrainType === TerrainType.ELECTRIC) { + if (!quiet) { + this.scene.queueMessage(i18next.t("terrain:defaultBlockMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(this), terrainName: getTerrainName(TerrainType.ELECTRIC) })); + } return false; } break; @@ -2767,14 +2770,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { trySetStatus(effect: StatusEffect | undefined, asPhase: boolean = false, sourcePokemon: Pokemon | null = null, cureTurn: integer | null = 0, sourceText: string | null = null): boolean { if (!this.canSetStatus(effect, asPhase, false, sourcePokemon)) { - switch (effect) { - case StatusEffect.SLEEP: - if (this.isGrounded() && this.scene.arena.terrain?.terrainType === TerrainType.ELECTRIC) { - this.scene.queueMessage(i18next.t("terrain:defaultBlockMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(this), terrainName: getTerrainName(TerrainType.ELECTRIC) })); - return false; - } - break; - } return false; }