From 19e8161b46b501fc247e487b5d65edef968fd68c Mon Sep 17 00:00:00 2001 From: NxKarim Date: Thu, 18 Apr 2024 15:29:18 -0600 Subject: [PATCH] More Disguise changes and fixes. Added pokemon battledata abilityTriggered. Disguise conditions now depend on abilityTriggered and if it got hit on the turn. The bug of excess HP is now fixed. --- .gitignore | 3 ++- src/battle-scene.ts | 16 ++++++++-------- src/data/ability.ts | 25 +++++++++++-------------- src/field/pokemon.ts | 1 + 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 4cf3196a72b..c9e1e507979 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,5 @@ public/images/character/*/ src/data/battle-anim-raw-data*.ts src/data/battle-anim-data.ts -coverage \ No newline at end of file +coverage +src/battle-scene.ts diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 5f27b8e0ceb..0c588558bd9 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -61,18 +61,18 @@ import CandyBar from './ui/candy-bar'; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; export const SEED_OVERRIDE = ''; -export const STARTER_SPECIES_OVERRIDE = 0; -export const STARTER_FORM_OVERRIDE = 0; -export const STARTING_LEVEL_OVERRIDE = 0; +export const STARTER_SPECIES_OVERRIDE = 778; +export const STARTER_FORM_OVERRIDE = 1; +export const STARTING_LEVEL_OVERRIDE = 2000; export const STARTING_WAVE_OVERRIDE = 0; export const STARTING_BIOME_OVERRIDE = Biome.TOWN; export const STARTING_MONEY_OVERRIDE = 0; -export const ABILITY_OVERRIDE = Abilities.NONE; -export const MOVE_OVERRIDE = Moves.NONE; -export const OPP_SPECIES_OVERRIDE = 0; -export const OPP_ABILITY_OVERRIDE = Abilities.NONE; -export const OPP_MOVE_OVERRIDE = Moves.NONE; +export const ABILITY_OVERRIDE = Abilities.DISGUISE; +export const MOVE_OVERRIDE = Moves.DRAGON_RAGE; +export const OPP_SPECIES_OVERRIDE = 778; +export const OPP_ABILITY_OVERRIDE = Abilities.MOLD_BREAKER; +export const OPP_MOVE_OVERRIDE = Moves.BITE; const DEBUG_RNG = false; diff --git a/src/data/ability.ts b/src/data/ability.ts index 905c57b7e2b..e6ad1981fb4 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -293,7 +293,7 @@ export class PreDefendMovePowerReductionAbAttr extends ReceivedMoveDamageMultipl statUsed = 1; (args[0] as Utils.NumberHolder).value = 1 / (statUsed * attacker.getMaxHp()); - + pokemon.battleData.abilityTriggered = true; return true; } @@ -436,21 +436,18 @@ export class PostDefendDisguiseAbAttr extends PostDefendAbAttr { applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { if (this.condition(pokemon, attacker, move.getMove())) { - const damageDealt = attacker.turnData.damageDealt; const eighthOfMaxHp = Math.ceil(pokemon.getMaxHp() / 8); let recoilDamage; - if (damageDealt < eighthOfMaxHp) { - recoilDamage = Math.ceil(eighthOfMaxHp - damageDealt); + recoilDamage = eighthOfMaxHp - damageDealt; } else { - recoilDamage = Math.min(damageDealt - eighthOfMaxHp, pokemon.getMaxHp()); + recoilDamage = Math.max(eighthOfMaxHp - damageDealt, -1*pokemon.getMaxHp()-eighthOfMaxHp); } - if (!recoilDamage) return false; - pokemon.battleData.hitCount += 1; - pokemon.damageAndUpdate(recoilDamage, HitResult.OTHER); + + pokemon.damageAndUpdate(Math.ceil(recoilDamage), HitResult.OTHER); pokemon.scene.queueMessage(getPokemonMessage(pokemon, '\'s disguise was busted!')); return true; @@ -2807,12 +2804,12 @@ export function initAbilities() { .attr(UnswappableAbilityAbAttr) .attr(UnsuppressableAbilityAbAttr), new Ability(Abilities.DISGUISE, "Disguise (P)", "Once per battle, the shroud that covers the Pokémon can protect it from an attack.", 7) - .attr(PreDefendMovePowerReductionAbAttr, (target, user, move) => target.battleData.hitCount === 0 && target.getAttackTypeEffectiveness(move.type) > 0) - .attr(PostSummonFormChangeAbAttr, p => p.getFormKey() == `disguised` && p.battleData.hitCount >= 1 ? 1 : p.getFormKey() == `busted` && p.battleData.hitCount >= 1 ? 1 : 0) - .attr(PostBattleInitFormChangeAbAttr, p => p.getFormKey() == `disguised` && p.battleData.hitCount >= 1 ? 1 : p.getFormKey() == `busted` && p.battleData.hitCount >= 1 ? 1 : 0) - .attr(PostDefendFormChangeAbAttr, p => p.getFormKey() == `disguised` && p.battleData.hitCount >= 1 ? 1 : p.getFormKey() == `busted` && p.battleData.hitCount >= 1 ? 1 : 0) - .attr(PreDefendFormChangeAbAttr, p => p.getFormKey() == `disguised` && p.battleData.hitCount >= 1 ? 1 : p.getFormKey() == `busted` && p.battleData.hitCount >= 1 ? 1 : 0) - .attr(PostDefendDisguiseAbAttr, (target, user, move) => target.battleData.hitCount === 1 && (move.category == MoveCategory.SPECIAL || move.category == MoveCategory.PHYSICAL)) + .attr(PreDefendMovePowerReductionAbAttr, (target, user, move) => target.battleData.abilityTriggered == false && target.getAttackTypeEffectiveness(move.type) > 0) + .attr(PostDefendDisguiseAbAttr, (target, user, move) => target.battleData.abilityTriggered == false && target.turnData.hitCount >= 1 && (move.category == MoveCategory.SPECIAL || move.category == MoveCategory.PHYSICAL)) + .attr(PostSummonFormChangeAbAttr, p => p.battleData.abilityTriggered == false ? 0 : 1) + .attr(PostBattleInitFormChangeAbAttr, p => p.battleData.abilityTriggered == false ? 0 : 1) + .attr(PostDefendFormChangeAbAttr, p => p.battleData.abilityTriggered == false ? 0 : 1) + .attr(PreDefendFormChangeAbAttr, p => p.battleData.abilityTriggered == false ? 0 : 1) .attr(UncopiableAbilityAbAttr) .attr(UnswappableAbilityAbAttr) .attr(UnsuppressableAbilityAbAttr) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 19774d7df54..ecfd339eeae 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2843,6 +2843,7 @@ export class PokemonSummonData { export class PokemonBattleData { public hitCount: integer = 0; public endured: boolean = false; + public abilityTriggered: boolean = false; } export class PokemonBattleSummonData {