Merge branch 'beta' into WorkingDiscardFunction

This commit is contained in:
Mikhail Shueb 2025-07-20 23:31:57 +01:00 committed by GitHub
commit 2a711429d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 5 deletions

View File

@ -5305,6 +5305,26 @@ export class PostFaintUnsuppressedWeatherFormChangeAbAttr extends PostFaintAbAtt
}
}
export class PostFaintFormChangeAbAttr extends PostFaintAbAttr {
private formFunc: (p: Pokemon) => number;
constructor(formFunc: (p: Pokemon) => number) {
super(true);
this.formFunc = formFunc;
}
override canApply({ pokemon }: AbAttrBaseParams): boolean {
return this.formFunc(pokemon) !== pokemon.formIndex;
}
override apply({ pokemon, simulated }: AbAttrBaseParams): void {
if (!simulated) {
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
}
}
}
export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
private damageRatio: number;
@ -7296,6 +7316,7 @@ export function initAbilities() {
(pokemon, abilityName) => i18next.t("abilityTriggers:disguiseAvoidedDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }),
(pokemon) => toDmgValue(pokemon.getMaxHp() / 8))
.attr(PostBattleInitFormChangeAbAttr, () => 0)
.attr(PostFaintFormChangeAbAttr, () => 0)
.uncopiable()
.unreplaceable()
.unsuppressable()
@ -7304,6 +7325,7 @@ export function initAbilities() {
new Ability(AbilityId.BATTLE_BOND, 7)
.attr(PostVictoryFormChangeAbAttr, () => 2)
.attr(PostBattleInitFormChangeAbAttr, () => 1)
.attr(PostFaintFormChangeAbAttr, () => 1)
.attr(NoFusionAbilityAbAttr)
.uncopiable()
.unreplaceable()
@ -7315,6 +7337,7 @@ export function initAbilities() {
.conditionalAttr(p => p.formIndex === 4 || p.formIndex === 5, PostBattleInitFormChangeAbAttr, p => p.formIndex - 2)
.conditionalAttr(p => p.getHpRatio() <= 0.5 && (p.formIndex === 2 || p.formIndex === 3), PostSummonFormChangeAbAttr, p => p.formIndex + 2)
.conditionalAttr(p => p.getHpRatio() <= 0.5 && (p.formIndex === 2 || p.formIndex === 3), PostTurnFormChangeAbAttr, p => p.formIndex + 2)
.conditionalAttr(p => p.formIndex === 4 || p.formIndex === 5, PostFaintFormChangeAbAttr, p => p.formIndex - 2)
.attr(NoFusionAbilityAbAttr)
.uncopiable()
.unreplaceable()

View File

@ -165,7 +165,7 @@ describe("Abilities - Disguise", () => {
expect(mimikyu.formIndex).toBe(disguisedForm);
});
it("reverts to Disguised form on biome change when fainted", async () => {
it("reverts to Disguised form when fainted", async () => {
game.override
.startingWave(10)
.starterSpecies(0)
@ -181,10 +181,6 @@ describe("Abilities - Disguise", () => {
game.move.select(MoveId.SPLASH);
await game.killPokemon(mimikyu1);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
game.move.select(MoveId.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(mimikyu1.formIndex).toBe(disguisedForm);