mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-28 09:46:05 +00:00
Replace * as Utils
imports with named imports
This commit is contained in:
parent
62ebb8d7a7
commit
c055649db6
@ -1,10 +1,10 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { applyAbAttrs, RunSuccessAbAttr } from "#app/data/ability";
|
import { applyAbAttrs, RunSuccessAbAttr } from "#app/data/ability";
|
||||||
import { Stat } from "#app/enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import { StatusEffect } from "#app/enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import Pokemon, { PlayerPokemon, EnemyPokemon } from "#app/field/pokemon";
|
import Pokemon, { PlayerPokemon, EnemyPokemon } from "#app/field/pokemon";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { NumberHolder } from "#app/utils";
|
||||||
import { BattleEndPhase } from "./battle-end-phase";
|
import { BattleEndPhase } from "./battle-end-phase";
|
||||||
import { NewBattlePhase } from "./new-battle-phase";
|
import { NewBattlePhase } from "./new-battle-phase";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
@ -26,7 +26,7 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||||||
|
|
||||||
const playerPokemon = this.getPokemon();
|
const playerPokemon = this.getPokemon();
|
||||||
|
|
||||||
const escapeChance = new Utils.NumberHolder(0);
|
const escapeChance = new NumberHolder(0);
|
||||||
|
|
||||||
this.attemptRunAway(playerField, enemyField, escapeChance);
|
this.attemptRunAway(playerField, enemyField, escapeChance);
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
attemptRunAway(playerField: PlayerPokemon[], enemyField: EnemyPokemon[], escapeChance: Utils.NumberHolder) {
|
attemptRunAway(playerField: PlayerPokemon[], enemyField: EnemyPokemon[], escapeChance: NumberHolder) {
|
||||||
/** Sum of the speed of all enemy pokemon on the field */
|
/** Sum of the speed of all enemy pokemon on the field */
|
||||||
const enemySpeed = enemyField.reduce((total: number, enemyPokemon: Pokemon) => total + enemyPokemon.getStat(Stat.SPD), 0);
|
const enemySpeed = enemyField.reduce((total: number, enemyPokemon: Pokemon) => total + enemyPokemon.getStat(Stat.SPD), 0);
|
||||||
/** Sum of the speed of all player pokemon on the field */
|
/** Sum of the speed of all player pokemon on the field */
|
||||||
|
@ -4,7 +4,7 @@ import { BerryUsedEvent } from "#app/events/battle-scene";
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { BerryModifier } from "#app/modifier/modifier";
|
import { BerryModifier } from "#app/modifier/modifier";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { BooleanHolder } from "#app/utils";
|
||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
import { CommonAnimPhase } from "./common-anim-phase";
|
import { CommonAnimPhase } from "./common-anim-phase";
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export class BerryPhase extends FieldPhase {
|
|||||||
}, pokemon.isPlayer());
|
}, pokemon.isPlayer());
|
||||||
|
|
||||||
if (hasUsableBerry) {
|
if (hasUsableBerry) {
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new BooleanHolder(false);
|
||||||
pokemon.getOpponents().map((opp) => applyAbAttrs(PreventBerryUseAbAttr, opp, cancelled));
|
pokemon.getOpponents().map((opp) => applyAbAttrs(PreventBerryUseAbAttr, opp, cancelled));
|
||||||
|
|
||||||
if (cancelled.value) {
|
if (cancelled.value) {
|
||||||
@ -42,7 +42,7 @@ export class BerryPhase extends FieldPhase {
|
|||||||
|
|
||||||
this.scene.updateModifiers(pokemon.isPlayer());
|
this.scene.updateModifiers(pokemon.isPlayer());
|
||||||
|
|
||||||
applyAbAttrs(HealFromBerryUseAbAttr, pokemon, new Utils.BooleanHolder(false));
|
applyAbAttrs(HealFromBerryUseAbAttr, pokemon, new BooleanHolder(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { BattleSpec } from "#app/enums/battle-spec";
|
import { BattleSpec } from "#enums/battle-spec";
|
||||||
import { DamageResult, HitResult } from "#app/field/pokemon";
|
import { DamageResult, HitResult } from "#app/field/pokemon";
|
||||||
import * as Utils from "#app/utils";
|
import { fixedInt } from "#app/utils";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
|
|
||||||
export class DamagePhase extends PokemonPhase {
|
export class DamagePhase extends PokemonPhase {
|
||||||
@ -25,7 +25,7 @@ export class DamagePhase extends PokemonPhase {
|
|||||||
if (this.scene.moveAnimations) {
|
if (this.scene.moveAnimations) {
|
||||||
this.scene.toggleInvert(true);
|
this.scene.toggleInvert(true);
|
||||||
}
|
}
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
|
this.scene.time.delayedCall(fixedInt(1000), () => {
|
||||||
this.scene.toggleInvert(false);
|
this.scene.toggleInvert(false);
|
||||||
this.applyDamage();
|
this.applyDamage();
|
||||||
});
|
});
|
||||||
|
@ -11,7 +11,7 @@ import PokemonInfoContainer from "#app/ui/pokemon-info-container";
|
|||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||||
import * as Utils from "#app/utils";
|
import { fixedInt, getFrameMs, randInt } from "#app/utils";
|
||||||
import { EggLapsePhase } from "./egg-lapse-phase";
|
import { EggLapsePhase } from "./egg-lapse-phase";
|
||||||
import { EggHatchData } from "#app/data/egg-hatch-data";
|
import { EggHatchData } from "#app/data/egg-hatch-data";
|
||||||
|
|
||||||
@ -285,15 +285,15 @@ export class EggHatchPhase extends Phase {
|
|||||||
this.canSkip = false;
|
this.canSkip = false;
|
||||||
this.hatched = true;
|
this.hatched = true;
|
||||||
if (this.evolutionBgm) {
|
if (this.evolutionBgm) {
|
||||||
SoundFade.fadeOut(this.scene, this.evolutionBgm, Utils.fixedInt(100));
|
SoundFade.fadeOut(this.scene, this.evolutionBgm, fixedInt(100));
|
||||||
}
|
}
|
||||||
for (let e = 0; e < 5; e++) {
|
for (let e = 0; e < 5; e++) {
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(375 * e), () => this.scene.playSound("se/egg_hatch", { volume: 1 - (e * 0.2) }));
|
this.scene.time.delayedCall(fixedInt(375 * e), () => this.scene.playSound("se/egg_hatch", { volume: 1 - (e * 0.2) }));
|
||||||
}
|
}
|
||||||
this.eggLightraysOverlay.setVisible(true);
|
this.eggLightraysOverlay.setVisible(true);
|
||||||
this.eggLightraysOverlay.play("egg_lightrays");
|
this.eggLightraysOverlay.play("egg_lightrays");
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
duration: Utils.fixedInt(125),
|
duration: fixedInt(125),
|
||||||
targets: this.eggHatchOverlay,
|
targets: this.eggHatchOverlay,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
ease: "Cubic.easeIn",
|
ease: "Cubic.easeIn",
|
||||||
@ -302,7 +302,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
this.canSkip = true;
|
this.canSkip = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(1500), () => {
|
this.scene.time.delayedCall(fixedInt(1500), () => {
|
||||||
this.canSkip = false;
|
this.canSkip = false;
|
||||||
if (!this.skipped) {
|
if (!this.skipped) {
|
||||||
this.doReveal();
|
this.doReveal();
|
||||||
@ -335,17 +335,17 @@ export class EggHatchPhase extends Phase {
|
|||||||
this.pokemonSprite.setPipelineData("shiny", this.pokemon.shiny);
|
this.pokemonSprite.setPipelineData("shiny", this.pokemon.shiny);
|
||||||
this.pokemonSprite.setPipelineData("variant", this.pokemon.variant);
|
this.pokemonSprite.setPipelineData("variant", this.pokemon.variant);
|
||||||
this.pokemonSprite.setVisible(true);
|
this.pokemonSprite.setVisible(true);
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(250), () => {
|
this.scene.time.delayedCall(fixedInt(250), () => {
|
||||||
this.eggsToHatchCount--;
|
this.eggsToHatchCount--;
|
||||||
this.eggHatchHandler.eventTarget.dispatchEvent(new EggCountChangedEvent(this.eggsToHatchCount));
|
this.eggHatchHandler.eventTarget.dispatchEvent(new EggCountChangedEvent(this.eggsToHatchCount));
|
||||||
this.pokemon.cry();
|
this.pokemon.cry();
|
||||||
if (isShiny) {
|
if (isShiny) {
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(500), () => {
|
this.scene.time.delayedCall(fixedInt(500), () => {
|
||||||
this.pokemonShinySparkle.play(`sparkle${this.pokemon.variant ? `_${this.pokemon.variant + 1}` : ""}`);
|
this.pokemonShinySparkle.play(`sparkle${this.pokemon.variant ? `_${this.pokemon.variant + 1}` : ""}`);
|
||||||
this.scene.playSound("se/sparkle");
|
this.scene.playSound("se/sparkle");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(!this.skipped ? !isShiny ? 1250 : 1750 : !isShiny ? 250 : 750), () => {
|
this.scene.time.delayedCall(fixedInt(!this.skipped ? !isShiny ? 1250 : 1750 : !isShiny ? 250 : 750), () => {
|
||||||
this.infoContainer.show(this.pokemon, false, this.skipped ? 2 : 1);
|
this.infoContainer.show(this.pokemon, false, this.skipped ? 2 : 1);
|
||||||
|
|
||||||
this.scene.playSoundWithoutBgm("evolution_fanfare");
|
this.scene.playSoundWithoutBgm("evolution_fanfare");
|
||||||
@ -363,7 +363,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
duration: Utils.fixedInt(this.skipped ? 500 : 3000),
|
duration: fixedInt(this.skipped ? 500 : 3000),
|
||||||
targets: this.eggHatchOverlay,
|
targets: this.eggHatchOverlay,
|
||||||
alpha: 0,
|
alpha: 0,
|
||||||
ease: "Cubic.easeOut"
|
ease: "Cubic.easeOut"
|
||||||
@ -388,9 +388,9 @@ export class EggHatchPhase extends Phase {
|
|||||||
doSpray(intensity: number, offsetY?: number) {
|
doSpray(intensity: number, offsetY?: number) {
|
||||||
this.scene.tweens.addCounter({
|
this.scene.tweens.addCounter({
|
||||||
repeat: intensity,
|
repeat: intensity,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
this.doSprayParticle(Utils.randInt(8), offsetY || 0);
|
this.doSprayParticle(randInt(8), offsetY || 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -409,12 +409,12 @@ export class EggHatchPhase extends Phase {
|
|||||||
|
|
||||||
let f = 0;
|
let f = 0;
|
||||||
let yOffset = 0;
|
let yOffset = 0;
|
||||||
const speed = 3 - Utils.randInt(8);
|
const speed = 3 - randInt(8);
|
||||||
const amp = 24 + Utils.randInt(32);
|
const amp = 24 + randInt(32);
|
||||||
|
|
||||||
const particleTimer = this.scene.tweens.addCounter({
|
const particleTimer = this.scene.tweens.addCounter({
|
||||||
repeat: -1,
|
repeat: -1,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import { Phase } from "#app/phase";
|
|||||||
import BattleScene, { AnySound } from "#app/battle-scene";
|
import BattleScene, { AnySound } from "#app/battle-scene";
|
||||||
import { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
import { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
||||||
import EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
import EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
||||||
import * as Utils from "#app/utils";
|
import { fixedInt, getFrameMs, randInt } from "#app/utils";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import { cos, sin } from "#app/field/anims";
|
import { cos, sin } from "#app/field/anims";
|
||||||
import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
|
import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
|
||||||
@ -251,8 +251,8 @@ export class EvolutionPhase extends Phase {
|
|||||||
this.scene.playSoundWithoutBgm("evolution_fanfare");
|
this.scene.playSoundWithoutBgm("evolution_fanfare");
|
||||||
|
|
||||||
evolvedPokemon.destroy();
|
evolvedPokemon.destroy();
|
||||||
this.scene.ui.showText(i18next.t("menu:evolutionDone", { pokemonName: this.preEvolvedPokemonName, evolvedPokemonName: this.pokemon.name }), null, () => this.end(), null, true, Utils.fixedInt(4000));
|
this.scene.ui.showText(i18next.t("menu:evolutionDone", { pokemonName: this.preEvolvedPokemonName, evolvedPokemonName: this.pokemon.name }), null, () => this.end(), null, true, fixedInt(4000));
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(4250), () => this.scene.playBgm());
|
this.scene.time.delayedCall(fixedInt(4250), () => this.scene.playBgm());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -303,7 +303,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
this.scene.tweens.addCounter({
|
this.scene.tweens.addCounter({
|
||||||
repeat: 64,
|
repeat: 64,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
if (f < 64) {
|
if (f < 64) {
|
||||||
if (!(f & 7)) {
|
if (!(f & 7)) {
|
||||||
@ -322,7 +322,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
this.scene.tweens.addCounter({
|
this.scene.tweens.addCounter({
|
||||||
repeat: 96,
|
repeat: 96,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
if (f < 96) {
|
if (f < 96) {
|
||||||
if (f < 6) {
|
if (f < 6) {
|
||||||
@ -372,7 +372,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
this.scene.tweens.addCounter({
|
this.scene.tweens.addCounter({
|
||||||
repeat: 48,
|
repeat: 48,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
if (!f) {
|
if (!f) {
|
||||||
for (let i = 0; i < 16; i++) {
|
for (let i = 0; i < 16; i++) {
|
||||||
@ -393,14 +393,14 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
this.scene.tweens.addCounter({
|
this.scene.tweens.addCounter({
|
||||||
repeat: 48,
|
repeat: 48,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
if (!f) {
|
if (!f) {
|
||||||
for (let i = 0; i < 8; i++) {
|
for (let i = 0; i < 8; i++) {
|
||||||
this.doSprayParticle(i);
|
this.doSprayParticle(i);
|
||||||
}
|
}
|
||||||
} else if (f < 50) {
|
} else if (f < 50) {
|
||||||
this.doSprayParticle(Utils.randInt(8));
|
this.doSprayParticle(randInt(8));
|
||||||
}
|
}
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
const particleTimer = this.scene.tweens.addCounter({
|
const particleTimer = this.scene.tweens.addCounter({
|
||||||
repeat: -1,
|
repeat: -1,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
const particleTimer = this.scene.tweens.addCounter({
|
const particleTimer = this.scene.tweens.addCounter({
|
||||||
repeat: -1,
|
repeat: -1,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
@ -486,7 +486,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
const particleTimer = this.scene.tweens.addCounter({
|
const particleTimer = this.scene.tweens.addCounter({
|
||||||
repeat: -1,
|
repeat: -1,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
@ -516,12 +516,12 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
let f = 0;
|
let f = 0;
|
||||||
let yOffset = 0;
|
let yOffset = 0;
|
||||||
const speed = 3 - Utils.randInt(8);
|
const speed = 3 - randInt(8);
|
||||||
const amp = 48 + Utils.randInt(64);
|
const amp = 48 + randInt(64);
|
||||||
|
|
||||||
const particleTimer = this.scene.tweens.addCounter({
|
const particleTimer = this.scene.tweens.addCounter({
|
||||||
repeat: -1,
|
repeat: -1,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: getFrameMs(1),
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import BattleScene from "#app/battle-scene";
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { ExpBoosterModifier } from "#app/modifier/modifier";
|
import { ExpBoosterModifier } from "#app/modifier/modifier";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { NumberHolder } from "#app/utils";
|
||||||
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
||||||
import { LevelUpPhase } from "./level-up-phase";
|
import { LevelUpPhase } from "./level-up-phase";
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export class ExpPhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
const exp = new Utils.NumberHolder(this.expValue);
|
const exp = new NumberHolder(this.expValue);
|
||||||
this.scene.applyModifiers(ExpBoosterModifier, true, exp);
|
this.scene.applyModifiers(ExpBoosterModifier, true, exp);
|
||||||
exp.value = Math.floor(exp.value);
|
exp.value = Math.floor(exp.value);
|
||||||
this.scene.ui.showText(i18next.t("battle:expGain", { pokemonName: getPokemonNameWithAffix(pokemon), exp: exp.value }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:expGain", { pokemonName: getPokemonNameWithAffix(pokemon), exp: exp.value }), null, () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BattleScene from "../battle-scene";
|
import BattleScene from "../battle-scene";
|
||||||
import * as Utils from "../utils";
|
import { fixedInt } from "#app/utils";
|
||||||
import { achvs } from "../system/achv";
|
import { achvs } from "../system/achv";
|
||||||
import { SpeciesFormChange, getSpeciesFormChangeMessage } from "../data/pokemon-forms";
|
import { SpeciesFormChange, getSpeciesFormChangeMessage } from "../data/pokemon-forms";
|
||||||
import { PlayerPokemon } from "../field/pokemon";
|
import { PlayerPokemon } from "../field/pokemon";
|
||||||
@ -8,7 +8,7 @@ import PartyUiHandler from "../ui/party-ui-handler";
|
|||||||
import { getPokemonNameWithAffix } from "../messages";
|
import { getPokemonNameWithAffix } from "../messages";
|
||||||
import { EndEvolutionPhase } from "./end-evolution-phase";
|
import { EndEvolutionPhase } from "./end-evolution-phase";
|
||||||
import { EvolutionPhase } from "./evolution-phase";
|
import { EvolutionPhase } from "./evolution-phase";
|
||||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||||
|
|
||||||
export class FormChangePhase extends EvolutionPhase {
|
export class FormChangePhase extends EvolutionPhase {
|
||||||
@ -134,8 +134,8 @@ export class FormChangePhase extends EvolutionPhase {
|
|||||||
this.scene.playSoundWithoutBgm(playEvolutionFanfare ? "evolution_fanfare" : "minor_fanfare");
|
this.scene.playSoundWithoutBgm(playEvolutionFanfare ? "evolution_fanfare" : "minor_fanfare");
|
||||||
|
|
||||||
transformedPokemon.destroy();
|
transformedPokemon.destroy();
|
||||||
this.scene.ui.showText(getSpeciesFormChangeMessage(this.pokemon, this.formChange, preName), null, () => this.end(), null, true, Utils.fixedInt(delay));
|
this.scene.ui.showText(getSpeciesFormChangeMessage(this.pokemon, this.formChange, preName), null, () => this.end(), null, true, fixedInt(delay));
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(delay + 250), () => this.scene.playBgm());
|
this.scene.time.delayedCall(fixedInt(delay + 250), () => this.scene.playBgm());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import { UnlockPhase } from "#app/phases/unlock-phase";
|
|||||||
import { achvs, ChallengeAchv } from "#app/system/achv";
|
import { achvs, ChallengeAchv } from "#app/system/achv";
|
||||||
import { Unlockables } from "#app/system/unlockables";
|
import { Unlockables } from "#app/system/unlockables";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import * as Utils from "#app/utils";
|
import { isLocal, isLocalServerConnected } from "#app/utils";
|
||||||
import { PlayerGender } from "#enums/player-gender";
|
import { PlayerGender } from "#enums/player-gender";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -177,7 +177,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
If Online, execute apiFetch as intended
|
If Online, execute apiFetch as intended
|
||||||
If Offline, execute offlineNewClear(), a localStorage implementation of newClear daily run checks */
|
If Offline, execute offlineNewClear(), a localStorage implementation of newClear daily run checks */
|
||||||
if (this.victory) {
|
if (this.victory) {
|
||||||
if (!Utils.isLocal || Utils.isLocalServerConnected) {
|
if (!isLocal || isLocalServerConnected) {
|
||||||
pokerogueApi.savedata.session.newclear({ slot: this.scene.sessionSlotId, clientSessionId })
|
pokerogueApi.savedata.session.newclear({ slot: this.scene.sessionSlotId, clientSessionId })
|
||||||
.then((success) => doGameOver(!!success));
|
.then((success) => doGameOver(!!success));
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,7 +5,7 @@ import { PlayerPokemon } from "#app/field/pokemon";
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { LevelAchv } from "#app/system/achv";
|
import { LevelAchv } from "#app/system/achv";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { NumberHolder } from "#app/utils";
|
||||||
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
||||||
import { LearnMovePhase } from "./learn-move-phase";
|
import { LearnMovePhase } from "./learn-move-phase";
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
this.scene.gameData.gameStats.highestLevel = this.level;
|
this.scene.gameData.gameStats.highestLevel = this.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scene.validateAchvs(LevelAchv, new Utils.NumberHolder(this.level));
|
this.scene.validateAchvs(LevelAchv, new NumberHolder(this.level));
|
||||||
|
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
const prevStats = pokemon.stats.slice(0);
|
const prevStats = pokemon.stats.slice(0);
|
||||||
|
@ -4,7 +4,7 @@ import { Phase } from "#app/phase";
|
|||||||
import { handleTutorial, Tutorial } from "#app/tutorial";
|
import { handleTutorial, Tutorial } from "#app/tutorial";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import i18next, { t } from "i18next";
|
import i18next, { t } from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { getCookie, sessionIdKey, executeIf, removeCookie } from "#app/utils";
|
||||||
import { SelectGenderPhase } from "./select-gender-phase";
|
import { SelectGenderPhase } from "./select-gender-phase";
|
||||||
import { UnavailablePhase } from "./unavailable-phase";
|
import { UnavailablePhase } from "./unavailable-phase";
|
||||||
|
|
||||||
@ -20,10 +20,10 @@ export class LoginPhase extends Phase {
|
|||||||
start(): void {
|
start(): void {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
const hasSession = !!Utils.getCookie(Utils.sessionIdKey);
|
const hasSession = !!getCookie(sessionIdKey);
|
||||||
|
|
||||||
this.scene.ui.setMode(Mode.LOADING, { buttonActions: []});
|
this.scene.ui.setMode(Mode.LOADING, { buttonActions: []});
|
||||||
Utils.executeIf(bypassLogin || hasSession, updateUserInfo).then(response => {
|
executeIf(bypassLogin || hasSession, updateUserInfo).then(response => {
|
||||||
const success = response ? response[0] : false;
|
const success = response ? response[0] : false;
|
||||||
const statusCode = response ? response[1] : null;
|
const statusCode = response ? response[1] : null;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -37,7 +37,7 @@ export class LoginPhase extends Phase {
|
|||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
updateUserInfo().then(success => {
|
updateUserInfo().then(success => {
|
||||||
if (!success[0]) {
|
if (!success[0]) {
|
||||||
Utils.removeCookie(Utils.sessionIdKey);
|
removeCookie(sessionIdKey);
|
||||||
this.scene.reset(true, true);
|
this.scene.reset(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ export class LoginPhase extends Phase {
|
|||||||
this.scene.ui.playSelect();
|
this.scene.ui.playSelect();
|
||||||
updateUserInfo().then(success => {
|
updateUserInfo().then(success => {
|
||||||
if (!success[0]) {
|
if (!success[0]) {
|
||||||
Utils.removeCookie(Utils.sessionIdKey);
|
removeCookie(sessionIdKey);
|
||||||
this.scene.reset(true, true);
|
this.scene.reset(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ export class LoginPhase extends Phase {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else if (statusCode === 401) {
|
} else if (statusCode === 401) {
|
||||||
Utils.removeCookie(Utils.sessionIdKey);
|
removeCookie(sessionIdKey);
|
||||||
this.scene.reset(true, true);
|
this.scene.reset(true, true);
|
||||||
} else {
|
} else {
|
||||||
this.scene.unshiftPhase(new UnavailablePhase(this.scene));
|
this.scene.unshiftPhase(new UnavailablePhase(this.scene));
|
||||||
|
@ -2,7 +2,7 @@ import BattleScene from "#app/battle-scene";
|
|||||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||||
import { MoneyMultiplierModifier } from "#app/modifier/modifier";
|
import { MoneyMultiplierModifier } from "#app/modifier/modifier";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { NumberHolder } from "#app/utils";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
|
|
||||||
export class MoneyRewardPhase extends BattlePhase {
|
export class MoneyRewardPhase extends BattlePhase {
|
||||||
@ -15,7 +15,7 @@ export class MoneyRewardPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
const moneyAmount = new Utils.NumberHolder(this.scene.getWaveMoneyAmount(this.moneyMultiplier));
|
const moneyAmount = new NumberHolder(this.scene.getWaveMoneyAmount(this.moneyMultiplier));
|
||||||
|
|
||||||
this.scene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
this.scene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
||||||
|
|
||||||
|
@ -24,8 +24,7 @@ import { TrainerSlot } from "../data/trainer-config";
|
|||||||
import { IvScannerModifier } from "../modifier/modifier";
|
import { IvScannerModifier } from "../modifier/modifier";
|
||||||
import { Phase } from "../phase";
|
import { Phase } from "../phase";
|
||||||
import { Mode } from "../ui/ui";
|
import { Mode } from "../ui/ui";
|
||||||
import * as Utils from "../utils";
|
import { isNullOrUndefined, randSeedItem } from "#app/utils";
|
||||||
import { isNullOrUndefined } from "../utils";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will handle (in order):
|
* Will handle (in order):
|
||||||
@ -368,7 +367,7 @@ export class MysteryEncounterBattlePhase extends Phase {
|
|||||||
} else {
|
} else {
|
||||||
const trainer = this.scene.currentBattle.trainer;
|
const trainer = this.scene.currentBattle.trainer;
|
||||||
let message: string;
|
let message: string;
|
||||||
scene.executeWithSeedOffset(() => message = Utils.randSeedItem(encounterMessages), this.scene.currentBattle.mysteryEncounter?.getSeedOffset());
|
scene.executeWithSeedOffset(() => message = randSeedItem(encounterMessages), this.scene.currentBattle.mysteryEncounter?.getSeedOffset());
|
||||||
message = message!; // tell TS compiler it's defined now
|
message = message!; // tell TS compiler it's defined now
|
||||||
const showDialogueAndSummon = () => {
|
const showDialogueAndSummon = () => {
|
||||||
scene.ui.showDialogue(message, trainer?.getName(TrainerSlot.NONE, true), null, () => {
|
scene.ui.showDialogue(message, trainer?.getName(TrainerSlot.NONE, true), null, () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import * as Utils from "#app/utils";
|
import { fixedInt } from "#app/utils";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
|
|
||||||
export class PartyHealPhase extends BattlePhase {
|
export class PartyHealPhase extends BattlePhase {
|
||||||
@ -28,7 +28,7 @@ export class PartyHealPhase extends BattlePhase {
|
|||||||
pokemon.updateInfo(true);
|
pokemon.updateInfo(true);
|
||||||
}
|
}
|
||||||
const healSong = this.scene.playSoundWithoutBgm("heal");
|
const healSong = this.scene.playSoundWithoutBgm("heal");
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(healSong.totalDuration * 1000), () => {
|
this.scene.time.delayedCall(fixedInt(healSong.totalDuration * 1000), () => {
|
||||||
healSong.destroy();
|
healSong.destroy();
|
||||||
if (this.resumeBgm && bgmPlaying) {
|
if (this.resumeBgm && bgmPlaying) {
|
||||||
this.scene.playBgm();
|
this.scene.playBgm();
|
||||||
|
@ -8,7 +8,7 @@ import { getPokemonNameWithAffix } from "#app/messages";
|
|||||||
import { HealingBoosterModifier } from "#app/modifier/modifier";
|
import { HealingBoosterModifier } from "#app/modifier/modifier";
|
||||||
import { HealAchv } from "#app/system/achv";
|
import { HealAchv } from "#app/system/achv";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { NumberHolder } from "#app/utils";
|
||||||
import { CommonAnimPhase } from "./common-anim-phase";
|
import { CommonAnimPhase } from "./common-anim-phase";
|
||||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||||
import { HealBlockTag } from "#app/data/battler-tags";
|
import { HealBlockTag } from "#app/data/battler-tags";
|
||||||
@ -59,11 +59,11 @@ 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.NumberHolder(1);
|
const hpRestoreMultiplier = new NumberHolder(1);
|
||||||
if (!this.revive) {
|
if (!this.revive) {
|
||||||
this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
|
this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
|
||||||
}
|
}
|
||||||
const healAmount = new Utils.NumberHolder(Math.floor(this.hpHealed * hpRestoreMultiplier.value));
|
const healAmount = new NumberHolder(Math.floor(this.hpHealed * hpRestoreMultiplier.value));
|
||||||
if (healAmount.value < 0) {
|
if (healAmount.value < 0) {
|
||||||
pokemon.damageAndUpdate(healAmount.value * -1, HitResult.HEAL as DamageResult);
|
pokemon.damageAndUpdate(healAmount.value * -1, HitResult.HEAL as DamageResult);
|
||||||
healAmount.value = 0;
|
healAmount.value = 0;
|
||||||
|
@ -6,7 +6,7 @@ import { getStatusEffectActivationText } from "#app/data/status-effect";
|
|||||||
import { BattleSpec } from "#app/enums/battle-spec";
|
import { BattleSpec } from "#app/enums/battle-spec";
|
||||||
import { StatusEffect } from "#app/enums/status-effect";
|
import { StatusEffect } from "#app/enums/status-effect";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import * as Utils from "#app/utils";
|
import { BooleanHolder, NumberHolder } from "#app/utils";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
|
|
||||||
export class PostTurnStatusEffectPhase extends PokemonPhase {
|
export class PostTurnStatusEffectPhase extends PokemonPhase {
|
||||||
@ -18,13 +18,13 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
|
|||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
if (pokemon?.isActive(true) && pokemon.status && pokemon.status.isPostTurn()) {
|
if (pokemon?.isActive(true) && pokemon.status && pokemon.status.isPostTurn()) {
|
||||||
pokemon.status.incrementTurn();
|
pokemon.status.incrementTurn();
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new BooleanHolder(false);
|
||||||
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
|
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
|
||||||
applyAbAttrs(BlockStatusDamageAbAttr, pokemon, cancelled);
|
applyAbAttrs(BlockStatusDamageAbAttr, pokemon, cancelled);
|
||||||
|
|
||||||
if (!cancelled.value) {
|
if (!cancelled.value) {
|
||||||
this.scene.queueMessage(getStatusEffectActivationText(pokemon.status.effect, getPokemonNameWithAffix(pokemon)));
|
this.scene.queueMessage(getStatusEffectActivationText(pokemon.status.effect, getPokemonNameWithAffix(pokemon)));
|
||||||
const damage = new Utils.NumberHolder(0);
|
const damage = new NumberHolder(0);
|
||||||
switch (pokemon.status.effect) {
|
switch (pokemon.status.effect) {
|
||||||
case StatusEffect.POISON:
|
case StatusEffect.POISON:
|
||||||
damage.value = Math.max(pokemon.getMaxHp() >> 3, 1);
|
damage.value = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { Phase } from "#app/phase";
|
import { Phase } from "#app/phase";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import * as Utils from "#app/utils";
|
import { fixedInt } from "#app/utils";
|
||||||
|
|
||||||
export class ReloadSessionPhase extends Phase {
|
export class ReloadSessionPhase extends Phase {
|
||||||
private systemDataStr?: string;
|
private systemDataStr?: string;
|
||||||
@ -18,7 +18,7 @@ export class ReloadSessionPhase extends Phase {
|
|||||||
let delayElapsed = false;
|
let delayElapsed = false;
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
|
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(1500), () => {
|
this.scene.time.delayedCall(fixedInt(1500), () => {
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
this.end();
|
this.end();
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,7 +5,7 @@ import { MoneyInterestModifier, MapModifier } from "#app/modifier/modifier";
|
|||||||
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import * as Utils from "#app/utils";
|
import { randSeedInt } from "#app/utils";
|
||||||
import { PartyHealPhase } from "./party-heal-phase";
|
import { PartyHealPhase } from "./party-heal-phase";
|
||||||
import { SwitchBiomePhase } from "./switch-biome-phase";
|
import { SwitchBiomePhase } from "./switch-biome-phase";
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
let biomes: Biome[] = [];
|
let biomes: Biome[] = [];
|
||||||
this.scene.executeWithSeedOffset(() => {
|
this.scene.executeWithSeedOffset(() => {
|
||||||
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
||||||
.filter(b => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
.filter(b => !Array.isArray(b) || !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);
|
||||||
if (biomes.length > 1 && this.scene.findModifier(m => m instanceof MapModifier)) {
|
if (biomes.length > 1 && this.scene.findModifier(m => m instanceof MapModifier)) {
|
||||||
@ -47,7 +47,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
biomeChoices = (!Array.isArray(biomeLinks[currentBiome])
|
biomeChoices = (!Array.isArray(biomeLinks[currentBiome])
|
||||||
? [ biomeLinks[currentBiome] as Biome ]
|
? [ biomeLinks[currentBiome] as Biome ]
|
||||||
: biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
: biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
||||||
.filter((b, i) => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
.filter((b, i) => !Array.isArray(b) || !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);
|
||||||
const biomeSelectItems = biomeChoices.map(b => {
|
const biomeSelectItems = biomeChoices.map(b => {
|
||||||
@ -66,7 +66,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
delay: 1000
|
delay: 1000
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setNextBiome(biomes[Utils.randSeedInt(biomes.length)]);
|
setNextBiome(biomes[randSeedInt(biomes.length)]);
|
||||||
}
|
}
|
||||||
} else if (biomeLinks.hasOwnProperty(currentBiome)) {
|
} else if (biomeLinks.hasOwnProperty(currentBiome)) {
|
||||||
setNextBiome(biomeLinks[currentBiome] as Biome);
|
setNextBiome(biomeLinks[currentBiome] as Biome);
|
||||||
|
@ -6,7 +6,6 @@ import ModifierSelectUiHandler, { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifie
|
|||||||
import PartyUiHandler, { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler";
|
import PartyUiHandler, { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import Overrides from "#app/overrides";
|
import Overrides from "#app/overrides";
|
||||||
import { CustomModifierSettings } from "#app/modifier/modifier-type";
|
import { CustomModifierSettings } from "#app/modifier/modifier-type";
|
||||||
@ -42,7 +41,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.NumberHolder(3);
|
const modifierCount = new 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);
|
||||||
|
@ -2,7 +2,7 @@ import BattleScene from "#app/battle-scene";
|
|||||||
import { ExpGainsSpeed } from "#app/enums/exp-gains-speed";
|
import { ExpGainsSpeed } from "#app/enums/exp-gains-speed";
|
||||||
import { ExpNotification } from "#app/enums/exp-notification";
|
import { ExpNotification } from "#app/enums/exp-notification";
|
||||||
import { ExpBoosterModifier } from "#app/modifier/modifier";
|
import { ExpBoosterModifier } from "#app/modifier/modifier";
|
||||||
import * as Utils from "#app/utils";
|
import { NumberHolder } from "#app/utils";
|
||||||
import { HidePartyExpBarPhase } from "./hide-party-exp-bar-phase";
|
import { HidePartyExpBarPhase } from "./hide-party-exp-bar-phase";
|
||||||
import { LevelUpPhase } from "./level-up-phase";
|
import { LevelUpPhase } from "./level-up-phase";
|
||||||
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
||||||
@ -20,7 +20,7 @@ export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
const exp = new Utils.NumberHolder(this.expValue);
|
const exp = new NumberHolder(this.expValue);
|
||||||
this.scene.applyModifiers(ExpBoosterModifier, true, exp);
|
this.scene.applyModifiers(ExpBoosterModifier, true, exp);
|
||||||
exp.value = Math.floor(exp.value);
|
exp.value = Math.floor(exp.value);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import { vouchers } from "#app/system/voucher";
|
|||||||
import { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
import { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||||
import { SaveSlotUiMode } from "#app/ui/save-slot-select-ui-handler";
|
import { SaveSlotUiMode } from "#app/ui/save-slot-select-ui-handler";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import * as Utils from "#app/utils";
|
import { isLocal, isLocalServerConnected } from "#app/utils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { CheckSwitchPhase } from "./check-switch-phase";
|
import { CheckSwitchPhase } from "./check-switch-phase";
|
||||||
import { EncounterPhase } from "./encounter-phase";
|
import { EncounterPhase } from "./encounter-phase";
|
||||||
@ -236,7 +236,7 @@ export class TitlePhase extends Phase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// If Online, calls seed fetch from db to generate daily run. If Offline, generates a daily run based on current date.
|
// If Online, calls seed fetch from db to generate daily run. If Offline, generates a daily run based on current date.
|
||||||
if (!Utils.isLocal || Utils.isLocalServerConnected) {
|
if (!isLocal || isLocalServerConnected) {
|
||||||
fetchDailyRunSeed().then(seed => {
|
fetchDailyRunSeed().then(seed => {
|
||||||
if (seed) {
|
if (seed) {
|
||||||
generateDaily(seed);
|
generateDaily(seed);
|
||||||
|
@ -4,7 +4,7 @@ import { TrainerType } from "#app/enums/trainer-type";
|
|||||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||||
import { vouchers } from "#app/system/voucher";
|
import { vouchers } from "#app/system/voucher";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils";
|
import { randSeedItem } from "#app/utils";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
||||||
import { MoneyRewardPhase } from "./money-reward-phase";
|
import { MoneyRewardPhase } from "./money-reward-phase";
|
||||||
@ -43,7 +43,7 @@ export class TrainerVictoryPhase extends BattlePhase {
|
|||||||
this.scene.ui.showText(i18next.t("battle:trainerDefeated", { trainerName: this.scene.currentBattle.trainer?.getName(TrainerSlot.NONE, true) }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:trainerDefeated", { trainerName: this.scene.currentBattle.trainer?.getName(TrainerSlot.NONE, true) }), null, () => {
|
||||||
const victoryMessages = this.scene.currentBattle.trainer?.getVictoryMessages()!; // TODO: is this bang correct?
|
const victoryMessages = this.scene.currentBattle.trainer?.getVictoryMessages()!; // TODO: is this bang correct?
|
||||||
let message: string;
|
let message: string;
|
||||||
this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(victoryMessages), this.scene.currentBattle.waveIndex);
|
this.scene.executeWithSeedOffset(() => message = randSeedItem(victoryMessages), this.scene.currentBattle.waveIndex);
|
||||||
message = message!; // tell TS compiler it's defined now
|
message = message!; // tell TS compiler it's defined now
|
||||||
|
|
||||||
const showMessage = () => {
|
const showMessage = () => {
|
||||||
|
@ -6,7 +6,7 @@ import { Stat } from "#app/enums/stat";
|
|||||||
import Pokemon, { PokemonMove } from "#app/field/pokemon";
|
import Pokemon, { PokemonMove } from "#app/field/pokemon";
|
||||||
import { BypassSpeedChanceModifier } from "#app/modifier/modifier";
|
import { BypassSpeedChanceModifier } from "#app/modifier/modifier";
|
||||||
import { Command } from "#app/ui/command-ui-handler";
|
import { Command } from "#app/ui/command-ui-handler";
|
||||||
import * as Utils from "#app/utils";
|
import { randSeedShuffle, BooleanHolder } from "#app/utils";
|
||||||
import { AttemptCapturePhase } from "./attempt-capture-phase";
|
import { AttemptCapturePhase } from "./attempt-capture-phase";
|
||||||
import { AttemptRunPhase } from "./attempt-run-phase";
|
import { AttemptRunPhase } from "./attempt-run-phase";
|
||||||
import { BerryPhase } from "./berry-phase";
|
import { BerryPhase } from "./berry-phase";
|
||||||
@ -40,11 +40,11 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
// We seed it with the current turn to prevent an inconsistency where it
|
// We seed it with the current turn to prevent an inconsistency where it
|
||||||
// was varying based on how long since you last reloaded
|
// was varying based on how long since you last reloaded
|
||||||
this.scene.executeWithSeedOffset(() => {
|
this.scene.executeWithSeedOffset(() => {
|
||||||
orderedTargets = Utils.randSeedShuffle(orderedTargets);
|
orderedTargets = randSeedShuffle(orderedTargets);
|
||||||
}, this.scene.currentBattle.turn, this.scene.waveSeed);
|
}, this.scene.currentBattle.turn, this.scene.waveSeed);
|
||||||
|
|
||||||
// Next, a check for Trick Room is applied to determine sort order.
|
// Next, a check for Trick Room is applied to determine sort order.
|
||||||
const speedReversed = new Utils.BooleanHolder(false);
|
const speedReversed = new BooleanHolder(false);
|
||||||
this.scene.arena.applyTags(TrickRoomTag, false, speedReversed);
|
this.scene.arena.applyTags(TrickRoomTag, false, speedReversed);
|
||||||
|
|
||||||
// Adjust the sort function based on whether Trick Room is active.
|
// Adjust the sort function based on whether Trick Room is active.
|
||||||
@ -71,8 +71,8 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
const battlerBypassSpeed = {};
|
const battlerBypassSpeed = {};
|
||||||
|
|
||||||
this.scene.getField(true).filter(p => p.summonData).map(p => {
|
this.scene.getField(true).filter(p => p.summonData).map(p => {
|
||||||
const bypassSpeed = new Utils.BooleanHolder(false);
|
const bypassSpeed = new BooleanHolder(false);
|
||||||
const canCheckHeldItems = new Utils.BooleanHolder(true);
|
const canCheckHeldItems = new BooleanHolder(true);
|
||||||
applyAbAttrs(BypassSpeedChanceAbAttr, p, null, false, bypassSpeed);
|
applyAbAttrs(BypassSpeedChanceAbAttr, p, null, false, bypassSpeed);
|
||||||
applyAbAttrs(PreventBypassSpeedChanceAbAttr, p, null, false, bypassSpeed, canCheckHeldItems);
|
applyAbAttrs(PreventBypassSpeedChanceAbAttr, p, null, false, bypassSpeed, canCheckHeldItems);
|
||||||
if (canCheckHeldItems.value) {
|
if (canCheckHeldItems.value) {
|
||||||
|
@ -5,7 +5,7 @@ import { Weather, getWeatherDamageMessage, getWeatherLapseMessage } from "#app/d
|
|||||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||||
import { WeatherType } from "#app/enums/weather-type";
|
import { WeatherType } from "#app/enums/weather-type";
|
||||||
import Pokemon, { HitResult } from "#app/field/pokemon";
|
import Pokemon, { HitResult } from "#app/field/pokemon";
|
||||||
import * as Utils from "#app/utils";
|
import { BooleanHolder, toDmgValue } from "#app/utils";
|
||||||
import { CommonAnimPhase } from "./common-anim-phase";
|
import { CommonAnimPhase } from "./common-anim-phase";
|
||||||
|
|
||||||
export class WeatherEffectPhase extends CommonAnimPhase {
|
export class WeatherEffectPhase extends CommonAnimPhase {
|
||||||
@ -28,13 +28,13 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
|||||||
|
|
||||||
if (this.weather.isDamaging()) {
|
if (this.weather.isDamaging()) {
|
||||||
|
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new BooleanHolder(false);
|
||||||
|
|
||||||
this.executeForAll((pokemon: Pokemon) => applyPreWeatherEffectAbAttrs(SuppressWeatherEffectAbAttr, pokemon, this.weather, cancelled));
|
this.executeForAll((pokemon: Pokemon) => applyPreWeatherEffectAbAttrs(SuppressWeatherEffectAbAttr, pokemon, this.weather, cancelled));
|
||||||
|
|
||||||
if (!cancelled.value) {
|
if (!cancelled.value) {
|
||||||
const inflictDamage = (pokemon: Pokemon) => {
|
const inflictDamage = (pokemon: Pokemon) => {
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new BooleanHolder(false);
|
||||||
|
|
||||||
applyPreWeatherEffectAbAttrs(PreWeatherDamageAbAttr, pokemon, this.weather, cancelled);
|
applyPreWeatherEffectAbAttrs(PreWeatherDamageAbAttr, pokemon, this.weather, cancelled);
|
||||||
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
|
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
|
||||||
@ -43,7 +43,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const damage = Utils.toDmgValue(pokemon.getMaxHp() / 16);
|
const damage = toDmgValue(pokemon.getMaxHp() / 16);
|
||||||
|
|
||||||
this.scene.queueMessage(getWeatherDamageMessage(this.weather!.weatherType, pokemon) ?? "");
|
this.scene.queueMessage(getWeatherDamageMessage(this.weather!.weatherType, pokemon) ?? "");
|
||||||
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
|
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user