Add helper functions to game mode
This commit is contained in:
parent
cd7e818a01
commit
aed9b56a7b
|
@ -93,10 +93,8 @@ export default class Battle {
|
|||
|
||||
private initBattleSpec(): void {
|
||||
let spec = BattleSpec.DEFAULT;
|
||||
if (this.gameMode.isClassic) {
|
||||
if (this.waveIndex === 200)
|
||||
spec = BattleSpec.FINAL_BOSS;
|
||||
}
|
||||
if (this.gameMode.isWaveFinal(this.waveIndex) && this.gameMode.isClassic)
|
||||
spec = BattleSpec.FINAL_BOSS;
|
||||
this.battleSpec = spec;
|
||||
}
|
||||
|
||||
|
@ -105,7 +103,7 @@ export default class Battle {
|
|||
let baseLevel = 1 + levelWaveIndex / 2 + Math.pow(levelWaveIndex / 25, 2);
|
||||
const bossMultiplier = 1.2;
|
||||
|
||||
if (!(this.waveIndex % 10)) {
|
||||
if (this.gameMode.isBoss(this.waveIndex)) {
|
||||
const ret = Math.floor(baseLevel * bossMultiplier);
|
||||
if (this.battleSpec === BattleSpec.FINAL_BOSS || !(this.waveIndex % 250))
|
||||
return Math.ceil(ret / 25) * 25;
|
||||
|
|
|
@ -147,8 +147,14 @@ export class GameMode implements GameModeConfig {
|
|||
return null;
|
||||
}
|
||||
|
||||
isWaveFinal(waveIndex: integer): boolean {
|
||||
switch (this.modeId) {
|
||||
/**
|
||||
* Checks if wave provided is the final for current or specified game mode
|
||||
* @param waveIndex
|
||||
* @param modeId game mode
|
||||
* @returns if the current wave is final for classic or daily OR a minor boss in endless
|
||||
*/
|
||||
isWaveFinal(waveIndex: integer, modeId: GameModes = this.modeId): boolean {
|
||||
switch (modeId) {
|
||||
case GameModes.CLASSIC:
|
||||
return waveIndex === 200;
|
||||
case GameModes.ENDLESS:
|
||||
|
@ -159,6 +165,45 @@ export class GameMode implements GameModeConfig {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Every 10 waves is a boss battle
|
||||
* @returns true if waveIndex is a multiple of 10
|
||||
*/
|
||||
isBoss(waveIndex: integer): boolean {
|
||||
return waveIndex % 10 === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Every 50 waves of an Endless mode is a boss
|
||||
* At this time it is paradox pokemon
|
||||
* @returns true if waveIndex is a multiple of 50 in Endless
|
||||
*/
|
||||
isEndlessBoss(waveIndex: integer): boolean {
|
||||
return waveIndex % 50 &&
|
||||
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every 250 waves of an Endless mode is a minor boss
|
||||
* At this time it is Eternatus
|
||||
* @returns true if waveIndex is a multiple of 250 in Endless
|
||||
*/
|
||||
isEndlessMinorBoss(waveIndex: integer): boolean {
|
||||
return waveIndex % 250 === 0 &&
|
||||
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every 1000 waves of an Endless mode is a major boss
|
||||
* At this time it is Eternamax Eternatus
|
||||
* @returns true if waveIndex is a multiple of 1000 in Endless
|
||||
*/
|
||||
isEndlessMajorBoss(waveIndex: integer): boolean {
|
||||
return waveIndex % 1000 === 0 &&
|
||||
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
||||
}
|
||||
|
||||
|
||||
getClearScoreBonus(): integer {
|
||||
switch (this.modeId) {
|
||||
case GameModes.CLASSIC:
|
||||
|
|
Loading…
Reference in New Issue