mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-12-11 08:07:15 +00:00
Clean up various phases
Remove redundant code, utilize default parameters, clean up some leftover `strict-null` `TODO`s, replace `integer` with `number`
This commit is contained in:
parent
7a0c88e661
commit
a0f10c1b7d
@ -1261,8 +1261,6 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
|
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.pushPhase(new TrainerMessageTestPhase(this, TrainerType.RIVAL, TrainerType.RIVAL_2, TrainerType.RIVAL_3, TrainerType.RIVAL_4, TrainerType.RIVAL_5, TrainerType.RIVAL_6));
|
|
||||||
|
|
||||||
if (!waveIndex && lastBattle) {
|
if (!waveIndex && lastBattle) {
|
||||||
const isWaveIndexMultipleOfTen = !(lastBattle.waveIndex % 10);
|
const isWaveIndexMultipleOfTen = !(lastBattle.waveIndex % 10);
|
||||||
const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily;
|
const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily;
|
||||||
|
@ -23,7 +23,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
private pokeball: Phaser.GameObjects.Sprite;
|
private pokeball: Phaser.GameObjects.Sprite;
|
||||||
private originalY: number;
|
private originalY: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, targetIndex: integer, pokeballType: PokeballType) {
|
constructor(scene: BattleScene, targetIndex: number, pokeballType: PokeballType) {
|
||||||
super(scene, BattlerIndex.ENEMY + targetIndex);
|
super(scene, BattlerIndex.ENEMY + targetIndex);
|
||||||
|
|
||||||
this.pokeballType = pokeballType;
|
this.pokeballType = pokeballType;
|
||||||
@ -160,7 +160,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
failCatch(shakeCount: integer) {
|
failCatch(shakeCount: number) {
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
this.scene.playSound("se/pb_rel");
|
this.scene.playSound("se/pb_rel");
|
||||||
@ -262,7 +262,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
}, false);
|
}, false);
|
||||||
}, () => {
|
}, () => {
|
||||||
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
|
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: number, _option: PartyOption) => {
|
||||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
addToParty(slotIndex);
|
addToParty(slotIndex);
|
||||||
|
@ -8,8 +8,12 @@ export class BattlePhase extends Phase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showEnemyTrainer(trainerSlot: TrainerSlot = TrainerSlot.NONE): void {
|
showEnemyTrainer(trainerSlot: TrainerSlot = TrainerSlot.NONE): void {
|
||||||
const sprites = this.scene.currentBattle.trainer?.getSprites()!; // TODO: is this bang correct?
|
if (!this.scene.currentBattle.trainer) {
|
||||||
const tintSprites = this.scene.currentBattle.trainer?.getTintSprites()!; // TODO: is this bang correct?
|
console.warn("Enemy trainer is missing!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const sprites = this.scene.currentBattle.trainer.getSprites();
|
||||||
|
const tintSprites = this.scene.currentBattle.trainer.getTintSprites();
|
||||||
for (let i = 0; i < sprites.length; i++) {
|
for (let i = 0; i < sprites.length; i++) {
|
||||||
const visible = !trainerSlot || !i === (trainerSlot === TrainerSlot.TRAINER) || sprites.length < 2;
|
const visible = !trainerSlot || !i === (trainerSlot === TrainerSlot.TRAINER) || sprites.length < 2;
|
||||||
[ sprites[i], tintSprites[i] ].map(sprite => {
|
[ sprites[i], tintSprites[i] ].map(sprite => {
|
||||||
|
@ -4,10 +4,9 @@ import { BattlerIndex } from "#app/battle";
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
|
|
||||||
export class CheckStatusEffectPhase extends Phase {
|
export class CheckStatusEffectPhase extends Phase {
|
||||||
private order : BattlerIndex[];
|
private order: BattlerIndex[];
|
||||||
constructor(scene : BattleScene, order : BattlerIndex[]) {
|
constructor(scene: BattleScene, order: BattlerIndex[]) {
|
||||||
super(scene);
|
super(scene);
|
||||||
this.scene = scene;
|
|
||||||
this.order = order;
|
this.order = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ import { SwitchPhase } from "./switch-phase";
|
|||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
|
|
||||||
export class CheckSwitchPhase extends BattlePhase {
|
export class CheckSwitchPhase extends BattlePhase {
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
protected useName: boolean;
|
protected useName: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, fieldIndex: integer, useName: boolean) {
|
constructor(scene: BattleScene, fieldIndex: number, useName: boolean) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.fieldIndex = fieldIndex;
|
this.fieldIndex = fieldIndex;
|
||||||
|
@ -21,9 +21,9 @@ import { ArenaTagSide } from "#app/data/arena-tag";
|
|||||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||||
|
|
||||||
export class CommandPhase extends FieldPhase {
|
export class CommandPhase extends FieldPhase {
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, fieldIndex: integer) {
|
constructor(scene: BattleScene, fieldIndex: number) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.fieldIndex = fieldIndex;
|
this.fieldIndex = fieldIndex;
|
||||||
@ -90,7 +90,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommand(command: Command, cursor: integer, ...args: any[]): boolean {
|
handleCommand(command: Command, cursor: number, ...args: any[]): boolean {
|
||||||
const playerPokemon = this.scene.getPlayerField()[this.fieldIndex];
|
const playerPokemon = this.scene.getPlayerField()[this.fieldIndex];
|
||||||
let success: boolean;
|
let success: boolean;
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFieldIndex(): integer {
|
getFieldIndex(): number {
|
||||||
return this.fieldIndex;
|
return this.fieldIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ import { PokemonPhase } from "./pokemon-phase";
|
|||||||
|
|
||||||
export class CommonAnimPhase extends PokemonPhase {
|
export class CommonAnimPhase extends PokemonPhase {
|
||||||
private anim: CommonAnim | null;
|
private anim: CommonAnim | null;
|
||||||
private targetIndex: integer | undefined;
|
private targetIndex?: BattlerIndex;
|
||||||
private playOnEmptyField: boolean;
|
private playOnEmptyField: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex?: BattlerIndex, targetIndex?: BattlerIndex | undefined, anim?: CommonAnim, playOnEmptyField: boolean = false) {
|
constructor(scene: BattleScene, battlerIndex?: BattlerIndex, targetIndex?: BattlerIndex, anim: CommonAnim | null = null, playOnEmptyField: boolean = false) {
|
||||||
super(scene, battlerIndex);
|
super(scene, battlerIndex);
|
||||||
|
|
||||||
this.anim = anim!; // TODO: is this bang correct?
|
this.anim = anim;
|
||||||
this.targetIndex = targetIndex;
|
this.targetIndex = targetIndex;
|
||||||
this.playOnEmptyField = playOnEmptyField;
|
this.playOnEmptyField = playOnEmptyField;
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,15 @@ import * as Utils from "#app/utils";
|
|||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
|
|
||||||
export class DamagePhase extends PokemonPhase {
|
export class DamagePhase extends PokemonPhase {
|
||||||
private amount: integer;
|
private amount: number;
|
||||||
private damageResult: DamageResult;
|
private damageResult: DamageResult;
|
||||||
private critical: boolean;
|
private critical: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, amount: integer, damageResult?: DamageResult, critical: boolean = false) {
|
constructor(scene: BattleScene, battlerIndex: BattlerIndex, amount: number, damageResult: DamageResult = HitResult.EFFECTIVE, critical: boolean = false) {
|
||||||
super(scene, battlerIndex);
|
super(scene, battlerIndex);
|
||||||
|
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.damageResult = damageResult || HitResult.EFFECTIVE;
|
this.damageResult = damageResult;
|
||||||
this.critical = critical;
|
this.critical = critical;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ export class DamagePhase extends PokemonPhase {
|
|||||||
this.applyDamage();
|
this.applyDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAmount(amount: integer): void {
|
updateAmount(amount: number): void {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
private eggHatchData: EggHatchData;
|
private eggHatchData: EggHatchData;
|
||||||
|
|
||||||
/** The number of eggs that are hatching */
|
/** The number of eggs that are hatching */
|
||||||
private eggsToHatchCount: integer;
|
private eggsToHatchCount: number;
|
||||||
/** The container that lists how many eggs are hatching */
|
/** The container that lists how many eggs are hatching */
|
||||||
private eggCounterContainer: EggCounterContainer;
|
private eggCounterContainer: EggCounterContainer;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
/** The newly hatched {@link PlayerPokemon} */
|
/** The newly hatched {@link PlayerPokemon} */
|
||||||
private pokemon: PlayerPokemon;
|
private pokemon: PlayerPokemon;
|
||||||
/** The index of which egg move is unlocked. 0-2 is common, 3 is rare */
|
/** The index of which egg move is unlocked. 0-2 is common, 3 is rare */
|
||||||
private eggMoveIndex: integer;
|
private eggMoveIndex: number;
|
||||||
/** Internal booleans representing if the egg is hatched, able to be skipped, or skipped */
|
/** Internal booleans representing if the egg is hatched, able to be skipped, or skipped */
|
||||||
private hatched: boolean;
|
private hatched: boolean;
|
||||||
private canSkip: boolean;
|
private canSkip: boolean;
|
||||||
@ -66,7 +66,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
private evolutionBgm: AnySound;
|
private evolutionBgm: AnySound;
|
||||||
private eggLapsePhase: EggLapsePhase;
|
private eggLapsePhase: EggLapsePhase;
|
||||||
|
|
||||||
constructor(scene: BattleScene, hatchScene: EggLapsePhase, egg: Egg, eggsToHatchCount: integer) {
|
constructor(scene: BattleScene, hatchScene: EggLapsePhase, egg: Egg, eggsToHatchCount: number) {
|
||||||
super(scene);
|
super(scene);
|
||||||
this.eggLapsePhase = hatchScene;
|
this.eggLapsePhase = hatchScene;
|
||||||
this.egg = egg;
|
this.egg = egg;
|
||||||
@ -219,7 +219,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param count the current number of times this function has been called.
|
* @param count the current number of times this function has been called.
|
||||||
* @returns nothing since it's a Promise<void>
|
* @returns nothing since it's a Promise<void>
|
||||||
*/
|
*/
|
||||||
doEggShake(intensity: number, repeatCount?: integer, count?: integer): Promise<void> {
|
doEggShake(intensity: number, repeatCount?: number, count?: number): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (repeatCount === undefined) {
|
if (repeatCount === undefined) {
|
||||||
repeatCount = 0;
|
repeatCount = 0;
|
||||||
@ -376,7 +376,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param amplitude Scaling
|
* @param amplitude Scaling
|
||||||
* @returns a number
|
* @returns a number
|
||||||
*/
|
*/
|
||||||
sin(index: integer, amplitude: integer): number {
|
sin(index: number, amplitude: number): number {
|
||||||
return amplitude * Math.sin(index * (Math.PI / 128));
|
return amplitude * Math.sin(index * (Math.PI / 128));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param intensity number of times this is repeated (this is a badly named variable)
|
* @param intensity number of times this is repeated (this is a badly named variable)
|
||||||
* @param offsetY how much to offset the Y coordinates
|
* @param offsetY how much to offset the Y coordinates
|
||||||
*/
|
*/
|
||||||
doSpray(intensity: integer, offsetY?: number) {
|
doSpray(intensity: number, offsetY?: number) {
|
||||||
this.scene.tweens.addCounter({
|
this.scene.tweens.addCounter({
|
||||||
repeat: intensity,
|
repeat: intensity,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: Utils.getFrameMs(1),
|
||||||
@ -400,7 +400,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param trigIndex Used to modify the particle's vertical speed, is a random number from 0-7
|
* @param trigIndex Used to modify the particle's vertical speed, is a random number from 0-7
|
||||||
* @param offsetY how much to offset the Y coordinate
|
* @param offsetY how much to offset the Y coordinate
|
||||||
*/
|
*/
|
||||||
doSprayParticle(trigIndex: integer, offsetY: number) {
|
doSprayParticle(trigIndex: number, offsetY: number) {
|
||||||
const initialX = this.eggHatchBg.displayWidth / 2;
|
const initialX = this.eggHatchBg.displayWidth / 2;
|
||||||
const initialY = this.eggHatchBg.displayHeight / 2 + offsetY;
|
const initialY = this.eggHatchBg.displayHeight / 2 + offsetY;
|
||||||
const shardKey = !this.egg.isManaphyEgg() ? this.egg.tier.toString() : "1";
|
const shardKey = !this.egg.isManaphyEgg() ? this.egg.tier.toString() : "1";
|
||||||
|
@ -40,10 +40,10 @@ import { WEIGHT_INCREMENT_ON_SPAWN_MISS } from "#app/data/mystery-encounters/mys
|
|||||||
export class EncounterPhase extends BattlePhase {
|
export class EncounterPhase extends BattlePhase {
|
||||||
private loaded: boolean;
|
private loaded: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, loaded?: boolean) {
|
constructor(scene: BattleScene, loaded: boolean = false) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.loaded = !!loaded;
|
this.loaded = loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
@ -268,7 +268,7 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
const enemyField = this.scene.getEnemyField();
|
const enemyField = this.scene.getEnemyField();
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: [ this.scene.arenaEnemy, this.scene.currentBattle.trainer, enemyField, this.scene.arenaPlayer, this.scene.trainer ].flat(),
|
targets: [ this.scene.arenaEnemy, this.scene.currentBattle.trainer, enemyField, this.scene.arenaPlayer, this.scene.trainer ].flat(),
|
||||||
x: (_target, _key, value, fieldIndex: integer) => fieldIndex < 2 + (enemyField.length) ? value + 300 : value - 300,
|
x: (_target, _key, value, fieldIndex: number) => fieldIndex < 2 + (enemyField.length) ? value + 300 : value - 300,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
if (!this.tryOverrideForBattleSpec()) {
|
if (!this.tryOverrideForBattleSpec()) {
|
||||||
|
@ -13,10 +13,10 @@ import { FieldPhase } from "./field-phase";
|
|||||||
* @see {@linkcode EnemyPokemon.getNextMove}
|
* @see {@linkcode EnemyPokemon.getNextMove}
|
||||||
*/
|
*/
|
||||||
export class EnemyCommandPhase extends FieldPhase {
|
export class EnemyCommandPhase extends FieldPhase {
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
protected skipTurn: boolean = false;
|
protected skipTurn: boolean = false;
|
||||||
|
|
||||||
constructor(scene: BattleScene, fieldIndex: integer) {
|
constructor(scene: BattleScene, fieldIndex: number) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.fieldIndex = fieldIndex;
|
this.fieldIndex = fieldIndex;
|
||||||
|
@ -3,7 +3,7 @@ import { EnemyPokemon } from "#app/field/pokemon";
|
|||||||
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
||||||
|
|
||||||
export abstract class EnemyPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
export abstract class EnemyPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer) {
|
constructor(scene: BattleScene, partyMemberIndex: number) {
|
||||||
super(scene, partyMemberIndex, false);
|
super(scene, partyMemberIndex, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import { EndEvolutionPhase } from "#app/phases/end-evolution-phase";
|
|||||||
|
|
||||||
export class EvolutionPhase extends Phase {
|
export class EvolutionPhase extends Phase {
|
||||||
protected pokemon: PlayerPokemon;
|
protected pokemon: PlayerPokemon;
|
||||||
protected lastLevel: integer;
|
protected lastLevel: number;
|
||||||
|
|
||||||
private preEvolvedPokemonName: string;
|
private preEvolvedPokemonName: string;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
protected pokemonEvoSprite: Phaser.GameObjects.Sprite;
|
protected pokemonEvoSprite: Phaser.GameObjects.Sprite;
|
||||||
protected pokemonEvoTintSprite: Phaser.GameObjects.Sprite;
|
protected pokemonEvoTintSprite: Phaser.GameObjects.Sprite;
|
||||||
|
|
||||||
constructor(scene: BattleScene, pokemon: PlayerPokemon, evolution: SpeciesFormEvolution | null, lastLevel: integer) {
|
constructor(scene: BattleScene, pokemon: PlayerPokemon, evolution: SpeciesFormEvolution | null, lastLevel: number) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.pokemon = pokemon;
|
this.pokemon = pokemon;
|
||||||
@ -339,7 +339,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doCycle(l: number, lastCycle: integer = 15): Promise<boolean> {
|
doCycle(l: number, lastCycle: number = 15): Promise<boolean> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const isLastCycle = l === lastCycle;
|
const isLastCycle = l === lastCycle;
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
@ -410,7 +410,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doSpiralUpwardParticle(trigIndex: integer) {
|
doSpiralUpwardParticle(trigIndex: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const particle = this.scene.add.image(initialX, 0, "evo_sparkle");
|
const particle = this.scene.add.image(initialX, 0, "evo_sparkle");
|
||||||
this.evolutionContainer.add(particle);
|
this.evolutionContainer.add(particle);
|
||||||
@ -446,7 +446,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
doArcDownParticle(trigIndex: integer) {
|
doArcDownParticle(trigIndex: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const particle = this.scene.add.image(initialX, 0, "evo_sparkle");
|
const particle = this.scene.add.image(initialX, 0, "evo_sparkle");
|
||||||
particle.setScale(0.5);
|
particle.setScale(0.5);
|
||||||
@ -479,7 +479,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
doCircleInwardParticle(trigIndex: integer, speed: integer) {
|
doCircleInwardParticle(trigIndex: number, speed: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
||||||
const particle = this.scene.add.image(initialX, initialY, "evo_sparkle");
|
const particle = this.scene.add.image(initialX, initialY, "evo_sparkle");
|
||||||
@ -511,7 +511,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
doSprayParticle(trigIndex: integer) {
|
doSprayParticle(trigIndex: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
||||||
const particle = this.scene.add.image(initialX, initialY, "evo_sparkle");
|
const particle = this.scene.add.image(initialX, initialY, "evo_sparkle");
|
||||||
|
@ -9,7 +9,7 @@ import { LevelUpPhase } from "./level-up-phase";
|
|||||||
export class ExpPhase extends PlayerPartyMemberPokemonPhase {
|
export class ExpPhase extends PlayerPartyMemberPokemonPhase {
|
||||||
private expValue: number;
|
private expValue: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer, expValue: number) {
|
constructor(scene: BattleScene, partyMemberIndex: number, expValue: number) {
|
||||||
super(scene, partyMemberIndex);
|
super(scene, partyMemberIndex);
|
||||||
|
|
||||||
this.expValue = expValue;
|
this.expValue = expValue;
|
||||||
|
@ -29,10 +29,10 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
private victory: boolean;
|
private victory: boolean;
|
||||||
private firstRibbons: PokemonSpecies[] = [];
|
private firstRibbons: PokemonSpecies[] = [];
|
||||||
|
|
||||||
constructor(scene: BattleScene, victory?: boolean) {
|
constructor(scene: BattleScene, victory: boolean = false) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.victory = !!victory;
|
this.victory = victory;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
@ -25,10 +25,10 @@ export enum LearnMoveType {
|
|||||||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||||
private moveId: Moves;
|
private moveId: Moves;
|
||||||
private messageMode: Mode;
|
private messageMode: Mode;
|
||||||
private learnMoveType;
|
private learnMoveType: LearnMoveType;
|
||||||
private cost: number;
|
private cost: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves, learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE, cost: number = -1) {
|
constructor(scene: BattleScene, partyMemberIndex: number, moveId: Moves, learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE, cost: number = -1) {
|
||||||
super(scene, partyMemberIndex);
|
super(scene, partyMemberIndex);
|
||||||
this.moveId = moveId;
|
this.moveId = moveId;
|
||||||
this.learnMoveType = learnMoveType;
|
this.learnMoveType = learnMoveType;
|
||||||
@ -98,7 +98,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
async forgetMoveProcess(move: Move, pokemon: Pokemon) {
|
async forgetMoveProcess(move: Move, pokemon: Pokemon) {
|
||||||
this.scene.ui.setMode(this.messageMode);
|
this.scene.ui.setMode(this.messageMode);
|
||||||
await this.scene.ui.showTextPromise(i18next.t("battle:learnMoveForgetQuestion"), undefined, true);
|
await this.scene.ui.showTextPromise(i18next.t("battle:learnMoveForgetQuestion"), undefined, true);
|
||||||
await this.scene.ui.setModeWithoutClear(Mode.SUMMARY, pokemon, SummaryUiMode.LEARN_MOVE, move, (moveIndex: integer) => {
|
await this.scene.ui.setModeWithoutClear(Mode.SUMMARY, pokemon, SummaryUiMode.LEARN_MOVE, move, (moveIndex: number) => {
|
||||||
if (moveIndex === 4) {
|
if (moveIndex === 4) {
|
||||||
this.scene.ui.setMode(this.messageMode).then(() => this.rejectMoveAndEnd(move, pokemon));
|
this.scene.ui.setMode(this.messageMode).then(() => this.rejectMoveAndEnd(move, pokemon));
|
||||||
return;
|
return;
|
||||||
|
@ -10,10 +10,10 @@ import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-pha
|
|||||||
import { LearnMovePhase } from "./learn-move-phase";
|
import { LearnMovePhase } from "./learn-move-phase";
|
||||||
|
|
||||||
export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
|
export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
|
||||||
private lastLevel: integer;
|
private lastLevel: number;
|
||||||
private level: integer;
|
private level: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer, lastLevel: integer, level: integer) {
|
constructor(scene: BattleScene, partyMemberIndex: number, lastLevel: number, level: number) {
|
||||||
super(scene, partyMemberIndex);
|
super(scene, partyMemberIndex);
|
||||||
|
|
||||||
this.lastLevel = lastLevel;
|
this.lastLevel = lastLevel;
|
||||||
|
@ -11,10 +11,10 @@ import { UnavailablePhase } from "./unavailable-phase";
|
|||||||
export class LoginPhase extends Phase {
|
export class LoginPhase extends Phase {
|
||||||
private showText: boolean;
|
private showText: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, showText?: boolean) {
|
constructor(scene: BattleScene, showText: boolean = true) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.showText = showText === undefined || !!showText;
|
this.showText = showText;
|
||||||
}
|
}
|
||||||
|
|
||||||
start(): void {
|
start(): void {
|
||||||
|
@ -3,18 +3,18 @@ import { Phase } from "#app/phase";
|
|||||||
|
|
||||||
export class MessagePhase extends Phase {
|
export class MessagePhase extends Phase {
|
||||||
private text: string;
|
private text: string;
|
||||||
private callbackDelay: integer | null;
|
private callbackDelay?: number | null;
|
||||||
private prompt: boolean | null;
|
private prompt?: boolean | null;
|
||||||
private promptDelay: integer | null;
|
private promptDelay?: number | null;
|
||||||
private speaker?: string;
|
private speaker?: string;
|
||||||
|
|
||||||
constructor(scene: BattleScene, text: string, callbackDelay?: integer | null, prompt?: boolean | null, promptDelay?: integer | null, speaker?: string) {
|
constructor(scene: BattleScene, text: string, callbackDelay?: number | null, prompt?: boolean | null, promptDelay?: number | null, speaker?: string) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.callbackDelay = callbackDelay!; // TODO: is this bang correct?
|
this.callbackDelay = callbackDelay;
|
||||||
this.prompt = prompt!; // TODO: is this bang correct?
|
this.prompt = prompt;
|
||||||
this.promptDelay = promptDelay!; // TODO: is this bang correct?
|
this.promptDelay = promptDelay;
|
||||||
this.speaker = speaker;
|
this.speaker = speaker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export class MoneyRewardPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
const moneyAmount = new Utils.IntegerHolder(this.scene.getWaveMoneyAmount(this.moneyMultiplier));
|
const moneyAmount = new Utils.NumberHolder(this.scene.getWaveMoneyAmount(this.moneyMultiplier));
|
||||||
|
|
||||||
this.scene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
this.scene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
||||||
|
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
|
||||||
import { initMoveAnim, loadMoveAnimAssets, MoveAnim } from "#app/data/battle-anims";
|
|
||||||
import { allMoves, SelfStatusMove } from "#app/data/move";
|
|
||||||
import { Moves } from "#app/enums/moves";
|
|
||||||
import * as Utils from "#app/utils";
|
|
||||||
import { BattlePhase } from "./battle-phase";
|
|
||||||
|
|
||||||
export class MoveAnimTestPhase extends BattlePhase {
|
|
||||||
private moveQueue: Moves[];
|
|
||||||
|
|
||||||
constructor(scene: BattleScene, moveQueue?: Moves[]) {
|
|
||||||
super(scene);
|
|
||||||
|
|
||||||
this.moveQueue = moveQueue || Utils.getEnumValues(Moves).slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
const moveQueue = this.moveQueue.slice(0);
|
|
||||||
this.playMoveAnim(moveQueue, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
playMoveAnim(moveQueue: Moves[], player: boolean) {
|
|
||||||
const moveId = player ? moveQueue[0] : moveQueue.shift();
|
|
||||||
if (moveId === undefined) {
|
|
||||||
this.playMoveAnim(this.moveQueue.slice(0), true);
|
|
||||||
return;
|
|
||||||
} else if (player) {
|
|
||||||
console.log(Moves[moveId]);
|
|
||||||
}
|
|
||||||
|
|
||||||
initMoveAnim(this.scene, moveId).then(() => {
|
|
||||||
loadMoveAnimAssets(this.scene, [ moveId ], true)
|
|
||||||
.then(() => {
|
|
||||||
const user = player ? this.scene.getPlayerPokemon()! : this.scene.getEnemyPokemon()!;
|
|
||||||
const target = (player !== (allMoves[moveId] instanceof SelfStatusMove)) ? this.scene.getEnemyPokemon()! : this.scene.getPlayerPokemon()!;
|
|
||||||
new MoveAnim(moveId, user, target.getBattlerIndex()).play(this.scene, allMoves[moveId].hitsSubstitute(user, target), () => { // TODO: are the bangs correct here?
|
|
||||||
if (player) {
|
|
||||||
this.playMoveAnim(moveQueue, false);
|
|
||||||
} else {
|
|
||||||
this.playMoveAnim(moveQueue, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,11 +3,11 @@ import Pokemon from "#app/field/pokemon";
|
|||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
|
|
||||||
export abstract class PartyMemberPokemonPhase extends FieldPhase {
|
export abstract class PartyMemberPokemonPhase extends FieldPhase {
|
||||||
protected partyMemberIndex: integer;
|
protected partyMemberIndex: number;
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
protected player: boolean;
|
protected player: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer, player: boolean) {
|
constructor(scene: BattleScene, partyMemberIndex: number, player: boolean) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.partyMemberIndex = partyMemberIndex;
|
this.partyMemberIndex = partyMemberIndex;
|
||||||
|
@ -3,7 +3,7 @@ import { PlayerPokemon } from "#app/field/pokemon";
|
|||||||
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
||||||
|
|
||||||
export abstract class PlayerPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
export abstract class PlayerPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer) {
|
constructor(scene: BattleScene, partyMemberIndex: number) {
|
||||||
super(scene, partyMemberIndex, true);
|
super(scene, partyMemberIndex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,18 +7,18 @@ import { BattlePhase } from "#app/phases/battle-phase";
|
|||||||
|
|
||||||
export class PokemonAnimPhase extends BattlePhase {
|
export class PokemonAnimPhase extends BattlePhase {
|
||||||
/** The type of animation to play in this phase */
|
/** The type of animation to play in this phase */
|
||||||
private key: PokemonAnimType;
|
protected key: PokemonAnimType;
|
||||||
/** The Pokemon to which this animation applies */
|
/** The Pokemon to which this animation applies */
|
||||||
private pokemon: Pokemon;
|
protected pokemon: Pokemon;
|
||||||
/** Any other field sprites affected by this animation */
|
/** Any other field sprites affected by this animation */
|
||||||
private fieldAssets: Phaser.GameObjects.Sprite[];
|
protected fieldAssets: Phaser.GameObjects.Sprite[];
|
||||||
|
|
||||||
constructor(scene: BattleScene, key: PokemonAnimType, pokemon: Pokemon, fieldAssets?: Phaser.GameObjects.Sprite[]) {
|
constructor(scene: BattleScene, key: PokemonAnimType, pokemon: Pokemon, fieldAssets: Phaser.GameObjects.Sprite[] = []) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.pokemon = pokemon;
|
this.pokemon = pokemon;
|
||||||
this.fieldAssets = fieldAssets ?? [];
|
this.fieldAssets = fieldAssets;
|
||||||
}
|
}
|
||||||
|
|
||||||
start(): void {
|
start(): void {
|
||||||
|
@ -14,7 +14,7 @@ import { BattlerTagType } from "#app/enums/battler-tag-type";
|
|||||||
import { HealBlockTag } from "#app/data/battler-tags";
|
import { HealBlockTag } from "#app/data/battler-tags";
|
||||||
|
|
||||||
export class PokemonHealPhase extends CommonAnimPhase {
|
export class PokemonHealPhase extends CommonAnimPhase {
|
||||||
private hpHealed: integer;
|
private hpHealed: number;
|
||||||
private message: string | null;
|
private message: string | null;
|
||||||
private showFullHpMessage: boolean;
|
private showFullHpMessage: boolean;
|
||||||
private skipAnim: boolean;
|
private skipAnim: boolean;
|
||||||
@ -22,7 +22,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
private healStatus: boolean;
|
private healStatus: boolean;
|
||||||
private preventFullHeal: boolean;
|
private preventFullHeal: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, hpHealed: integer, message: string | null, showFullHpMessage: boolean, skipAnim: boolean = false, revive: boolean = false, healStatus: boolean = false, preventFullHeal: boolean = false) {
|
constructor(scene: BattleScene, battlerIndex: BattlerIndex, hpHealed: number, message: string | null, showFullHpMessage: boolean, skipAnim: boolean = false, revive: boolean = false, healStatus: boolean = false, preventFullHeal: boolean = false) {
|
||||||
super(scene, battlerIndex, undefined, CommonAnim.HEALTH_UP);
|
super(scene, battlerIndex, undefined, CommonAnim.HEALTH_UP);
|
||||||
|
|
||||||
this.hpHealed = hpHealed;
|
this.hpHealed = hpHealed;
|
||||||
@ -59,7 +59,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
this.message = null;
|
this.message = null;
|
||||||
return super.end();
|
return super.end();
|
||||||
} else if (healOrDamage) {
|
} else if (healOrDamage) {
|
||||||
const hpRestoreMultiplier = new Utils.IntegerHolder(1);
|
const hpRestoreMultiplier = new Utils.NumberHolder(1);
|
||||||
if (!this.revive) {
|
if (!this.revive) {
|
||||||
this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
|
this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,16 @@ import Pokemon from "#app/field/pokemon";
|
|||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
|
|
||||||
export abstract class PokemonPhase extends FieldPhase {
|
export abstract class PokemonPhase extends FieldPhase {
|
||||||
protected battlerIndex: BattlerIndex | integer;
|
protected battlerIndex: BattlerIndex | number;
|
||||||
public player: boolean;
|
public player: boolean;
|
||||||
public fieldIndex: integer;
|
public fieldIndex: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex?: BattlerIndex | integer) {
|
constructor(scene: BattleScene, battlerIndex?: BattlerIndex | number) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
|
battlerIndex = battlerIndex ?? scene.getField().find(p => p?.isActive())!.getBattlerIndex(); // TODO: is the bang correct here?
|
||||||
if (battlerIndex === undefined) {
|
if (battlerIndex === undefined) {
|
||||||
battlerIndex = scene.getField().find(p => p?.isActive())!.getBattlerIndex(); // TODO: is the bang correct here?
|
console.warn("There are no Pokemon on the field!"); // TODO: figure out a suitable fallback behavior
|
||||||
}
|
}
|
||||||
|
|
||||||
this.battlerIndex = battlerIndex;
|
this.battlerIndex = battlerIndex;
|
||||||
|
@ -4,12 +4,12 @@ import { EndCardPhase } from "./end-card-phase";
|
|||||||
import { TitlePhase } from "./title-phase";
|
import { TitlePhase } from "./title-phase";
|
||||||
|
|
||||||
export class PostGameOverPhase extends Phase {
|
export class PostGameOverPhase extends Phase {
|
||||||
private endCardPhase: EndCardPhase | null;
|
private endCardPhase?: EndCardPhase;
|
||||||
|
|
||||||
constructor(scene: BattleScene, endCardPhase?: EndCardPhase) {
|
constructor(scene: BattleScene, endCardPhase?: EndCardPhase) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.endCardPhase = endCardPhase!; // TODO: is this bang correct?
|
this.endCardPhase = endCardPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
@ -4,12 +4,12 @@ import { Mode } from "#app/ui/ui";
|
|||||||
import * as Utils from "#app/utils";
|
import * as Utils from "#app/utils";
|
||||||
|
|
||||||
export class ReloadSessionPhase extends Phase {
|
export class ReloadSessionPhase extends Phase {
|
||||||
private systemDataStr: string | null;
|
private systemDataStr?: string;
|
||||||
|
|
||||||
constructor(scene: BattleScene, systemDataStr?: string) {
|
constructor(scene: BattleScene, systemDataStr?: string) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.systemDataStr = systemDataStr ?? null;
|
this.systemDataStr = systemDataStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
start(): void {
|
start(): void {
|
||||||
|
@ -4,7 +4,7 @@ import { SwitchType } from "#enums/switch-type";
|
|||||||
import { SwitchSummonPhase } from "./switch-summon-phase";
|
import { SwitchSummonPhase } from "./switch-summon-phase";
|
||||||
|
|
||||||
export class ReturnPhase extends SwitchSummonPhase {
|
export class ReturnPhase extends SwitchSummonPhase {
|
||||||
constructor(scene: BattleScene, fieldIndex: integer) {
|
constructor(scene: BattleScene, fieldIndex: number) {
|
||||||
super(scene, SwitchType.SWITCH, fieldIndex, -1, true);
|
super(scene, SwitchType.SWITCH, fieldIndex, -1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ import i18next from "i18next";
|
|||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
|
|
||||||
export class ScanIvsPhase extends PokemonPhase {
|
export class ScanIvsPhase extends PokemonPhase {
|
||||||
private shownIvs: integer;
|
private shownIvs: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, shownIvs: integer) {
|
constructor(scene: BattleScene, battlerIndex: BattlerIndex, shownIvs: number) {
|
||||||
super(scene, battlerIndex);
|
super(scene, battlerIndex);
|
||||||
|
|
||||||
this.shownIvs = shownIvs;
|
this.shownIvs = shownIvs;
|
||||||
|
@ -37,7 +37,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
||||||
let biomes: Biome[] = [];
|
let biomes: Biome[] = [];
|
||||||
this.scene.executeWithSeedOffset(() => {
|
this.scene.executeWithSeedOffset(() => {
|
||||||
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, integer])[])
|
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
||||||
.filter(b => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
.filter(b => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
||||||
.map(b => !Array.isArray(b) ? b : b[0]);
|
.map(b => !Array.isArray(b) ? b : b[0]);
|
||||||
}, this.scene.currentBattle.waveIndex);
|
}, this.scene.currentBattle.waveIndex);
|
||||||
@ -46,7 +46,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
this.scene.executeWithSeedOffset(() => {
|
this.scene.executeWithSeedOffset(() => {
|
||||||
biomeChoices = (!Array.isArray(biomeLinks[currentBiome])
|
biomeChoices = (!Array.isArray(biomeLinks[currentBiome])
|
||||||
? [ biomeLinks[currentBiome] as Biome ]
|
? [ biomeLinks[currentBiome] as Biome ]
|
||||||
: biomeLinks[currentBiome] as (Biome | [Biome, integer])[])
|
: biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
||||||
.filter((b, i) => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
.filter((b, i) => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
||||||
.map(b => Array.isArray(b) ? b[0] : b);
|
.map(b => Array.isArray(b) ? b[0] : b);
|
||||||
}, this.scene.currentBattle.waveIndex);
|
}, this.scene.currentBattle.waveIndex);
|
||||||
|
@ -13,14 +13,14 @@ import { CustomModifierSettings } from "#app/modifier/modifier-type";
|
|||||||
import { isNullOrUndefined, NumberHolder } from "#app/utils";
|
import { isNullOrUndefined, NumberHolder } from "#app/utils";
|
||||||
|
|
||||||
export class SelectModifierPhase extends BattlePhase {
|
export class SelectModifierPhase extends BattlePhase {
|
||||||
private rerollCount: integer;
|
private rerollCount: number;
|
||||||
private modifierTiers?: ModifierTier[];
|
private modifierTiers?: ModifierTier[];
|
||||||
private customModifierSettings?: CustomModifierSettings;
|
private customModifierSettings?: CustomModifierSettings;
|
||||||
private isCopy: boolean;
|
private isCopy: boolean;
|
||||||
|
|
||||||
private typeOptions: ModifierTypeOption[];
|
private typeOptions: ModifierTypeOption[];
|
||||||
|
|
||||||
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings, isCopy: boolean = false) {
|
constructor(scene: BattleScene, rerollCount: number = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings, isCopy: boolean = false) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.rerollCount = rerollCount;
|
this.rerollCount = rerollCount;
|
||||||
@ -42,7 +42,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
if (!this.isCopy) {
|
if (!this.isCopy) {
|
||||||
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
||||||
}
|
}
|
||||||
const modifierCount = new Utils.IntegerHolder(3);
|
const modifierCount = new Utils.NumberHolder(3);
|
||||||
if (this.isPlayer()) {
|
if (this.isPlayer()) {
|
||||||
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
||||||
this.scene.applyModifiers(TempExtraModifierModifier, true, modifierCount);
|
this.scene.applyModifiers(TempExtraModifierModifier, true, modifierCount);
|
||||||
@ -63,7 +63,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
|
|
||||||
this.typeOptions = this.getModifierTypeOptions(modifierCount.value);
|
this.typeOptions = this.getModifierTypeOptions(modifierCount.value);
|
||||||
|
|
||||||
const modifierSelectCallback = (rowCursor: integer, cursor: integer) => {
|
const modifierSelectCallback = (rowCursor: number, cursor: number) => {
|
||||||
if (rowCursor < 0 || cursor < 0) {
|
if (rowCursor < 0 || cursor < 0) {
|
||||||
this.scene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => {
|
this.scene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => {
|
||||||
this.scene.ui.setOverlayMode(Mode.CONFIRM, () => {
|
this.scene.ui.setOverlayMode(Mode.CONFIRM, () => {
|
||||||
@ -75,7 +75,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let modifierType: ModifierType;
|
let modifierType: ModifierType;
|
||||||
let cost: integer;
|
let cost: number;
|
||||||
const rerollCost = this.getRerollCost(this.scene.lockModifierTiers);
|
const rerollCost = this.getRerollCost(this.scene.lockModifierTiers);
|
||||||
switch (rowCursor) {
|
switch (rowCursor) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -98,7 +98,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, itemQuantity: integer, toSlotIndex: integer) => {
|
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: number, itemIndex: number, itemQuantity: number, toSlotIndex: number) => {
|
||||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||||
&& m.isTransferable && m.pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
&& m.isTransferable && m.pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
||||||
@ -197,7 +197,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
|
|
||||||
if (modifierType! instanceof PokemonModifierType) { //TODO: is the bang correct?
|
if (modifierType! instanceof PokemonModifierType) { //TODO: is the bang correct?
|
||||||
if (modifierType instanceof FusePokemonModifierType) {
|
if (modifierType instanceof FusePokemonModifierType) {
|
||||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.SPLICE, -1, (fromSlotIndex: integer, spliceSlotIndex: integer) => {
|
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.SPLICE, -1, (fromSlotIndex: number, spliceSlotIndex: number) => {
|
||||||
if (spliceSlotIndex !== undefined && fromSlotIndex < 6 && spliceSlotIndex < 6 && fromSlotIndex !== spliceSlotIndex) {
|
if (spliceSlotIndex !== undefined && fromSlotIndex < 6 && spliceSlotIndex < 6 && fromSlotIndex !== spliceSlotIndex) {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||||
const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex])!; //TODO: is the bang correct?
|
const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex])!; //TODO: is the bang correct?
|
||||||
@ -220,13 +220,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
const tmMoveId = isTmModifier
|
const tmMoveId = isTmModifier
|
||||||
? (modifierType as TmModifierType).moveId
|
? (modifierType as TmModifierType).moveId
|
||||||
: undefined;
|
: undefined;
|
||||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, partyUiMode, -1, (slotIndex: integer, option: PartyOption) => {
|
this.scene.ui.setModeWithoutClear(Mode.PARTY, partyUiMode, -1, (slotIndex: number, option: PartyOption) => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||||
const modifier = !isMoveModifier
|
const modifier = !isMoveModifier
|
||||||
? !isRememberMoveModifier
|
? !isRememberMoveModifier
|
||||||
? modifierType.newModifier(party[slotIndex])
|
? modifierType.newModifier(party[slotIndex])
|
||||||
: modifierType.newModifier(party[slotIndex], option as integer)
|
: modifierType.newModifier(party[slotIndex], option as number)
|
||||||
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
||||||
applyModifier(modifier!, true); // TODO: is the bang correct?
|
applyModifier(modifier!, true); // TODO: is the bang correct?
|
||||||
});
|
});
|
||||||
@ -288,7 +288,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return ModifierPoolType.PLAYER;
|
return ModifierPoolType.PLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
getModifierTypeOptions(modifierCount: number): ModifierTypeOption[] {
|
||||||
return getPlayerModifierTypeOptions(modifierCount, this.scene.getPlayerParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
return getPlayerModifierTypeOptions(modifierCount, this.scene.getPlayerParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export class SelectStarterPhase extends Phase {
|
|||||||
|
|
||||||
this.scene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => {
|
this.scene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => {
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
this.scene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: integer) => {
|
this.scene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||||
if (slotId === -1) {
|
if (slotId === -1) {
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.pushPhase(new TitlePhase(this.scene));
|
this.scene.pushPhase(new TitlePhase(this.scene));
|
||||||
@ -45,7 +45,7 @@ export class SelectStarterPhase extends Phase {
|
|||||||
initBattle(starters: Starter[]) {
|
initBattle(starters: Starter[]) {
|
||||||
const party = this.scene.getPlayerParty();
|
const party = this.scene.getPlayerParty();
|
||||||
const loadPokemonAssets: Promise<void>[] = [];
|
const loadPokemonAssets: Promise<void>[] = [];
|
||||||
starters.forEach((starter: Starter, i: integer) => {
|
starters.forEach((starter: Starter, i: number) => {
|
||||||
if (!i && Overrides.STARTER_SPECIES_OVERRIDE) {
|
if (!i && Overrides.STARTER_SPECIES_OVERRIDE) {
|
||||||
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
|
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import i18next from "#app/plugins/i18n";
|
|||||||
import { allMoves } from "#app/data/move";
|
import { allMoves } from "#app/data/move";
|
||||||
|
|
||||||
export class SelectTargetPhase extends PokemonPhase {
|
export class SelectTargetPhase extends PokemonPhase {
|
||||||
constructor(scene: BattleScene, fieldIndex: integer) {
|
constructor(scene: BattleScene, fieldIndex: number) {
|
||||||
super(scene, fieldIndex);
|
super(scene, fieldIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-pha
|
|||||||
export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
|
export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
|
||||||
private expValue: number;
|
private expValue: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer, expValue: number) {
|
constructor(scene: BattleScene, partyMemberIndex: number, expValue: number) {
|
||||||
super(scene, partyMemberIndex);
|
super(scene, partyMemberIndex);
|
||||||
|
|
||||||
this.expValue = expValue;
|
this.expValue = expValue;
|
||||||
|
@ -16,14 +16,14 @@ export type StatStageChangeCallback = (target: Pokemon | null, changed: BattleSt
|
|||||||
export class StatStageChangePhase extends PokemonPhase {
|
export class StatStageChangePhase extends PokemonPhase {
|
||||||
private stats: BattleStat[];
|
private stats: BattleStat[];
|
||||||
private selfTarget: boolean;
|
private selfTarget: boolean;
|
||||||
private stages: integer;
|
private stages: number;
|
||||||
private showMessage: boolean;
|
private showMessage: boolean;
|
||||||
private ignoreAbilities: boolean;
|
private ignoreAbilities: boolean;
|
||||||
private canBeCopied: boolean;
|
private canBeCopied: boolean;
|
||||||
private onChange: StatStageChangeCallback | null;
|
private onChange: StatStageChangeCallback | null;
|
||||||
|
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, selfTarget: boolean, stats: BattleStat[], stages: integer, showMessage: boolean = true, ignoreAbilities: boolean = false, canBeCopied: boolean = true, onChange: StatStageChangeCallback | null = null) {
|
constructor(scene: BattleScene, battlerIndex: BattlerIndex, selfTarget: boolean, stats: BattleStat[], stages: number, showMessage: boolean = true, ignoreAbilities: boolean = false, canBeCopied: boolean = true, onChange: StatStageChangeCallback | null = null) {
|
||||||
super(scene, battlerIndex);
|
super(scene, battlerIndex);
|
||||||
|
|
||||||
this.selfTarget = selfTarget;
|
this.selfTarget = selfTarget;
|
||||||
@ -214,7 +214,7 @@ export class StatStageChangePhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatStageChangeMessages(stats: BattleStat[], stages: integer, relStages: integer[]): string[] {
|
getStatStageChangeMessages(stats: BattleStat[], stages: number, relStages: number[]): string[] {
|
||||||
const messages: string[] = [];
|
const messages: string[] = [];
|
||||||
|
|
||||||
const relStageStatIndexes = {};
|
const relStageStatIndexes = {};
|
||||||
|
@ -4,7 +4,7 @@ import i18next from "i18next";
|
|||||||
import { SummonPhase } from "./summon-phase";
|
import { SummonPhase } from "./summon-phase";
|
||||||
|
|
||||||
export class SummonMissingPhase extends SummonPhase {
|
export class SummonMissingPhase extends SummonPhase {
|
||||||
constructor(scene: BattleScene, fieldIndex: integer) {
|
constructor(scene: BattleScene, fieldIndex: number) {
|
||||||
super(scene, fieldIndex);
|
super(scene, fieldIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
|||||||
export class SummonPhase extends PartyMemberPokemonPhase {
|
export class SummonPhase extends PartyMemberPokemonPhase {
|
||||||
private loaded: boolean;
|
private loaded: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, fieldIndex: integer, player: boolean = true, loaded: boolean = false) {
|
constructor(scene: BattleScene, fieldIndex: number, player: boolean = true, loaded: boolean = false) {
|
||||||
super(scene, fieldIndex, player);
|
super(scene, fieldIndex, player);
|
||||||
|
|
||||||
this.loaded = loaded;
|
this.loaded = loaded;
|
||||||
|
@ -10,7 +10,7 @@ import { SwitchSummonPhase } from "./switch-summon-phase";
|
|||||||
* for the player (if a switch would be valid for the current battle state).
|
* for the player (if a switch would be valid for the current battle state).
|
||||||
*/
|
*/
|
||||||
export class SwitchPhase extends BattlePhase {
|
export class SwitchPhase extends BattlePhase {
|
||||||
protected readonly fieldIndex: integer;
|
protected readonly fieldIndex: number;
|
||||||
private readonly switchType: SwitchType;
|
private readonly switchType: SwitchType;
|
||||||
private readonly isModal: boolean;
|
private readonly isModal: boolean;
|
||||||
private readonly doReturn: boolean;
|
private readonly doReturn: boolean;
|
||||||
@ -25,7 +25,7 @@ export class SwitchPhase extends BattlePhase {
|
|||||||
* @param doReturn Indicates if the party member on the field should be
|
* @param doReturn Indicates if the party member on the field should be
|
||||||
* recalled to ball or has already left the field. Passed to {@linkcode SwitchSummonPhase}.
|
* recalled to ball or has already left the field. Passed to {@linkcode SwitchSummonPhase}.
|
||||||
*/
|
*/
|
||||||
constructor(scene: BattleScene, switchType: SwitchType, fieldIndex: integer, isModal: boolean, doReturn: boolean) {
|
constructor(scene: BattleScene, switchType: SwitchType, fieldIndex: number, isModal: boolean, doReturn: boolean) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.switchType = switchType;
|
this.switchType = switchType;
|
||||||
@ -61,7 +61,7 @@ export class SwitchPhase extends BattlePhase {
|
|||||||
// Override field index to 0 in case of double battle where 2/3 remaining legal party members fainted at once
|
// Override field index to 0 in case of double battle where 2/3 remaining legal party members fainted at once
|
||||||
const fieldIndex = this.scene.currentBattle.getBattlerCount() === 1 || this.scene.getPokemonAllowedInBattle().length > 1 ? this.fieldIndex : 0;
|
const fieldIndex = this.scene.currentBattle.getBattlerCount() === 1 || this.scene.getPokemonAllowedInBattle().length > 1 ? this.fieldIndex : 0;
|
||||||
|
|
||||||
this.scene.ui.setMode(Mode.PARTY, this.isModal ? PartyUiMode.FAINT_SWITCH : PartyUiMode.POST_BATTLE_SWITCH, fieldIndex, (slotIndex: integer, option: PartyOption) => {
|
this.scene.ui.setMode(Mode.PARTY, this.isModal ? PartyUiMode.FAINT_SWITCH : PartyUiMode.POST_BATTLE_SWITCH, fieldIndex, (slotIndex: number, option: PartyOption) => {
|
||||||
if (slotIndex >= this.scene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
if (slotIndex >= this.scene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
||||||
const switchType = (option === PartyOption.PASS_BATON) ? SwitchType.BATON_PASS : this.switchType;
|
const switchType = (option === PartyOption.PASS_BATON) ? SwitchType.BATON_PASS : this.switchType;
|
||||||
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, switchType, fieldIndex, slotIndex, this.doReturn));
|
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, switchType, fieldIndex, slotIndex, this.doReturn));
|
||||||
|
@ -16,7 +16,7 @@ import { SwitchType } from "#enums/switch-type";
|
|||||||
|
|
||||||
export class SwitchSummonPhase extends SummonPhase {
|
export class SwitchSummonPhase extends SummonPhase {
|
||||||
private readonly switchType: SwitchType;
|
private readonly switchType: SwitchType;
|
||||||
private readonly slotIndex: integer;
|
private readonly slotIndex: number;
|
||||||
private readonly doReturn: boolean;
|
private readonly doReturn: boolean;
|
||||||
|
|
||||||
private lastPokemon: Pokemon;
|
private lastPokemon: Pokemon;
|
||||||
@ -25,12 +25,12 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
* Constructor for creating a new SwitchSummonPhase
|
* Constructor for creating a new SwitchSummonPhase
|
||||||
* @param scene {@linkcode BattleScene} the scene the phase is associated with
|
* @param scene {@linkcode BattleScene} the scene the phase is associated with
|
||||||
* @param switchType the type of switch behavior
|
* @param switchType the type of switch behavior
|
||||||
* @param fieldIndex integer representing position on the battle field
|
* @param fieldIndex number representing position on the battle field
|
||||||
* @param slotIndex integer for the index of pokemon (in party of 6) to switch into
|
* @param slotIndex number for the index of pokemon (in party of 6) to switch into
|
||||||
* @param doReturn boolean whether to render "comeback" dialogue
|
* @param doReturn boolean whether to render "comeback" dialogue
|
||||||
* @param player boolean if the switch is from the player
|
* @param player boolean if the switch is from the player
|
||||||
*/
|
*/
|
||||||
constructor(scene: BattleScene, switchType: SwitchType, fieldIndex: integer, slotIndex: integer, doReturn: boolean, player?: boolean) {
|
constructor(scene: BattleScene, switchType: SwitchType, fieldIndex: number, slotIndex: number, doReturn: boolean, player?: boolean) {
|
||||||
super(scene, fieldIndex, player !== undefined ? player : true);
|
super(scene, fieldIndex, player !== undefined ? player : true);
|
||||||
|
|
||||||
this.switchType = switchType;
|
this.switchType = switchType;
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
|
||||||
import { MessagePhase } from "./message-phase";
|
|
||||||
|
|
||||||
export class TestMessagePhase extends MessagePhase {
|
|
||||||
constructor(scene: BattleScene, message: string) {
|
|
||||||
super(scene, message, null, true);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
import { loggedInUser } from "#app/account";
|
import { loggedInUser } from "#app/account";
|
||||||
import { BattleType } from "#app/battle";
|
import { BattleType } from "#app/battle";
|
||||||
import BattleScene from "#app/battle-scene";
|
|
||||||
import { fetchDailyRunSeed, getDailyRunStarters } from "#app/data/daily-run";
|
import { fetchDailyRunSeed, getDailyRunStarters } from "#app/data/daily-run";
|
||||||
import { Gender } from "#app/data/gender";
|
import { Gender } from "#app/data/gender";
|
||||||
import { getBiomeKey } from "#app/field/arena";
|
import { getBiomeKey } from "#app/field/arena";
|
||||||
@ -24,16 +23,10 @@ import { SummonPhase } from "./summon-phase";
|
|||||||
|
|
||||||
|
|
||||||
export class TitlePhase extends Phase {
|
export class TitlePhase extends Phase {
|
||||||
private loaded: boolean;
|
private loaded: boolean = false;
|
||||||
private lastSessionData: SessionSaveData;
|
private lastSessionData: SessionSaveData;
|
||||||
public gameMode: GameModes;
|
public gameMode: GameModes;
|
||||||
|
|
||||||
constructor(scene: BattleScene) {
|
|
||||||
super(scene);
|
|
||||||
|
|
||||||
this.loaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
start(): void {
|
start(): void {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
@ -133,7 +126,7 @@ export class TitlePhase extends Phase {
|
|||||||
label: i18next.t("menu:loadGame"),
|
label: i18next.t("menu:loadGame"),
|
||||||
handler: () => {
|
handler: () => {
|
||||||
this.scene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD,
|
this.scene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD,
|
||||||
(slotId: integer) => {
|
(slotId: number) => {
|
||||||
if (slotId === -1) {
|
if (slotId === -1) {
|
||||||
return this.showOptions();
|
return this.showOptions();
|
||||||
}
|
}
|
||||||
@ -166,7 +159,7 @@ export class TitlePhase extends Phase {
|
|||||||
this.scene.ui.setMode(Mode.TITLE, config);
|
this.scene.ui.setMode(Mode.TITLE, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSaveSlot(slotId: integer): void {
|
loadSaveSlot(slotId: number): void {
|
||||||
this.scene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot;
|
this.scene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot;
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.ui.resetModeChain();
|
this.scene.ui.resetModeChain();
|
||||||
@ -184,7 +177,7 @@ export class TitlePhase extends Phase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initDailyRun(): void {
|
initDailyRun(): void {
|
||||||
this.scene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: integer) => {
|
this.scene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
if (slotId === -1) {
|
if (slotId === -1) {
|
||||||
this.scene.pushPhase(new TitlePhase(this.scene));
|
this.scene.pushPhase(new TitlePhase(this.scene));
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
|
||||||
import { trainerConfigs } from "#app/data/trainer-config";
|
|
||||||
import { TrainerType } from "#app/enums/trainer-type";
|
|
||||||
import { BattlePhase } from "./battle-phase";
|
|
||||||
import { TestMessagePhase } from "./test-message-phase";
|
|
||||||
|
|
||||||
export class TrainerMessageTestPhase extends BattlePhase {
|
|
||||||
private trainerTypes: TrainerType[];
|
|
||||||
|
|
||||||
constructor(scene: BattleScene, ...trainerTypes: TrainerType[]) {
|
|
||||||
super(scene);
|
|
||||||
|
|
||||||
this.trainerTypes = trainerTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
super.start();
|
|
||||||
|
|
||||||
const testMessages: string[] = [];
|
|
||||||
|
|
||||||
for (const t of Object.keys(trainerConfigs)) {
|
|
||||||
const type = parseInt(t);
|
|
||||||
if (this.trainerTypes.length && !this.trainerTypes.find(tt => tt === type as TrainerType)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const config = trainerConfigs[type];
|
|
||||||
[ config.encounterMessages, config.femaleEncounterMessages, config.victoryMessages, config.femaleVictoryMessages, config.defeatMessages, config.femaleDefeatMessages ]
|
|
||||||
.map(messages => {
|
|
||||||
if (messages?.length) {
|
|
||||||
testMessages.push(...messages);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const message of testMessages) {
|
|
||||||
this.scene.pushPhase(new TestMessagePhase(this.scene, message));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.end();
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,7 +44,6 @@ export class TurnInitPhase extends FieldPhase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//this.scene.pushPhase(new MoveAnimTestPhase(this.scene));
|
|
||||||
this.scene.eventTarget.dispatchEvent(new TurnInitEvent());
|
this.scene.eventTarget.dispatchEvent(new TurnInitEvent());
|
||||||
|
|
||||||
handleMysteryEncounterBattleStartEffects(this.scene);
|
handleMysteryEncounterBattleStartEffects(this.scene);
|
||||||
|
@ -99,8 +99,8 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
const bMove = allMoves[bCommand!.move!.move];
|
const bMove = allMoves[bCommand!.move!.move];
|
||||||
|
|
||||||
// The game now considers priority and applies the relevant move and ability attributes
|
// The game now considers priority and applies the relevant move and ability attributes
|
||||||
const aPriority = new Utils.IntegerHolder(aMove.priority);
|
const aPriority = new Utils.NumberHolder(aMove.priority);
|
||||||
const bPriority = new Utils.IntegerHolder(bMove.priority);
|
const bPriority = new Utils.NumberHolder(bMove.priority);
|
||||||
|
|
||||||
applyMoveAttrs(IncrementMovePriorityAttr, this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === a)!, null, aMove, aPriority);
|
applyMoveAttrs(IncrementMovePriorityAttr, this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === a)!, null, aMove, aPriority);
|
||||||
applyMoveAttrs(IncrementMovePriorityAttr, this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === b)!, null, bMove, bPriority);
|
applyMoveAttrs(IncrementMovePriorityAttr, this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === b)!, null, bMove, bPriority);
|
||||||
|
@ -16,7 +16,7 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
/** If true, indicates that the phase is intended for EXP purposes only, and not to continue a battle to next phase */
|
/** If true, indicates that the phase is intended for EXP purposes only, and not to continue a battle to next phase */
|
||||||
isExpOnly: boolean;
|
isExpOnly: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex | integer, isExpOnly: boolean = false) {
|
constructor(scene: BattleScene, battlerIndex: BattlerIndex | number, isExpOnly: boolean = false) {
|
||||||
super(scene, battlerIndex);
|
super(scene, battlerIndex);
|
||||||
|
|
||||||
this.isExpOnly = isExpOnly;
|
this.isExpOnly = isExpOnly;
|
||||||
|
@ -21,8 +21,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
|||||||
this.weather = this.scene?.arena?.weather;
|
this.weather = this.scene?.arena?.weather;
|
||||||
|
|
||||||
if (!this.weather) {
|
if (!this.weather) {
|
||||||
this.end();
|
return this.end();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setAnimation(CommonAnim.SUNNY + (this.weather.weatherType - 1));
|
this.setAnimation(CommonAnim.SUNNY + (this.weather.weatherType - 1));
|
||||||
@ -46,7 +45,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
|||||||
|
|
||||||
const damage = Utils.toDmgValue(pokemon.getMaxHp() / 16);
|
const damage = Utils.toDmgValue(pokemon.getMaxHp() / 16);
|
||||||
|
|
||||||
this.scene.queueMessage(getWeatherDamageMessage(this.weather?.weatherType!, pokemon)!); // TODO: are those bangs correct?
|
this.scene.queueMessage(getWeatherDamageMessage(this.weather!.weatherType, pokemon) ?? "");
|
||||||
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
|
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scene.ui.showText(getWeatherLapseMessage(this.weather.weatherType)!, null, () => { // TODO: is this bang correct?
|
this.scene.ui.showText(getWeatherLapseMessage(this.weather.weatherType) ?? "", null, () => {
|
||||||
this.executeForAll((pokemon: Pokemon) => applyPostWeatherLapseAbAttrs(PostWeatherLapseAbAttr, pokemon, this.weather));
|
this.executeForAll((pokemon: Pokemon) => applyPostWeatherLapseAbAttrs(PostWeatherLapseAbAttr, pokemon, this.weather));
|
||||||
|
|
||||||
super.start();
|
super.start();
|
||||||
|
Loading…
Reference in New Issue
Block a user