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.
This commit is contained in:
NxKarim 2024-04-18 15:29:18 -06:00
parent 396ddea18d
commit 19e8161b46
4 changed files with 22 additions and 23 deletions

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ src/data/battle-anim-raw-data*.ts
src/data/battle-anim-data.ts
coverage
src/battle-scene.ts

View File

@ -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;

View File

@ -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)

View File

@ -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 {