Fix crash related to weather and issue with level up stats
This commit is contained in:
parent
5a1de4d9a5
commit
5ab3b2dab6
|
@ -22,6 +22,7 @@ import { BattleTagLapseType, BattleTagType, HideSpriteTag as HiddenTag } from ".
|
|||
import { getPokemonMessage } from "./messages";
|
||||
import { Starter } from "./ui/starter-select-ui-handler";
|
||||
import { Gender } from "./gender";
|
||||
import { getRandomWeatherType } from "./weather";
|
||||
|
||||
export class SelectStarterPhase extends BattlePhase {
|
||||
constructor(scene: BattleScene) {
|
||||
|
@ -151,6 +152,8 @@ export class NewBiomeEncounterPhase extends NextEncounterPhase {
|
|||
}
|
||||
|
||||
doEncounter(): void {
|
||||
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena.biomeType), false);
|
||||
|
||||
const enemyPokemon = this.scene.getEnemyPokemon();
|
||||
this.scene.tweens.add({
|
||||
targets: [ this.scene.arenaEnemy, enemyPokemon ],
|
||||
|
@ -1081,10 +1084,6 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
|
|||
}
|
||||
}
|
||||
|
||||
export class WeatherPhase extends BattlePhase {
|
||||
|
||||
}
|
||||
|
||||
export class MessagePhase extends BattlePhase {
|
||||
private text: string;
|
||||
private callbackDelay: integer;
|
||||
|
@ -1296,7 +1295,7 @@ export class LevelUpPhase extends PartyMemberPokemonPhase {
|
|||
pokemon.calculateStats();
|
||||
pokemon.updateInfo();
|
||||
this.scene.playSoundWithoutBgm('level_up_fanfare', 1500);
|
||||
this.scene.ui.showText(`${this.getPokemon().name} grew to\nLV. ${this.level}!`, null, () => this.scene.ui.getMessageHandler().promptLevelUpStats(prevStats, false, () => this.end()), null, true);
|
||||
this.scene.ui.showText(`${this.getPokemon().name} grew to\nLV. ${this.level}!`, null, () => this.scene.ui.getMessageHandler().promptLevelUpStats(this.partyMemberIndex, prevStats, false, () => this.end()), null, true);
|
||||
const levelMoves = this.getPokemon().getLevelMoves(this.lastLevel + 1);
|
||||
for (let lm of levelMoves)
|
||||
this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, lm));
|
||||
|
|
|
@ -438,7 +438,6 @@ export default class BattleScene extends Phaser.Scene {
|
|||
|
||||
newArena(biome: Biome): Arena {
|
||||
this.arena = new Arena(this, biome, Biome[biome].toLowerCase());
|
||||
this.arena.trySetWeather(getRandomWeatherType(this.arena.biomeType), false);
|
||||
return this.arena;
|
||||
}
|
||||
|
||||
|
@ -482,7 +481,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
}
|
||||
else if (this.isButtonPressed(Button.SPEED_UP)) {
|
||||
if (!this.auto) {
|
||||
if (this.gameSpeed < 2)
|
||||
if (this.gameSpeed < 2.5)
|
||||
this.gameSpeed += 0.25;
|
||||
} else if (this.gameSpeed < 20)
|
||||
this.gameSpeed++;
|
||||
|
@ -498,8 +497,8 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.auto = !this.auto;
|
||||
if (this.auto)
|
||||
this.gameSpeed = Math.floor(this.gameSpeed);
|
||||
else if (this.gameSpeed > 2)
|
||||
this.gameSpeed = 2;
|
||||
else if (this.gameSpeed > 2.5)
|
||||
this.gameSpeed = 2.5;
|
||||
} else
|
||||
return;
|
||||
} else
|
||||
|
|
|
@ -402,7 +402,7 @@ export class PokemonHpRestoreModifier extends ConsumablePokemonModifier {
|
|||
restorePoints = Math.floor(restorePoints * (args[1] as number));
|
||||
else
|
||||
pokemon.resetStatus();
|
||||
pokemon.hp = Math.min(pokemon.hp + (this.percent ? (restorePoints * 0.01) * pokemon.getMaxHp() : restorePoints), pokemon.getMaxHp());
|
||||
pokemon.hp = Math.min(pokemon.hp + Math.ceil((this.percent ? (restorePoints * 0.01) * pokemon.getMaxHp() : restorePoints)), pokemon.getMaxHp());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -625,6 +625,10 @@ export class ExpShareModifier extends PersistentModifier {
|
|||
super(type);
|
||||
}
|
||||
|
||||
match(modifier: Modifier): boolean {
|
||||
return modifier instanceof ExpShareModifier;
|
||||
}
|
||||
|
||||
apply(_args: any[]): boolean {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -105,8 +105,8 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
super.clear();
|
||||
}
|
||||
|
||||
promptLevelUpStats(prevStats: integer[], showTotals: boolean, callback?: Function) {
|
||||
const newStats = (this.scene as BattleScene).getPlayerPokemon().stats;
|
||||
promptLevelUpStats(partyMemberIndex: integer, prevStats: integer[], showTotals: boolean, callback?: Function) {
|
||||
const newStats = (this.scene as BattleScene).getParty()[partyMemberIndex].stats;
|
||||
let levelUpStatsValuesText = '';
|
||||
const stats = Utils.getEnumValues(Stat);
|
||||
for (let s of stats)
|
||||
|
@ -117,7 +117,7 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
this.awaitingActionInput = true;
|
||||
this.onActionInput = () => {
|
||||
if (!showTotals)
|
||||
this.promptLevelUpStats(null, true, callback);
|
||||
this.promptLevelUpStats(partyMemberIndex, null, true, callback);
|
||||
else {
|
||||
this.levelUpStatsContainer.setVisible(false);
|
||||
if (callback)
|
||||
|
|
Loading…
Reference in New Issue