rename some parameters back in useIllusion

This commit is contained in:
Lylian 2025-03-31 16:54:21 +02:00
parent 0e68cc347a
commit d05e1d3624

View File

@ -541,11 +541,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
/** /**
* @param {boolean} fakeName - Whether we want the fake name or the real name of the Pokemon (for Illusion ability). * @param {boolean} useIllusion - Whether we want the fake name or the real name of the Pokemon (for Illusion ability).
*/ */
getNameToRender(fakeName: boolean = true) { getNameToRender(useIllusion: boolean = true) {
const name: string = (!fakeName && this.battleData?.illusion.active) ? this.battleData?.illusion.basePokemon!.name : this.name; const name: string = (!useIllusion && this.battleData?.illusion.active) ? this.battleData?.illusion.basePokemon!.name : this.name;
const nickname: string = (!fakeName && this.battleData?.illusion.active) ? this.battleData?.illusion.basePokemon!.nickname : this.nickname; const nickname: string = (!useIllusion && this.battleData?.illusion.active) ? this.battleData?.illusion.basePokemon!.nickname : this.nickname;
try { try {
if (nickname) { if (nickname) {
return decodeURIComponent(escape(atob(nickname))); return decodeURIComponent(escape(atob(nickname)));
@ -1824,10 +1824,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
/** /**
* @param {boolean} fakeGender - Whether we want the fake or real gender (illusion ability). * @param {boolean} useIllusion - Whether we want the fake or real gender (illusion ability).
*/ */
getGender(ignoreOverride?: boolean, fakeGender: boolean = false): Gender { getGender(ignoreOverride?: boolean, useIllusion: boolean = false): Gender {
if (fakeGender && this.battleData?.illusion.active) { if (useIllusion && this.battleData?.illusion.active) {
return this.battleData?.illusion.gender!; return this.battleData?.illusion.gender!;
} else if (!ignoreOverride && this.summonData?.gender !== undefined) { } else if (!ignoreOverride && this.summonData?.gender !== undefined) {
return this.summonData.gender; return this.summonData.gender;
@ -1836,10 +1836,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
/** /**
* @param {boolean} fakeGender - Whether we want the fake or real gender (illusion ability). * @param {boolean} useIllusion - Whether we want the fake or real gender (illusion ability).
*/ */
getFusionGender(ignoreOverride?: boolean, fakeGender: boolean = false): Gender { getFusionGender(ignoreOverride?: boolean, useIllusion: boolean = false): Gender {
if (fakeGender && this.battleData?.illusion.active) { if (useIllusion && this.battleData?.illusion.active) {
return this.battleData?.illusion.fusionGender!; return this.battleData?.illusion.fusionGender!;
} else if (!ignoreOverride && this.summonData?.fusionGender !== undefined) { } else if (!ignoreOverride && this.summonData?.fusionGender !== undefined) {
return this.summonData.fusionGender; return this.summonData.fusionGender;
@ -1848,34 +1848,34 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
/** /**
* @param {boolean} fakeShininess - Whether we want the fake or real shininess (illusion ability). * @param {boolean} useIllusion - Whether we want the fake or real shininess (illusion ability).
*/ */
isShiny(fakeShininess: boolean = false): boolean { isShiny(useIllusion: boolean = false): boolean {
if (!fakeShininess && this.battleData?.illusion.active) { if (!useIllusion && this.battleData?.illusion.active) {
return this.battleData?.illusion.basePokemon?.shiny || (!!this.battleData?.illusion.fusionSpecies && this.battleData?.illusion.basePokemon?.fusionShiny) || false; return this.battleData?.illusion.basePokemon?.shiny || (!!this.battleData?.illusion.fusionSpecies && this.battleData?.illusion.basePokemon?.fusionShiny) || false;
} else { } else {
return this.shiny || (this.isFusion(fakeShininess) && this.fusionShiny); return this.shiny || (this.isFusion(useIllusion) && this.fusionShiny);
} }
} }
/** /**
* *
* @param fakeShininess - Whether we want the fake or real shininess (illusion ability). * @param useIllusion - Whether we want the fake or real shininess (illusion ability).
* @returns `true` if the {@linkcode Pokemon} is shiny and the fusion is shiny as well, `false` otherwise * @returns `true` if the {@linkcode Pokemon} is shiny and the fusion is shiny as well, `false` otherwise
*/ */
isDoubleShiny(fakeShininess: boolean = false): boolean { isDoubleShiny(useIllusion: boolean = false): boolean {
if (!fakeShininess && this.battleData?.illusion.active) { if (!useIllusion && this.battleData?.illusion.active) {
return this.isFusion(false) && this.battleData?.illusion.basePokemon!.shiny && this.battleData?.illusion.basePokemon.fusionShiny; return this.isFusion(false) && this.battleData?.illusion.basePokemon!.shiny && this.battleData?.illusion.basePokemon.fusionShiny;
} else { } else {
return this.isFusion(fakeShininess) && this.shiny && this.fusionShiny; return this.isFusion(useIllusion) && this.shiny && this.fusionShiny;
} }
} }
/** /**
* @param {boolean} fakeVariant - Whether we want the fake or real variant (illusion ability). * @param {boolean} useIllusion - Whether we want the fake or real variant (illusion ability).
*/ */
getVariant(fakeVariant: boolean = false): Variant { getVariant(useIllusion: boolean = false): Variant {
if (!fakeVariant && this.battleData?.illusion.active) { if (!useIllusion && this.battleData?.illusion.active) {
return !this.isFusion(false) return !this.isFusion(false)
? this.battleData?.illusion.basePokemon!.variant ? this.battleData?.illusion.basePokemon!.variant
: Math.max(this.variant, this.fusionVariant) as Variant; : Math.max(this.variant, this.fusionVariant) as Variant;
@ -1910,10 +1910,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
/** /**
* @param {boolean} fakeName - Whether we want the fake name or the real name of the Pokemon (for Illusion ability). * @param {boolean} useIllusion - Whether we want the fake name or the real name of the Pokemon (for Illusion ability).
*/ */
getName(fakeName: boolean = false): string { getName(useIllusion: boolean = false): string {
return (!fakeName && this.battleData?.illusion.active && this.battleData?.illusion.basePokemon) return (!useIllusion && this.battleData?.illusion.active && this.battleData?.illusion.basePokemon)
? this.battleData?.illusion.basePokemon.name ? this.battleData?.illusion.basePokemon.name
: this.name; : this.name;
} }
@ -2030,14 +2030,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @param includeTeraType - `true` to include tera-formed type; Default: `false` * @param includeTeraType - `true` to include tera-formed type; Default: `false`
* @param forDefend - `true` if the pokemon is defending from an attack; Default: `false` * @param forDefend - `true` if the pokemon is defending from an attack; Default: `false`
* @param ignoreOverride - If `true`, ignore ability changing effects; Default: `false` * @param ignoreOverride - If `true`, ignore ability changing effects; Default: `false`
* @param fakeType - `true` to return the types of the illusion instead of the actual types; "AUTO" will depend on forDefend param; Default: "AUTO" * @param useIllusion - `true` to return the types of the illusion instead of the actual types; "AUTO" will depend on forDefend param; Default: "AUTO"
* @returns array of {@linkcode PokemonType} * @returns array of {@linkcode PokemonType}
*/ */
public getTypes( public getTypes(
includeTeraType = false, includeTeraType = false,
forDefend: boolean = false, forDefend: boolean = false,
ignoreOverride?: boolean, ignoreOverride?: boolean,
fakeType: boolean | "AUTO" = "AUTO" useIllusion: boolean | "AUTO" = "AUTO"
): PokemonType[] { ): PokemonType[] {
const types: PokemonType[] = []; const types: PokemonType[] = [];
@ -2053,7 +2053,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
if (!types.length || !includeTeraType) { if (!types.length || !includeTeraType) {
const doIllusion: boolean = (fakeType === "AUTO") ? !forDefend : fakeType; const doIllusion: boolean = (useIllusion === "AUTO") ? !forDefend : useIllusion;
if ( if (
!ignoreOverride && !ignoreOverride &&
this.summonData?.types && this.summonData?.types &&
@ -2616,7 +2616,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @param ignoreAbility Whether to ignore abilities that might affect type effectiveness or immunity (defaults to `false`). * @param ignoreAbility Whether to ignore abilities that might affect type effectiveness or immunity (defaults to `false`).
* @param simulated Whether to apply abilities via simulated calls (defaults to `true`) * @param simulated Whether to apply abilities via simulated calls (defaults to `true`)
* @param cancelled {@linkcode Utils.BooleanHolder} Stores whether the move was cancelled by a non-type-based immunity. * @param cancelled {@linkcode Utils.BooleanHolder} Stores whether the move was cancelled by a non-type-based immunity.
* @param {boolean} useFakeType - Whether we want the attack move effectiveness on the illusion or not * @param {boolean} useIllusion - Whether we want the attack move effectiveness on the illusion or not
* Currently only used by {@linkcode Pokemon.apply} to determine whether a "No effect" message should be shown. * Currently only used by {@linkcode Pokemon.apply} to determine whether a "No effect" message should be shown.
* @returns The type damage multiplier, indicating the effectiveness of the move * @returns The type damage multiplier, indicating the effectiveness of the move
*/ */
@ -2626,7 +2626,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
ignoreAbility: boolean = false, ignoreAbility: boolean = false,
simulated: boolean = true, simulated: boolean = true,
cancelled?: Utils.BooleanHolder, cancelled?: Utils.BooleanHolder,
useFakeType: boolean = false useIllusion: boolean = false
): TypeDamageMultiplier { ): TypeDamageMultiplier {
if (!Utils.isNullOrUndefined(this.turnData?.moveEffectiveness)) { if (!Utils.isNullOrUndefined(this.turnData?.moveEffectiveness)) {
return this.turnData?.moveEffectiveness; return this.turnData?.moveEffectiveness;
@ -2646,7 +2646,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
false, false,
simulated, simulated,
move, move,
useFakeType useIllusion
) )
: 1); : 1);
@ -2752,7 +2752,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @param ignoreStrongWinds whether or not this ignores strong winds (anticipation, forewarn, stealth rocks) * @param ignoreStrongWinds whether or not this ignores strong winds (anticipation, forewarn, stealth rocks)
* @param simulated tag to only apply the strong winds effect message when the move is used * @param simulated tag to only apply the strong winds effect message when the move is used
* @param move (optional) the move whose type effectiveness is to be checked. Used for applying {@linkcode VariableMoveTypeChartAttr} * @param move (optional) the move whose type effectiveness is to be checked. Used for applying {@linkcode VariableMoveTypeChartAttr}
* @param {boolean} useFakeType - Whether we want the attack type effectiveness on the illusion or not * @param {boolean} useIllusion - Whether we want the attack type effectiveness on the illusion or not
* @returns a multiplier for the type effectiveness * @returns a multiplier for the type effectiveness
*/ */
getAttackTypeEffectiveness( getAttackTypeEffectiveness(
@ -2761,12 +2761,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
ignoreStrongWinds: boolean = false, ignoreStrongWinds: boolean = false,
simulated: boolean = true, simulated: boolean = true,
move?: Move, move?: Move,
useFakeType: boolean = false useIllusion: boolean = false
): TypeDamageMultiplier { ): TypeDamageMultiplier {
if (moveType === PokemonType.STELLAR) { if (moveType === PokemonType.STELLAR) {
return this.isTerastallized ? 2 : 1; return this.isTerastallized ? 2 : 1;
} }
const types = this.getTypes(true, true, undefined, useFakeType); const types = this.getTypes(true, true, undefined, useIllusion);
const arena = globalScene.arena; const arena = globalScene.arena;
// Handle flying v ground type immunity without removing flying type so effective types are still effective // Handle flying v ground type immunity without removing flying type so effective types are still effective