Add Pokerus and give only Golden EXP Charms until wave 40
parent
e0acb1e737
commit
0ac853eba2
|
@ -4,34 +4,34 @@
|
||||||
"image": "statuses.png",
|
"image": "statuses.png",
|
||||||
"format": "RGBA8888",
|
"format": "RGBA8888",
|
||||||
"size": {
|
"size": {
|
||||||
"w": 20,
|
"w": 22,
|
||||||
"h": 56
|
"h": 64
|
||||||
},
|
},
|
||||||
"scale": 1,
|
"scale": 1,
|
||||||
"frames": [
|
"frames": [
|
||||||
{
|
{
|
||||||
"filename": "burn",
|
"filename": "pokerus",
|
||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
"w": 20,
|
"w": 22,
|
||||||
"h": 8
|
"h": 8
|
||||||
},
|
},
|
||||||
"spriteSourceSize": {
|
"spriteSourceSize": {
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"w": 20,
|
"w": 22,
|
||||||
"h": 8
|
"h": 8
|
||||||
},
|
},
|
||||||
"frame": {
|
"frame": {
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"w": 20,
|
"w": 22,
|
||||||
"h": 8
|
"h": 8
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "faint",
|
"filename": "burn",
|
||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "freeze",
|
"filename": "faint",
|
||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "paralysis",
|
"filename": "freeze",
|
||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "poison",
|
"filename": "paralysis",
|
||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "sleep",
|
"filename": "poison",
|
||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
|
@ -136,7 +136,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "toxic",
|
"filename": "sleep",
|
||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
|
@ -155,6 +155,27 @@
|
||||||
"w": 20,
|
"w": 20,
|
||||||
"h": 8
|
"h": 8
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "toxic",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 20,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 20,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 56,
|
||||||
|
"w": 20,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -162,6 +183,6 @@
|
||||||
"meta": {
|
"meta": {
|
||||||
"app": "https://www.codeandweb.com/texturepacker",
|
"app": "https://www.codeandweb.com/texturepacker",
|
||||||
"version": "3.0",
|
"version": "3.0",
|
||||||
"smartupdate": "$TexturePacker:SmartUpdate:b1f59475db34388a7177fe541f95d9e8:47a06b96ac24cc4249538472b2604202:e6649238c018d3630e55681417c698ca$"
|
"smartupdate": "$TexturePacker:SmartUpdate:37686e85605d17b806f22d43081c1139:70535ffee63ba61b3397d8470c2c8982:e6649238c018d3630e55681417c698ca$"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 441 B |
Binary file not shown.
After Width: | Height: | Size: 191 B |
Binary file not shown.
After Width: | Height: | Size: 103 B |
Binary file not shown.
After Width: | Height: | Size: 183 B |
|
@ -16,7 +16,7 @@ import { EvolutionPhase } from "./evolution-phase";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat";
|
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat";
|
||||||
import { Biome, biomeLinks } from "./data/biome";
|
import { Biome, biomeLinks } from "./data/biome";
|
||||||
import { ModifierPoolType, ModifierType, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, TmModifierType, getPlayerModifierTypeOptionsForWave, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
import { ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, TmModifierType, getPlayerModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
||||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||||
import { BattlerTagLapseType, BattlerTagType, HideSpriteTag as HiddenTag, TrappedTag } from "./data/battler-tag";
|
import { BattlerTagLapseType, BattlerTagType, HideSpriteTag as HiddenTag, TrappedTag } from "./data/battler-tag";
|
||||||
import { getPokemonMessage } from "./messages";
|
import { getPokemonMessage } from "./messages";
|
||||||
|
@ -109,6 +109,8 @@ export class SelectStarterPhase extends BattlePhase {
|
||||||
? !starter.female ? Gender.MALE : Gender.FEMALE
|
? !starter.female ? Gender.MALE : Gender.FEMALE
|
||||||
: Gender.GENDERLESS;
|
: Gender.GENDERLESS;
|
||||||
const starterPokemon = new PlayerPokemon(this.scene, starter.species, startingLevel, starter.abilityIndex, starter.formIndex, starterGender, starter.shiny);
|
const starterPokemon = new PlayerPokemon(this.scene, starter.species, startingLevel, starter.abilityIndex, starter.formIndex, starterGender, starter.shiny);
|
||||||
|
if (starter.pokerus)
|
||||||
|
starterPokemon.pokerus = true;
|
||||||
starterPokemon.setVisible(false);
|
starterPokemon.setVisible(false);
|
||||||
party.push(starterPokemon);
|
party.push(starterPokemon);
|
||||||
loadPokemonAssets.push(starterPokemon.loadAssets());
|
loadPokemonAssets.push(starterPokemon.loadAssets());
|
||||||
|
@ -2036,6 +2038,8 @@ export class VictoryPhase extends PokemonPhase {
|
||||||
expMultiplier += multipleParticipantExpBonusModifier.getStackCount() * 0.2;
|
expMultiplier += multipleParticipantExpBonusModifier.getStackCount() * 0.2;
|
||||||
} else if (expShareModifier)
|
} else if (expShareModifier)
|
||||||
expMultiplier += (expShareModifier.getStackCount() * 0.2) / participantIds.size;
|
expMultiplier += (expShareModifier.getStackCount() * 0.2) / participantIds.size;
|
||||||
|
if (partyMember.pokerus)
|
||||||
|
expMultiplier *= 1.5;
|
||||||
const pokemonExp = new Utils.NumberHolder(expValue * expMultiplier);
|
const pokemonExp = new Utils.NumberHolder(expValue * expMultiplier);
|
||||||
this.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, pokemonExp);
|
this.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, pokemonExp);
|
||||||
partyMemberExp.push(Math.floor(pokemonExp.value));
|
partyMemberExp.push(Math.floor(pokemonExp.value));
|
||||||
|
@ -2078,7 +2082,10 @@ export class VictoryPhase extends PokemonPhase {
|
||||||
if (this.scene.currentBattle.battleType === BattleType.TRAINER)
|
if (this.scene.currentBattle.battleType === BattleType.TRAINER)
|
||||||
this.scene.pushPhase(new TrainerVictoryPhase(this.scene));
|
this.scene.pushPhase(new TrainerVictoryPhase(this.scene));
|
||||||
if (this.scene.gameMode === GameMode.ENDLESS || this.scene.currentBattle.waveIndex < this.scene.finalWave) {
|
if (this.scene.gameMode === GameMode.ENDLESS || this.scene.currentBattle.waveIndex < this.scene.finalWave) {
|
||||||
this.scene.pushPhase(new SelectModifierPhase(this.scene));
|
if (this.scene.currentBattle.waveIndex > 30 || this.scene.currentBattle.waveIndex % 10)
|
||||||
|
this.scene.pushPhase(new SelectModifierPhase(this.scene));
|
||||||
|
else
|
||||||
|
this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.GOLDEN_EXP_CHARM))
|
||||||
this.scene.pushPhase(new NewBattlePhase(this.scene));
|
this.scene.pushPhase(new NewBattlePhase(this.scene));
|
||||||
} else
|
} else
|
||||||
this.scene.pushPhase(new GameOverPhase(this.scene, true));
|
this.scene.pushPhase(new GameOverPhase(this.scene, true));
|
||||||
|
@ -2098,7 +2105,7 @@ export class TrainerVictoryPhase extends BattlePhase {
|
||||||
|
|
||||||
const modifierRewardFuncs = this.scene.currentBattle.trainer.config.modifierRewardFuncs;
|
const modifierRewardFuncs = this.scene.currentBattle.trainer.config.modifierRewardFuncs;
|
||||||
for (let modifierRewardFunc of modifierRewardFuncs)
|
for (let modifierRewardFunc of modifierRewardFuncs)
|
||||||
this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, modifierRewardFunc()));
|
this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, modifierRewardFunc));
|
||||||
|
|
||||||
this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName()}!`, null, () => {
|
this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName()}!`, null, () => {
|
||||||
const defeatMessages = this.scene.currentBattle.trainer.config.victoryMessages;
|
const defeatMessages = this.scene.currentBattle.trainer.config.victoryMessages;
|
||||||
|
@ -2130,10 +2137,12 @@ export class TrainerVictoryPhase extends BattlePhase {
|
||||||
export class ModifierRewardPhase extends BattlePhase {
|
export class ModifierRewardPhase extends BattlePhase {
|
||||||
private modifierType: ModifierType;
|
private modifierType: ModifierType;
|
||||||
|
|
||||||
constructor(scene: BattleScene, modifierType: ModifierType) {
|
constructor(scene: BattleScene, modifierTypeFunc: ModifierTypeFunc) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.modifierType = modifierType;
|
this.modifierType = modifierTypeFunc();
|
||||||
|
if (!this.modifierType.id)
|
||||||
|
this.modifierType.id = Object.keys(modifierTypes).find(k => modifierTypes[k] === modifierTypeFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
|
|
@ -215,6 +215,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.loadImage('summary_bg', 'ui');
|
this.loadImage('summary_bg', 'ui');
|
||||||
this.loadImage('summary_overlay_shiny', 'ui');
|
this.loadImage('summary_overlay_shiny', 'ui');
|
||||||
this.loadImage('summary_profile', 'ui');
|
this.loadImage('summary_profile', 'ui');
|
||||||
|
this.loadImage('summary_status', 'ui');
|
||||||
this.loadImage('summary_stats', 'ui');
|
this.loadImage('summary_stats', 'ui');
|
||||||
this.loadImage('summary_stats_overlay_exp', 'ui');
|
this.loadImage('summary_stats_overlay_exp', 'ui');
|
||||||
this.loadImage('summary_moves', 'ui');
|
this.loadImage('summary_moves', 'ui');
|
||||||
|
@ -232,6 +233,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.loadImage('starter_select_message', 'ui');
|
this.loadImage('starter_select_message', 'ui');
|
||||||
this.loadImage('starter_select_cursor', 'ui');
|
this.loadImage('starter_select_cursor', 'ui');
|
||||||
this.loadImage('starter_select_cursor_highlight', 'ui');
|
this.loadImage('starter_select_cursor_highlight', 'ui');
|
||||||
|
this.loadImage('starter_select_cursor_pokerus', 'ui');
|
||||||
this.loadImage('starter_select_gen_cursor', 'ui');
|
this.loadImage('starter_select_gen_cursor', 'ui');
|
||||||
this.loadImage('starter_select_gen_cursor_highlight', 'ui');
|
this.loadImage('starter_select_gen_cursor_highlight', 'ui');
|
||||||
|
|
||||||
|
@ -649,6 +651,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
const availablePartyMemberCount = this.getParty().filter(p => !p.isFainted()).length;
|
const availablePartyMemberCount = this.getParty().filter(p => !p.isFainted()).length;
|
||||||
if (lastBattle) {
|
if (lastBattle) {
|
||||||
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
|
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
|
||||||
|
this.trySpreadPokerus();
|
||||||
if (showTrainer) {
|
if (showTrainer) {
|
||||||
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
|
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
|
||||||
this.unshiftPhase(new ShowTrainerPhase(this));
|
this.unshiftPhase(new ShowTrainerPhase(this));
|
||||||
|
@ -717,16 +720,43 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
return this.arena;
|
return this.arena;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trySpreadPokerus(): void {
|
||||||
|
const party = this.getParty();
|
||||||
|
const infectedIndexes: integer[] = [];
|
||||||
|
party.forEach((pokemon, p) => {
|
||||||
|
if (!pokemon.pokerus || infectedIndexes.indexOf(p) > -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.executeWithSeedOffset(() => {
|
||||||
|
if (p) {
|
||||||
|
const partyMember = party[p - 1];
|
||||||
|
if (!partyMember.pokerus && !Utils.randSeedInt(10)) {
|
||||||
|
partyMember.pokerus = true;
|
||||||
|
infectedIndexes.push(p - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p < party.length - 1) {
|
||||||
|
const partyMember = party[p + 1];
|
||||||
|
if (!partyMember.pokerus && !Utils.randSeedInt(10)) {
|
||||||
|
partyMember.pokerus = true;
|
||||||
|
infectedIndexes.push(p + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this.currentBattle.waveIndex + (p << 8));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
resetSeed(waveIndex?: integer): void {
|
resetSeed(waveIndex?: integer): void {
|
||||||
this.waveSeed = Utils.shiftCharCodes(this.seed, waveIndex || this.currentBattle.waveIndex);
|
this.waveSeed = Utils.shiftCharCodes(this.seed, waveIndex || this.currentBattle.waveIndex);
|
||||||
Phaser.Math.RND.sow([ this.waveSeed ]);
|
Phaser.Math.RND.sow([ this.waveSeed ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
executeWithSeedOffset(func: Function, offset: integer): void {
|
executeWithSeedOffset(func: Function, offset: integer, seedOverride?: string): void {
|
||||||
if (!func)
|
if (!func)
|
||||||
return;
|
return;
|
||||||
const state = Phaser.Math.RND.state();
|
const state = Phaser.Math.RND.state();
|
||||||
Phaser.Math.RND.sow([ Utils.shiftCharCodes(this.seed, offset) ]);
|
Phaser.Math.RND.sow([ Utils.shiftCharCodes(seedOverride || this.seed, offset) ]);
|
||||||
func();
|
func();
|
||||||
Phaser.Math.RND.state(state);
|
Phaser.Math.RND.state(state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ export class TrainerConfig {
|
||||||
public encounterBgm: string;
|
public encounterBgm: string;
|
||||||
public femaleEncounterBgm: string;
|
public femaleEncounterBgm: string;
|
||||||
public victoryBgm: string;
|
public victoryBgm: string;
|
||||||
public modifierRewardFuncs: (() => ModifierType)[] = [];
|
public modifierRewardFuncs: ModifierTypeFunc[] = [];
|
||||||
public partyTemplates: TrainerPartyTemplate[];
|
public partyTemplates: TrainerPartyTemplate[];
|
||||||
public partyTemplateFunc: PartyTemplateFunc;
|
public partyTemplateFunc: PartyTemplateFunc;
|
||||||
public partyMemberFuncs: PartyMemberFuncs = {};
|
public partyMemberFuncs: PartyMemberFuncs = {};
|
||||||
|
|
|
@ -55,6 +55,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
public moveset: PokemonMove[];
|
public moveset: PokemonMove[];
|
||||||
public status: Status;
|
public status: Status;
|
||||||
public winCount: integer;
|
public winCount: integer;
|
||||||
|
public pokerus: boolean;
|
||||||
|
|
||||||
public summonData: PokemonSummonData;
|
public summonData: PokemonSummonData;
|
||||||
public battleSummonData: PokemonBattleSummonData;
|
public battleSummonData: PokemonBattleSummonData;
|
||||||
|
@ -96,6 +97,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
this.moveset = dataSource.moveset;
|
this.moveset = dataSource.moveset;
|
||||||
this.status = dataSource.status;
|
this.status = dataSource.status;
|
||||||
this.winCount = dataSource.winCount;
|
this.winCount = dataSource.winCount;
|
||||||
|
this.pokerus = !!dataSource.pokerus;
|
||||||
} else {
|
} else {
|
||||||
this.generateAndPopulateMoveset();
|
this.generateAndPopulateMoveset();
|
||||||
|
|
||||||
|
@ -142,6 +144,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.winCount = 0;
|
this.winCount = 0;
|
||||||
|
this.pokerus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!species.isObtainable())
|
if (!species.isObtainable())
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default class PokemonData {
|
||||||
public moveset: PokemonMove[];
|
public moveset: PokemonMove[];
|
||||||
public status: Status;
|
public status: Status;
|
||||||
public winCount: integer;
|
public winCount: integer;
|
||||||
|
public pokerus: boolean;
|
||||||
|
|
||||||
public summonData: PokemonSummonData;
|
public summonData: PokemonSummonData;
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ export default class PokemonData {
|
||||||
this.stats = source.stats;
|
this.stats = source.stats;
|
||||||
this.ivs = source.ivs;
|
this.ivs = source.ivs;
|
||||||
this.winCount = source.winCount;
|
this.winCount = source.winCount;
|
||||||
|
this.pokerus = !!source.pokerus;
|
||||||
|
|
||||||
if (sourcePokemon) {
|
if (sourcePokemon) {
|
||||||
this.moveset = sourcePokemon.moveset;
|
this.moveset = sourcePokemon.moveset;
|
||||||
|
@ -51,11 +53,7 @@ export default class PokemonData {
|
||||||
if (this.player)
|
if (this.player)
|
||||||
this.summonData = sourcePokemon.summonData;
|
this.summonData = sourcePokemon.summonData;
|
||||||
} else {
|
} else {
|
||||||
this.moveset = source.moveset.map((m: any) => {
|
this.moveset = source.moveset.map((m: any) => new PokemonMove(m.moveId, m.ppUsed, m.ppUp));
|
||||||
const move = new PokemonMove(m.moveId, m.ppUsed, m.ppUp);
|
|
||||||
move.disableTurns = m.disableTurns;
|
|
||||||
return move;
|
|
||||||
});
|
|
||||||
this.status = source.status
|
this.status = source.status
|
||||||
? new Status(source.status.effect, source.status.turnCount, source.status.cureTurn)
|
? new Status(source.status.effect, source.status.turnCount, source.status.cureTurn)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import BattleScene, { Button } from "../battle-scene";
|
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 { Species } from "../data/species";
|
||||||
import { TextStyle, addTextObject, getTextColor } from "./text";
|
import { TextStyle, addTextObject, getTextColor } from "./text";
|
||||||
import { Mode } from "./ui";
|
import { Mode } from "./ui";
|
||||||
|
@ -21,6 +21,7 @@ export interface Starter {
|
||||||
formIndex: integer;
|
formIndex: integer;
|
||||||
female: boolean;
|
female: boolean;
|
||||||
abilityIndex: integer;
|
abilityIndex: integer;
|
||||||
|
pokerus: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class StarterSelectUiHandler extends MessageUiHandler {
|
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 speciesLoaded: Map<Species, boolean> = new Map<Species, boolean>();
|
||||||
private starterGens: integer[] = [];
|
private starterGens: integer[] = [];
|
||||||
private starterCursors: integer[] = [];
|
private starterCursors: integer[] = [];
|
||||||
|
private pokerusGens: integer[] = [];
|
||||||
|
private pokerusCursors: integer[] = [];
|
||||||
private starterDetails: [boolean, integer, boolean, integer][] = [];
|
private starterDetails: [boolean, integer, boolean, integer][] = [];
|
||||||
private speciesStarterDexEntry: DexEntryDetails;
|
private speciesStarterDexEntry: DexEntryDetails;
|
||||||
private speciesStarterDexTree: StarterDexUnlockTree;
|
private speciesStarterDexTree: StarterDexUnlockTree;
|
||||||
|
@ -60,6 +63,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
private assetLoadCancelled: Utils.BooleanHolder;
|
private assetLoadCancelled: Utils.BooleanHolder;
|
||||||
private cursorObj: Phaser.GameObjects.Image;
|
private cursorObj: Phaser.GameObjects.Image;
|
||||||
private starterCursorObjs: Phaser.GameObjects.Image[];
|
private starterCursorObjs: Phaser.GameObjects.Image[];
|
||||||
|
private pokerusCursorObjs: Phaser.GameObjects.Image[];
|
||||||
private starterIcons: Phaser.GameObjects.Sprite[];
|
private starterIcons: Phaser.GameObjects.Sprite[];
|
||||||
private genCursorObj: Phaser.GameObjects.Image;
|
private genCursorObj: Phaser.GameObjects.Image;
|
||||||
private genCursorHighlightObj: Phaser.GameObjects.Image;
|
private genCursorHighlightObj: Phaser.GameObjects.Image;
|
||||||
|
@ -127,6 +131,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
return container;
|
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(() => {
|
this.starterCursorObjs = new Array(3).fill(null).map(() => {
|
||||||
const cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor_highlight');
|
const cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor_highlight');
|
||||||
cursorObj.setVisible(false);
|
cursorObj.setVisible(false);
|
||||||
|
@ -147,6 +159,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
this.genCursorObj.setVisible(false);
|
this.genCursorObj.setVisible(false);
|
||||||
this.genCursorObj.setOrigin(0, 0);
|
this.genCursorObj.setOrigin(0, 0);
|
||||||
this.starterSelectContainer.add(this.genCursorObj);
|
this.starterSelectContainer.add(this.genCursorObj);
|
||||||
|
|
||||||
|
const starterSpecies: Species[] = [];
|
||||||
|
|
||||||
for (let g = 0; g < this.starterSelectGenIconContainers.length; g++) {
|
for (let g = 0; g < this.starterSelectGenIconContainers.length; g++) {
|
||||||
let s = 0;
|
let s = 0;
|
||||||
|
@ -157,6 +171,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
break;
|
break;
|
||||||
if (pokemonPrevolutions.hasOwnProperty(species.speciesId) || species.generation !== g + 1)
|
if (pokemonPrevolutions.hasOwnProperty(species.speciesId) || species.generation !== g + 1)
|
||||||
continue;
|
continue;
|
||||||
|
starterSpecies.push(species.speciesId);
|
||||||
this.speciesLoaded.set(species.speciesId, false);
|
this.speciesLoaded.set(species.speciesId, false);
|
||||||
this.genSpecies[g].push(species);
|
this.genSpecies[g].push(species);
|
||||||
const dexEntry = this.scene.gameData.getDefaultDexEntry(species);
|
const dexEntry = this.scene.gameData.getDefaultDexEntry(species);
|
||||||
|
@ -207,6 +222,41 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
this.message.setOrigin(0, 1);
|
this.message.setOrigin(0, 1);
|
||||||
this.starterSelectMessageBoxContainer.add(this.message);
|
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();
|
this.updateInstructions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,12 +347,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
const originalStarterSelectCallback = this.starterSelectCallback;
|
const originalStarterSelectCallback = this.starterSelectCallback;
|
||||||
this.starterSelectCallback = null;
|
this.starterSelectCallback = null;
|
||||||
originalStarterSelectCallback(new Array(3).fill(0).map(function (_, i) {
|
originalStarterSelectCallback(new Array(3).fill(0).map(function (_, i) {
|
||||||
|
const starterSpecies = thisObj.genSpecies[thisObj.starterGens[i]][thisObj.starterCursors[i]];
|
||||||
return {
|
return {
|
||||||
species: thisObj.genSpecies[thisObj.starterGens[i]][thisObj.starterCursors[i]],
|
species: starterSpecies,
|
||||||
shiny: thisObj.starterDetails[i][0],
|
shiny: thisObj.starterDetails[i][0],
|
||||||
formIndex: thisObj.starterDetails[i][1],
|
formIndex: thisObj.starterDetails[i][1],
|
||||||
female: thisObj.starterDetails[i][2],
|
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++)
|
for (let s = 0; s < this.starterCursorObjs.length; s++)
|
||||||
this.starterCursorObjs[s].setVisible(this.starterGens[s] === cursor);
|
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 {
|
} else {
|
||||||
changed = super.setCursor(cursor);
|
changed = super.setCursor(cursor);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { getLevelTotalExp } from "../data/exp";
|
||||||
import { Stat, getStatName } from "../data/pokemon-stat";
|
import { Stat, getStatName } from "../data/pokemon-stat";
|
||||||
import { abilities } from "../data/ability";
|
import { abilities } from "../data/ability";
|
||||||
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
||||||
|
import { StatusEffect } from "../data/status-effect";
|
||||||
|
|
||||||
enum Page {
|
enum Page {
|
||||||
PROFILE,
|
PROFILE,
|
||||||
|
@ -36,6 +37,8 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
private pokeball: Phaser.GameObjects.Sprite;
|
private pokeball: Phaser.GameObjects.Sprite;
|
||||||
private levelText: Phaser.GameObjects.Text;
|
private levelText: Phaser.GameObjects.Text;
|
||||||
private genderText: Phaser.GameObjects.Text;
|
private genderText: Phaser.GameObjects.Text;
|
||||||
|
private statusContainer: Phaser.GameObjects.Container;
|
||||||
|
private status: Phaser.GameObjects.Image;
|
||||||
private summaryPageContainer: Phaser.GameObjects.Container;
|
private summaryPageContainer: Phaser.GameObjects.Container;
|
||||||
private movesContainer: Phaser.GameObjects.Container;
|
private movesContainer: Phaser.GameObjects.Container;
|
||||||
private moveDescriptionText: Phaser.GameObjects.Text;
|
private moveDescriptionText: Phaser.GameObjects.Text;
|
||||||
|
@ -56,6 +59,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
private newMove: Move;
|
private newMove: Move;
|
||||||
private moveSelectFunction: Function;
|
private moveSelectFunction: Function;
|
||||||
private transitioning: boolean;
|
private transitioning: boolean;
|
||||||
|
private statusVisible: boolean;
|
||||||
private moveEffectsVisible: boolean;
|
private moveEffectsVisible: boolean;
|
||||||
|
|
||||||
private moveSelect: boolean;
|
private moveSelect: boolean;
|
||||||
|
@ -81,11 +85,15 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.tabSprite.setOrigin(1, 1);
|
this.tabSprite.setOrigin(1, 1);
|
||||||
this.summaryContainer.add(this.tabSprite);
|
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 = this.scene.add.image(6, -54, 'summary_overlay_shiny');
|
||||||
this.shinyOverlay.setOrigin(0, 1);
|
this.shinyOverlay.setOrigin(0, 1);
|
||||||
this.summaryContainer.add(this.shinyOverlay);
|
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.numberText.setOrigin(0, 1);
|
||||||
this.summaryContainer.add(this.numberText);
|
this.summaryContainer.add(this.numberText);
|
||||||
|
|
||||||
|
@ -108,6 +116,25 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.genderText.setOrigin(0, 1);
|
this.genderText.setOrigin(0, 1);
|
||||||
this.summaryContainer.add(this.genderText);
|
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.moveEffectContainer = this.scene.add.container(106, -62);
|
||||||
|
|
||||||
this.summaryContainer.add(this.moveEffectContainer);
|
this.summaryContainer.add(this.moveEffectContainer);
|
||||||
|
@ -194,6 +221,14 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.showMoveSelect();
|
this.showMoveSelect();
|
||||||
break;
|
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) {
|
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 {
|
getSelectedMove(): Move {
|
||||||
if (this.cursor !== Page.MOVES)
|
if (this.cursor !== Page.MOVES)
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue