Add golden egg every 10 waves for exp balancing
parent
7e3cde77be
commit
807bf9da8c
|
@ -77,7 +77,7 @@ export function initAutoPlay(speed: number) {
|
|||
}
|
||||
|
||||
if (bestPartyMemberIndex === -1) {
|
||||
let highestHpValue = 0;
|
||||
let highestHpValue = -1;
|
||||
for (let p = 0; p < party.length; p++) {
|
||||
const pokemon = party[p];
|
||||
if (pokemon.hp > highestHpValue) {
|
||||
|
@ -135,10 +135,10 @@ export function initAutoPlay(speed: number) {
|
|||
console.log('Switching to ', Species[thisArg.getParty()[bestPartyMemberIndex].species.speciesId]);
|
||||
nextPartyMemberIndex = bestPartyMemberIndex;
|
||||
commandUiHandler.setCursor(2);
|
||||
this.processInput(keyCodes.Z);
|
||||
thisArg.time.delayedCall(20, () => this.processInput(keyCodes.Z));
|
||||
} else {
|
||||
commandUiHandler.setCursor(0);
|
||||
this.processInput(keyCodes.Z);
|
||||
thisArg.time.delayedCall(20, () => this.processInput(keyCodes.Z));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -150,7 +150,7 @@ export function initAutoPlay(speed: number) {
|
|||
thisArg.time.delayedCall(20, () => {
|
||||
const nextMove = playerPokemon.getNextMove() as PokemonMove;
|
||||
fightUiHandler.setCursor(playerPokemon.moveset.indexOf(nextMove));
|
||||
this.processInput(keyCodes.Z);
|
||||
thisArg.time.delayedCall(20, () => this.processInput(keyCodes.Z));
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -174,7 +174,7 @@ export function initAutoPlay(speed: number) {
|
|||
if (bestPartyMemberIndex)
|
||||
nextPartyMemberIndex = bestPartyMemberIndex;
|
||||
switchCheckUiHandler.setCursor(bestPartyMemberIndex ? 1 : 0);
|
||||
this.processInput(keyCodes.Z);
|
||||
thisArg.time.delayedCall(20, () => this.processInput(keyCodes.Z));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ export function initAutoPlay(speed: number) {
|
|||
return true;
|
||||
}
|
||||
} else if (criticalHpPartyMemberIndex > -1){
|
||||
nextPartyMemberIndex = faintedPartyMemberIndex;
|
||||
nextPartyMemberIndex = criticalHpPartyMemberIndex;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import { Mode } from './ui/ui';
|
|||
import { Command } from "./ui/command-ui-handler";
|
||||
import { interp } from "./temp_interpreter";
|
||||
import { Stat } from "./pokemon-stat";
|
||||
import { ExpBoosterModifier, getNewModifierType, ModifierType, PokemonBaseStatModifier, PokemonModifierType, regenerateModifierPoolThresholds } from "./modifier";
|
||||
import { ExpBoosterModifier, getNewModifierType, getNewModifierTypes as getModifierTypesForWave, ModifierType, PokemonBaseStatModifier, PokemonModifierType, regenerateModifierPoolThresholds } from "./modifier";
|
||||
import PartyUiHandler from "./ui/party-ui-handler";
|
||||
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getTintColor as getPokeballTintColor, PokeballType } from "./pokeball";
|
||||
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor as getPokeballTintColor, PokeballType } from "./pokeball";
|
||||
import { pokemonLevelMoves } from "./pokemon-level-moves";
|
||||
|
||||
export class BattlePhase {
|
||||
|
@ -339,6 +339,8 @@ abstract class MovePhase extends BattlePhase {
|
|||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
if (!this.canMove()) {
|
||||
this.end();
|
||||
return;
|
||||
|
@ -381,6 +383,8 @@ abstract class MoveEffectPhase extends PokemonPhase {
|
|||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
this.getTargetPokemon().apply(this.getUserPokemon(), this.move, () => this.end());
|
||||
if (this.getTargetPokemon().hp <= 0) {
|
||||
this.scene.pushPhase(new FaintPhase(this.scene, !this.player));
|
||||
|
@ -757,9 +761,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
super.start();
|
||||
|
||||
regenerateModifierPoolThresholds(this.scene.getParty());
|
||||
const types: Array<ModifierType> = [];
|
||||
for (let mt = 0; mt < 3; mt++)
|
||||
types.push(getNewModifierType(this.scene.waveIndex));
|
||||
const types: Array<ModifierType> = getModifierTypesForWave(this.scene.waveIndex, 3);
|
||||
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, types, (cursor: integer) => {
|
||||
if (cursor < 0) {
|
||||
|
|
|
@ -239,17 +239,23 @@ export class PokemonHpRestoreModifier extends ConsumablePokemonModifier {
|
|||
}
|
||||
|
||||
export class ExpBoosterModifier extends Modifier {
|
||||
constructor(type: ModifierType) {
|
||||
private boostMultiplier: integer;
|
||||
|
||||
constructor(type: ModifierType, boostPercent: integer) {
|
||||
super(type);
|
||||
|
||||
this.boostMultiplier = boostPercent * 0.01;
|
||||
}
|
||||
|
||||
add(modifierBar: ModifierBar, modifiers: Modifier[]): boolean {
|
||||
for (let modifier of modifiers) {
|
||||
if (modifier instanceof ExpBoosterModifier) {
|
||||
const expModifier = modifier as ExpBoosterModifier;
|
||||
expModifier.incrementStack();
|
||||
modifierBar.updateModifier(expModifier, modifiers);
|
||||
return true;
|
||||
if (expModifier.boostMultiplier === this.boostMultiplier) {
|
||||
expModifier.incrementStack();
|
||||
modifierBar.updateModifier(expModifier, modifiers);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +263,7 @@ export class ExpBoosterModifier extends Modifier {
|
|||
}
|
||||
|
||||
apply(args: any[]): boolean {
|
||||
(args[0] as Utils.IntegerHolder).value = Math.floor((args[0] as Utils.IntegerHolder).value * (1 + (this.stackCount * 0.25)));
|
||||
(args[0] as Utils.IntegerHolder).value = Math.floor((args[0] as Utils.IntegerHolder).value * (1 + (this.stackCount * (this.boostMultiplier))));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -292,7 +298,8 @@ export enum ModifierTier {
|
|||
COMMON,
|
||||
GREAT,
|
||||
ULTRA,
|
||||
MASTER
|
||||
MASTER,
|
||||
LUXURY
|
||||
};
|
||||
|
||||
export class ModifierType {
|
||||
|
@ -378,6 +385,12 @@ class AllPokemonFullHpRestoreModifierType extends ModifierType {
|
|||
}
|
||||
}
|
||||
|
||||
class ExpBoosterModifierType extends ModifierType {
|
||||
constructor(name: string, boostPercent: integer, iconImage?: string) {
|
||||
super(name, `Increases gain of EXP. Points by ${boostPercent}%`, () => new ExpBoosterModifier(this, boostPercent), iconImage);
|
||||
}
|
||||
}
|
||||
|
||||
class WeightedModifierType {
|
||||
public modifierType: ModifierType;
|
||||
public weight: integer | Function;
|
||||
|
@ -428,12 +441,15 @@ const modifierPool = {
|
|||
const thresholdPartyMemberCount = party.filter(p => p.getHpRatio() <= 0.5).length;
|
||||
return Math.ceil(thresholdPartyMemberCount / 3);
|
||||
}),
|
||||
new ModifierType('LUCKY EGG', 'Increases gain of EXP. Points by 25%', (type, _args) => new ExpBoosterModifier(type))
|
||||
new ExpBoosterModifierType('LUCKY EGG', 25)
|
||||
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
|
||||
[ModifierTier.MASTER]: [
|
||||
new AddPokeballModifierType(PokeballType.MASTER_BALL, 1, 'mb'),
|
||||
new WeightedModifierType(new ModifierType('SHINY CHARM', 'Dramatically increases the chance of a wild POkéMON being shiny', (type, _args) => new ShinyRateBoosterModifier(type)), 2)
|
||||
].map(m => { m.setTier(ModifierTier.MASTER); return m; })
|
||||
].map(m => { m.setTier(ModifierTier.MASTER); return m; }),
|
||||
[ModifierTier.LUXURY]: [
|
||||
new ExpBoosterModifierType('GOLDEN EGG', 100)
|
||||
].map(m => { m.setTier(ModifierTier.LUXURY); return m; }),
|
||||
};
|
||||
|
||||
let modifierPoolThresholds = {};
|
||||
|
@ -467,7 +483,16 @@ export function regenerateModifierPoolThresholds(party: Array<PlayerPokemon>) {
|
|||
console.log(modifierPoolThresholds)
|
||||
}
|
||||
|
||||
export function getNewModifierType(): ModifierType {
|
||||
export function getNewModifierTypes(waveIndex: integer, count: integer): Array<ModifierType> {
|
||||
if (waveIndex % 10 === 0)
|
||||
return modifierPool[ModifierTier.LUXURY];
|
||||
const ret = [];
|
||||
for (let m = 0; m < count; m++)
|
||||
ret.push(getNewModifierType());
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getNewModifierType() {
|
||||
const tierValue = Utils.randInt(256);
|
||||
const tier = tierValue >= 52 ? ModifierTier.COMMON : tierValue >= 8 ? ModifierTier.GREAT : tierValue >= 1 ? ModifierTier.ULTRA : ModifierTier.MASTER;
|
||||
const thresholds = Object.keys(modifierPoolThresholds[tier]);
|
||||
|
|
|
@ -61,7 +61,7 @@ export function getPokeballCatchMultiplier(type: PokeballType): number {
|
|||
}
|
||||
}
|
||||
|
||||
export function getTintColor(type: PokeballType): number {
|
||||
export function getPokeballTintColor(type: PokeballType): number {
|
||||
switch (type) {
|
||||
case PokeballType.POKEBALL:
|
||||
return 0xd52929;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { SwitchPhase, SwitchSummonPhase } from "../battle-phase";
|
||||
import BattleScene from "../battle-scene";
|
||||
import { ModifierTier, ModifierType } from "../modifier";
|
||||
import { getPokeballAtlasKey, PokeballType } from "../pokeball";
|
||||
|
@ -279,7 +278,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
getPbAtlasKey() {
|
||||
return getPokeballAtlasKey(this.modifierType.tier as unknown as PokeballType);
|
||||
return getPokeballAtlasKey(this.modifierType.tier as integer as PokeballType);
|
||||
}
|
||||
|
||||
getTextTint(): integer {
|
||||
|
@ -292,6 +291,8 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||
return 0xf8d038
|
||||
case ModifierTier.MASTER:
|
||||
return 0xe020c0;
|
||||
case ModifierTier.LUXURY:
|
||||
return 0xe64a18;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue