Add Pokerus and give only Golden EXP Charms until wave 40
This commit is contained in:
1 parent
e0acb1e737
commit
0ac853eba2
12 files changed
+204
-30
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import BattleScene, { Button } from "../battle-scene";
|
||||
import PokemonSpecies, { allSpecies } from "../data/pokemon-species";
|
||||
import PokemonSpecies, { allSpecies, getPokemonSpecies } from "../data/pokemon-species";
|
||||
import { Species } from "../data/species";
|
||||
import { TextStyle, addTextObject, getTextColor } from "./text";
|
||||
import { Mode } from "./ui";
|
||||
@@ -21,6 +21,7 @@ export interface Starter {
|
||||
formIndex: integer;
|
||||
female: boolean;
|
||||
abilityIndex: integer;
|
||||
pokerus: boolean;
|
||||
}
|
||||
|
||||
export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
@@ -49,6 +50,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
private speciesLoaded: Map<Species, boolean> = new Map<Species, boolean>();
|
||||
private starterGens: integer[] = [];
|
||||
private starterCursors: integer[] = [];
|
||||
private pokerusGens: integer[] = [];
|
||||
private pokerusCursors: integer[] = [];
|
||||
private starterDetails: [boolean, integer, boolean, integer][] = [];
|
||||
private speciesStarterDexEntry: DexEntryDetails;
|
||||
private speciesStarterDexTree: StarterDexUnlockTree;
|
||||
@@ -60,6 +63,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
private assetLoadCancelled: Utils.BooleanHolder;
|
||||
private cursorObj: Phaser.GameObjects.Image;
|
||||
private starterCursorObjs: Phaser.GameObjects.Image[];
|
||||
private pokerusCursorObjs: Phaser.GameObjects.Image[];
|
||||
private starterIcons: Phaser.GameObjects.Sprite[];
|
||||
private genCursorObj: Phaser.GameObjects.Image;
|
||||
private genCursorHighlightObj: Phaser.GameObjects.Image;
|
||||
@@ -127,6 +131,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
return container;
|
||||
});
|
||||
|
||||
this.pokerusCursorObjs = new Array(3).fill(null).map(() => {
|
||||
const cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor_pokerus');
|
||||
cursorObj.setVisible(false);
|
||||
cursorObj.setOrigin(0, 0);
|
||||
this.starterSelectContainer.add(cursorObj);
|
||||
return cursorObj;
|
||||
});
|
||||
|
||||
this.starterCursorObjs = new Array(3).fill(null).map(() => {
|
||||
const cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor_highlight');
|
||||
cursorObj.setVisible(false);
|
||||
@@ -147,6 +159,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
this.genCursorObj.setVisible(false);
|
||||
this.genCursorObj.setOrigin(0, 0);
|
||||
this.starterSelectContainer.add(this.genCursorObj);
|
||||
|
||||
const starterSpecies: Species[] = [];
|
||||
|
||||
for (let g = 0; g < this.starterSelectGenIconContainers.length; g++) {
|
||||
let s = 0;
|
||||
@@ -157,6 +171,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
break;
|
||||
if (pokemonPrevolutions.hasOwnProperty(species.speciesId) || species.generation !== g + 1)
|
||||
continue;
|
||||
starterSpecies.push(species.speciesId);
|
||||
this.speciesLoaded.set(species.speciesId, false);
|
||||
this.genSpecies[g].push(species);
|
||||
const dexEntry = this.scene.gameData.getDefaultDexEntry(species);
|
||||
@@ -207,6 +222,41 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
this.message.setOrigin(0, 1);
|
||||
this.starterSelectMessageBoxContainer.add(this.message);
|
||||
|
||||
const date = new Date();
|
||||
date.setUTCHours(0, 0, 0, 0);
|
||||
|
||||
this.scene.executeWithSeedOffset(() => {
|
||||
for (let c = 0; c < 3; c++) {
|
||||
let randomSpeciesId: Species;
|
||||
let species: PokemonSpecies;
|
||||
let pokerusCursor: integer;
|
||||
|
||||
const generateSpecies = () => {
|
||||
randomSpeciesId = Phaser.Math.RND.pick(starterSpecies);
|
||||
species = getPokemonSpecies(randomSpeciesId);
|
||||
pokerusCursor = this.genSpecies[species.generation - 1].indexOf(species);
|
||||
};
|
||||
|
||||
let dupe = false;
|
||||
|
||||
do {
|
||||
generateSpecies();
|
||||
|
||||
for (let pc = 0; pc < c; pc++) {
|
||||
if (this.pokerusGens[pc] === species.generation -1 && this.pokerusCursors[pc] === pokerusCursor) {
|
||||
dupe = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (dupe);
|
||||
|
||||
this.pokerusGens.push(species.generation - 1);
|
||||
this.pokerusCursors.push(pokerusCursor);
|
||||
this.pokerusCursorObjs[c].setPosition(148 + 18 * (pokerusCursor % 9), 10 + 18 * Math.floor(pokerusCursor / 9));
|
||||
console.log(species.name);
|
||||
}
|
||||
}, 0, date.getTime().toString());
|
||||
|
||||
this.updateInstructions();
|
||||
}
|
||||
|
||||
@@ -297,12 +347,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
const originalStarterSelectCallback = this.starterSelectCallback;
|
||||
this.starterSelectCallback = null;
|
||||
originalStarterSelectCallback(new Array(3).fill(0).map(function (_, i) {
|
||||
const starterSpecies = thisObj.genSpecies[thisObj.starterGens[i]][thisObj.starterCursors[i]];
|
||||
return {
|
||||
species: thisObj.genSpecies[thisObj.starterGens[i]][thisObj.starterCursors[i]],
|
||||
species: starterSpecies,
|
||||
shiny: thisObj.starterDetails[i][0],
|
||||
formIndex: thisObj.starterDetails[i][1],
|
||||
female: thisObj.starterDetails[i][2],
|
||||
abilityIndex: thisObj.starterDetails[i][3]
|
||||
abilityIndex: thisObj.starterDetails[i][3],
|
||||
pokerus: !![ 0, 1, 2 ].filter(n => thisObj.pokerusGens[n] === starterSpecies.generation - 1 && thisObj.pokerusCursors[n] === thisObj.genSpecies[starterSpecies.generation - 1].indexOf(starterSpecies)).length
|
||||
};
|
||||
}));
|
||||
};
|
||||
@@ -435,6 +487,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
|
||||
for (let s = 0; s < this.starterCursorObjs.length; s++)
|
||||
this.starterCursorObjs[s].setVisible(this.starterGens[s] === cursor);
|
||||
for (let s = 0; s < this.pokerusCursorObjs.length; s++)
|
||||
this.pokerusCursorObjs[s].setVisible(this.pokerusGens[s] === cursor);
|
||||
} else {
|
||||
changed = super.setCursor(cursor);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { getLevelTotalExp } from "../data/exp";
|
||||
import { Stat, getStatName } from "../data/pokemon-stat";
|
||||
import { abilities } from "../data/ability";
|
||||
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
||||
import { StatusEffect } from "../data/status-effect";
|
||||
|
||||
enum Page {
|
||||
PROFILE,
|
||||
@@ -36,6 +37,8 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
private pokeball: Phaser.GameObjects.Sprite;
|
||||
private levelText: Phaser.GameObjects.Text;
|
||||
private genderText: Phaser.GameObjects.Text;
|
||||
private statusContainer: Phaser.GameObjects.Container;
|
||||
private status: Phaser.GameObjects.Image;
|
||||
private summaryPageContainer: Phaser.GameObjects.Container;
|
||||
private movesContainer: Phaser.GameObjects.Container;
|
||||
private moveDescriptionText: Phaser.GameObjects.Text;
|
||||
@@ -56,6 +59,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
private newMove: Move;
|
||||
private moveSelectFunction: Function;
|
||||
private transitioning: boolean;
|
||||
private statusVisible: boolean;
|
||||
private moveEffectsVisible: boolean;
|
||||
|
||||
private moveSelect: boolean;
|
||||
@@ -81,11 +85,15 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
this.tabSprite.setOrigin(1, 1);
|
||||
this.summaryContainer.add(this.tabSprite);
|
||||
|
||||
const summaryLabel = addTextObject(this.scene, 4, -165, 'Pokémon Info', TextStyle.SUMMARY);
|
||||
summaryLabel.setOrigin(0, 1);
|
||||
this.summaryContainer.add(summaryLabel);
|
||||
|
||||
this.shinyOverlay = this.scene.add.image(6, -54, 'summary_overlay_shiny');
|
||||
this.shinyOverlay.setOrigin(0, 1);
|
||||
this.summaryContainer.add(this.shinyOverlay);
|
||||
|
||||
this.numberText = addTextObject(this.scene, 17, -150, '000', TextStyle.SUMMARY);
|
||||
this.numberText = addTextObject(this.scene, 17, -149, '000', TextStyle.SUMMARY);
|
||||
this.numberText.setOrigin(0, 1);
|
||||
this.summaryContainer.add(this.numberText);
|
||||
|
||||
@@ -108,6 +116,25 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
this.genderText.setOrigin(0, 1);
|
||||
this.summaryContainer.add(this.genderText);
|
||||
|
||||
this.statusContainer = this.scene.add.container(-106, -16);
|
||||
|
||||
const statusBg = this.scene.add.image(0, 0, 'summary_status');
|
||||
statusBg.setOrigin(0, 0);
|
||||
|
||||
this.statusContainer.add(statusBg);
|
||||
|
||||
const statusLabel = addTextObject(this.scene, 3, 0, 'Status', TextStyle.SUMMARY);
|
||||
statusLabel.setOrigin(0, 0);
|
||||
|
||||
this.statusContainer.add(statusLabel);
|
||||
|
||||
this.status = this.scene.add.sprite(91, 4, 'statuses');
|
||||
this.status.setOrigin(0.5, 0);
|
||||
|
||||
this.statusContainer.add(this.status);
|
||||
|
||||
this.summaryContainer.add(this.statusContainer);
|
||||
|
||||
this.moveEffectContainer = this.scene.add.container(106, -62);
|
||||
|
||||
this.summaryContainer.add(this.moveEffectContainer);
|
||||
@@ -194,6 +221,14 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
this.showMoveSelect();
|
||||
break;
|
||||
}
|
||||
|
||||
const fromSummary = args.length >= 2;
|
||||
|
||||
if (this.pokemon.status || this.pokemon.pokerus) {
|
||||
this.showStatus(!fromSummary);
|
||||
this.status.setFrame(this.pokemon.status ? StatusEffect[this.pokemon.status.effect].toLowerCase() : 'pokerus');
|
||||
} else
|
||||
this.hideStatus(!fromSummary);
|
||||
}
|
||||
|
||||
processInput(button: Button) {
|
||||
@@ -605,6 +640,30 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
}
|
||||
}
|
||||
|
||||
showStatus(instant?: boolean) {
|
||||
if (this.statusVisible)
|
||||
return;
|
||||
this.statusVisible = true;
|
||||
this.scene.tweens.add({
|
||||
targets: this.statusContainer,
|
||||
x: 0,
|
||||
duration: instant ? 0 : 250,
|
||||
ease: 'Sine.easeOut'
|
||||
});
|
||||
}
|
||||
|
||||
hideStatus(instant?: boolean) {
|
||||
if (!this.statusVisible)
|
||||
return;
|
||||
this.statusVisible = false;
|
||||
this.scene.tweens.add({
|
||||
targets: this.statusContainer,
|
||||
x: -106,
|
||||
duration: instant ? 0 : 250,
|
||||
ease: 'Sine.easeIn'
|
||||
});
|
||||
}
|
||||
|
||||
getSelectedMove(): Move {
|
||||
if (this.cursor !== Page.MOVES)
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user