From 6b1aa7760a82802dd1977d7418e22c57ae95d339 Mon Sep 17 00:00:00 2001 From: Karthik99999 Date: Thu, 14 Sep 2023 00:57:42 -0700 Subject: [PATCH 1/3] Fix Hospitality activation message --- src/battle-text-parser.ts | 2 +- src/battle.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/battle-text-parser.ts b/src/battle-text-parser.ts index b17bf62120..08568375a4 100644 --- a/src/battle-text-parser.ts +++ b/src/battle-text-parser.ts @@ -930,7 +930,7 @@ class BattleTextParser { case '-heal': { let [, pokemon] = args; let template = this.template('heal', kwArgs.from, 'NODEFAULT'); - const line1 = this.maybeAbility(kwArgs.from, pokemon); + const line1 = this.maybeAbility(kwArgs.from, BattleTextParser.effectId(kwArgs.from) === 'hospitality' ? kwArgs.of : pokemon); if (template) { return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[SOURCE]', this.pokemon(kwArgs.of)).replace('[NICKNAME]', kwArgs.wisher); } diff --git a/src/battle.ts b/src/battle.ts index 2845a7d6d8..32948c4a5f 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -1740,7 +1740,8 @@ export class Battle { if (kwArgs.from) { let effect = Dex.getEffect(kwArgs.from); - this.activateAbility(poke, effect); + let ofpoke = this.getPokemon(kwArgs.of); + this.activateAbility(effect.id === 'hospitality' ? ofpoke : poke, effect); if (effect.effectType === 'Item' && !CONSUMED.includes(poke.prevItemEffect)) { if (poke.prevItem !== effect.name) { poke.item = effect.name; From c8389992050cf202c9762398182073deadfd9709 Mon Sep 17 00:00:00 2001 From: Karthik99999 Date: Thu, 14 Sep 2023 09:58:33 -0700 Subject: [PATCH 2/3] use upgradeArgs --- src/battle-text-parser.ts | 9 ++++++++- src/battle.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/battle-text-parser.ts b/src/battle-text-parser.ts index 08568375a4..f99c4eb602 100644 --- a/src/battle-text-parser.ts +++ b/src/battle-text-parser.ts @@ -183,6 +183,13 @@ class BattleTextParser { break; } + case '-heal': { + let [, pokemon] = args; + const id = BattleTextParser.effectId(kwArgs.from); + if (['dryskin', 'eartheater', 'voltabsorb', 'waterabsorb'].includes(id)) kwArgs.of = ''; + break; + } + case '-nothing': // OLD: |-nothing // NEW: |-activate||move:Splash @@ -930,7 +937,7 @@ class BattleTextParser { case '-heal': { let [, pokemon] = args; let template = this.template('heal', kwArgs.from, 'NODEFAULT'); - const line1 = this.maybeAbility(kwArgs.from, BattleTextParser.effectId(kwArgs.from) === 'hospitality' ? kwArgs.of : pokemon); + const line1 = this.maybeAbility(kwArgs.from, kwArgs.of || pokemon); if (template) { return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[SOURCE]', this.pokemon(kwArgs.of)).replace('[NICKNAME]', kwArgs.wisher); } diff --git a/src/battle.ts b/src/battle.ts index 32948c4a5f..9f3985be78 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -1741,7 +1741,7 @@ export class Battle { if (kwArgs.from) { let effect = Dex.getEffect(kwArgs.from); let ofpoke = this.getPokemon(kwArgs.of); - this.activateAbility(effect.id === 'hospitality' ? ofpoke : poke, effect); + this.activateAbility(ofpoke || poke, effect); if (effect.effectType === 'Item' && !CONSUMED.includes(poke.prevItemEffect)) { if (poke.prevItem !== effect.name) { poke.item = effect.name; From ae34ac397f9b139b1695db322c90aca21eb99ebc Mon Sep 17 00:00:00 2001 From: Karthik99999 Date: Thu, 14 Sep 2023 15:11:56 -0700 Subject: [PATCH 3/3] remove unused variable --- src/battle-text-parser.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/battle-text-parser.ts b/src/battle-text-parser.ts index f99c4eb602..8df97c2ea5 100644 --- a/src/battle-text-parser.ts +++ b/src/battle-text-parser.ts @@ -184,7 +184,6 @@ class BattleTextParser { } case '-heal': { - let [, pokemon] = args; const id = BattleTextParser.effectId(kwArgs.from); if (['dryskin', 'eartheater', 'voltabsorb', 'waterabsorb'].includes(id)) kwArgs.of = ''; break;