mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-18 14:22:19 +02:00
refactor battleData.illusion as summonData.illusion and delete oncePerBattleClause
This commit is contained in:
parent
d05e1d3624
commit
9db05ed86a
@ -886,16 +886,16 @@ export default class BattleScene extends SceneBase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPlayerParty(fakeShininess = true): PlayerPokemon[] {
|
public getPlayerParty(useIllusion = true): PlayerPokemon[] {
|
||||||
const party = this.party;
|
const party = this.party;
|
||||||
if (!fakeShininess) {
|
if (!useIllusion) {
|
||||||
party.map(pokemon => {
|
party.map(pokemon => {
|
||||||
pokemon.shiny = pokemon.isShiny();
|
pokemon.shiny = pokemon.isShiny();
|
||||||
pokemon.variant = pokemon.getVariant();
|
pokemon.variant = pokemon.getVariant();
|
||||||
pokemon.name = pokemon.getNameToRender();
|
pokemon.name = pokemon.getNameToRender();
|
||||||
if (pokemon.isFusion()) {
|
if (pokemon.isFusion()) {
|
||||||
pokemon.fusionVariant = pokemon.battleData?.illusion.basePokemon?.fusionVariant ?? pokemon.fusionVariant;
|
pokemon.fusionVariant = pokemon.summonData?.illusion?.basePokemon.fusionVariant ?? pokemon.fusionVariant;
|
||||||
pokemon.fusionShiny = pokemon.battleData?.illusion.basePokemon?.fusionShiny ?? pokemon.fusionShiny;
|
pokemon.fusionShiny = pokemon.summonData?.illusion?.basePokemon.fusionShiny ?? pokemon.fusionShiny;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2785,7 +2785,7 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
|||||||
const targets = pokemon.getOpponents();
|
const targets = pokemon.getOpponents();
|
||||||
const target = this.getTarget(targets);
|
const target = this.getTarget(targets);
|
||||||
|
|
||||||
if (target.battleData.illusion.active) {
|
if (!!target.summonData?.illusion) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5225,11 +5225,22 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr {
|
|||||||
* @returns {boolean} - Whether the illusion was applied.
|
* @returns {boolean} - Whether the illusion was applied.
|
||||||
*/
|
*/
|
||||||
override applyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): void {
|
override applyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): void {
|
||||||
pokemon.generateIllusion();
|
const party: Pokemon[] = (pokemon.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
||||||
|
const lastPokemon: Pokemon = party.filter(p => p !==pokemon).at(-1) || pokemon;
|
||||||
|
pokemon.setIllusion(lastPokemon);
|
||||||
}
|
}
|
||||||
|
|
||||||
override canApplyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
override canApplyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||||
return pokemon.battleData.illusion.available && pokemon.canApplyAbility();
|
if(pokemon.hasTrainer()){
|
||||||
|
const party: Pokemon[] = (pokemon.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
||||||
|
const lastPokemon: Pokemon = party.filter(p => p !==pokemon).at(-1) || pokemon;
|
||||||
|
const speciesId = lastPokemon.species.speciesId;
|
||||||
|
if ( lastPokemon === pokemon || !!pokemon.summonData?.illusion ||
|
||||||
|
((speciesId === Species.OGERPON || speciesId === Species.TERAPAGOS) && (lastPokemon.isTerastallized || pokemon.isTerastallized))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pokemon.canApplyAbility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5251,7 +5262,7 @@ export class IllusionBreakAbAttr extends PostDefendAbAttr {
|
|||||||
|
|
||||||
override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean {
|
override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean {
|
||||||
const breakIllusion: HitResult[] = [ HitResult.EFFECTIVE, HitResult.SUPER_EFFECTIVE, HitResult.NOT_VERY_EFFECTIVE, HitResult.ONE_HIT_KO ];
|
const breakIllusion: HitResult[] = [ HitResult.EFFECTIVE, HitResult.SUPER_EFFECTIVE, HitResult.NOT_VERY_EFFECTIVE, HitResult.ONE_HIT_KO ];
|
||||||
return breakIllusion.includes(hitResult) && pokemon.battleData.illusion.active
|
return breakIllusion.includes(hitResult) && !!pokemon.summonData?.illusion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5265,10 +5276,11 @@ export class IllusionPostBattleAbAttr extends PostBattleAbAttr {
|
|||||||
* @returns {boolean} - Whether the illusion was applied.
|
* @returns {boolean} - Whether the illusion was applied.
|
||||||
*/
|
*/
|
||||||
override applyPostBattle(pokemon: Pokemon, passive: boolean, simulated:boolean, args: any[]): void {
|
override applyPostBattle(pokemon: Pokemon, passive: boolean, simulated:boolean, args: any[]): void {
|
||||||
const illusion = pokemon.breakIllusion();
|
/*const illusion = pokemon.breakIllusion();
|
||||||
if (illusion) {
|
if (illusion) {
|
||||||
pokemon.battleData.illusion.available = true;
|
pokemon.summonData?.illusion.available = true;
|
||||||
}
|
}*/
|
||||||
|
pokemon.breakIllusion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6832,9 +6844,9 @@ export function initAbilities() {
|
|||||||
}, 1.3),
|
}, 1.3),
|
||||||
new Ability(Abilities.ILLUSION, 5)
|
new Ability(Abilities.ILLUSION, 5)
|
||||||
//The pokemon generate an illusion if it's available
|
//The pokemon generate an illusion if it's available
|
||||||
.conditionalAttr((pokemon) => pokemon.battleData.illusion.available, IllusionPreSummonAbAttr, false)
|
.attr(IllusionPreSummonAbAttr, false)
|
||||||
//The pokemon loses his illusion when he is damaged by a move
|
//The pokemon loses his illusion when he is damaged by a move
|
||||||
.conditionalAttr((pokemon) => pokemon.battleData.illusion.active, IllusionBreakAbAttr, true)
|
.attr(IllusionBreakAbAttr, true)
|
||||||
//Illusion is available again after a battle
|
//Illusion is available again after a battle
|
||||||
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionPostBattleAbAttr, false)
|
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionPostBattleAbAttr, false)
|
||||||
.uncopiable()
|
.uncopiable()
|
||||||
|
@ -8654,7 +8654,7 @@ export function initMoves() {
|
|||||||
new StatusMove(Moves.TRANSFORM, PokemonType.NORMAL, -1, 10, -1, 0, 1)
|
new StatusMove(Moves.TRANSFORM, PokemonType.NORMAL, -1, 10, -1, 0, 1)
|
||||||
.attr(TransformAttr)
|
.attr(TransformAttr)
|
||||||
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE))
|
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE))
|
||||||
.condition((user, target, move) => !target.battleData.illusion.active && !user.battleData.illusion.active)
|
.condition((user, target, move) => !target.summonData?.illusion && !user.summonData?.illusion)
|
||||||
// transforming from or into fusion pokemon causes various problems (such as crashes)
|
// transforming from or into fusion pokemon causes various problems (such as crashes)
|
||||||
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE) && !user.fusionSpecies && !target.fusionSpecies)
|
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE) && !user.fusionSpecies && !target.fusionSpecies)
|
||||||
.ignoresProtect(),
|
.ignoresProtect(),
|
||||||
|
@ -544,8 +544,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - 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(useIllusion: boolean = true) {
|
getNameToRender(useIllusion: boolean = true) {
|
||||||
const name: string = (!useIllusion && this.battleData?.illusion.active) ? this.battleData?.illusion.basePokemon!.name : this.name;
|
const name: string = (!useIllusion && !!this.summonData?.illusion) ? this.summonData?.illusion.basePokemon!.name : this.name;
|
||||||
const nickname: string = (!useIllusion && this.battleData?.illusion.active) ? this.battleData?.illusion.basePokemon!.nickname : this.nickname;
|
const nickname: string = (!useIllusion && !!this.summonData?.illusion) ? this.summonData?.illusion.basePokemon!.nickname : this.nickname;
|
||||||
try {
|
try {
|
||||||
if (nickname) {
|
if (nickname) {
|
||||||
return decodeURIComponent(escape(atob(nickname)));
|
return decodeURIComponent(escape(atob(nickname)));
|
||||||
@ -559,7 +559,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
init(): void {
|
init(): void {
|
||||||
this.fieldPosition = FieldPosition.CENTER;
|
this.fieldPosition = FieldPosition.CENTER;
|
||||||
this.resetBattleData();
|
this.summonData = new PokemonSummonData();
|
||||||
this.initBattleInfo();
|
this.initBattleInfo();
|
||||||
|
|
||||||
globalScene.fieldUI.addAt(this.battleInfo, 0);
|
globalScene.fieldUI.addAt(this.battleInfo, 0);
|
||||||
@ -697,58 +697,47 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {Pokemon} pokemon - The Pokemon that will create an illusion.
|
* @param {Pokemon} pokemon - The Pokemon that will create an illusion.
|
||||||
* @param {Pokemon[]} party - The party of the trainer's pokemon.
|
* @param {Pokemon[]} party - The party of the trainer's pokemon.
|
||||||
*/
|
*/
|
||||||
generateIllusion(): boolean {
|
setIllusion(pokemon: Pokemon): boolean {
|
||||||
if (this.hasTrainer()) {
|
if (this.hasTrainer()) {
|
||||||
const party: Pokemon[] = (this.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
const speciesId = pokemon.species.speciesId;
|
||||||
const lastPokemon: Pokemon = party.filter(p => p !== this).at(-1) || this;
|
|
||||||
const speciesId = lastPokemon.species.speciesId;
|
|
||||||
|
|
||||||
if ( lastPokemon === this || this.battleData.illusion.active ||
|
this.summonData.illusion = {
|
||||||
((speciesId === Species.OGERPON || speciesId === Species.TERAPAGOS) && (lastPokemon.isTerastallized || this.isTerastallized))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.battleData.illusion = {
|
|
||||||
active: true,
|
|
||||||
available: true,
|
|
||||||
basePokemon: { ...this },
|
basePokemon: { ...this },
|
||||||
species: getPokemonSpecies(speciesId),
|
species: getPokemonSpecies(speciesId),
|
||||||
formIndex: lastPokemon.formIndex,
|
formIndex: pokemon.formIndex,
|
||||||
gender: lastPokemon.gender,
|
gender: pokemon.gender,
|
||||||
pokeball: lastPokemon.pokeball,
|
pokeball: pokemon.pokeball,
|
||||||
fusionFormIndex: lastPokemon.fusionFormIndex,
|
fusionFormIndex: pokemon.fusionFormIndex,
|
||||||
fusionSpecies: lastPokemon.fusionSpecies || undefined,
|
fusionSpecies: pokemon.fusionSpecies || undefined,
|
||||||
fusionGender: lastPokemon.fusionGender
|
fusionGender: pokemon.fusionGender
|
||||||
};
|
};
|
||||||
|
|
||||||
this.name = lastPokemon.name;
|
this.name = pokemon.name;
|
||||||
this.nickname = lastPokemon.nickname;
|
this.nickname = pokemon.nickname;
|
||||||
this.shiny = lastPokemon.shiny;
|
this.shiny = pokemon.shiny;
|
||||||
this.variant = lastPokemon.variant;
|
this.variant = pokemon.variant;
|
||||||
this.fusionVariant = lastPokemon.fusionVariant;
|
this.fusionVariant = pokemon.fusionVariant;
|
||||||
this.fusionShiny = lastPokemon.fusionShiny;
|
this.fusionShiny = pokemon.fusionShiny;
|
||||||
if (this.shiny) {
|
if (this.shiny) {
|
||||||
this.initShinySparkle();
|
this.initShinySparkle();
|
||||||
}
|
}
|
||||||
this.loadAssets(false, true).then(() => this.playAnim());
|
this.loadAssets(false, true).then(() => this.playAnim());
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
} else {
|
} else {
|
||||||
const availables: Species[] = [];
|
|
||||||
const randomIllusion: PokemonSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, this.level);
|
const randomIllusion: PokemonSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, this.level);
|
||||||
/*
|
/*
|
||||||
if (this.isBoss()) {
|
if (this.isBoss()) {
|
||||||
availables = [ Species.ENTEI, Species.RAIKOU, Species.SUICUNE ];
|
const availables = [ Species.ENTEI, Species.RAIKOU, Species.SUICUNE ];
|
||||||
randomIllusion = getPokemonSpecies(availables[this.randSeedInt(availables.length)]);
|
randomIllusion = getPokemonSpecies(availables[this.randSeedInt(availables.length)]);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.battleData.illusion = {
|
this.summonData.illusion = {
|
||||||
active: true,
|
|
||||||
available: true,
|
|
||||||
basePokemon: { ...this },
|
basePokemon: { ...this },
|
||||||
species: randomIllusion,
|
species: randomIllusion,
|
||||||
formIndex: randomIllusion.formIndex,
|
formIndex: randomIllusion.formIndex,
|
||||||
gender: this.gender
|
gender: this.gender,
|
||||||
|
pokeball: this.pokeball
|
||||||
};
|
};
|
||||||
|
|
||||||
this.name = randomIllusion.name;
|
this.name = randomIllusion.name;
|
||||||
@ -758,16 +747,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
breakIllusion(): boolean {
|
breakIllusion(): boolean {
|
||||||
if (!this.battleData?.illusion.active) {
|
if (!this.summonData?.illusion) {
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
this.name = this.summonData?.illusion.basePokemon.name ?? this.name;
|
||||||
|
this.nickname = this.summonData?.illusion.basePokemon.nickname ?? this.nickname;
|
||||||
|
this.shiny = this.summonData?.illusion.basePokemon.shiny ?? this.shiny;
|
||||||
|
this.variant = this.summonData?.illusion.basePokemon.variant ?? this.variant;
|
||||||
|
this.fusionVariant = this.summonData?.illusion.basePokemon.fusionVariant ?? this.fusionVariant;
|
||||||
|
this.fusionShiny = this.summonData?.illusion.basePokemon.fusionShiny ?? this.fusionShiny;
|
||||||
|
this.summonData.illusion = null;
|
||||||
}
|
}
|
||||||
this.name = this.battleData?.illusion.basePokemon?.name ?? this.name;
|
|
||||||
this.nickname = this.battleData?.illusion.basePokemon?.nickname ?? this.nickname;
|
|
||||||
this.shiny = this.battleData?.illusion.basePokemon?.shiny ?? this.shiny;
|
|
||||||
this.variant = this.battleData?.illusion.basePokemon?.variant ?? this.variant;
|
|
||||||
this.fusionVariant = this.battleData?.illusion.basePokemon?.fusionVariant ?? this.fusionVariant;
|
|
||||||
this.fusionShiny = this.battleData?.illusion.basePokemon?.fusionShiny ?? this.fusionShiny;
|
|
||||||
this.battleData.illusion = { active: false, available: false, basePokemon: this };
|
|
||||||
if (this.isOnField()) {
|
if (this.isOnField()) {
|
||||||
globalScene.playSound("PRSFX- Transform");
|
globalScene.playSound("PRSFX- Transform");
|
||||||
}
|
}
|
||||||
@ -796,7 +786,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const moveIds = this.getMoveset().map(m => m.getMove().id);
|
const moveIds = this.getMoveset().map(m => m.getMove().id);
|
||||||
Promise.allSettled(moveIds.map(m => initMoveAnim(m))).then(() => {
|
Promise.allSettled(moveIds.map(m => initMoveAnim(m))).then(() => {
|
||||||
loadMoveAnimAssets(moveIds);
|
loadMoveAnimAssets(moveIds);
|
||||||
const formIndex = this.battleData?.illusion.active && useIllusion ? this.battleData?.illusion.formIndex : this.formIndex;
|
const formIndex = !!this.summonData?.illusion && useIllusion ? this.summonData?.illusion.formIndex : this.formIndex;
|
||||||
this.getSpeciesForm(false, useIllusion).loadAssets(
|
this.getSpeciesForm(false, useIllusion).loadAssets(
|
||||||
this.getGender(useIllusion) === Gender.FEMALE,
|
this.getGender(useIllusion) === Gender.FEMALE,
|
||||||
formIndex,
|
formIndex,
|
||||||
@ -810,9 +800,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (this.getFusionSpeciesForm(false, useIllusion)) {
|
if (this.getFusionSpeciesForm(false, useIllusion)) {
|
||||||
const fusionFormIndex = this.battleData?.illusion.active && useIllusion ? this.battleData?.illusion.fusionFormIndex : this.fusionFormIndex;
|
const fusionFormIndex = !!this.summonData?.illusion && useIllusion ? this.summonData?.illusion.fusionFormIndex : this.fusionFormIndex;
|
||||||
const fusionShiny = this.battleData?.illusion.active && !useIllusion ? this.battleData?.illusion.basePokemon!.fusionShiny : this.fusionShiny;
|
const fusionShiny = !!this.summonData?.illusion && !useIllusion ? this.summonData?.illusion.basePokemon!.fusionShiny : this.fusionShiny;
|
||||||
const fusionVariant = this.battleData?.illusion.active && !useIllusion ? this.battleData?.illusion.basePokemon!.fusionVariant : this.fusionVariant;
|
const fusionVariant = !!this.summonData?.illusion && !useIllusion ? this.summonData?.illusion.basePokemon!.fusionVariant : this.fusionVariant;
|
||||||
this.getFusionSpeciesForm(false, useIllusion).loadAssets(
|
this.getFusionSpeciesForm(false, useIllusion).loadAssets(
|
||||||
this.getFusionGender(false, useIllusion) === Gender.FEMALE,
|
this.getFusionGender(false, useIllusion) === Gender.FEMALE,
|
||||||
fusionFormIndex,
|
fusionFormIndex,
|
||||||
@ -1011,7 +1001,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSpriteId(ignoreOverride?: boolean): string {
|
getSpriteId(ignoreOverride?: boolean): string {
|
||||||
const formIndex: integer = this.battleData?.illusion.active ? this.battleData?.illusion.formIndex! : this.formIndex;
|
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex! : this.formIndex;
|
||||||
return this.getSpeciesForm(ignoreOverride, true).getSpriteId(
|
return this.getSpeciesForm(ignoreOverride, true).getSpriteId(
|
||||||
this.getGender(ignoreOverride, true) === Gender.FEMALE,
|
this.getGender(ignoreOverride, true) === Gender.FEMALE,
|
||||||
formIndex,
|
formIndex,
|
||||||
@ -1025,7 +1015,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
back = this.isPlayer();
|
back = this.isPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
const formIndex: integer = this.battleData?.illusion.active ? this.battleData?.illusion.formIndex! : this.formIndex;
|
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex! : this.formIndex;
|
||||||
|
|
||||||
return this.getSpeciesForm(ignoreOverride, true).getSpriteId(
|
return this.getSpeciesForm(ignoreOverride, true).getSpriteId(
|
||||||
this.getGender(ignoreOverride, true) === Gender.FEMALE,
|
this.getGender(ignoreOverride, true) === Gender.FEMALE,
|
||||||
@ -1040,8 +1030,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return this.getSpeciesForm(ignoreOverride, false).getSpriteKey(
|
return this.getSpeciesForm(ignoreOverride, false).getSpriteKey(
|
||||||
this.getGender(ignoreOverride) === Gender.FEMALE,
|
this.getGender(ignoreOverride) === Gender.FEMALE,
|
||||||
this.formIndex,
|
this.formIndex,
|
||||||
this.battleData?.illusion.basePokemon?.shiny ?? this.shiny,
|
this.summonData?.illusion?.basePokemon.shiny ?? this.shiny,
|
||||||
this.battleData?.illusion.basePokemon?.variant ?? this.variant
|
this.summonData?.illusion?.basePokemon.variant ?? this.variant
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1050,7 +1040,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFusionSpriteId(ignoreOverride?: boolean): string {
|
getFusionSpriteId(ignoreOverride?: boolean): string {
|
||||||
const fusionFormIndex: integer = this.battleData?.illusion.active ? this.battleData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
const fusionFormIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||||
return this.getFusionSpeciesForm(ignoreOverride, true).getSpriteId(
|
return this.getFusionSpeciesForm(ignoreOverride, true).getSpriteId(
|
||||||
this.getFusionGender(ignoreOverride, true) === Gender.FEMALE,
|
this.getFusionGender(ignoreOverride, true) === Gender.FEMALE,
|
||||||
fusionFormIndex,
|
fusionFormIndex,
|
||||||
@ -1064,7 +1054,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
back = this.isPlayer();
|
back = this.isPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fusionFormIndex: integer = this.battleData?.illusion.active ? this.battleData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
const fusionFormIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||||
|
|
||||||
return this.getFusionSpeciesForm(ignoreOverride, true).getSpriteId(
|
return this.getFusionSpeciesForm(ignoreOverride, true).getSpriteId(
|
||||||
this.getFusionGender(ignoreOverride, true) === Gender.FEMALE,
|
this.getFusionGender(ignoreOverride, true) === Gender.FEMALE,
|
||||||
@ -1090,7 +1080,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getIconAtlasKey(ignoreOverride?: boolean): string {
|
getIconAtlasKey(ignoreOverride?: boolean): string {
|
||||||
const formIndex: integer = this.battleData?.illusion.active ? this.battleData?.illusion.formIndex! : this.formIndex;
|
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex! : this.formIndex;
|
||||||
return this.getSpeciesForm(ignoreOverride, true).getIconAtlasKey(
|
return this.getSpeciesForm(ignoreOverride, true).getIconAtlasKey(
|
||||||
formIndex,
|
formIndex,
|
||||||
this.shiny,
|
this.shiny,
|
||||||
@ -1107,7 +1097,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getIconId(ignoreOverride?: boolean): string {
|
getIconId(ignoreOverride?: boolean): string {
|
||||||
const formIndex: integer = this.battleData?.illusion.active ? this.battleData?.illusion.formIndex! : this.formIndex;
|
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex! : this.formIndex;
|
||||||
return this.getSpeciesForm(ignoreOverride, true).getIconId(
|
return this.getSpeciesForm(ignoreOverride, true).getIconId(
|
||||||
this.getGender(ignoreOverride, true) === Gender.FEMALE,
|
this.getGender(ignoreOverride, true) === Gender.FEMALE,
|
||||||
formIndex,
|
formIndex,
|
||||||
@ -1117,7 +1107,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFusionIconId(ignoreOverride?: boolean): string {
|
getFusionIconId(ignoreOverride?: boolean): string {
|
||||||
const fusionFormIndex: integer = this.battleData?.illusion.active ? this.battleData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
const fusionFormIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||||
return this.getFusionSpeciesForm(ignoreOverride, true).getIconId(
|
return this.getFusionSpeciesForm(ignoreOverride, true).getIconId(
|
||||||
this.getFusionGender(ignoreOverride, true) === Gender.FEMALE,
|
this.getFusionGender(ignoreOverride, true) === Gender.FEMALE,
|
||||||
fusionFormIndex,
|
fusionFormIndex,
|
||||||
@ -1130,9 +1120,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - Whether we want the speciesForm of the illusion or not.
|
* @param {boolean} useIllusion - Whether we want the speciesForm of the illusion or not.
|
||||||
*/
|
*/
|
||||||
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||||
const species: PokemonSpecies = useIllusion && this.battleData?.illusion.active ? this.battleData?.illusion.species! : this.species;
|
const species: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.species : this.species;
|
||||||
|
|
||||||
const formIndex: integer = useIllusion && this.battleData?.illusion.active ? this.battleData?.illusion.formIndex! : this.formIndex;
|
const formIndex: integer = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex;
|
||||||
|
|
||||||
if (!ignoreOverride && this.summonData?.speciesForm) {
|
if (!ignoreOverride && this.summonData?.speciesForm) {
|
||||||
return this.summonData.speciesForm;
|
return this.summonData.speciesForm;
|
||||||
@ -1148,8 +1138,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - Whether we want the fusionSpeciesForm of the illusion or not.
|
* @param {boolean} useIllusion - Whether we want the fusionSpeciesForm of the illusion or not.
|
||||||
*/
|
*/
|
||||||
getFusionSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
getFusionSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||||
const fusionSpecies: PokemonSpecies = useIllusion && this.battleData?.illusion.active ? this.battleData?.illusion.fusionSpecies! : this.fusionSpecies!;
|
const fusionSpecies: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.fusionSpecies! : this.fusionSpecies!;
|
||||||
const fusionFormIndex: integer = useIllusion && this.battleData?.illusion.active ? this.battleData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
const fusionFormIndex: integer = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.fusionFormIndex! : this.fusionFormIndex;
|
||||||
|
|
||||||
if (!ignoreOverride && this.summonData?.speciesForm) {
|
if (!ignoreOverride && this.summonData?.speciesForm) {
|
||||||
return this.summonData.fusionSpeciesForm;
|
return this.summonData.fusionSpeciesForm;
|
||||||
@ -1827,8 +1817,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - 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, useIllusion: boolean = false): Gender {
|
getGender(ignoreOverride?: boolean, useIllusion: boolean = false): Gender {
|
||||||
if (useIllusion && this.battleData?.illusion.active) {
|
if (useIllusion && !!this.summonData?.illusion) {
|
||||||
return this.battleData?.illusion.gender!;
|
return this.summonData?.illusion.gender!;
|
||||||
} else if (!ignoreOverride && this.summonData?.gender !== undefined) {
|
} else if (!ignoreOverride && this.summonData?.gender !== undefined) {
|
||||||
return this.summonData.gender;
|
return this.summonData.gender;
|
||||||
}
|
}
|
||||||
@ -1839,8 +1829,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - 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, useIllusion: boolean = false): Gender {
|
getFusionGender(ignoreOverride?: boolean, useIllusion: boolean = false): Gender {
|
||||||
if (useIllusion && this.battleData?.illusion.active) {
|
if (useIllusion && !!this.summonData?.illusion) {
|
||||||
return this.battleData?.illusion.fusionGender!;
|
return this.summonData?.illusion.fusionGender!;
|
||||||
} else if (!ignoreOverride && this.summonData?.fusionGender !== undefined) {
|
} else if (!ignoreOverride && this.summonData?.fusionGender !== undefined) {
|
||||||
return this.summonData.fusionGender;
|
return this.summonData.fusionGender;
|
||||||
}
|
}
|
||||||
@ -1851,8 +1841,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - Whether we want the fake or real shininess (illusion ability).
|
* @param {boolean} useIllusion - Whether we want the fake or real shininess (illusion ability).
|
||||||
*/
|
*/
|
||||||
isShiny(useIllusion: boolean = false): boolean {
|
isShiny(useIllusion: boolean = false): boolean {
|
||||||
if (!useIllusion && this.battleData?.illusion.active) {
|
if (!useIllusion && !!this.summonData?.illusion) {
|
||||||
return this.battleData?.illusion.basePokemon?.shiny || (!!this.battleData?.illusion.fusionSpecies && this.battleData?.illusion.basePokemon?.fusionShiny) || false;
|
return this.summonData?.illusion.basePokemon?.shiny || (!!this.summonData?.illusion.fusionSpecies && this.summonData?.illusion.basePokemon?.fusionShiny) || false;
|
||||||
} else {
|
} else {
|
||||||
return this.shiny || (this.isFusion(useIllusion) && this.fusionShiny);
|
return this.shiny || (this.isFusion(useIllusion) && this.fusionShiny);
|
||||||
}
|
}
|
||||||
@ -1864,8 +1854,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @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(useIllusion: boolean = false): boolean {
|
isDoubleShiny(useIllusion: boolean = false): boolean {
|
||||||
if (!useIllusion && this.battleData?.illusion.active) {
|
if (!useIllusion && !!this.summonData?.illusion) {
|
||||||
return this.isFusion(false) && this.battleData?.illusion.basePokemon!.shiny && this.battleData?.illusion.basePokemon.fusionShiny;
|
return this.isFusion(false) && this.summonData?.illusion.basePokemon!.shiny && this.summonData?.illusion.basePokemon.fusionShiny;
|
||||||
} else {
|
} else {
|
||||||
return this.isFusion(useIllusion) && this.shiny && this.fusionShiny;
|
return this.isFusion(useIllusion) && this.shiny && this.fusionShiny;
|
||||||
}
|
}
|
||||||
@ -1875,9 +1865,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - Whether we want the fake or real variant (illusion ability).
|
* @param {boolean} useIllusion - Whether we want the fake or real variant (illusion ability).
|
||||||
*/
|
*/
|
||||||
getVariant(useIllusion: boolean = false): Variant {
|
getVariant(useIllusion: boolean = false): Variant {
|
||||||
if (!useIllusion && this.battleData?.illusion.active) {
|
if (!useIllusion && !!this.summonData?.illusion) {
|
||||||
return !this.isFusion(false)
|
return !this.isFusion(false)
|
||||||
? this.battleData?.illusion.basePokemon!.variant
|
? this.summonData?.illusion.basePokemon!.variant
|
||||||
: Math.max(this.variant, this.fusionVariant) as Variant;
|
: Math.max(this.variant, this.fusionVariant) as Variant;
|
||||||
} else {
|
} else {
|
||||||
return !this.isFusion(true)
|
return !this.isFusion(true)
|
||||||
@ -1889,8 +1879,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
getBaseVariant(doubleShiny: boolean): Variant {
|
getBaseVariant(doubleShiny: boolean): Variant {
|
||||||
if (doubleShiny) {
|
if (doubleShiny) {
|
||||||
return this.battleData?.illusion.active
|
return !!this.summonData?.illusion
|
||||||
? this.battleData?.illusion.basePokemon!.variant
|
? this.summonData?.illusion.basePokemon!.variant
|
||||||
: this.variant;
|
: this.variant;
|
||||||
} else {
|
} else {
|
||||||
return this.getVariant();
|
return this.getVariant();
|
||||||
@ -1902,8 +1892,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isFusion(useIllusion: boolean = false): boolean {
|
isFusion(useIllusion: boolean = false): boolean {
|
||||||
if (useIllusion && this.battleData?.illusion.active) {
|
if (useIllusion && !!this.summonData?.illusion) {
|
||||||
return !!this.battleData?.illusion.fusionSpecies;
|
return !!this.summonData?.illusion.fusionSpecies;
|
||||||
} else {
|
} else {
|
||||||
return !!this.fusionSpecies;
|
return !!this.fusionSpecies;
|
||||||
}
|
}
|
||||||
@ -1913,8 +1903,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param {boolean} useIllusion - 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(useIllusion: boolean = false): string {
|
getName(useIllusion: boolean = false): string {
|
||||||
return (!useIllusion && this.battleData?.illusion.active && this.battleData?.illusion.basePokemon)
|
return (!useIllusion && !!this.summonData?.illusion && this.summonData?.illusion.basePokemon)
|
||||||
? this.battleData?.illusion.basePokemon.name
|
? this.summonData?.illusion.basePokemon.name
|
||||||
: this.name;
|
: this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2058,7 +2048,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
!ignoreOverride &&
|
!ignoreOverride &&
|
||||||
this.summonData?.types &&
|
this.summonData?.types &&
|
||||||
this.summonData.types.length > 0 &&
|
this.summonData.types.length > 0 &&
|
||||||
(!this.battleData?.illusion.active || !doIllusion)
|
(!!!this.summonData?.illusion || !doIllusion)
|
||||||
) {
|
) {
|
||||||
this.summonData.types.forEach(t => types.push(t));
|
this.summonData.types.forEach(t => types.push(t));
|
||||||
} else {
|
} else {
|
||||||
@ -5795,6 +5785,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resetSummonData(): void {
|
resetSummonData(): void {
|
||||||
|
const illusion: Illusion | null = this.summonData?.illusion;
|
||||||
if (this.summonData?.speciesForm) {
|
if (this.summonData?.speciesForm) {
|
||||||
this.summonData.speciesForm = null;
|
this.summonData.speciesForm = null;
|
||||||
this.updateFusionPalette();
|
this.updateFusionPalette();
|
||||||
@ -5830,17 +5821,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
this.summonDataPrimer = null;
|
this.summonDataPrimer = null;
|
||||||
}
|
}
|
||||||
|
this.summonData.illusion = illusion
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetBattleData(): void {
|
resetBattleData(): void {
|
||||||
console.log("RESET BATTLE DATA")
|
|
||||||
const illusionActive: boolean = this.battleData?.illusion.active;
|
|
||||||
this.breakIllusion();
|
|
||||||
this.battleData = new PokemonBattleData();
|
this.battleData = new PokemonBattleData();
|
||||||
if (illusionActive) {
|
|
||||||
this.generateIllusion();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetBattleSummonData(): void {
|
resetBattleSummonData(): void {
|
||||||
@ -7809,36 +7795,36 @@ interface Illusion {
|
|||||||
* Whether the illusion is active or not.
|
* Whether the illusion is active or not.
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
active: boolean;
|
//active: boolean;
|
||||||
/**
|
/**
|
||||||
* Whether the pokemon can generate an illusion or not.
|
* Whether the pokemon can generate an illusion or not.
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
available: boolean;
|
//available: boolean;
|
||||||
/**
|
/**
|
||||||
* The actual Pokemon.
|
* The actual Pokemon.
|
||||||
* @type {Pokemon}
|
* @type {Pokemon}
|
||||||
*/
|
*/
|
||||||
basePokemon?: Pokemon;
|
basePokemon: Pokemon;
|
||||||
/**
|
/**
|
||||||
* The species of the illusion.
|
* The species of the illusion.
|
||||||
* @type {PokemonSpecies}
|
* @type {PokemonSpecies}
|
||||||
*/
|
*/
|
||||||
species?: PokemonSpecies;
|
species: PokemonSpecies;
|
||||||
/**
|
/**
|
||||||
* The formIndex of the illusion
|
* The formIndex of the illusion
|
||||||
* @type {integer}
|
* @type {integer}
|
||||||
*/
|
*/
|
||||||
formIndex?: number;
|
formIndex: number;
|
||||||
/**
|
/**
|
||||||
* The gender of the illusion
|
* The gender of the illusion
|
||||||
* @type {Gender}
|
* @type {Gender}
|
||||||
*/
|
*/
|
||||||
gender?: Gender;
|
gender: Gender;
|
||||||
/**
|
/**
|
||||||
* The pokeball of the illusion.
|
* The pokeball of the illusion.
|
||||||
*/
|
*/
|
||||||
pokeball?: PokeballType;
|
pokeball: PokeballType;
|
||||||
/**
|
/**
|
||||||
* The fusionned species of the illusion if it's a fusion.
|
* The fusionned species of the illusion if it's a fusion.
|
||||||
* @type {PokemonSpecies}
|
* @type {PokemonSpecies}
|
||||||
@ -7897,6 +7883,7 @@ export class PokemonSummonData {
|
|||||||
// If not initialized this value will not be populated from save data.
|
// If not initialized this value will not be populated from save data.
|
||||||
public types: PokemonType[] = [];
|
public types: PokemonType[] = [];
|
||||||
public addedType: PokemonType | null = null;
|
public addedType: PokemonType | null = null;
|
||||||
|
public illusion: Illusion | null = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonBattleData {
|
export class PokemonBattleData {
|
||||||
@ -7908,7 +7895,6 @@ export class PokemonBattleData {
|
|||||||
public berriesEaten: BerryType[] = [];
|
public berriesEaten: BerryType[] = [];
|
||||||
public abilitiesApplied: Abilities[] = [];
|
public abilitiesApplied: Abilities[] = [];
|
||||||
public abilityRevealed: boolean = false;
|
public abilityRevealed: boolean = false;
|
||||||
public illusion: Illusion = { active: false, available: true };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonBattleSummonData {
|
export class PokemonBattleSummonData {
|
||||||
|
@ -259,10 +259,9 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
if (e < (battle.double ? 2 : 1)) {
|
if (e < (battle.double ? 2 : 1)) {
|
||||||
if (battle.battleType === BattleType.WILD) {
|
if (battle.battleType === BattleType.WILD) {
|
||||||
for (const pokemon of globalScene.getPlayerField()) {
|
for (const pokemon of globalScene.getField()) {
|
||||||
applyPreSummonAbAttrs(PreSummonAbAttr, pokemon, []);
|
applyPreSummonAbAttrs(PreSummonAbAttr, pokemon, []);
|
||||||
}
|
}
|
||||||
applyPreSummonAbAttrs(PreSummonAbAttr, enemyPokemon, []);
|
|
||||||
globalScene.field.add(enemyPokemon);
|
globalScene.field.add(enemyPokemon);
|
||||||
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
||||||
const playerPokemon = globalScene.getPlayerPokemon();
|
const playerPokemon = globalScene.getPlayerPokemon();
|
||||||
|
@ -128,7 +128,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
this.player ? 36 : 248,
|
this.player ? 36 : 248,
|
||||||
this.player ? 80 : 44,
|
this.player ? 80 : 44,
|
||||||
"pb",
|
"pb",
|
||||||
getPokeballAtlasKey(pokemon.battleData.illusion.pokeball ?? pokemon.pokeball),
|
getPokeballAtlasKey(pokemon.summonData?.illusion?.pokeball ?? pokemon.pokeball),
|
||||||
);
|
);
|
||||||
pokeball.setVisible(false);
|
pokeball.setVisible(false);
|
||||||
pokeball.setOrigin(0.5, 0.625);
|
pokeball.setOrigin(0.5, 0.625);
|
||||||
@ -180,7 +180,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
addPokeballOpenParticles(
|
addPokeballOpenParticles(
|
||||||
pokemon.x,
|
pokemon.x,
|
||||||
pokemon.y - 16,
|
pokemon.y - 16,
|
||||||
pokemon.battleData.illusion.pokeball ?? pokemon.pokeball,
|
pokemon.summonData?.illusion?.pokeball ?? pokemon.pokeball,
|
||||||
);
|
);
|
||||||
globalScene.updateModifiers(this.player);
|
globalScene.updateModifiers(this.player);
|
||||||
globalScene.updateFieldScale();
|
globalScene.updateFieldScale();
|
||||||
@ -189,7 +189,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
pokemon.setVisible(true);
|
pokemon.setVisible(true);
|
||||||
pokemon.getSprite().setVisible(true);
|
pokemon.getSprite().setVisible(true);
|
||||||
pokemon.setScale(0.5);
|
pokemon.setScale(0.5);
|
||||||
pokemon.tint(getPokeballTintColor(pokemon.battleData.illusion.pokeball ?? pokemon.pokeball));
|
pokemon.tint(getPokeballTintColor(pokemon.summonData?.illusion?.pokeball ?? pokemon.pokeball));
|
||||||
pokemon.untint(250, "Sine.easeIn");
|
pokemon.untint(250, "Sine.easeIn");
|
||||||
globalScene.updateFieldScale();
|
globalScene.updateFieldScale();
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
|
@ -105,7 +105,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
);
|
);
|
||||||
globalScene.playSound("se/pb_rel");
|
globalScene.playSound("se/pb_rel");
|
||||||
pokemon.hideInfo();
|
pokemon.hideInfo();
|
||||||
pokemon.tint(getPokeballTintColor(pokemon.battleData.illusion.pokeball ?? pokemon.pokeball), 1, 250, "Sine.easeIn");
|
pokemon.tint(getPokeballTintColor(pokemon.summonData?.illusion?.pokeball ?? pokemon.pokeball), 1, 250, "Sine.easeIn");
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
targets: pokemon,
|
targets: pokemon,
|
||||||
duration: 250,
|
duration: 250,
|
||||||
|
@ -617,7 +617,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
const gender: Gender = pokemon.battleData.illusion.active ? pokemon.battleData.illusion.gender! : pokemon.gender;
|
const gender: Gender = !!pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender;
|
||||||
|
|
||||||
this.genderText.setText(getGenderSymbol(gender));
|
this.genderText.setText(getGenderSymbol(gender));
|
||||||
this.genderText.setColor(getGenderColor(gender));
|
this.genderText.setColor(getGenderColor(gender));
|
||||||
@ -794,7 +794,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
const nameSizeTest = addTextObject(0, 0, displayName, TextStyle.BATTLE_INFO);
|
const nameSizeTest = addTextObject(0, 0, displayName, TextStyle.BATTLE_INFO);
|
||||||
nameTextWidth = nameSizeTest.displayWidth;
|
nameTextWidth = nameSizeTest.displayWidth;
|
||||||
|
|
||||||
const gender: Gender = pokemon.battleData.illusion.active ? pokemon.battleData.illusion.gender! : pokemon.gender;
|
const gender: Gender = !!pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender;
|
||||||
while (
|
while (
|
||||||
nameTextWidth >
|
nameTextWidth >
|
||||||
(this.player || !this.boss ? 60 : 98) -
|
(this.player || !this.boss ? 60 : 98) -
|
||||||
|
@ -1581,7 +1581,7 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
fusionShinyStar.setOrigin(0, 0);
|
fusionShinyStar.setOrigin(0, 0);
|
||||||
fusionShinyStar.setPosition(shinyStar.x, shinyStar.y);
|
fusionShinyStar.setPosition(shinyStar.x, shinyStar.y);
|
||||||
fusionShinyStar.setTint(
|
fusionShinyStar.setTint(
|
||||||
getVariantTint(this.pokemon.battleData.illusion.basePokemon?.fusionVariant ?? this.pokemon.fusionVariant),
|
getVariantTint(this.pokemon.summonData?.illusion?.basePokemon.fusionVariant ?? this.pokemon.fusionVariant),
|
||||||
);
|
);
|
||||||
|
|
||||||
slotInfoContainer.add(fusionShinyStar);
|
slotInfoContainer.add(fusionShinyStar);
|
||||||
|
@ -350,11 +350,11 @@ export default class SummaryUiHandler extends UiHandler {
|
|||||||
this.pokemonSprite.setPipelineData("spriteKey", this.pokemon.getSpriteKey());
|
this.pokemonSprite.setPipelineData("spriteKey", this.pokemon.getSpriteKey());
|
||||||
this.pokemonSprite.setPipelineData(
|
this.pokemonSprite.setPipelineData(
|
||||||
"shiny",
|
"shiny",
|
||||||
this.pokemon.battleData.illusion.basePokemon?.shiny ?? this.pokemon.shiny,
|
this.pokemon.summonData?.illusion?.basePokemon.shiny ?? this.pokemon.shiny,
|
||||||
);
|
);
|
||||||
this.pokemonSprite.setPipelineData(
|
this.pokemonSprite.setPipelineData(
|
||||||
"variant",
|
"variant",
|
||||||
this.pokemon.battleData.illusion.basePokemon?.variant ?? this.pokemon.variant,
|
this.pokemon.summonData?.illusion?.basePokemon.variant ?? this.pokemon.variant,
|
||||||
);
|
);
|
||||||
["spriteColors", "fusionSpriteColors"].map(k => {
|
["spriteColors", "fusionSpriteColors"].map(k => {
|
||||||
delete this.pokemonSprite.pipelineData[`${k}Base`];
|
delete this.pokemonSprite.pipelineData[`${k}Base`];
|
||||||
@ -453,7 +453,7 @@ export default class SummaryUiHandler extends UiHandler {
|
|||||||
this.fusionShinyIcon.setVisible(doubleShiny);
|
this.fusionShinyIcon.setVisible(doubleShiny);
|
||||||
if (isFusion) {
|
if (isFusion) {
|
||||||
this.fusionShinyIcon.setTint(
|
this.fusionShinyIcon.setTint(
|
||||||
getVariantTint(this.pokemon.battleData.illusion.basePokemon?.fusionVariant ?? this.pokemon.fusionVariant),
|
getVariantTint(this.pokemon.summonData?.illusion?.basePokemon.fusionVariant ?? this.pokemon.fusionVariant),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import overrides from "#app/overrides";
|
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
@ -40,8 +39,8 @@ describe("Abilities - Illusion", () => {
|
|||||||
const zoroark = game.scene.getPlayerPokemon()!;
|
const zoroark = game.scene.getPlayerPokemon()!;
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(zoroark.battleData.illusion.active).equals(true);
|
expect(!!zoroark.summonData?.illusion).equals(true);
|
||||||
expect(zorua.battleData.illusion.active).equals(true);
|
expect(!!zorua.summonData?.illusion).equals(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("break after receiving damaging move", async () => {
|
it("break after receiving damaging move", async () => {
|
||||||
@ -52,8 +51,7 @@ describe("Abilities - Illusion", () => {
|
|||||||
|
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(zorua.battleData.illusion.active).equals(false);
|
expect(!!zorua.summonData?.illusion).equals(false);
|
||||||
expect(zorua.battleData.illusion.available).equals(false);
|
|
||||||
expect(zorua.name).equals("Zorua");
|
expect(zorua.name).equals("Zorua");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,7 +63,7 @@ describe("Abilities - Illusion", () => {
|
|||||||
|
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(zorua.battleData.illusion.active).equals(false);
|
expect(!!zorua.summonData?.illusion).equals(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("break if the ability is suppressed", async () => {
|
it("break if the ability is suppressed", async () => {
|
||||||
@ -74,7 +72,7 @@ describe("Abilities - Illusion", () => {
|
|||||||
|
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(zorua.battleData.illusion.active).equals(false);
|
expect(!!zorua.summonData?.illusion).equals(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("causes enemy AI to consider the illusion's type instead of the actual type when considering move effectiveness", async () => {
|
it("causes enemy AI to consider the illusion's type instead of the actual type when considering move effectiveness", async () => {
|
||||||
@ -119,7 +117,7 @@ describe("Abilities - Illusion", () => {
|
|||||||
|
|
||||||
const zoroark = game.scene.getPlayerPokemon()!;
|
const zoroark = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
expect(zoroark.battleData.illusion.active).equals(true);
|
expect(!!zoroark.summonData?.illusion).equals(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("copies the the name, nickname, gender, shininess, and pokeball from the illusion source", async () => {
|
it("copies the the name, nickname, gender, shininess, and pokeball from the illusion source", async () => {
|
||||||
@ -136,10 +134,12 @@ describe("Abilities - Illusion", () => {
|
|||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
|
|
||||||
const zoroark = game.scene.getPlayerPokemon()!;
|
const zoroark = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
|
console.log("OOOOOOOOOOOOOOOOOOOOO", !!zoroark.summonData.illusion)
|
||||||
expect(zoroark.name).equals("Axew");
|
expect(zoroark.name).equals("Axew");
|
||||||
expect(zoroark.getNameToRender()).equals("axew nickname");
|
expect(zoroark.getNameToRender()).equals("axew nickname");
|
||||||
expect(zoroark.getGender(false, true)).equals(Gender.FEMALE);
|
expect(zoroark.getGender(false, true)).equals(Gender.FEMALE);
|
||||||
expect(zoroark.isShiny(true)).equals(true);
|
expect(zoroark.isShiny(true)).equals(true);
|
||||||
expect(zoroark.battleData.illusion.pokeball).equals(PokeballType.GREAT_BALL);
|
expect(zoroark.summonData?.illusion?.pokeball).equals(PokeballType.GREAT_BALL);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user