From ebe1e1dc47ffce311d2154f155aba24248a4484f Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:39:01 +0100 Subject: [PATCH 01/11] Updated getStatusEffectActivationText with placeholder function --- src/data/status-effect.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/data/status-effect.ts b/src/data/status-effect.ts index 4ae09526536..6208cd612ab 100644 --- a/src/data/status-effect.ts +++ b/src/data/status-effect.ts @@ -51,19 +51,26 @@ export function getStatusEffectObtainText(statusEffect: StatusEffect, sourceText return ''; } -export function getStatusEffectActivationText(statusEffect: StatusEffect): string { +export function getStatusEffectActivationText(statusEffect: StatusEffect, pokemon: Pokemon): string { switch (statusEffect) { case StatusEffect.POISON: case StatusEffect.TOXIC: - return ' is hurt\nby poison!'; + // Placeholder, idk how to fix this, too new to typeScript, but it functions as normal anyway because of the pokemon && clause always returning the else value + if (pokemon && pokemon.getAbility().id === Abilities.POISON_HEAL) { + console.log("Poison Heal ability detected"); + return ' had its HP restored!'; + } else { + console.log("No Poison Heal ability detected"); + return ' is hurt by poison!'; + } case StatusEffect.PARALYSIS: - return ' is paralyzed!\nIt can\'t move!'; + return ' is paralyzed! It can\'t move!'; case StatusEffect.SLEEP: return ' is fast asleep.'; case StatusEffect.FREEZE: - return ' is\nfrozen solid!'; + return ' is frozen solid!'; case StatusEffect.BURN: - return ' is hurt\nby its burn!'; + return ' is hurt by its burn!'; } return ''; @@ -134,4 +141,4 @@ export function getStatusEffectCatchRateMultiplier(statusEffect: StatusEffect): } return 1; -} \ No newline at end of file +} From d79a4ddf582cd6a79200e06c33344593cd79168a Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:40:54 +0100 Subject: [PATCH 02/11] Update to PostTurnStatusEffectPhase to support Poison Heal --- src/phases.ts | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index 5b8b9cdc004..f838d36880e 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2759,27 +2759,45 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { if (!cancelled.value) { this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect))); + + let healing: integer = 0; let damage: integer = 0; + + // Determine the amount of healing or damage based on the status effect switch (pokemon.status.effect) { case StatusEffect.POISON: - damage = Math.max(pokemon.getMaxHp() >> 3, 1); + // If the Pokémon has the ability Poison Heal, heal instead of taking damage + if (pokemon.getAbility().id === Abilities.POISON_HEAL) + healing = Math.max(pokemon.getMaxHp() >> 3, 1); + else // Otherwise, take damage as usual + damage = Math.max(pokemon.getMaxHp() >> 3, 1); break; - case StatusEffect.TOXIC: - damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1); + case StatusEffect.TOXIC: // Follow same logic from Poison, but with Toxic's damage formula + if (pokemon.getAbility().id === Abilities.POISON_HEAL) + healing = Math.max(pokemon.getMaxHp() >> 3, 1); + else + damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1); break; - case StatusEffect.BURN: + case StatusEffect.BURN: // For the burn status effect, always take damage damage = Math.max(pokemon.getMaxHp() >> 4, 1); break; } - if (damage) { - this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage)); + // Apply that healing or damage to the Pokémon's HP + if (healing > 0) { + this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.heal(healing), HitResult.HEAL); + new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); pokemon.updateInfo(); + } else if (damage > 0) { + this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage)); + new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); + pokemon.updateInfo(); + } else { + // End the phase if the healing or damage is cancelled + this.end(); } - new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); - } else - this.end(); + } } else - this.end(); + this.end(); } } From cdadd638abac061402a43e1c6cf763a56b1ff507 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:43:32 +0100 Subject: [PATCH 03/11] Forgot the breaks --- src/data/status-effect.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/data/status-effect.ts b/src/data/status-effect.ts index 6208cd612ab..484ee6a5073 100644 --- a/src/data/status-effect.ts +++ b/src/data/status-effect.ts @@ -58,19 +58,19 @@ export function getStatusEffectActivationText(statusEffect: StatusEffect, pokemo // Placeholder, idk how to fix this, too new to typeScript, but it functions as normal anyway because of the pokemon && clause always returning the else value if (pokemon && pokemon.getAbility().id === Abilities.POISON_HEAL) { console.log("Poison Heal ability detected"); - return ' had its HP restored!'; + return ' had its\nHP restored!'; } else { console.log("No Poison Heal ability detected"); - return ' is hurt by poison!'; + return ' is hurt\nby poison!'; } case StatusEffect.PARALYSIS: - return ' is paralyzed! It can\'t move!'; + return ' is paralyzed!\nIt can\'t move!'; case StatusEffect.SLEEP: return ' is fast asleep.'; case StatusEffect.FREEZE: - return ' is frozen solid!'; + return ' is\nfrozen solid!'; case StatusEffect.BURN: - return ' is hurt by its burn!'; + return ' is hurt\nby its burn!'; } return ''; From 3cb1b3ea05296eb7edd92e5c4c44574390669e20 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:44:48 +0100 Subject: [PATCH 04/11] Updated formatting --- src/phases.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phases.ts b/src/phases.ts index f838d36880e..6f295f88430 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2797,7 +2797,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { } } } else - this.end(); + this.end(); } } From 56543b7eb99d5f7e26ee18f8e58ab45db98fdaf7 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:47:20 +0100 Subject: [PATCH 05/11] Updated Poison Heal (P) because the "heal" still says they take poison damage currently --- src/data/ability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 072a6aa155d..0d420f94257 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2219,7 +2219,7 @@ export function initAbilities() { .attr(DownloadAbAttr), new Ability(Abilities.IRON_FIST, "Iron Fist", "Powers up punching moves.", 4) .attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.PUNCHING_MOVE), 1.2), - new Ability(Abilities.POISON_HEAL, "Poison Heal (N)", "Restores HP if the Pokémon is poisoned instead of losing HP.", 4), + new Ability(Abilities.POISON_HEAL, "Poison Heal (P)", "Restores HP if the Pokémon is poisoned instead of losing HP.", 4), new Ability(Abilities.ADAPTABILITY, "Adaptability", "Powers up moves of the same type as the Pokémon.", 4) .attr(StabBoostAbAttr), new Ability(Abilities.SKILL_LINK, "Skill Link", "Maximizes the number of times multistrike moves hit.", 4) From 8369f5540c8727c9991d1d9169524546e64ab8c0 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:06:13 +0100 Subject: [PATCH 06/11] Updated formatting to streamline as requested Should handle logic better --- src/phases.ts | 53 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index 6f295f88430..b4b154bfe37 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2760,44 +2760,43 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { if (!cancelled.value) { this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect))); - let healing: integer = 0; - let damage: integer = 0; + let netEffect = 0; // This variable now handles both healing and damage + const isHealing = pokemon.getAbility().id === Abilities.POISON_HEAL; - // Determine the amount of healing or damage based on the status effect switch (pokemon.status.effect) { case StatusEffect.POISON: - // If the Pokémon has the ability Poison Heal, heal instead of taking damage - if (pokemon.getAbility().id === Abilities.POISON_HEAL) - healing = Math.max(pokemon.getMaxHp() >> 3, 1); - else // Otherwise, take damage as usual - damage = Math.max(pokemon.getMaxHp() >> 3, 1); + case StatusEffect.TOXIC: + if (isHealing) { + netEffect = Math.max(pokemon.getMaxHp() >> 3, 1); // Healing logic + } else { + // Toxic damage increases over time, Poison does not + netEffect = (pokemon.status.effect === StatusEffect.TOXIC) ? + Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1) : // Applies if Toxic + Math.max(pokemon.getMaxHp() >> 3, 1); // Damage logic for Poison otherwise + } break; - case StatusEffect.TOXIC: // Follow same logic from Poison, but with Toxic's damage formula - if (pokemon.getAbility().id === Abilities.POISON_HEAL) - healing = Math.max(pokemon.getMaxHp() >> 3, 1); - else - damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1); - break; - case StatusEffect.BURN: // For the burn status effect, always take damage - damage = Math.max(pokemon.getMaxHp() >> 4, 1); + case StatusEffect.BURN: + netEffect = Math.max(pokemon.getMaxHp() >> 4, 1); // Burn always causes damage break; } - // Apply that healing or damage to the Pokémon's HP - if (healing > 0) { - this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.heal(healing), HitResult.HEAL); - new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); - pokemon.updateInfo(); - } else if (damage > 0) { - this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage)); - new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); + + if (netEffect > 0) { + if (isHealing) { + this.scene.damageNumberHandler.add(pokemon, pokemon.heal(netEffect), HitResult.HEAL); + } else { + this.scene.damageNumberHandler.add(pokemon, pokemon.damage(netEffect)); + } + + const animType = CommonAnim.POISON + (pokemon.status.effect - 1); + new CommonBattleAnim(animType, pokemon).play(this.scene, () => this.end()); pokemon.updateInfo(); } else { - // End the phase if the healing or damage is cancelled - this.end(); + this.end(); // End the phase if no net effect to apply } } - } else + } else { this.end(); + } } } From 50f53516b8d546ea08386e34e24e27a8a538f878 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:07:56 +0100 Subject: [PATCH 07/11] Reverted changes, someone else can sort --- src/data/status-effect.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/data/status-effect.ts b/src/data/status-effect.ts index 484ee6a5073..2e3b2ebdde6 100644 --- a/src/data/status-effect.ts +++ b/src/data/status-effect.ts @@ -55,14 +55,7 @@ export function getStatusEffectActivationText(statusEffect: StatusEffect, pokemo switch (statusEffect) { case StatusEffect.POISON: case StatusEffect.TOXIC: - // Placeholder, idk how to fix this, too new to typeScript, but it functions as normal anyway because of the pokemon && clause always returning the else value - if (pokemon && pokemon.getAbility().id === Abilities.POISON_HEAL) { - console.log("Poison Heal ability detected"); - return ' had its\nHP restored!'; - } else { - console.log("No Poison Heal ability detected"); - return ' is hurt\nby poison!'; - } + return ' is hurt\nby poison!'; case StatusEffect.PARALYSIS: return ' is paralyzed!\nIt can\'t move!'; case StatusEffect.SLEEP: From 8336f4ffe198b939a8642f572c8f59434bd35262 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:08:44 +0100 Subject: [PATCH 08/11] Forgot to remove pokemon variable --- src/data/status-effect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/status-effect.ts b/src/data/status-effect.ts index 2e3b2ebdde6..121a7f8ee78 100644 --- a/src/data/status-effect.ts +++ b/src/data/status-effect.ts @@ -51,7 +51,7 @@ export function getStatusEffectObtainText(statusEffect: StatusEffect, sourceText return ''; } -export function getStatusEffectActivationText(statusEffect: StatusEffect, pokemon: Pokemon): string { +export function getStatusEffectActivationText(statusEffect: StatusEffect): string { switch (statusEffect) { case StatusEffect.POISON: case StatusEffect.TOXIC: From 33f6214dc71e3f102a0540f14f74ef2ffff8272c Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Sun, 14 Apr 2024 11:04:49 +0100 Subject: [PATCH 09/11] Added pokemon.getPassive check to support new passives --- src/phases.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index b4b154bfe37..ecc0fd17352 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2761,7 +2761,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect))); let netEffect = 0; // This variable now handles both healing and damage - const isHealing = pokemon.getAbility().id === Abilities.POISON_HEAL; + const isHealing = pokemon.getAbility().id === Abilities.POISON_HEAL || pokemon.getPassive().id === Abilities.POISON_HEAL; // Added check for both Ability and the new Passives switch (pokemon.status.effect) { case StatusEffect.POISON: @@ -2772,7 +2772,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { // Toxic damage increases over time, Poison does not netEffect = (pokemon.status.effect === StatusEffect.TOXIC) ? Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1) : // Applies if Toxic - Math.max(pokemon.getMaxHp() >> 3, 1); // Damage logic for Poison otherwise + Math.max(pokemon.getMaxHp() >> 3, 1); // Damage logic for Poison otherwise } break; case StatusEffect.BURN: From a6277f9d485b398813062b0e1dc4eb99e6e73f31 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Tue, 16 Apr 2024 21:41:36 +0100 Subject: [PATCH 10/11] Updated to hasPassive from getPassive --- src/phases.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phases.ts b/src/phases.ts index ecc0fd17352..7cb2c5f64eb 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2761,7 +2761,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect))); let netEffect = 0; // This variable now handles both healing and damage - const isHealing = pokemon.getAbility().id === Abilities.POISON_HEAL || pokemon.getPassive().id === Abilities.POISON_HEAL; // Added check for both Ability and the new Passives + const isHealing = pokemon.getAbility().id === Abilities.POISON_HEAL || pokemon.hasPassive().id === Abilities.POISON_HEAL; // Added check for both Ability and the new Passives switch (pokemon.status.effect) { case StatusEffect.POISON: From 99a26e366b304cb618a5c7ce4a23df7a2dee3921 Mon Sep 17 00:00:00 2001 From: EmoUsedHM01 <131687820+EmoUsedHM01@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:37:09 +0100 Subject: [PATCH 11/11] Updated check logic, should account for both ability and passive --- src/phases.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phases.ts b/src/phases.ts index 7cb2c5f64eb..6a65bfed285 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2761,7 +2761,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect))); let netEffect = 0; // This variable now handles both healing and damage - const isHealing = pokemon.getAbility().id === Abilities.POISON_HEAL || pokemon.hasPassive().id === Abilities.POISON_HEAL; // Added check for both Ability and the new Passives + const isHealing = pokemon.hasAbility(Abilities.POISON_HEAL); // Added check for both Ability and the new Passives switch (pokemon.status.effect) { case StatusEffect.POISON: