Add money (currently unused) and fix issue with reward modifiers not persisting
parent
8222d67408
commit
7dbf3f62da
|
@ -231,6 +231,7 @@ export class EncounterPhase extends BattlePhase {
|
|||
super.start();
|
||||
|
||||
this.scene.updateWaveCountText();
|
||||
this.scene.updateMoneyText();
|
||||
|
||||
const loadEnemyAssets = [];
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ const quickStart = false;
|
|||
export const startingLevel = 5;
|
||||
export const startingWave = 1;
|
||||
export const startingBiome = Biome.TOWN;
|
||||
export const startingMoney = 1000;
|
||||
|
||||
export enum Button {
|
||||
UP,
|
||||
|
@ -88,8 +89,10 @@ export default class BattleScene extends Phaser.Scene {
|
|||
public lastEnemyTrainer: Trainer;
|
||||
public currentBattle: Battle;
|
||||
public pokeballCounts: PokeballCounts;
|
||||
public money: integer;
|
||||
private party: PlayerPokemon[];
|
||||
private waveCountText: Phaser.GameObjects.Text;
|
||||
private moneyText: Phaser.GameObjects.Text;
|
||||
private modifierBar: ModifierBar;
|
||||
private enemyModifierBar: ModifierBar;
|
||||
private modifiers: PersistentModifier[];
|
||||
|
@ -384,9 +387,14 @@ export default class BattleScene extends Phaser.Scene {
|
|||
|
||||
this.waveCountText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO);
|
||||
this.waveCountText.setOrigin(1, 0);
|
||||
this.updateUIPositions();
|
||||
this.fieldUI.add(this.waveCountText);
|
||||
|
||||
this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.MONEY);
|
||||
this.moneyText.setOrigin(1, 0);
|
||||
this.fieldUI.add(this.moneyText);
|
||||
|
||||
this.updateUIPositions();
|
||||
|
||||
this.party = [];
|
||||
|
||||
let loadPokemonAssets = [];
|
||||
|
@ -538,6 +546,8 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.seed = Utils.randomString(16);
|
||||
console.log('Seed:', this.seed);
|
||||
|
||||
this.money = startingMoney;
|
||||
|
||||
this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ]));
|
||||
this.pokeballCounts[PokeballType.POKEBALL] += 5;
|
||||
|
||||
|
@ -556,6 +566,9 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.waveCountText.setText(startingWave.toString());
|
||||
this.waveCountText.setVisible(false);
|
||||
|
||||
this.updateMoneyText();
|
||||
this.moneyText.setVisible(false);
|
||||
|
||||
this.newArena(startingBiome, true);
|
||||
|
||||
this.arenaBgTransition.setPosition(0, 0);
|
||||
|
@ -722,9 +735,15 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.waveCountText.setVisible(true);
|
||||
}
|
||||
|
||||
updateMoneyText(): void {
|
||||
this.moneyText.setText(`₽${this.money.toLocaleString('en-US')}`);
|
||||
this.moneyText.setVisible(true);
|
||||
}
|
||||
|
||||
updateUIPositions(): void {
|
||||
this.waveCountText.setY(-(this.game.canvas.height / 6) + (this.enemyModifiers.length ? 15 : 0));
|
||||
this.partyExpBar.setY(this.waveCountText.y + 15);
|
||||
this.moneyText.setY(this.waveCountText.y + 10);
|
||||
this.partyExpBar.setY(this.moneyText.y + 15);
|
||||
}
|
||||
|
||||
getMaxExpLevel(): integer {
|
||||
|
|
|
@ -4702,7 +4702,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
|
|||
console.log(beautify(trainerOutput, null, 2, 120).replace(/( | (?:\{ "\d+": \[ )?| "(?:.*?)": \[ |, (?:(?:\{ )?"\d+": \[ )?)"(.*?)"/g, '$1TrainerType.$2').replace(/"(\d+)": /g, '$1: ').replace(/( )"(.*?)"/g, '$1[BiomePoolTier.$2]').replace(/( )"(.*?)"/g, '$1[Biome.$2]'));
|
||||
}
|
||||
|
||||
outputPools();
|
||||
//outputPools();
|
||||
|
||||
/*for (let pokemon of allSpecies) {
|
||||
if (pokemon.speciesId >= Species.XERNEAS)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import BattleScene from "../battle-scene";
|
||||
import { ModifierType, modifierTypes } from "../modifier/modifier-type";
|
||||
import { ModifierType, ModifierTypeFunc, modifierTypes } from "../modifier/modifier-type";
|
||||
import { EnemyPokemon } from "../pokemon";
|
||||
import * as Utils from "../utils";
|
||||
import { Moves } from "./move";
|
||||
|
@ -413,8 +413,9 @@ export class TrainerConfig {
|
|||
return this;
|
||||
}
|
||||
|
||||
setModifierRewardFuncs(...modifierTypeFuncs: (() => ModifierType)[]): TrainerConfig {
|
||||
this.modifierRewardFuncs = modifierTypeFuncs.map(modifierTypeFunc => () => {
|
||||
setModifierRewardFuncs(...modifierTypeFuncs: (() => ModifierTypeFunc)[]): TrainerConfig {
|
||||
this.modifierRewardFuncs = modifierTypeFuncs.map(func => () => {
|
||||
const modifierTypeFunc = func();
|
||||
const modifierType = modifierTypeFunc();
|
||||
modifierType.id = Object.keys(modifierTypes).find(k => modifierTypes[k] === modifierTypeFunc);
|
||||
return modifierType;
|
||||
|
@ -682,7 +683,7 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
$Just kidding! I lost fair and square, and now I know you'll do fine out there.
|
||||
$By the way, the professor wanted me to give you some items. Hopefully they're helpful!
|
||||
$Do your best like always! I believe in you!`
|
||||
]).setModifierRewardFuncs(() => modifierTypes.EXP_CHARM(), () => modifierTypes.EXP_SHARE()).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.CHIKORITA, Species.CYNDAQUIL, Species.TOTODILE, Species.TREECKO, Species.TORCHIC, Species.MUDKIP, Species.TURTWIG, Species.CHIMCHAR, Species.PIPLUP, Species.SNIVY, Species.TEPIG, Species.OSHAWOTT ]))
|
||||
]).setModifierRewardFuncs(() => modifierTypes.EXP_CHARM, () => modifierTypes.EXP_SHARE).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.CHIKORITA, Species.CYNDAQUIL, Species.TOTODILE, Species.TREECKO, Species.TORCHIC, Species.MUDKIP, Species.TURTWIG, Species.CHIMCHAR, Species.PIPLUP, Species.SNIVY, Species.TEPIG, Species.OSHAWOTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEY, Species.HOOTHOOT, Species.TAILLOW, Species.STARLY, Species.PIDOVE ])),
|
||||
[TrainerType.RIVAL_2]: new TrainerConfig(++t).setStaticParty().setEncounterBgm(TrainerType.RIVAL).setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL_2).setEncounterMessages([
|
||||
`Oh, fancy meeting you here. Looks like you're still undefeated. Right on!
|
||||
|
|
|
@ -518,7 +518,7 @@ export class TurnHeldItemTransferModifierType extends PokemonHeldItemModifierTyp
|
|||
}
|
||||
}
|
||||
|
||||
type ModifierTypeFunc = () => ModifierType;
|
||||
export type ModifierTypeFunc = () => ModifierType;
|
||||
type WeightedModifierTypeWeightFunc = (party: Pokemon[]) => integer;
|
||||
|
||||
class WeightedModifierType {
|
||||
|
|
|
@ -6,7 +6,8 @@ export enum TextStyle {
|
|||
PARTY_RED,
|
||||
SUMMARY,
|
||||
SUMMARY_RED,
|
||||
SUMMARY_GOLD
|
||||
SUMMARY_GOLD,
|
||||
MONEY
|
||||
};
|
||||
|
||||
export function addTextObject(scene: Phaser.Scene, x: number, y: number, content: string, style: TextStyle, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle) {
|
||||
|
@ -31,8 +32,8 @@ export function addTextObject(scene: Phaser.Scene, x: number, y: number, content
|
|||
styleOptions.fontSize = '96px';
|
||||
break;
|
||||
case TextStyle.BATTLE_INFO:
|
||||
case TextStyle.MONEY:
|
||||
styleOptions.fontSize = '72px';
|
||||
styleOptions.padding = undefined;
|
||||
shadowSize = 4;
|
||||
break;
|
||||
case TextStyle.PARTY:
|
||||
|
@ -77,6 +78,7 @@ export function getTextColor(textStyle: TextStyle, shadow?: boolean) {
|
|||
case TextStyle.SUMMARY_RED:
|
||||
return !shadow ? '#f89890' : '#984038';
|
||||
case TextStyle.SUMMARY_GOLD:
|
||||
case TextStyle.MONEY:
|
||||
return !shadow ? '#e8e8a8' : '#a0a060'
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue