Zoroark change illusion after lastPokemon update
This commit is contained in:
parent
1535c2f45a
commit
d7ed17b066
|
@ -2436,7 +2436,7 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
|||
target = targets[0];
|
||||
}
|
||||
|
||||
if (target.illusion.active) {
|
||||
if (target.battleData.illusion.active) {
|
||||
return false;
|
||||
}
|
||||
pokemon.summonData.speciesForm = target.getSpeciesForm();
|
||||
|
@ -4577,7 +4577,7 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr {
|
|||
}
|
||||
});
|
||||
|
||||
if (pokemon.illusion.available && !suppressed) {
|
||||
if (pokemon.battleData.illusion.available && !suppressed) {
|
||||
return pokemon.generateIllusion();
|
||||
} else {
|
||||
return false;
|
||||
|
@ -4619,7 +4619,7 @@ export class IllusionPostBattleAbAttr extends PostBattleAbAttr {
|
|||
*/
|
||||
applyPostBattle(pokemon: Pokemon, passive: boolean, simulated:boolean, args: any[]): boolean {
|
||||
pokemon.breakIllusion();
|
||||
pokemon.illusion.available = true;
|
||||
pokemon.battleData.illusion.available = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4635,7 +4635,7 @@ export class IllusionDisableAbAttr extends PostSummonAbAttr {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
pokemon.illusion.available = false;
|
||||
pokemon.battleData.illusion.available = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5421,9 +5421,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
|
||||
|
|
|
@ -123,7 +123,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
public battleSummonData: PokemonBattleSummonData;
|
||||
public turnData: PokemonTurnData;
|
||||
public mysteryEncounterPokemonData: MysteryEncounterPokemonData;
|
||||
public illusion: Illusion;
|
||||
|
||||
/** Used by Mystery Encounters to execute pokemon-specific logic (such as stat boosts) at start of battle */
|
||||
public mysteryEncounterBattleEffects?: (pokemon: Pokemon) => void;
|
||||
|
@ -154,7 +153,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.pokeball = dataSource?.pokeball || PokeballType.POKEBALL;
|
||||
this.level = level;
|
||||
this.switchOutStatus = false;
|
||||
this.illusion = { active: false, available: true };
|
||||
|
||||
// Determine the ability index
|
||||
if (abilityIndex !== undefined) {
|
||||
|
@ -283,8 +281,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)));
|
||||
|
@ -298,7 +296,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
|
||||
init(): void {
|
||||
this.fieldPosition = FieldPosition.CENTER;
|
||||
|
||||
this.resetBattleData();
|
||||
this.initBattleInfo();
|
||||
|
||||
|
@ -399,18 +396,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
*/
|
||||
generateIllusion(): boolean {
|
||||
if (this.hasTrainer()) {
|
||||
console.log("GENERATEILLUSION() : ", this.name);
|
||||
const party: Pokemon[] = (this.isPlayer() ? this.scene.getParty() : this.scene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
||||
const lastPokemon: Pokemon = party.filter(p => p !== this).at(-1) || this;
|
||||
console.log(lastPokemon.name);
|
||||
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,
|
||||
|
@ -461,7 +456,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,
|
||||
|
@ -475,23 +470,21 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.name = randomIllusion.name;
|
||||
this.loadAssets(false, true).then(() => this.playAnim());
|
||||
}
|
||||
console.log("L'ILLUSION : ", this.illusion);
|
||||
return true;
|
||||
}
|
||||
|
||||
breakIllusion(): boolean {
|
||||
console.log("BREAKILLUSION");
|
||||
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");
|
||||
}
|
||||
|
@ -520,15 +513,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));
|
||||
}
|
||||
|
@ -629,7 +622,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);
|
||||
}
|
||||
|
||||
|
@ -638,7 +631,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);
|
||||
}
|
||||
|
@ -647,8 +640,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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -657,7 +650,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);
|
||||
}
|
||||
|
||||
|
@ -666,7 +659,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);
|
||||
}
|
||||
|
@ -680,7 +673,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);
|
||||
}
|
||||
|
||||
|
@ -689,12 +682,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);
|
||||
}
|
||||
|
||||
|
@ -702,9 +695,9 @@ 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 species: PokemonSpecies = useIllusion && this.battleData.illusion.active ? this.battleData.illusion.species! : this.species;
|
||||
|
||||
const formIndex: integer = useIllusion && this.illusion.active ? this.illusion.formIndex! : this.formIndex;
|
||||
const formIndex: integer = useIllusion && this.battleData.illusion.active ? this.battleData.illusion.formIndex! : this.formIndex;
|
||||
|
||||
if (!ignoreOverride && this.summonData?.speciesForm) {
|
||||
return this.summonData.speciesForm;
|
||||
|
@ -720,8 +713,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;
|
||||
|
@ -1217,8 +1210,8 @@ 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!;
|
||||
if (useIllusion && this.battleData.illusion.active) {
|
||||
return this.battleData.illusion.gender!;
|
||||
} else if (!ignoreOverride && this.summonData?.gender !== undefined) {
|
||||
return this.summonData.gender;
|
||||
}
|
||||
|
@ -1229,8 +1222,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;
|
||||
}
|
||||
|
@ -1238,24 +1231,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;
|
||||
}
|
||||
|
@ -1264,7 +1257,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();
|
||||
}
|
||||
|
@ -1275,15 +1268,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1387,7 +1380,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
if (this.mysteryEncounterPokemonData.types && this.mysteryEncounterPokemonData.types.length > 0) {
|
||||
// "Permanent" override for a Pokemon's normal types, currently only used by Mystery Encounters
|
||||
this.mysteryEncounterPokemonData.types.forEach(t => types.push(t));
|
||||
} else if (!ignoreOverride && this.summonData?.types && this.summonData.types.length > 0 && (!this.illusion.active || !doIllusion)) {
|
||||
} else if (!ignoreOverride && this.summonData?.types && this.summonData.types.length > 0 && (!this.battleData.illusion.active || !doIllusion)) {
|
||||
this.summonData.types.forEach(t => types.push(t));
|
||||
} else if (this.mysteryEncounterPokemonData.types && this.mysteryEncounterPokemonData.types.length > 0) {
|
||||
// "Permanent" override for a Pokemon's normal types, currently only used by Mystery Encounters
|
||||
|
@ -3717,7 +3710,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
resetBattleData(): void {
|
||||
const illusionActive: boolean = this.battleData?.illusion.active ?? false
|
||||
this.breakIllusion();
|
||||
this.battleData = new PokemonBattleData();
|
||||
illusionActive ? this.generateIllusion() : null
|
||||
}
|
||||
|
||||
resetBattleSummonData(): void {
|
||||
|
@ -5308,6 +5304,7 @@ export class PokemonBattleData {
|
|||
public berriesEaten: BerryType[] = [];
|
||||
public abilitiesApplied: Abilities[] = [];
|
||||
public abilityRevealed: boolean = false;
|
||||
public illusion: Illusion = {active: false, available: true}
|
||||
}
|
||||
|
||||
export class PokemonBattleSummonData {
|
||||
|
|
|
@ -102,7 +102,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);
|
||||
|
@ -149,7 +149,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();
|
||||
|
@ -157,7 +157,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({
|
||||
|
|
|
@ -88,7 +88,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||
);
|
||||
this.scene.playSound("se/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,
|
||||
|
|
|
@ -43,9 +43,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 () => {
|
||||
|
@ -56,7 +56,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 () => {
|
||||
|
@ -67,7 +67,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 () => {
|
||||
|
@ -76,7 +76,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 () => {
|
||||
|
@ -126,11 +126,11 @@ describe("Abilities - Illusion", () => {
|
|||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
const zoroark = game.scene.getPlayerPokemon()!;
|
||||
console.log(zoroark.illusion);
|
||||
//console.log(zoroark.battleData.illusion);
|
||||
expect(zoroark.name).equals("Axew");
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -534,7 +534,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));
|
||||
|
@ -682,7 +682,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);
|
||||
|
|
|
@ -1294,7 +1294,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);
|
||||
}
|
||||
|
|
|
@ -324,8 +324,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) {
|
||||
|
@ -396,7 +396,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