Merge branch 'pr/116'

This commit is contained in:
Chacolay 2024-04-29 10:53:45 -04:00
commit 9ddb9920c3
3 changed files with 31 additions and 15 deletions

View File

@ -2716,9 +2716,8 @@ export function initAbilities() {
.attr(DownloadAbAttr), .attr(DownloadAbAttr),
new Ability(Abilities.IRON_FIST, 4) new Ability(Abilities.IRON_FIST, 4)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.PUNCHING_MOVE), 1.2), .attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.PUNCHING_MOVE), 1.2),
new Ability(Abilities.POISON_HEAL, 4) new Ability(Abilities.POISON_HEAL, "Poison Heal (P)", "Restores HP if the Pokémon is poisoned instead of losing HP.", 4),
.unimplemented(), new Ability(Abilities.ADAPTABILITY, "Adaptability", "Powers up moves of the same type as the Pokémon.", 4)
new Ability(Abilities.ADAPTABILITY, 4)
.attr(StabBoostAbAttr), .attr(StabBoostAbAttr),
new Ability(Abilities.SKILL_LINK, 4) new Ability(Abilities.SKILL_LINK, 4)
.attr(MaxMultiHitAbAttr), .attr(MaxMultiHitAbAttr),

View File

@ -134,4 +134,4 @@ export function getStatusEffectCatchRateMultiplier(statusEffect: StatusEffect):
} }
return 1; return 1;
} }

View File

@ -2915,27 +2915,44 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
if (!cancelled.value) { if (!cancelled.value) {
this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect))); this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect)));
let damage: integer = 0;
let netEffect = 0; // This variable now handles both healing and damage
const isHealing = pokemon.hasAbility(Abilities.POISON_HEAL); // Added check for both Ability and the new Passives
switch (pokemon.status.effect) { switch (pokemon.status.effect) {
case StatusEffect.POISON: case StatusEffect.POISON:
damage = Math.max(pokemon.getMaxHp() >> 3, 1);
break;
case StatusEffect.TOXIC: case StatusEffect.TOXIC:
damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1); 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; break;
case StatusEffect.BURN: case StatusEffect.BURN:
damage = Math.max(pokemon.getMaxHp() >> 4, 1); netEffect = Math.max(pokemon.getMaxHp() >> 4, 1); // Burn always causes damage
break; break;
} }
if (damage) {
this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage)); 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(); pokemon.updateInfo();
} else {
this.end(); // End the phase if no net effect to apply
} }
new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); }
} else } else {
this.end();
} else
this.end(); this.end();
}
} }
} }