mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 07:42:25 +02:00
refactor property pokemon.illusion to pokemon.battleData.illusion
This commit is contained in:
parent
947ee488f5
commit
7214c70f93
@ -2265,7 +2265,7 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.illusion.active) {
|
||||
if (target.battleData.illusion.active) {
|
||||
return false;
|
||||
}
|
||||
pokemon.summonData.speciesForm = target.getSpeciesForm();
|
||||
@ -4122,7 +4122,7 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr {
|
||||
}
|
||||
});
|
||||
|
||||
if (pokemon.illusion.available && !suppressed) {
|
||||
if (pokemon.battleData.illusion.available && !suppressed) {
|
||||
return pokemon.generateIllusion();
|
||||
} else {
|
||||
return false;
|
||||
@ -4164,7 +4164,7 @@ export class IllusionPostBattleAbAttr extends PostBattleAbAttr {
|
||||
*/
|
||||
applyPostBattle(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||
pokemon.breakIllusion();
|
||||
pokemon.illusion.available = true;
|
||||
pokemon.battleData.illusion.available = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -4180,7 +4180,7 @@ export class IllusionDisableAbAttr extends PostSummonAbAttr {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||
pokemon.illusion.available = false;
|
||||
pokemon.battleData.illusion.available = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -4950,9 +4950,9 @@ export function initAbilities() {
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
//The pokemon generate an illusion if it's available
|
||||
.conditionalAttr((pokemon) => pokemon.illusion.available, IllusionPreSummonAbAttr, false)
|
||||
.conditionalAttr((pokemon) => pokemon.battleData.illusion.available, IllusionPreSummonAbAttr, false)
|
||||
//The pokemon loses his illusion when he is damaged by a move
|
||||
.conditionalAttr((pokemon) => pokemon.illusion.active, IllusionBreakAbAttr, true)
|
||||
.conditionalAttr((pokemon) => pokemon.battleData.illusion.active, IllusionBreakAbAttr, true)
|
||||
//Illusion is available again after a battle
|
||||
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionPostBattleAbAttr, false)
|
||||
//Illusion is not available after summon
|
||||
|
@ -5816,7 +5816,7 @@ export class SuppressAbilitiesIfActedAttr extends MoveEffectAttr {
|
||||
export class TransformAttr extends MoveEffectAttr {
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
||||
return new Promise(resolve => {
|
||||
if (!super.apply(user, target, move, args) || target.illusion.active || user.illusion.active) {
|
||||
if (!super.apply(user, target, move, args) || target.battleData.illusion.active || user.battleData.illusion.active) {
|
||||
user.scene.queueMessage(i18next.t("battle:attackFailed"));
|
||||
return resolve(false);
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
public name: string;
|
||||
public nickname: string;
|
||||
public species: PokemonSpecies;
|
||||
public illusion: Illusion;
|
||||
public formIndex: integer;
|
||||
public abilityIndex: integer;
|
||||
public passive: boolean;
|
||||
@ -137,7 +136,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const randAbilityIndex = Utils.randSeedInt(2);
|
||||
|
||||
this.species = species;
|
||||
this.illusion = { active: false, available: true };
|
||||
|
||||
this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL;
|
||||
this.level = level;
|
||||
@ -258,8 +256,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
|
||||
|
||||
getNameToRender(useIllusion: boolean = true) {
|
||||
const name: string = (!useIllusion && this.illusion.active) ? this.illusion.name! : this.name;
|
||||
const nickname: string = (!useIllusion && this.illusion.active) ? this.illusion.nickname! : this.nickname;
|
||||
const name: string = (!useIllusion && this.battleData.illusion.active) ? this.battleData.illusion.name! : this.name;
|
||||
const nickname: string = (!useIllusion && this.battleData.illusion.active) ? this.battleData.illusion.nickname! : this.nickname;
|
||||
try {
|
||||
if (nickname) {
|
||||
return decodeURIComponent(escape(atob(nickname)));
|
||||
@ -274,6 +272,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
init(): void {
|
||||
this.fieldPosition = FieldPosition.CENTER;
|
||||
|
||||
this.resetBattleData();
|
||||
this.initBattleInfo();
|
||||
|
||||
this.scene.fieldUI.addAt(this.battleInfo, 0);
|
||||
@ -368,12 +367,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const lastPokemon: Pokemon = party.at(-1) || this;
|
||||
const speciesId = lastPokemon.species.speciesId;
|
||||
|
||||
if ( lastPokemon === this || this.illusion.active ||
|
||||
if ( lastPokemon === this || this.battleData.illusion.active ||
|
||||
((speciesId === Species.OGERPON || speciesId === Species.TERAPAGOS) && (lastPokemon.isTerastallized() || this.isTerastallized()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.illusion = {
|
||||
this.battleData.illusion = {
|
||||
active: true,
|
||||
available: true,
|
||||
name: this.name,
|
||||
@ -424,7 +423,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
const randomIllusion: PokemonSpecies = getPokemonSpecies(availables[this.randSeedInt(availables.length)]);
|
||||
|
||||
this.illusion = {
|
||||
this.battleData.illusion = {
|
||||
active: true,
|
||||
available: true,
|
||||
species: randomIllusion,
|
||||
@ -441,17 +440,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
breakIllusion(): boolean {
|
||||
if (!this.illusion.active) {
|
||||
if (!this.battleData.illusion.active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.name = this.illusion.name!;
|
||||
this.nickname = this.illusion.nickname!;
|
||||
this.shiny = this.illusion.shiny!;
|
||||
this.variant = this.illusion.variant!;
|
||||
this.fusionVariant = this.illusion.fusionVariant!;
|
||||
this.fusionShiny = this.illusion.fusionShiny!;
|
||||
this.illusion = {active: false, available: false};
|
||||
this.name = this.battleData.illusion.name!;
|
||||
this.nickname = this.battleData.illusion.nickname!;
|
||||
this.shiny = this.battleData.illusion.shiny!;
|
||||
this.variant = this.battleData.illusion.variant!;
|
||||
this.fusionVariant = this.battleData.illusion.fusionVariant!;
|
||||
this.fusionShiny = this.battleData.illusion.fusionShiny!;
|
||||
this.battleData.illusion = {active: false, available: false};
|
||||
if (this.isOnField()) {
|
||||
this.scene.playSound("PRSFX- Transform");
|
||||
}
|
||||
@ -480,15 +479,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
Promise.allSettled(moveIds.map(m => initMoveAnim(this.scene, m)))
|
||||
.then(() => {
|
||||
loadMoveAnimAssets(this.scene, moveIds);
|
||||
const formIndex = this.illusion.active && useIllusion ? this.illusion.formIndex : this.formIndex;
|
||||
const formIndex = this.battleData.illusion.active && useIllusion ? this.battleData.illusion.formIndex : this.formIndex;
|
||||
this.getSpeciesForm(false, useIllusion).loadAssets(this.scene, this.getGender(useIllusion) === Gender.FEMALE, formIndex, this.isShiny(useIllusion), this.getVariant(useIllusion));
|
||||
if (this.isPlayer() || this.getFusionSpeciesForm(false, useIllusion)) {
|
||||
this.scene.loadPokemonAtlas(this.getBattleSpriteKey(true, ignoreOverride), this.getBattleSpriteAtlasPath(true, ignoreOverride));
|
||||
}
|
||||
if (this.getFusionSpeciesForm(false, useIllusion)) {
|
||||
const fusionFormIndex = this.illusion.active && useIllusion ? this.illusion.fusionFormIndex : this.fusionFormIndex;
|
||||
const fusionShiny = this.illusion.active && !useIllusion ? this.illusion.fusionShiny : this.fusionShiny;
|
||||
const fusionVariant = this.illusion.active && !useIllusion ? this.illusion.fusionVariant : this.fusionVariant;
|
||||
const fusionFormIndex = this.battleData.illusion.active && useIllusion ? this.battleData.illusion.fusionFormIndex : this.fusionFormIndex;
|
||||
const fusionShiny = this.battleData.illusion.active && !useIllusion ? this.battleData.illusion.fusionShiny : this.fusionShiny;
|
||||
const fusionVariant = this.battleData.illusion.active && !useIllusion ? this.battleData.illusion.fusionVariant : this.fusionVariant;
|
||||
this.getFusionSpeciesForm(false, useIllusion).loadAssets(this.scene, this.getFusionGender(false, useIllusion) === Gender.FEMALE, fusionFormIndex, fusionShiny, fusionVariant);
|
||||
this.scene.loadPokemonAtlas(this.getFusionBattleSpriteKey(true, ignoreOverride), this.getFusionBattleSpriteAtlasPath(true, ignoreOverride));
|
||||
}
|
||||
@ -589,7 +588,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
getSpriteId(ignoreOverride?: boolean): string {
|
||||
const formIndex: integer = this.illusion.active ? this.illusion.formIndex! : this.formIndex;
|
||||
const formIndex: integer = this.battleData.illusion.active ? this.battleData.illusion.formIndex! : this.formIndex;
|
||||
return this.getSpeciesForm(ignoreOverride, true).getSpriteId(this.getGender(ignoreOverride, true) === Gender.FEMALE, formIndex, this.shiny, this.variant);
|
||||
}
|
||||
|
||||
@ -598,7 +597,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
back = this.isPlayer();
|
||||
}
|
||||
|
||||
const formIndex: integer = this.illusion.active ? this.illusion.formIndex! : this.formIndex;
|
||||
const formIndex: integer = this.battleData.illusion.active ? this.battleData.illusion.formIndex! : this.formIndex;
|
||||
|
||||
return this.getSpeciesForm(ignoreOverride, true).getSpriteId(this.getGender(ignoreOverride, true) === Gender.FEMALE, formIndex, this.shiny, this.variant, back);
|
||||
}
|
||||
@ -607,8 +606,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
return this.getSpeciesForm(ignoreOverride, false).getSpriteKey(
|
||||
this.getGender(ignoreOverride) === Gender.FEMALE,
|
||||
this.formIndex,
|
||||
this.illusion.shiny ?? this.shiny,
|
||||
this.illusion.variant ?? this.variant
|
||||
this.battleData.illusion.shiny ?? this.shiny,
|
||||
this.battleData.illusion.variant ?? this.variant
|
||||
);
|
||||
}
|
||||
|
||||
@ -617,7 +616,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
getFusionSpriteId(ignoreOverride?: boolean): string {
|
||||
const fusionFormIndex: integer = this.illusion.active ? this.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
const fusionFormIndex: integer = this.battleData.illusion.active ? this.battleData.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
return this.getFusionSpeciesForm(ignoreOverride, true).getSpriteId(this.getFusionGender(ignoreOverride, true) === Gender.FEMALE, fusionFormIndex, this.fusionShiny, this.fusionVariant);
|
||||
}
|
||||
|
||||
@ -626,7 +625,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
back = this.isPlayer();
|
||||
}
|
||||
|
||||
const fusionFormIndex: integer = this.illusion.active ? this.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
const fusionFormIndex: integer = this.battleData.illusion.active ? this.battleData.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
|
||||
return this.getFusionSpeciesForm(ignoreOverride, true).getSpriteId(this.getFusionGender(ignoreOverride, true) === Gender.FEMALE, fusionFormIndex, this.fusionShiny, this.fusionVariant, back);
|
||||
}
|
||||
@ -640,7 +639,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
getIconAtlasKey(ignoreOverride?: boolean): string {
|
||||
const formIndex: integer = this.illusion.active ? this.illusion.formIndex! : this.formIndex;
|
||||
const formIndex: integer = this.battleData.illusion.active ? this.battleData.illusion.formIndex! : this.formIndex;
|
||||
return this.getSpeciesForm(ignoreOverride, true).getIconAtlasKey(formIndex, this.shiny, this.variant);
|
||||
}
|
||||
|
||||
@ -649,12 +648,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
getIconId(ignoreOverride?: boolean): string {
|
||||
const formIndex: integer = this.illusion.active ? this.illusion.formIndex! : this.formIndex;
|
||||
const formIndex: integer = this.battleData.illusion.active ? this.battleData.illusion.formIndex! : this.formIndex;
|
||||
return this.getSpeciesForm(ignoreOverride, true).getIconId(this.getGender(ignoreOverride, true) === Gender.FEMALE, formIndex, this.shiny, this.variant);
|
||||
}
|
||||
|
||||
getFusionIconId(ignoreOverride?: boolean): string {
|
||||
const fusionFormIndex: integer = this.illusion.active ? this.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
const fusionFormIndex: integer = this.battleData.illusion.active ? this.battleData.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
return this.getFusionSpeciesForm(ignoreOverride, true).getIconId(this.getFusionGender(ignoreOverride, true) === Gender.FEMALE, fusionFormIndex, this.fusionShiny, this.fusionVariant);
|
||||
}
|
||||
|
||||
@ -662,8 +661,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param {boolean} useIllusion - Whether we want the speciesForm of the illusion or not.
|
||||
*/
|
||||
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||
const species: PokemonSpecies = useIllusion && this.illusion.active ? this.illusion.species! : this.species;
|
||||
const formIndex: integer = useIllusion && this.illusion.active ? this.illusion.formIndex! : this.formIndex;
|
||||
const species: PokemonSpecies = useIllusion && this.battleData.illusion.active ? this.battleData.illusion.species! : this.species;
|
||||
const formIndex: integer = useIllusion && this.battleData.illusion.active ? this.battleData.illusion.formIndex! : this.formIndex;
|
||||
|
||||
if (!ignoreOverride && this.summonData?.speciesForm) {
|
||||
return this.summonData.speciesForm;
|
||||
@ -680,8 +679,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param {boolean} useIllusion - Whether we want the fusionSpeciesForm of the illusion or not.
|
||||
*/
|
||||
getFusionSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||
const fusionSpecies: PokemonSpecies = useIllusion && this.illusion.active ? this.illusion.fusionSpecies! : this.fusionSpecies!;
|
||||
const fusionFormIndex: integer = useIllusion && this.illusion.active ? this.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
const fusionSpecies: PokemonSpecies = useIllusion && this.battleData.illusion.active ? this.battleData.illusion.fusionSpecies! : this.fusionSpecies!;
|
||||
const fusionFormIndex: integer = useIllusion && this.battleData.illusion.active ? this.battleData.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||
|
||||
if (!ignoreOverride && this.summonData?.speciesForm) {
|
||||
return this.summonData.fusionSpeciesForm;
|
||||
@ -1003,8 +1002,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param {boolean} useIllusion - Whether we want the gender of the illusion or not.
|
||||
*/
|
||||
getGender(ignoreOverride?: boolean, useIllusion: boolean = false): Gender {
|
||||
if (useIllusion && this.illusion.active) {
|
||||
return this.illusion.gender!;
|
||||
console.log("ALLLO", this.battleData.illusion.active);
|
||||
if (useIllusion && this.battleData.illusion.active) {
|
||||
return this.battleData.illusion.gender!;
|
||||
} else if (!ignoreOverride && this.summonData?.gender !== undefined) {
|
||||
return this.summonData.gender;
|
||||
}
|
||||
@ -1015,8 +1015,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param {boolean} useIllusion - Whether we want the fusionGender of the illusion or not.
|
||||
*/
|
||||
getFusionGender(ignoreOverride?: boolean, useIllusion: boolean = false): Gender {
|
||||
if (useIllusion && this.illusion.active) {
|
||||
return this.illusion.fusionGender!;
|
||||
if (useIllusion && this.battleData.illusion.active) {
|
||||
return this.battleData.illusion.fusionGender!;
|
||||
} else if (!ignoreOverride && this.summonData?.fusionGender !== undefined) {
|
||||
return this.summonData.fusionGender;
|
||||
}
|
||||
@ -1024,24 +1024,24 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
isShiny(useIllusion: boolean = false): boolean {
|
||||
if (!useIllusion && this.illusion.active) {
|
||||
return this.illusion.shiny || (!!this.illusion.fusionSpecies && this.illusion.fusionShiny) || false;
|
||||
if (!useIllusion && this.battleData.illusion.active) {
|
||||
return this.battleData.illusion.shiny || (!!this.battleData.illusion.fusionSpecies && this.battleData.illusion.fusionShiny) || false;
|
||||
} else {
|
||||
return this.shiny || (this.isFusion(useIllusion) && this.fusionShiny);
|
||||
}
|
||||
}
|
||||
|
||||
isDoubleShiny(useIllusion: boolean = false): boolean {
|
||||
if (!useIllusion && this.illusion.active) {
|
||||
return this.isFusion(false) && this.illusion.shiny! && this.illusion.fusionShiny!;
|
||||
if (!useIllusion && this.battleData.illusion.active) {
|
||||
return this.isFusion(false) && this.battleData.illusion.shiny! && this.battleData.illusion.fusionShiny!;
|
||||
} else {
|
||||
return this.isFusion(useIllusion) && this.shiny && this.fusionShiny;
|
||||
}
|
||||
}
|
||||
|
||||
getVariant(useIllusion: boolean = false): Variant {
|
||||
if (!useIllusion && this.illusion.active) {
|
||||
return !this.isFusion(false) ? this.illusion.variant! : Math.max(this.variant, this.fusionVariant) as Variant;
|
||||
if (!useIllusion && this.battleData.illusion.active) {
|
||||
return !this.isFusion(false) ? this.battleData.illusion.variant! : Math.max(this.variant, this.fusionVariant) as Variant;
|
||||
} else {
|
||||
return !this.isFusion(true) ? this.variant : Math.max(this.variant, this.fusionVariant) as Variant;
|
||||
}
|
||||
@ -1050,7 +1050,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
|
||||
getBaseVariant(doubleShiny: boolean): Variant {
|
||||
if (doubleShiny) {
|
||||
return this.illusion.active ? this.illusion.variant! : this.variant;
|
||||
return this.battleData.illusion.active ? this.battleData.illusion.variant! : this.variant;
|
||||
} else {
|
||||
return this.getVariant();
|
||||
}
|
||||
@ -1061,15 +1061,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
isFusion(useIllusion: boolean = false): boolean {
|
||||
if (useIllusion && this.illusion.active) {
|
||||
return !!this.illusion.fusionSpecies;
|
||||
if (useIllusion && this.battleData.illusion.active) {
|
||||
return !!this.battleData.illusion.fusionSpecies;
|
||||
} else {
|
||||
return !!this.fusionSpecies;
|
||||
}
|
||||
}
|
||||
|
||||
getName(illusion: boolean = false): string {
|
||||
return (!illusion && this.illusion.active && this.illusion.name) ? this.illusion.name : this.name;
|
||||
return (!illusion && this.battleData.illusion.active && this.battleData.illusion.name) ? this.battleData.illusion.name : this.name;
|
||||
}
|
||||
|
||||
abstract isBoss(): boolean;
|
||||
@ -1147,7 +1147,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
if (!types.length || !includeTeraType) {
|
||||
const doIllusion: boolean = useIllusion === "AUTO" ? !forDefend : useIllusion;
|
||||
if (!ignoreOverride && this.summonData?.types && this.summonData.types.length !== 0 && (!this.illusion.active || !doIllusion)) {
|
||||
if (!ignoreOverride && this.summonData?.types && this.summonData.types.length !== 0 && (!this.battleData.illusion.active || !doIllusion)) {
|
||||
this.summonData.types.forEach(t => types.push(t));
|
||||
} else {
|
||||
const speciesForm = this.getSpeciesForm(ignoreOverride, doIllusion);
|
||||
@ -4537,6 +4537,7 @@ export class PokemonBattleData {
|
||||
public berriesEaten: BerryType[] = [];
|
||||
public abilitiesApplied: Abilities[] = [];
|
||||
public abilityRevealed: boolean = false;
|
||||
public illusion: Illusion = { active: false, available: true };
|
||||
}
|
||||
|
||||
export class PokemonBattleSummonData {
|
||||
|
@ -95,7 +95,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
||||
const pokemon = this.getPokemon();
|
||||
|
||||
const pokeball = this.scene.addFieldSprite(
|
||||
this.player ? 36 : 248, this.player ? 80 : 44, "pb", getPokeballAtlasKey(pokemon.illusion.pokeball ?? pokemon.pokeball)
|
||||
this.player ? 36 : 248, this.player ? 80 : 44, "pb", getPokeballAtlasKey(pokemon.battleData.illusion.pokeball ?? pokemon.pokeball)
|
||||
);
|
||||
pokeball.setVisible(false);
|
||||
pokeball.setOrigin(0.5, 0.625);
|
||||
@ -142,7 +142,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
||||
}
|
||||
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
||||
}
|
||||
addPokeballOpenParticles(this.scene, pokemon.x, pokemon.y - 16, pokemon.illusion.pokeball ?? pokemon.pokeball);
|
||||
addPokeballOpenParticles(this.scene, pokemon.x, pokemon.y - 16, pokemon.battleData.illusion.pokeball ?? pokemon.pokeball);
|
||||
this.scene.updateModifiers(this.player);
|
||||
this.scene.updateFieldScale();
|
||||
pokemon.showInfo();
|
||||
@ -150,7 +150,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
||||
pokemon.setVisible(true);
|
||||
pokemon.getSprite().setVisible(true);
|
||||
pokemon.setScale(0.5);
|
||||
pokemon.tint(getPokeballTintColor(pokemon.illusion.pokeball ?? pokemon.pokeball));
|
||||
pokemon.tint(getPokeballTintColor(pokemon.battleData.illusion.pokeball ?? pokemon.pokeball));
|
||||
pokemon.untint(250, "Sine.easeIn");
|
||||
this.scene.updateFieldScale();
|
||||
this.scene.tweens.add({
|
||||
|
@ -76,7 +76,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
||||
);
|
||||
this.scene.playSound("pb_rel");
|
||||
pokemon.hideInfo();
|
||||
pokemon.tint(getPokeballTintColor(pokemon.illusion.pokeball ?? pokemon.pokeball), 1, 250, "Sine.easeIn");
|
||||
pokemon.tint(getPokeballTintColor(pokemon.battleData.illusion.pokeball ?? pokemon.pokeball), 1, 250, "Sine.easeIn");
|
||||
this.scene.tweens.add({
|
||||
targets: pokemon,
|
||||
duration: 250,
|
||||
@ -118,7 +118,6 @@ export class SwitchSummonPhase extends SummonPhase {
|
||||
);
|
||||
// Ensure improperly persisted summon data (such as tags) is cleared upon switching
|
||||
if (!this.batonPass) {
|
||||
switchedInPokemon.resetBattleData();
|
||||
switchedInPokemon.resetSummonData();
|
||||
}
|
||||
this.summon();
|
||||
|
@ -44,9 +44,9 @@ describe("Abilities - Illusion", () => {
|
||||
const zoroark = game.scene.getPlayerPokemon()!;
|
||||
const zorua = game.scene.getEnemyPokemon()!;
|
||||
|
||||
expect(zoroark.illusion.active).equals(true);
|
||||
expect(zorua.illusion.active).equals(true);
|
||||
expect(zoroark.illusion.available).equals(false);
|
||||
expect(zoroark.battleData.illusion.active).equals(true);
|
||||
expect(zorua.battleData.illusion.active).equals(true);
|
||||
expect(zoroark.battleData.illusion.available).equals(false);
|
||||
});
|
||||
|
||||
it("break after receiving damaging move", async () => {
|
||||
@ -57,7 +57,7 @@ describe("Abilities - Illusion", () => {
|
||||
|
||||
const zorua = game.scene.getEnemyPokemon()!;
|
||||
|
||||
expect(zorua.illusion.active).equals(false);
|
||||
expect(zorua.battleData.illusion.active).equals(false);
|
||||
});
|
||||
|
||||
it("break after getting ability changed", async () => {
|
||||
@ -68,7 +68,7 @@ describe("Abilities - Illusion", () => {
|
||||
|
||||
const zorua = game.scene.getEnemyPokemon()!;
|
||||
|
||||
expect(zorua.illusion.active).equals(false);
|
||||
expect(zorua.battleData.illusion.active).equals(false);
|
||||
});
|
||||
|
||||
it("break if the ability is suppressed", async () => {
|
||||
@ -77,7 +77,7 @@ describe("Abilities - Illusion", () => {
|
||||
|
||||
const zorua = game.scene.getEnemyPokemon()!;
|
||||
|
||||
expect(zorua.illusion.active).equals(false);
|
||||
expect(zorua.battleData.illusion.active).equals(false);
|
||||
});
|
||||
|
||||
it("trick the enemy AI for moves effectiveness using ILLUSION type instead of actual type", async () => {
|
||||
@ -107,7 +107,7 @@ describe("Abilities - Illusion", () => {
|
||||
|
||||
const zoroark = game.scene.getPlayerPokemon()!;
|
||||
|
||||
expect(zoroark.illusion.active).equals(true);
|
||||
expect(zoroark.battleData.illusion.active).equals(true);
|
||||
});
|
||||
|
||||
it("copy the the name, the nickname, the gender, the shininess and the pokeball of the pokemon", async () => {
|
||||
@ -130,6 +130,6 @@ describe("Abilities - Illusion", () => {
|
||||
expect(zoroark.getNameToRender()).equals("axew nickname");
|
||||
expect(zoroark.getGender(false, true)).equals(Gender.FEMALE);
|
||||
expect(zoroark.isShiny(true)).equals(true);
|
||||
expect(zoroark.illusion.pokeball).equals(PokeballType.GREAT_BALL);
|
||||
expect(zoroark.battleData.illusion.pokeball).equals(PokeballType.GREAT_BALL);
|
||||
});
|
||||
});
|
||||
|
@ -540,7 +540,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
||||
return resolve();
|
||||
}
|
||||
|
||||
const gender: Gender = pokemon.illusion.active ? pokemon.illusion.gender! : pokemon.gender;
|
||||
const gender: Gender = pokemon.battleData.illusion.active ? pokemon.battleData.illusion.gender! : pokemon.gender;
|
||||
|
||||
this.genderText.setText(getGenderSymbol(gender));
|
||||
this.genderText.setColor(getGenderColor(gender));
|
||||
@ -690,7 +690,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
||||
const nameSizeTest = addTextObject(this.scene, 0, 0, displayName, TextStyle.BATTLE_INFO);
|
||||
nameTextWidth = nameSizeTest.displayWidth;
|
||||
|
||||
const gender: Gender = pokemon.illusion.active ? pokemon.illusion.gender! : pokemon.gender;
|
||||
const gender: Gender = pokemon.battleData.illusion.active ? pokemon.battleData.illusion.gender! : pokemon.gender;
|
||||
while (nameTextWidth > (this.player || !this.boss ? 60 : 98) - ((gender !== Gender.GENDERLESS ? 6 : 0) + (pokemon.fusionSpecies ? 8 : 0) + (pokemon.isShiny() ? 8 : 0) + (Math.min(pokemon.level.toString().length, 3) - 3) * 8)) {
|
||||
displayName = `${displayName.slice(0, displayName.endsWith(".") ? -2 : -1).trimEnd()}.`;
|
||||
nameSizeTest.setText(displayName);
|
||||
|
@ -1282,7 +1282,7 @@ class PartySlot extends Phaser.GameObjects.Container {
|
||||
const fusionShinyStar = this.scene.add.image(0, 0, "shiny_star_small_2");
|
||||
fusionShinyStar.setOrigin(0, 0);
|
||||
fusionShinyStar.setPosition(shinyStar.x, shinyStar.y);
|
||||
fusionShinyStar.setTint(getVariantTint(this.pokemon.illusion.fusionVariant ?? this.pokemon.fusionVariant));
|
||||
fusionShinyStar.setTint(getVariantTint(this.pokemon.battleData.illusion.fusionVariant ?? this.pokemon.fusionVariant));
|
||||
|
||||
slotInfoContainer.add(fusionShinyStar);
|
||||
}
|
||||
|
@ -300,8 +300,8 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
this.pokemonSprite.setPipelineData("teraColor", getTypeRgb(this.pokemon.getTeraType()));
|
||||
this.pokemonSprite.setPipelineData("ignoreTimeTint", true);
|
||||
this.pokemonSprite.setPipelineData("spriteKey", this.pokemon.getSpriteKey());
|
||||
this.pokemonSprite.setPipelineData("shiny", this.pokemon.illusion.shiny ?? this.pokemon.shiny);
|
||||
this.pokemonSprite.setPipelineData("variant", this.pokemon.illusion.variant ?? this.pokemon.variant);
|
||||
this.pokemonSprite.setPipelineData("shiny", this.pokemon.battleData.illusion.shiny ?? this.pokemon.shiny);
|
||||
this.pokemonSprite.setPipelineData("variant", this.pokemon.battleData.illusion.variant ?? this.pokemon.variant);
|
||||
[ "spriteColors", "fusionSpriteColors" ].map(k => {
|
||||
delete this.pokemonSprite.pipelineData[`${k}Base`];
|
||||
if (this.pokemon?.summonData?.speciesForm) {
|
||||
@ -363,7 +363,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
this.fusionShinyIcon.setPosition(this.shinyIcon.x, this.shinyIcon.y);
|
||||
this.fusionShinyIcon.setVisible(doubleShiny);
|
||||
if (isFusion) {
|
||||
this.fusionShinyIcon.setTint(getVariantTint(this.pokemon.illusion.fusionVariant ?? this.pokemon.fusionVariant));
|
||||
this.fusionShinyIcon.setTint(getVariantTint(this.pokemon.battleData.illusion.fusionVariant ?? this.pokemon.fusionVariant));
|
||||
}
|
||||
|
||||
this.pokeball.setFrame(getPokeballAtlasKey(this.pokemon.pokeball));
|
||||
|
Loading…
Reference in New Issue
Block a user