Fix some bugs and re-implement unintentionally reverted weather logic

pull/1/head
Flashfyre 2023-04-19 14:07:38 -04:00
parent 64076a842d
commit 5a3f626776
10 changed files with 133 additions and 58 deletions

View File

@ -26,11 +26,12 @@ export class Arena {
} }
randomSpecies(waveIndex: integer, level: integer): PokemonSpecies { randomSpecies(waveIndex: integer, level: integer): PokemonSpecies {
const isBoss = waveIndex % 10 === 0 && this.pokemonPool[BiomePoolTier.BOSS].length; const isBoss = (waveIndex >= 100 || waveIndex % 10 === 0) && !!this.pokemonPool[BiomePoolTier.BOSS].length;
const tierValue = Utils.randInt(!isBoss ? 512 : 64); const tierValue = Utils.randInt(!isBoss ? 512 : 64);
let tier = !isBoss let tier = !isBoss
? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE ? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE
: tierValue >= 20 ? BiomePoolTier.BOSS : tierValue >= 6 ? BiomePoolTier.BOSS_RARE : tierValue >= 1 ? BiomePoolTier.BOSS_SUPER_RARE : BiomePoolTier.BOSS_ULTRA_RARE; : tierValue >= 20 ? BiomePoolTier.BOSS : tierValue >= 6 ? BiomePoolTier.BOSS_RARE : tierValue >= 1 ? BiomePoolTier.BOSS_SUPER_RARE : BiomePoolTier.BOSS_ULTRA_RARE;
console.log(BiomePoolTier[tier]);
while (!this.pokemonPool[tier].length) { while (!this.pokemonPool[tier].length) {
console.log(`Downgraded rarity tier from ${BiomePoolTier[tier]} to ${BiomePoolTier[tier - 1]}`); console.log(`Downgraded rarity tier from ${BiomePoolTier[tier]} to ${BiomePoolTier[tier - 1]}`);
tier--; tier--;
@ -38,7 +39,7 @@ export class Arena {
const tierPool = this.pokemonPool[tier]; const tierPool = this.pokemonPool[tier];
let ret: PokemonSpecies; let ret: PokemonSpecies;
if (!tierPool.length) if (!tierPool.length)
ret = this.scene.randomSpecies(level); ret = this.scene.randomSpecies(waveIndex, level);
else { else {
const entry = tierPool[Utils.randInt(tierPool.length)]; const entry = tierPool[Utils.randInt(tierPool.length)];
let species: Species; let species: Species;
@ -101,6 +102,8 @@ export class Arena {
if (this.weather?.weatherType === (weather || undefined)) if (this.weather?.weatherType === (weather || undefined))
return false; return false;
console.log('set weather', WeatherType[weather]);
const oldWeatherType = this.weather?.weatherType || WeatherType.NONE; const oldWeatherType = this.weather?.weatherType || WeatherType.NONE;
this.weather = weather ? new Weather(weather, viaMove ? 5 : 0) : null; this.weather = weather ? new Weather(weather, viaMove ? 5 : 0) : null;

View File

@ -189,7 +189,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.lastMaxHp = pokemon.getMaxHp(); this.lastMaxHp = pokemon.getMaxHp();
}; };
if (this.player && this.lastExp !== pokemon.exp) { if (this.player && (this.lastExp !== pokemon.exp || this.lastLevel !== pokemon.level)) {
const originalResolve = resolve; const originalResolve = resolve;
resolve = () => this.updatePokemonExp(pokemon).then(() => originalResolve()); resolve = () => this.updatePokemonExp(pokemon).then(() => originalResolve());
} }
@ -211,7 +211,12 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
const levelUp = this.lastLevel < battler.level; const levelUp = this.lastLevel < battler.level;
const relLevelExp = getLevelRelExp(this.lastLevel + 1, battler.species.growthRate); const relLevelExp = getLevelRelExp(this.lastLevel + 1, battler.species.growthRate);
const levelExp = levelUp ? relLevelExp : battler.levelExp; const levelExp = levelUp ? relLevelExp : battler.levelExp;
let ratio = levelExp / relLevelExp; let ratio = relLevelExp ? levelExp / relLevelExp : 0;
if (this.lastLevel >= 100) {
if (levelUp)
ratio = 1;
instant = true;
}
let duration = this.visible && !instant ? ((levelExp - this.lastLevelExp) / relLevelExp) * 1650 : 0; let duration = this.visible && !instant ? ((levelExp - this.lastLevelExp) / relLevelExp) * 1650 : 0;
if (duration) if (duration)
this.scene.sound.play('exp'); this.scene.sound.play('exp');

View File

@ -1,7 +1,7 @@
import BattleScene from "./battle-scene"; import BattleScene, { startingLevel, startingWave } from "./battle-scene";
import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult } from "./pokemon"; import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult } from "./pokemon";
import * as Utils from './utils'; import * as Utils from './utils';
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, ConditionalMoveAttr, HitsTagAttr, MissEffectAttr, MoveCategory, MoveEffectAttr, MoveFlags, MoveHitEffectAttr, Moves, MultiHitAttr, OverrideMoveEffectAttr } from "./move"; import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, ConditionalMoveAttr, HitsTagAttr, MissEffectAttr, MoveCategory, MoveEffectAttr, MoveFlags, MoveHitEffectAttr, Moves, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr } from "./move";
import { Mode } from './ui/ui'; import { Mode } from './ui/ui';
import { Command } from "./ui/command-ui-handler"; import { Command } from "./ui/command-ui-handler";
import { Stat } from "./pokemon-stat"; import { Stat } from "./pokemon-stat";
@ -22,7 +22,7 @@ import { BattleTagLapseType, BattleTagType, HideSpriteTag as HiddenTag } from ".
import { getPokemonMessage } from "./messages"; import { getPokemonMessage } from "./messages";
import { Starter } from "./ui/starter-select-ui-handler"; import { Starter } from "./ui/starter-select-ui-handler";
import { Gender } from "./gender"; import { Gender } from "./gender";
import { getRandomWeatherType } from "./weather"; import { Weather, WeatherType, getRandomWeatherType, getWeatherDamageMessage, getWeatherLapseMessage } from "./weather";
export class SelectStarterPhase extends BattlePhase { export class SelectStarterPhase extends BattlePhase {
constructor(scene: BattleScene) { constructor(scene: BattleScene) {
@ -41,7 +41,7 @@ export class SelectStarterPhase extends BattlePhase {
const starterGender = starter.species.malePercent !== null const starterGender = starter.species.malePercent !== null
? !starter.female ? Gender.MALE : Gender.FEMALE ? !starter.female ? Gender.MALE : Gender.FEMALE
: Gender.GENDERLESS; : Gender.GENDERLESS;
const starterPokemon = new PlayerPokemon(this.scene, starter.species, 5, starter.formIndex, starterGender, starter.shiny); const starterPokemon = new PlayerPokemon(this.scene, starter.species, startingLevel, starter.formIndex, starterGender, starter.shiny);
starterPokemon.setVisible(false); starterPokemon.setVisible(false);
party.push(starterPokemon); party.push(starterPokemon);
loadPokemonAssets.push(starterPokemon.loadAssets()); loadPokemonAssets.push(starterPokemon.loadAssets());
@ -69,7 +69,7 @@ export class EncounterPhase extends BattlePhase {
this.scene.updateWaveText(); this.scene.updateWaveText();
const battle = this.scene.currentBattle; const battle = this.scene.currentBattle;
const enemySpecies = this.scene.arena.randomSpecies(1, battle.enemyLevel); const enemySpecies = this.scene.arena.randomSpecies(battle.waveIndex, battle.enemyLevel);
battle.enemyPokemon = new EnemyPokemon(this.scene, enemySpecies, battle.enemyLevel); battle.enemyPokemon = new EnemyPokemon(this.scene, enemySpecies, battle.enemyLevel);
const enemyPokemon = this.scene.getEnemyPokemon(); const enemyPokemon = this.scene.getEnemyPokemon();
enemyPokemon.resetSummonData(); enemyPokemon.resetSummonData();
@ -89,6 +89,13 @@ export class EncounterPhase extends BattlePhase {
} }
doEncounter() { doEncounter() {
if (startingWave > 10) {
for (let m = 0; m < Math.floor(startingWave / 10); m++)
this.scene.addModifier(getModifierTypeOptionsForWave((m + 1) * 10, 1, this.scene.getParty())[0].type.newModifier());
}
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena.biomeType), false);
const enemyPokemon = this.scene.getEnemyPokemon(); const enemyPokemon = this.scene.getEnemyPokemon();
this.scene.tweens.add({ this.scene.tweens.add({
targets: [ this.scene.arenaEnemy, enemyPokemon, this.scene.arenaPlayer, this.scene.trainer ], targets: [ this.scene.arenaEnemy, enemyPokemon, this.scene.arenaPlayer, this.scene.trainer ],
@ -405,9 +412,13 @@ export class CheckSwitchPhase extends BattlePhase {
this.scene.ui.showText('Will you switch\nPOKéMON?', null, () => { this.scene.ui.showText('Will you switch\nPOKéMON?', null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => { this.scene.ui.setMode(Mode.CONFIRM, () => {
this.scene.ui.setMode(Mode.MESSAGE);
this.scene.unshiftPhase(new SwitchPhase(this.scene, false, true)); this.scene.unshiftPhase(new SwitchPhase(this.scene, false, true));
this.end(); this.end();
}, () => this.end()); }, () => {
this.scene.ui.setMode(Mode.MESSAGE);
this.end();
});
}); });
} }
} }
@ -455,10 +466,12 @@ export class CommandPhase extends BattlePhase {
let isDelayed = (command: Command, playerMove: PokemonMove, enemyMove: PokemonMove) => { let isDelayed = (command: Command, playerMove: PokemonMove, enemyMove: PokemonMove) => {
switch (command) { switch (command) {
case Command.FIGHT: case Command.FIGHT:
const playerMovePriority = playerMove.getMove().priority; if (playerMove && enemyMove) {
const enemyMovePriority = enemyMove.getMove().priority; const playerMovePriority = playerMove.getMove().priority;
if (playerMovePriority !== enemyMovePriority) const enemyMovePriority = enemyMove.getMove().priority;
return playerMovePriority < enemyMovePriority; if (playerMovePriority !== enemyMovePriority)
return playerMovePriority < enemyMovePriority;
}
break; break;
case Command.BALL: case Command.BALL:
case Command.POKEMON: case Command.POKEMON:
@ -498,6 +511,9 @@ export class CommandPhase extends BattlePhase {
} }
if (success) { if (success) {
if (this.scene.arena.weather)
this.scene.unshiftPhase(new WeatherEffectPhase(this.scene, this.scene.arena.weather, isDelayed(command, null, null)));
const enemyMove = enemyPokemon.getNextMove(); const enemyMove = enemyPokemon.getNextMove();
const enemyPhase = new EnemyMovePhase(this.scene, enemyPokemon, enemyMove); const enemyPhase = new EnemyMovePhase(this.scene, enemyPokemon, enemyMove);
if (isDelayed(command, playerMove, enemyMove)) if (isDelayed(command, playerMove, enemyMove))
@ -552,6 +568,9 @@ export class TurnEndPhase extends BattlePhase {
enemyPokemon.battleSummonData.turnCount++; enemyPokemon.battleSummonData.turnCount++;
} }
if (this.scene.arena.weather && !this.scene.arena.weather.lapse())
this.scene.arena.trySetWeather(WeatherType.NONE, false);
this.end(); this.end();
} }
} }
@ -663,6 +682,8 @@ export abstract class MovePhase extends BattlePhase {
const failed = new Utils.BooleanHolder(false); const failed = new Utils.BooleanHolder(false);
applyMoveAttrs(ConditionalMoveAttr, this.pokemon, target, this.move.getMove(), failed); applyMoveAttrs(ConditionalMoveAttr, this.pokemon, target, this.move.getMove(), failed);
if (!failed.value && this.scene.arena.isMoveWeatherCancelled(this.move.getMove()))
failed.value = true;
if (failed.value) { if (failed.value) {
this.pokemon.summonData.moveHistory.push({ move: this.move.moveId, result: MoveResult.FAILED }); this.pokemon.summonData.moveHistory.push({ move: this.move.moveId, result: MoveResult.FAILED });
this.scene.unshiftPhase(new MessagePhase(this.scene, 'But it failed!')); this.scene.unshiftPhase(new MessagePhase(this.scene, 'But it failed!'));
@ -828,6 +849,12 @@ abstract class MoveEffectPhase extends PokemonPhase {
if (!this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length) if (!this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length)
return false; return false;
} }
const moveAccuracy = new Utils.NumberHolder(this.move.getMove().accuracy);
applyMoveAttrs(VariableAccuracyAttr, this.getUserPokemon(), this.getTargetPokemon(), this.move.getMove(), moveAccuracy);
if (moveAccuracy.value === -1)
return true;
if (this.move.getMove().category !== MoveCategory.STATUS) { if (this.move.getMove().category !== MoveCategory.STATUS) {
const userAccuracyLevel = new Utils.IntegerHolder(this.getUserPokemon().summonData.battleStats[BattleStat.ACC]); const userAccuracyLevel = new Utils.IntegerHolder(this.getUserPokemon().summonData.battleStats[BattleStat.ACC]);
@ -1024,6 +1051,42 @@ export class StatChangePhase extends PokemonPhase {
} }
} }
export class WeatherEffectPhase extends CommonAnimPhase {
private weather: Weather;
private playerDelayed: boolean;
constructor(scene: BattleScene, weather: Weather, playerDelayed: boolean) {
super(scene, true, CommonAnim.SUNNY + (weather.weatherType - 1));
this.weather = weather;
this.playerDelayed = playerDelayed;
}
start() {
if (this.weather.isDamaging()) {
const inflictDamage = (pokemon: Pokemon) => {
this.scene.unshiftPhase(new MessagePhase(this.scene, getWeatherDamageMessage(this.weather.weatherType, pokemon)));
pokemon.damage(Math.ceil(pokemon.getMaxHp() / 16));
this.scene.unshiftPhase(new DamagePhase(this.scene, pokemon.isPlayer()));
};
const playerPokemon = this.scene.getPlayerPokemon();
const enemyPokemon = this.scene.getEnemyPokemon();
const playerImmune = !!playerPokemon.getTypes().filter(t => this.weather.isTypeDamageImmune(t)).length;
const enemyImmune = !!enemyPokemon.getTypes().filter(t => this.weather.isTypeDamageImmune(t)).length;
if (!this.playerDelayed && !playerImmune)
inflictDamage(playerPokemon);
if (!enemyImmune)
inflictDamage(enemyPokemon);
if (this.playerDelayed && !playerImmune)
inflictDamage(playerPokemon);
}
this.scene.ui.showText(getWeatherLapseMessage(this.weather.weatherType), null, () => super.start());
}
}
export class ObtainStatusEffectPhase extends PokemonPhase { export class ObtainStatusEffectPhase extends PokemonPhase {
private statusEffect: StatusEffect; private statusEffect: StatusEffect;
private cureTurn: integer; private cureTurn: integer;
@ -1296,12 +1359,14 @@ export class LevelUpPhase extends PartyMemberPokemonPhase {
pokemon.updateInfo(); pokemon.updateInfo();
this.scene.playSoundWithoutBgm('level_up_fanfare', 1500); 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(this.partyMemberIndex, 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); if (this.level <= 100) {
for (let lm of levelMoves) const levelMoves = this.getPokemon().getLevelMoves(this.lastLevel + 1);
this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, lm)); for (let lm of levelMoves)
const evolution = pokemon.getEvolution(); this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, lm));
if (evolution) const evolution = pokemon.getEvolution();
this.scene.unshiftPhase(new EvolutionPhase(this.scene, this.partyMemberIndex, evolution, this.lastLevel)); if (evolution)
this.scene.unshiftPhase(new EvolutionPhase(this.scene, this.partyMemberIndex, evolution, this.lastLevel));
}
} }
} }

View File

@ -16,10 +16,12 @@ import { initGameSpeed } from './game-speed';
import { Arena } from './arena'; import { Arena } from './arena';
import { GameData } from './game-data'; import { GameData } from './game-data';
import StarterSelectUiHandler from './ui/starter-select-ui-handler'; import StarterSelectUiHandler from './ui/starter-select-ui-handler';
import { getRandomWeatherType } from './weather';
import { TextStyle, addTextObject } from './text'; import { TextStyle, addTextObject } from './text';
const enableAuto = true; const enableAuto = true;
export const startingLevel = 5;
export const startingWave = 1;
export const startingBiome = Biome.PLAINS;
export enum Button { export enum Button {
UP, UP,
@ -301,7 +303,7 @@ export default class BattleScene extends Phaser.Scene {
const biomes = Utils.getEnumValues(Biome); const biomes = Utils.getEnumValues(Biome);
this.newArena(biomes[Utils.randInt(biomes.length)]); this.newArena(biomes[Utils.randInt(biomes.length)]);
} else } else
this.newArena(Biome.PLAINS); this.newArena(startingBiome);
const biomeKey = this.arena.getBiomeKey(); const biomeKey = this.arena.getBiomeKey();
this.arenaBg = this.add.sprite(0, 0, `${biomeKey}_bg`); this.arenaBg = this.add.sprite(0, 0, `${biomeKey}_bg`);
@ -321,8 +323,10 @@ export default class BattleScene extends Phaser.Scene {
if (this.quickStart) { if (this.quickStart) {
for (let s = 0; s < 3; s++) { for (let s = 0; s < 3; s++) {
const playerSpecies = !isRandom ? getPokemonSpecies(s === 0 ? Species.TORCHIC : s === 1 ? Species.TREECKO : Species.MUDKIP) : this.randomSpecies(5); const playerSpecies = (!isRandom
const playerPokemon = new PlayerPokemon(this, playerSpecies, 5, 0); ? getPokemonSpecies((getPokemonSpecies(s === 0 ? Species.TORCHIC : s === 1 ? Species.TREECKO : Species.MUDKIP)).getSpeciesForLevel(startingLevel, true))
: this.randomSpecies(startingWave, startingLevel));
const playerPokemon = new PlayerPokemon(this, playerSpecies, startingLevel, 0);
playerPokemon.setVisible(false); playerPokemon.setVisible(false);
loadPokemonAssets.push(playerPokemon.loadAssets()); loadPokemonAssets.push(playerPokemon.loadAssets());
@ -431,7 +435,7 @@ export default class BattleScene extends Phaser.Scene {
this.pushPhase(new SummonPhase(this)); this.pushPhase(new SummonPhase(this));
} }
this.currentBattle = new Battle((this.currentBattle?.waveIndex || 0) + 1); this.currentBattle = new Battle((this.currentBattle?.waveIndex || (startingWave - 1)) + 1);
return this.currentBattle; return this.currentBattle;
} }
@ -448,9 +452,9 @@ export default class BattleScene extends Phaser.Scene {
this.waveCountText.setShadowColor(!isBoss ? '#ded6b5' : '#984038'); this.waveCountText.setShadowColor(!isBoss ? '#ded6b5' : '#984038');
} }
randomSpecies(level: integer, fromArenaPool?: boolean): PokemonSpecies { randomSpecies(waveIndex: integer, level: integer, fromArenaPool?: boolean): PokemonSpecies {
return fromArenaPool return fromArenaPool
? this.arena.randomSpecies(1, level) ? this.arena.randomSpecies(waveIndex, level)
: getPokemonSpecies(allSpecies[(Utils.randInt(allSpecies.length)) - 1].getSpeciesForLevel(level)); : getPokemonSpecies(allSpecies[(Utils.randInt(allSpecies.length)) - 1].getSpeciesForLevel(level));
} }
@ -584,13 +588,14 @@ export default class BattleScene extends Phaser.Scene {
addModifier(modifier: Modifier, virtual?: boolean): Promise<void> { addModifier(modifier: Modifier, virtual?: boolean): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
if (modifier instanceof PersistentModifier) { if (modifier instanceof PersistentModifier) {
if ((modifier as PersistentModifier).add(this.modifiers, !!virtual) && !virtual) if ((modifier as PersistentModifier).add(this.modifiers, !!virtual) && !virtual && !this.sound.get('restore'))
this.sound.play('restore'); this.sound.play('restore');
if (!virtual) if (!virtual)
this.updateModifiers().then(() => resolve()); this.updateModifiers().then(() => resolve());
} else if (modifier instanceof ConsumableModifier) { } else if (modifier instanceof ConsumableModifier) {
this.sound.play('restore'); if (!this.sound.get('restore'))
this.sound.play('restore');
if (modifier instanceof ConsumablePokemonModifier) { if (modifier instanceof ConsumablePokemonModifier) {
for (let p in this.party) { for (let p in this.party) {

View File

@ -13,14 +13,14 @@ export class Battle {
} }
private getLevelForWave(): number { private getLevelForWave(): number {
let averageLevel = 1 + this.waveIndex / 2 + Math.pow(this.waveIndex / 25, 2); let baseLevel = 1 + this.waveIndex / 2 + Math.pow(this.waveIndex / 25, 2);
if (!(this.waveIndex % 10)) if (!(this.waveIndex % 10))
return Math.floor(averageLevel * 1.2); return Math.floor(baseLevel * 1.2);
const deviation = 10 / this.waveIndex; const deviation = 10 / this.waveIndex;
return Math.max(Math.round(averageLevel + Utils.randGauss(deviation)), 1); return Math.max(Math.round(baseLevel + Math.abs(Utils.randGauss(deviation))), 1);
} }
addParticipant(playerPokemon: PlayerPokemon): void { addParticipant(playerPokemon: PlayerPokemon): void {

View File

@ -1,5 +1,4 @@
import { pokemonEvolutions, SpeciesEvolution } from "./pokemon-evolutions"; import { pokemonEvolutions, SpeciesEvolution } from "./pokemon-evolutions";
import { allSpecies } from "./pokemon-species";
import { Species } from "./species"; import { Species } from "./species";
import { Type } from './type'; import { Type } from './type';
import * as Utils from './utils'; import * as Utils from './utils';
@ -460,7 +459,7 @@ export const biomePools: BiomePools = {
[BiomePoolTier.BOSS]: [ Species.PIDGEOT, Species.FEAROW, Species.SKARMORY, Species.SWELLOW, Species.AGGRON, Species.ALTARIA, Species.STARAPTOR, Species.UNFEZANT, Species.BRAVIARY, Species.MANDIBUZZ ], [BiomePoolTier.BOSS]: [ Species.PIDGEOT, Species.FEAROW, Species.SKARMORY, Species.SWELLOW, Species.AGGRON, Species.ALTARIA, Species.STARAPTOR, Species.UNFEZANT, Species.BRAVIARY, Species.MANDIBUZZ ],
[BiomePoolTier.BOSS_RARE]: [ Species.BLAZIKEN, Species.RAMPARDOS, Species.BASTIODON ], [BiomePoolTier.BOSS_RARE]: [ Species.BLAZIKEN, Species.RAMPARDOS, Species.BASTIODON ],
[BiomePoolTier.BOSS_SUPER_RARE]: [ Species.TORNADUS ], [BiomePoolTier.BOSS_SUPER_RARE]: [ Species.TORNADUS ],
[BiomePoolTier.BOSS_ULTRA_RARE]: [ Species.HO_OH, Species.RAYQUAZA ] [BiomePoolTier.BOSS_ULTRA_RARE]: [ Species.HO_OH ]
}, },
[Biome.LAND]: { [Biome.LAND]: {
[BiomePoolTier.COMMON]: [ [BiomePoolTier.COMMON]: [
@ -651,11 +650,11 @@ export const biomePools: BiomePools = {
}, },
[Biome.WASTELAND]: { [Biome.WASTELAND]: {
[BiomePoolTier.COMMON]: [ [BiomePoolTier.COMMON]: [
{ 1: [ Species.LARVITAR ], 30: [ Species.PUPITAR ] }, { 1: [ Species.LARVITAR ], 30: [ Species.PUPITAR ], 55: [ Species.TYRANITAR ] },
{ 1: [ Species.VIBRAVA ], 45: [ Species.FLYGON ] }, { 1: [ Species.VIBRAVA ], 45: [ Species.FLYGON ] },
{ 1: [ Species.BAGON ], 30: [ Species.SHELGON ], 50: [ Species.SALAMENCE ] }, { 1: [ Species.BAGON ], 30: [ Species.SHELGON ], 50: [ Species.SALAMENCE ] },
{ 1: [ Species.GIBLE ], 24: [ Species.GABITE ], 48: [ Species.GARCHOMP ] }, { 1: [ Species.GIBLE ], 24: [ Species.GABITE ], 48: [ Species.GARCHOMP ] },
{ 1: [ Species.AXEW ], 38: [ Species.FRAXURE ] } { 1: [ Species.AXEW ], 38: [ Species.FRAXURE ], 48: [ Species.HAXORUS ] }
], ],
[BiomePoolTier.UNCOMMON]: [ { 1: [ Species.SWABLU ], 35: [ Species.ALTARIA ] }, { 1: [ Species.DEINO ], 50: [ Species.ZWEILOUS ], 64: [ Species.HYDREIGON ] } ], [BiomePoolTier.UNCOMMON]: [ { 1: [ Species.SWABLU ], 35: [ Species.ALTARIA ] }, { 1: [ Species.DEINO ], 50: [ Species.ZWEILOUS ], 64: [ Species.HYDREIGON ] } ],
[BiomePoolTier.RARE]: [ { 1: [ Species.DRATINI ], 30: [ Species.DRAGONAIR ], 55: [ Species.DRAGONITE ] } ], [BiomePoolTier.RARE]: [ { 1: [ Species.DRATINI ], 30: [ Species.DRAGONAIR ], 55: [ Species.DRAGONITE ] } ],
@ -664,7 +663,7 @@ export const biomePools: BiomePools = {
[BiomePoolTier.BOSS]: [ Species.DRAGONITE, Species.TYRANITAR, Species.FLYGON, Species.SALAMENCE, Species.GARCHOMP, Species.HAXORUS ], [BiomePoolTier.BOSS]: [ Species.DRAGONITE, Species.TYRANITAR, Species.FLYGON, Species.SALAMENCE, Species.GARCHOMP, Species.HAXORUS ],
[BiomePoolTier.BOSS_RARE]: [ Species.AERODACTYL, Species.DRUDDIGON ], [BiomePoolTier.BOSS_RARE]: [ Species.AERODACTYL, Species.DRUDDIGON ],
[BiomePoolTier.BOSS_SUPER_RARE]: [], [BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: [ Species.DIALGA ] [BiomePoolTier.BOSS_ULTRA_RARE]: [ Species.RAYQUAZA, Species.DIALGA ]
}, },
[Biome.ABYSS]: { [Biome.ABYSS]: {
[BiomePoolTier.COMMON]: [ Species.MURKROW, { 1: [ Species.HOUNDOUR ], 24: [ Species.HOUNDOOM ] }, Species.SABLEYE, { 1: [ Species.PURRLOIN ], 20: [ Species.LIEPARD ] }, { 1: [ Species.PAWNIARD ], 52: [ Species.BISHARP ] } ], [BiomePoolTier.COMMON]: [ Species.MURKROW, { 1: [ Species.HOUNDOUR ], 24: [ Species.HOUNDOOM ] }, Species.SABLEYE, { 1: [ Species.PURRLOIN ], 20: [ Species.LIEPARD ] }, { 1: [ Species.PAWNIARD ], 52: [ Species.BISHARP ] } ],
@ -1858,6 +1857,7 @@ export const biomePools: BiomePools = {
] ]
], ],
[ Species.TYRANITAR, Type.ROCK, Type.DARK, [ [ Species.TYRANITAR, Type.ROCK, Type.DARK, [
[ Biome.WASTELAND, BiomePoolTier.COMMON ],
[ Biome.WASTELAND, BiomePoolTier.BOSS ] [ Biome.WASTELAND, BiomePoolTier.BOSS ]
] ]
], ],
@ -2500,7 +2500,7 @@ export const biomePools: BiomePools = {
] ]
], ],
[ Species.RAYQUAZA, Type.DRAGON, Type.FLYING, [ [ Species.RAYQUAZA, Type.DRAGON, Type.FLYING, [
[ Biome.MOUNTAIN, BiomePoolTier.BOSS_ULTRA_RARE ] [ Biome.WASTELAND, BiomePoolTier.BOSS_ULTRA_RARE ]
] ]
], ],
[ Species.JIRACHI, Type.STEEL, Type.PSYCHIC, [ [ Species.JIRACHI, Type.STEEL, Type.PSYCHIC, [
@ -3562,6 +3562,7 @@ export const biomePools: BiomePools = {
] ]
], ],
[ Species.HAXORUS, Type.DRAGON, -1, [ [ Species.HAXORUS, Type.DRAGON, -1, [
[ Biome.WASTELAND, BiomePoolTier.COMMON ],
[ Biome.WASTELAND, BiomePoolTier.BOSS ] [ Biome.WASTELAND, BiomePoolTier.BOSS ]
] ]
], ],

View File

@ -53,6 +53,9 @@ export class GameData {
} }
private save(): boolean { private save(): boolean {
if (this.scene.quickStart)
return false;
const data: SaveData = { const data: SaveData = {
trainerId: this.trainerId, trainerId: this.trainerId,
secretId: this.secretId, secretId: this.secretId,

View File

@ -453,19 +453,6 @@ class WeightedModifierType {
} }
} }
class WeightedModifierTypeGroup {
public modifierTypes: WeightedModifierType[];
constructor(...modifierTypes: WeightedModifierType[]) {
this.modifierTypes = modifierTypes;
}
setTier(tier: ModifierTier) {
for (let modifierType of this.modifierTypes)
modifierType.setTier(tier);
}
}
const modifierPool = { const modifierPool = {
[ModifierTier.COMMON]: [ [ModifierTier.COMMON]: [
new WeightedModifierType(new AddPokeballModifierType(PokeballType.POKEBALL, 5, 'pb'), 6), new WeightedModifierType(new AddPokeballModifierType(PokeballType.POKEBALL, 5, 'pb'), 6),
@ -552,7 +539,7 @@ const modifierPool = {
].map(m => { m.setTier(ModifierTier.MASTER); return m; }), ].map(m => { m.setTier(ModifierTier.MASTER); return m; }),
[ModifierTier.LUXURY]: [ [ModifierTier.LUXURY]: [
new ExpBoosterModifierType('GOLDEN EGG', 100), new ExpBoosterModifierType('GOLDEN EGG', 100),
new ModifierType(`GOLDEN ${getPokeballName(PokeballType.POKEBALL)}`, 'Adds 1 extra ITEM option at the end of every battle', (type, _args) => new Modifiers.ExtraModifierModifier(type), 'pb_gold') new ModifierType(`GOLDEN ${getPokeballName(PokeballType.POKEBALL)}`, 'Adds 1 extra item option at the end of every battle', (type, _args) => new Modifiers.ExtraModifierModifier(type), 'pb_gold')
].map(m => { m.setTier(ModifierTier.LUXURY); return m; }), ].map(m => { m.setTier(ModifierTier.LUXURY); return m; }),
}; };

View File

@ -28,13 +28,15 @@ export class ModifierBar extends Phaser.GameObjects.Container {
for (let modifier of modifiers) { for (let modifier of modifiers) {
const icon = modifier.getIcon(this.scene as BattleScene); const icon = modifier.getIcon(this.scene as BattleScene);
this.add(icon); this.add(icon);
this.setModifierIconPosition(icon); this.setModifierIconPosition(icon, modifiers.length);
} }
} }
setModifierIconPosition(icon: Phaser.GameObjects.Container) { setModifierIconPosition(icon: Phaser.GameObjects.Container, modifierCount: integer) {
const x = (this.getIndex(icon) % 12) * 26; let rowIcons: integer = 12 + 6 * Math.max((Math.ceil(modifierCount / 12) - 2), 0);
const y = Math.floor((this.getIndex(icon) * 6) / (this.scene.game.canvas.width / 6)) * 20;
const x = (this.getIndex(icon) % rowIcons) * 26 / (rowIcons / 12);
const y = Math.floor(this.getIndex(icon) / rowIcons) * 20;
icon.setPosition(x, y); icon.setPosition(x, y);
} }
@ -477,8 +479,10 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier {
apply(args: any[]): boolean { apply(args: any[]): boolean {
const pokemon = args[0] as PlayerPokemon; const pokemon = args[0] as PlayerPokemon;
pokemon.level++; pokemon.level++;
pokemon.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate); if (pokemon.level <= 100) {
pokemon.levelExp = 0; pokemon.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate);
pokemon.levelExp = 0;
}
pokemon.scene.unshiftPhase(new LevelUpPhase(pokemon.scene, pokemon.scene.getParty().indexOf(pokemon), pokemon.level - 1, pokemon.level)); pokemon.scene.unshiftPhase(new LevelUpPhase(pokemon.scene, pokemon.scene.getParty().indexOf(pokemon), pokemon.level - 1, pokemon.level));

View File

@ -61,6 +61,8 @@ export class Weather {
case WeatherType.HAIL: case WeatherType.HAIL:
return type === Type.ICE; return type === Type.ICE;
} }
return false;
} }
getAttackTypeMultiplier(attackType: Type): number { getAttackTypeMultiplier(attackType: Type): number {