diff --git a/public/images/statuses.json b/public/images/statuses.json new file mode 100644 index 000000000..b893554b1 --- /dev/null +++ b/public/images/statuses.json @@ -0,0 +1,146 @@ +{ + "textures": [ + { + "image": "statuses.png", + "format": "RGBA8888", + "size": { + "w": 44, + "h": 30 + }, + "scale": 1, + "frames": [ + { + "filename": "burn", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 20, + "h": 8 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 20, + "h": 8 + }, + "frame": { + "x": 1, + "y": 1, + "w": 20, + "h": 8 + } + }, + { + "filename": "faint", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 20, + "h": 8 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 20, + "h": 8 + }, + "frame": { + "x": 1, + "y": 11, + "w": 20, + "h": 8 + } + }, + { + "filename": "freeze", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 20, + "h": 8 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 20, + "h": 8 + }, + "frame": { + "x": 1, + "y": 21, + "w": 20, + "h": 8 + } + }, + { + "filename": "paralysis", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 20, + "h": 8 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 20, + "h": 8 + }, + "frame": { + "x": 23, + "y": 1, + "w": 20, + "h": 8 + } + }, + { + "filename": "poison", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 20, + "h": 8 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 20, + "h": 8 + }, + "frame": { + "x": 23, + "y": 11, + "w": 20, + "h": 8 + } + }, + { + "filename": "sleep", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 20, + "h": 8 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 20, + "h": 8 + }, + "frame": { + "x": 23, + "y": 21, + "w": 20, + "h": 8 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:34eb38966145af4ef9cffbaaa8d07ea3:fba056f9a49345436b0820757c78f418:e6649238c018d3630e55681417c698ca$" + } +} diff --git a/public/images/statuses.png b/public/images/statuses.png new file mode 100644 index 000000000..8820b5568 Binary files /dev/null and b/public/images/statuses.png differ diff --git a/public/images/statuses/burn.png b/public/images/statuses/burn.png new file mode 100644 index 000000000..e77cd88af Binary files /dev/null and b/public/images/statuses/burn.png differ diff --git a/public/images/statuses/faint.png b/public/images/statuses/faint.png new file mode 100644 index 000000000..12297bdab Binary files /dev/null and b/public/images/statuses/faint.png differ diff --git a/public/images/statuses/freeze.png b/public/images/statuses/freeze.png new file mode 100644 index 000000000..5f768a5ce Binary files /dev/null and b/public/images/statuses/freeze.png differ diff --git a/public/images/statuses/paralysis.png b/public/images/statuses/paralysis.png new file mode 100644 index 000000000..ceda90717 Binary files /dev/null and b/public/images/statuses/paralysis.png differ diff --git a/public/images/statuses/poison.png b/public/images/statuses/poison.png new file mode 100644 index 000000000..b9ed12adc Binary files /dev/null and b/public/images/statuses/poison.png differ diff --git a/public/images/statuses/sleep.png b/public/images/statuses/sleep.png new file mode 100644 index 000000000..8a54bbab7 Binary files /dev/null and b/public/images/statuses/sleep.png differ diff --git a/public/images/types.json b/public/images/types.json new file mode 100644 index 000000000..c348d426f --- /dev/null +++ b/public/images/types.json @@ -0,0 +1,398 @@ +{ + "textures": [ + { + "image": "types.png", + "format": "RGBA8888", + "size": { + "w": 612, + "h": 16 + }, + "scale": 1, + "frames": [ + { + "filename": "bug", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 1, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "dark", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 35, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "dragon", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 69, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "electric", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 103, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "fighting", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 137, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "fire", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 171, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "flying", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 205, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "ghost", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 239, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "grass", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 273, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "ground", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 307, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "ice", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 341, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "normal", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 375, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "poison", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 409, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "psychic", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 443, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "rock", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 477, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "steel", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 511, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "water", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 545, + "y": 1, + "w": 32, + "h": 14 + } + }, + { + "filename": "unknown", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 32, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 32, + "h": 14 + }, + "frame": { + "x": 579, + "y": 1, + "w": 32, + "h": 14 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:487be8bed12f0ec062283a698524f491:d47bd2a8523f360e898c134601ed66bd:5961efbfbf4c56b8745347e7a663a32f$" + } +} diff --git a/public/images/types.png b/public/images/types.png new file mode 100644 index 000000000..fa705e341 Binary files /dev/null and b/public/images/types.png differ diff --git a/public/images/types/bug.png b/public/images/types/bug.png new file mode 100644 index 000000000..72681086e Binary files /dev/null and b/public/images/types/bug.png differ diff --git a/public/images/types/dark.png b/public/images/types/dark.png new file mode 100644 index 000000000..6605a95bb Binary files /dev/null and b/public/images/types/dark.png differ diff --git a/public/images/types/dragon.png b/public/images/types/dragon.png new file mode 100644 index 000000000..3554bc8bd Binary files /dev/null and b/public/images/types/dragon.png differ diff --git a/public/images/types/electric.png b/public/images/types/electric.png new file mode 100644 index 000000000..ea5008652 Binary files /dev/null and b/public/images/types/electric.png differ diff --git a/public/images/types/fighting.png b/public/images/types/fighting.png new file mode 100644 index 000000000..0fd87f3db Binary files /dev/null and b/public/images/types/fighting.png differ diff --git a/public/images/types/fire.png b/public/images/types/fire.png new file mode 100644 index 000000000..08a550fca Binary files /dev/null and b/public/images/types/fire.png differ diff --git a/public/images/types/flying.png b/public/images/types/flying.png new file mode 100644 index 000000000..3a13e0512 Binary files /dev/null and b/public/images/types/flying.png differ diff --git a/public/images/types/ghost.png b/public/images/types/ghost.png new file mode 100644 index 000000000..f32896bed Binary files /dev/null and b/public/images/types/ghost.png differ diff --git a/public/images/types/grass.png b/public/images/types/grass.png new file mode 100644 index 000000000..35dfecfc2 Binary files /dev/null and b/public/images/types/grass.png differ diff --git a/public/images/types/ground.png b/public/images/types/ground.png new file mode 100644 index 000000000..0df975559 Binary files /dev/null and b/public/images/types/ground.png differ diff --git a/public/images/types/ice.png b/public/images/types/ice.png new file mode 100644 index 000000000..57ea33f9b Binary files /dev/null and b/public/images/types/ice.png differ diff --git a/public/images/types/normal.png b/public/images/types/normal.png new file mode 100644 index 000000000..92524168f Binary files /dev/null and b/public/images/types/normal.png differ diff --git a/public/images/types/poison.png b/public/images/types/poison.png new file mode 100644 index 000000000..c898b4d14 Binary files /dev/null and b/public/images/types/poison.png differ diff --git a/public/images/types/psychic.png b/public/images/types/psychic.png new file mode 100644 index 000000000..ff55bc54a Binary files /dev/null and b/public/images/types/psychic.png differ diff --git a/public/images/types/rock.png b/public/images/types/rock.png new file mode 100644 index 000000000..0a90b780a Binary files /dev/null and b/public/images/types/rock.png differ diff --git a/public/images/types/steel.png b/public/images/types/steel.png new file mode 100644 index 000000000..34e2ad73d Binary files /dev/null and b/public/images/types/steel.png differ diff --git a/public/images/types/unknown.png b/public/images/types/unknown.png new file mode 100644 index 000000000..607111ade Binary files /dev/null and b/public/images/types/unknown.png differ diff --git a/public/images/types/water.png b/public/images/types/water.png new file mode 100644 index 000000000..eb618008d Binary files /dev/null and b/public/images/types/water.png differ diff --git a/src/battle-phase.ts b/src/battle-phase.ts index 162d89460..ce1a7db06 100644 --- a/src/battle-phase.ts +++ b/src/battle-phase.ts @@ -449,6 +449,7 @@ abstract class MovePhase extends BattlePhase { if (!this.move) console.log(this.pokemon.moveset); this.scene.ui.showText(`${this.pokemon.name} used\n${this.move.getName()}!`, null, () => this.end(), 500); + this.move.ppUsed++; if (this.move.getMove().category !== MOVE_CATEGORY.STATUS) this.scene.unshiftPhase(this.getEffectPhase()); } @@ -863,10 +864,13 @@ export class AttemptCapturePhase extends BattlePhase { this.scene.unshiftPhase(new VictoryPhase(this.scene)); this.scene.ui.showText(`${pokemon.name} was caught!`, null, () => { pokemon.hideInfo(); - pokemon.addToParty(); + const newPokemon = pokemon.addToParty(); this.scene.field.remove(pokemon, true); - this.removePb(); - this.end(); + newPokemon.loadAssets().then(() => { + this.removePb(); + this.end(); + }); + this.scene.load.start(); }, 0, true); } @@ -893,7 +897,7 @@ export class SelectModifierPhase extends BattlePhase { regenerateModifierPoolThresholds(this.scene.getParty()); const modifierCount = new Utils.IntegerHolder(3); this.scene.applyModifiers(ExtraModifierModifier, modifierCount); - const types: Array = getModifierTypesForWave(this.scene.currentBattle.waveIndex, modifierCount.value); + const types: Array = getModifierTypesForWave(this.scene.currentBattle.waveIndex - 1, modifierCount.value); this.scene.ui.setMode(Mode.MODIFIER_SELECT, types, (cursor: integer) => { if (cursor < 0) { diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 3481e77ad..f0efa7566 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -5,7 +5,7 @@ import { BattlePhase, EncounterPhase, SummonPhase, CommandPhase, NextEncounterPh import { PlayerPokemon, EnemyPokemon } from './pokemon'; import PokemonSpecies, { allSpecies, getPokemonSpecies } from './pokemon-species'; import * as Utils from './utils'; -import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonModifier } from './modifier'; +import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonModifier, ExpBoosterModifier, ExpBoosterModifierType } from './modifier'; import { PokeballType } from './pokeball'; import { Species } from './species'; import { initAutoPlay } from './auto-play'; @@ -138,6 +138,8 @@ export default class BattleScene extends Phaser.Scene { this.loadAtlas('pb', ''); this.loadAtlas('items', ''); + this.loadAtlas('types', ''); + this.loadAtlas('statuses', ''); for (let i = 0; i < 6; i++) this.loadAtlas(`pokemon_icons_${i}`, 'ui'); @@ -351,7 +353,7 @@ export default class BattleScene extends Phaser.Scene { if (this.bgm && this.bgm.isPlaying) this.bgm.stop(); this.bgm = this.sound.add(bgmName, { loop: true }); - this.bgm.play(); + //this.bgm.play(); } pauseBgm(): void { diff --git a/src/biome.ts b/src/biome.ts index a862dd484..2dbbf3281 100644 --- a/src/biome.ts +++ b/src/biome.ts @@ -121,10 +121,6 @@ export class BiomeArena { } fadeOutBgm(duration: integer) { - console.log(this.scene) - console.log(this.bgm) - console.log(this.scene.sound.get(this.bgm)) - console.log(duration) SoundFade.fadeOut(this.scene, this.scene.sound.get(this.bgm), duration); } } @@ -564,8 +560,14 @@ const biomePools = { { 1: [ Species.PHANPY ], 25: [ Species.DONPHAN ] }, { 1: [ Species.DRILBUR ], 31: [ Species.EXCADRILL ] } ], - [PoolTier.UNCOMMON]: [ Species.ONIX, { 1: [ Species.CUBONE ], 28: [ Species.MAROWAK ] }, Species.GLIGAR, { 1: [ Species.NUMEL ], 33: [ Species.CAMERUPT ] }, { 1: [ Species.ROGGENROLA ], 25: [ Species.BOLDORE ] } ], - [PoolTier.RARE]: [ Species.TORKOAL ], + [PoolTier.UNCOMMON]: [ + { 1: [ Species.SANDSHREW ], 22: [ Species.SANDSLASH ] }, + { 1: [ Species.CUBONE ], 28: [ Species.MAROWAK ] }, + Species.GLIGAR, + { 1: [ Species.NUMEL ], 33: [ Species.CAMERUPT ] }, + { 1: [ Species.ROGGENROLA ], 25: [ Species.BOLDORE ] } + ], + [PoolTier.RARE]: [ Species.ONIX ], [PoolTier.SUPER_RARE]: [], [PoolTier.ULTRA_RARE]: [ Species.TERRAKION, Species.LANDORUS ], [PoolTier.BOSS]: [ Species.DUGTRIO, Species.GOLEM, Species.MAROWAK, Species.DONPHAN, Species.RHYPERIOR, Species.GLISCOR, Species.EXCADRILL ], @@ -644,8 +646,8 @@ const biomePools = { { 1: [ Species.ELECTRIKE ], 26: [ Species.MANECTRIC ] }, { 1: [ Species.SHINX ], 15: [ Species.LUXIO ], 30: [ Species.LUXRAY ] } ], - [PoolTier.UNCOMMON]: [ Species.PLUSLE, Species.MINUN, Species.PACHIRISU, Species.EMOLGA ], - [PoolTier.RARE]: [ Species.ELECTABUZZ ], + [PoolTier.UNCOMMON]: [ Species.ELECTABUZZ, Species.PLUSLE, Species.MINUN, Species.PACHIRISU, Species.EMOLGA ], + [PoolTier.RARE]: [], [PoolTier.SUPER_RARE]: [ Species.JOLTEON ], [PoolTier.ULTRA_RARE]: [ Species.RAIKOU, Species.ROTOM, Species.THUNDURUS ], [PoolTier.BOSS]: [ Species.RAICHU, Species.MANECTRIC, Species.LUXRAY, Species.MAGNEZONE, Species.ELECTIVIRE ], @@ -654,11 +656,10 @@ const biomePools = { [PoolTier.BOSS_ULTRA_RARE]: [ Species.ZEKROM ] }, [Biome.VOLCANO]: { - [PoolTier.COMMON]: [ Species.VULPIX, { 1: [ Species.PONYTA ], 40: [ Species.RAPIDASH ] }, { 1: [ Species.SLUGMA ], 38: [ Species.MAGCARGO ] }, { 1: [ Species.NUMEL ], 33: [ Species.CAMERUPT ] } ], - [PoolTier.UNCOMMON]: [ Species.GROWLITHE, Species.TORKOAL, { 1: [ Species.PANSEAR ], 20: [ Species.SIMISEAR ] }, Species.HEATMOR ], + [PoolTier.COMMON]: [ Species.VULPIX, Species.GROWLITHE, { 1: [ Species.PONYTA ], 40: [ Species.RAPIDASH ] }, { 1: [ Species.SLUGMA ], 38: [ Species.MAGCARGO ] }, { 1: [ Species.NUMEL ], 33: [ Species.CAMERUPT ] } ], + [PoolTier.UNCOMMON]: [ Species.MAGMAR, Species.TORKOAL, { 1: [ Species.PANSEAR ], 20: [ Species.SIMISEAR ] }, Species.HEATMOR ], [PoolTier.RARE]: [ { 1: [ Species.CHARMANDER ], 16: [ Species.CHARMELEON ], 36: [ Species.CHARIZARD ] }, - Species.MAGMAR, { 1: [ Species.CYNDAQUIL ], 14: [ Species.QUILAVA ], 36: [ Species.TYPHLOSION ] }, { 1: [ Species.TORCHIC ], 16: [ Species.COMBUSKEN ], 36: [ Species.BLAZIKEN ] }, { 1: [ Species.CHIMCHAR ], 14: [ Species.MONFERNO ], 36: [ Species.INFERNAPE ] }, @@ -699,17 +700,15 @@ const biomePools = { { 1: [ Species.MACHOP ], 28: [ Species.MACHOKE ] }, { 1: [ Species.MAKUHITA ], 24: [ Species.HARIYAMA ] }, { 1: [ Species.MEDITITE ], 37: [ Species.MEDICHAM ] }, - { 1: [ Species.TIMBURR ], 25: [ Species.GURDURR ] }, - { 1: [ Species.SCRAGGY ], 39: [ Species.SCRAFTY ] }, - { 1: [ Species.MIENFOO ], 50: [ Species.MIENSHAO ] } + { 1: [ Species.TIMBURR ], 25: [ Species.GURDURR ] } ], - [PoolTier.UNCOMMON]: [ { 1: [ Species.CROAGUNK ], 37: [ Species.TOXICROAK ] } ], - [PoolTier.RARE]: [ { 1: [ Species.TYROGUE ], 20: [ Species.HITMONLEE ] }, Species.HITMONCHAN, Species.LUCARIO, Species.THROH, Species.SAWK ], + [PoolTier.UNCOMMON]: [ { 1: [ Species.CROAGUNK ], 37: [ Species.TOXICROAK ] }, { 1: [ Species.SCRAGGY ], 39: [ Species.SCRAFTY ] }, { 1: [ Species.MIENFOO ], 50: [ Species.MIENSHAO ] } ], + [PoolTier.RARE]: [ { 1: [ Species.TYROGUE ], 20: [ Species.HITMONLEE, Species.HITMONCHAN ] }, Species.LUCARIO, Species.THROH, Species.SAWK ], [PoolTier.SUPER_RARE]: [ Species.HITMONTOP, Species.GALLADE ], - [PoolTier.ULTRA_RARE]: [], + [PoolTier.ULTRA_RARE]: [ Species.COBALION, Species.TERRAKION, Species.VIRIZION, Species.KELDEO ], [PoolTier.BOSS]: [ Species.PRIMEAPE, Species.MACHAMP, Species.HITMONLEE, Species.HITMONCHAN, Species.HARIYAMA, Species.MEDICHAM, Species.LUCARIO, Species.TOXICROAK, Species.CONKELDURR, Species.THROH, Species.SAWK, Species.SCRAFTY, Species.MIENSHAO ], [PoolTier.BOSS_RARE]: [ Species.HITMONTOP, Species.GALLADE ], - [PoolTier.BOSS_SUPER_RARE]: [], + [PoolTier.BOSS_SUPER_RARE]: [ Species.COBALION, Species.TERRAKION, Species.VIRIZION, Species.KELDEO ], [PoolTier.BOSS_ULTRA_RARE]: [] }, [Biome.RUINS]: { @@ -743,24 +742,23 @@ const biomePools = { { 1: [ Species.VIBRAVA ], 45: [ Species.FLYGON ] }, { 1: [ Species.BAGON ], 30: [ Species.SHELGON ], 50: [ Species.SALAMENCE ] }, { 1: [ Species.GIBLE ], 24: [ Species.GABITE ], 48: [ Species.GARCHOMP ] }, - { 1: [ Species.AXEW ], 38: [ Species.FRAXURE ] }, - { 1: [ Species.DEINO ], 50: [ Species.ZWEILOUS ], 64: [ Species.HYDREIGON ] } + { 1: [ Species.AXEW ], 38: [ Species.FRAXURE ] } ], - [PoolTier.RARE]: [ { 1: [ Species.DRATINI ], 30: [ Species.DRAGONAIR ], 55: [ Species.DRAGONITE ] }, Species.DRUDDIGON ], - [PoolTier.SUPER_RARE]: [ Species.AERODACTYL ], + [PoolTier.RARE]: [ { 1: [ Species.DRATINI ], 30: [ Species.DRAGONAIR ], 55: [ Species.DRAGONITE ] }, { 1: [ Species.DEINO ], 50: [ Species.ZWEILOUS ], 64: [ Species.HYDREIGON ] } ], + [PoolTier.SUPER_RARE]: [ Species.AERODACTYL, Species.DRUDDIGON ], [PoolTier.ULTRA_RARE]: [], - [PoolTier.BOSS]: [ Species.DRAGONITE, Species.TYRANITAR, Species.FLYGON, Species.ALTARIA, Species.SALAMENCE, Species.GARCHOMP, Species.HAXORUS, Species.DRUDDIGON, Species.HYDREIGON ], - [PoolTier.BOSS_RARE]: [ Species.AERODACTYL ], + [PoolTier.BOSS]: [ Species.DRAGONITE, Species.TYRANITAR, Species.FLYGON, Species.ALTARIA, Species.SALAMENCE, Species.GARCHOMP, Species.HAXORUS ], + [PoolTier.BOSS_RARE]: [ Species.AERODACTYL, Species.DRUDDIGON ], [PoolTier.BOSS_SUPER_RARE]: [], [PoolTier.BOSS_ULTRA_RARE]: [ Species.DIALGA ] }, [Biome.ABYSS]: { [PoolTier.COMMON]: [ { 1: [ Species.HOUNDOUR ], 24: [ Species.HOUNDOOM ] }, { 1: [ Species.POOCHYENA ], 18: [ Species.MIGHTYENA ] }, Species.SABLEYE, { 1: [ Species.PURRLOIN ], 20: [ Species.LIEPARD ] } ], - [PoolTier.UNCOMMON]: [ Species.MURKROW, { 1: [ Species.PAWNIARD ], 52: [ Species.BISHARP ] } ], + [PoolTier.UNCOMMON]: [ Species.MURKROW, { 1: [ Species.PAWNIARD ], 52: [ Species.BISHARP ] }, { 1: [ Species.DEINO ], 50: [ Species.ZWEILOUS ], 64: [ Species.HYDREIGON ] } ], [PoolTier.RARE]: [ Species.ABSOL, Species.SPIRITOMB, { 1: [ Species.ZORUA ], 30: [ Species.ZOROARK ] } ], [PoolTier.SUPER_RARE]: [ Species.UMBREON ], [PoolTier.ULTRA_RARE]: [ Species.DARKRAI ], - [PoolTier.BOSS]: [ Species.HOUNDOOM, Species.MIGHTYENA, Species.SABLEYE, Species.ABSOL, Species.HONCHKROW, Species.SPIRITOMB, Species.LIEPARD, Species.ZOROARK, Species.BISHARP ], + [PoolTier.BOSS]: [ Species.HOUNDOOM, Species.MIGHTYENA, Species.SABLEYE, Species.ABSOL, Species.HONCHKROW, Species.SPIRITOMB, Species.LIEPARD, Species.ZOROARK, Species.BISHARP, Species.HYDREIGON ], [PoolTier.BOSS_RARE]: [ Species.UMBREON ], [PoolTier.BOSS_SUPER_RARE]: [ Species.DARKRAI ], [PoolTier.BOSS_ULTRA_RARE]: [ Species.PALKIA ] @@ -918,10 +916,12 @@ const biomePools = { ] ], [ Species.SANDSHREW, Type.GROUND, -1, [ + [ Biome.LAND, PoolTier.UNCOMMON ], [ Biome.DESERT, PoolTier.COMMON ] ] ], [ Species.SANDSLASH, Type.GROUND, -1, [ + [ Biome.LAND, PoolTier.UNCOMMON ], [ Biome.DESERT, PoolTier.COMMON ], [ Biome.DESERT, PoolTier.BOSS ] ] @@ -1073,7 +1073,7 @@ const biomePools = { ], [ Species.GROWLITHE, Type.FIRE, -1, [ [ Biome.GRASS, PoolTier.RARE ], - [ Biome.VOLCANO, PoolTier.UNCOMMON ] + [ Biome.VOLCANO, PoolTier.COMMON ] ] ], [ Species.ARCANINE, Type.FIRE, -1, [ @@ -1248,7 +1248,7 @@ const biomePools = { ] ], [ Species.ONIX, Type.ROCK, Type.GROUND, [ - [ Biome.LAND, PoolTier.UNCOMMON ], + [ Biome.LAND, PoolTier.RARE ], [ Biome.CAVE, PoolTier.RARE ], [ Biome.CAVE, PoolTier.BOSS ] ] @@ -1397,11 +1397,11 @@ const biomePools = { ] ], [ Species.ELECTABUZZ, Type.ELECTRIC, -1, [ - [ Biome.POWER_PLANT, PoolTier.RARE ] + [ Biome.POWER_PLANT, PoolTier.UNCOMMON ] ] ], [ Species.MAGMAR, Type.FIRE, -1, [ - [ Biome.VOLCANO, PoolTier.RARE ] + [ Biome.VOLCANO, PoolTier.UNCOMMON ] ] ], [ Species.PINSIR, Type.BUG, -1, [ @@ -2338,7 +2338,6 @@ const biomePools = { ] ], [ Species.TORKOAL, Type.FIRE, -1, [ - [ Biome.LAND, PoolTier.RARE ], [ Biome.VOLCANO, PoolTier.UNCOMMON ], [ Biome.VOLCANO, PoolTier.BOSS ] ] @@ -3443,11 +3442,11 @@ const biomePools = { ] ], [ Species.SCRAGGY, Type.DARK, Type.FIGHTING, [ - [ Biome.DOJO, PoolTier.COMMON ] + [ Biome.DOJO, PoolTier.UNCOMMON ] ] ], [ Species.SCRAFTY, Type.DARK, Type.FIGHTING, [ - [ Biome.DOJO, PoolTier.COMMON ], + [ Biome.DOJO, PoolTier.UNCOMMON ], [ Biome.DOJO, PoolTier.BOSS ] ] ], @@ -3724,17 +3723,17 @@ const biomePools = { ] ], [ Species.MIENFOO, Type.FIGHTING, -1, [ - [ Biome.DOJO, PoolTier.COMMON ] + [ Biome.DOJO, PoolTier.UNCOMMON ] ] ], [ Species.MIENSHAO, Type.FIGHTING, -1, [ - [ Biome.DOJO, PoolTier.COMMON ], + [ Biome.DOJO, PoolTier.UNCOMMON ], [ Biome.DOJO, PoolTier.BOSS ] ] ], [ Species.DRUDDIGON, Type.DRAGON, -1, [ - [ Biome.WASTELAND, PoolTier.RARE ], - [ Biome.WASTELAND, PoolTier.BOSS ] + [ Biome.WASTELAND, PoolTier.SUPER_RARE ], + [ Biome.WASTELAND, PoolTier.BOSS_RARE ] ] ], [ Species.GOLETT, Type.GROUND, Type.GHOST, [ @@ -3790,16 +3789,19 @@ const biomePools = { ] ], [ Species.DEINO, Type.DARK, Type.DRAGON, [ - [ Biome.WASTELAND, PoolTier.UNCOMMON ] + [ Biome.WASTELAND, PoolTier.RARE ], + [ Biome.ABYSS, PoolTier.UNCOMMON ] ] ], [ Species.ZWEILOUS, Type.DARK, Type.DRAGON, [ - [ Biome.WASTELAND, PoolTier.UNCOMMON ] + [ Biome.WASTELAND, PoolTier.RARE ], + [ Biome.ABYSS, PoolTier.UNCOMMON ] ] ], [ Species.HYDREIGON, Type.DARK, Type.DRAGON, [ - [ Biome.WASTELAND, PoolTier.UNCOMMON ], - [ Biome.WASTELAND, PoolTier.BOSS ] + [ Biome.WASTELAND, PoolTier.RARE ], + [ Biome.ABYSS, PoolTier.UNCOMMON ], + [ Biome.ABYSS, PoolTier.BOSS ] ] ], [ Species.LARVESTA, Type.BUG, Type.FIRE, [ @@ -3813,17 +3815,23 @@ const biomePools = { ], [ Species.COBALION, Type.STEEL, Type.FIGHTING, [ [ Biome.CAVE, PoolTier.ULTRA_RARE ], - [ Biome.CAVE, PoolTier.BOSS_SUPER_RARE ] + [ Biome.CAVE, PoolTier.BOSS_SUPER_RARE ], + [ Biome.DOJO, PoolTier.ULTRA_RARE ], + [ Biome.DOJO, PoolTier.BOSS_SUPER_RARE ] ] ], [ Species.TERRAKION, Type.ROCK, Type.FIGHTING, [ [ Biome.LAND, PoolTier.ULTRA_RARE ], - [ Biome.LAND, PoolTier.BOSS_SUPER_RARE ] + [ Biome.LAND, PoolTier.BOSS_SUPER_RARE ], + [ Biome.DOJO, PoolTier.ULTRA_RARE ], + [ Biome.DOJO, PoolTier.BOSS_SUPER_RARE ] ] ], [ Species.VIRIZION, Type.GRASS, Type.FIGHTING, [ [ Biome.FOREST, PoolTier.ULTRA_RARE ], - [ Biome.FOREST, PoolTier.BOSS_SUPER_RARE ] + [ Biome.FOREST, PoolTier.BOSS_SUPER_RARE ], + [ Biome.DOJO, PoolTier.ULTRA_RARE ], + [ Biome.DOJO, PoolTier.BOSS_SUPER_RARE ] ] ], [ Species.TORNADUS, Type.FLYING, -1, [ @@ -3855,7 +3863,9 @@ const biomePools = { ], [ Species.KELDEO, Type.WATER, Type.FIGHTING, [ [ Biome.SWAMP, PoolTier.ULTRA_RARE ], - [ Biome.SWAMP, PoolTier.BOSS_SUPER_RARE ] + [ Biome.SWAMP, PoolTier.BOSS_SUPER_RARE ], + [ Biome.DOJO, PoolTier.ULTRA_RARE ], + [ Biome.DOJO, PoolTier.BOSS_SUPER_RARE ] ] ], [ Species.MELOETTA, Type.NORMAL, Type.PSYCHIC, [ @@ -3976,7 +3986,7 @@ const biomePools = { console.log(beautify(output, null, 2, 180).replace(/( | (?:\{ "\d+": \[ )?| "(?:.*?)": \[ |, (?:(?:\{ )?"\d+": \[ )?)"(.*?)"/g, '$1Species.$2').replace(/"(\d+)": /g, '$1: ').replace(/( )"(.*?)"/g, '$1[PoolTier.$2]').replace(/( )"(.*?)"/g, '$1[Biome.$2]')); } - //outputPools(); + outputPools(); /*for (let pokemon of allSpecies) { if (pokemon.speciesId >= Species.XERNEAS) diff --git a/src/modifier.ts b/src/modifier.ts index 680bac316..9ae12f0cb 100644 --- a/src/modifier.ts +++ b/src/modifier.ts @@ -88,7 +88,7 @@ export abstract class Modifier { if (this.stackCount <= 1) return null; - const text = addTextObject(scene, 16, 12, this.stackCount.toString(), TextStyle.PARTY, { fontSize: '66px', color: this.stackCount < this.getMaxStackCount() ? '#484848' : '#e64a18' }); + const text = addTextObject(scene, 16, 12, this.stackCount.toString(), TextStyle.PARTY, { fontSize: '66px', color: this.stackCount < this.getMaxStackCount() ? '#f8f8f8' : '#e64a18' }); text.setStroke('#424242', 16) text.setOrigin(1, 0); @@ -424,7 +424,7 @@ class AllPokemonFullReviveModifierType extends AllPokemonFullHpRestoreModifierTy } } -class ExpBoosterModifierType extends ModifierType { +export 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); } diff --git a/src/pokemon.ts b/src/pokemon.ts index e613feec9..81a346082 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -600,10 +600,16 @@ export class EnemyPokemon extends Pokemon { addToParty() { const party = (this.scene as BattleScene).getParty(); + let ret: PlayerPokemon = null; - if (party.length < 6) - party.push(new PlayerPokemon(this.scene as BattleScene, this.species, this.level, this)); + if (party.length < 6) { + const newPokemon = new PlayerPokemon(this.scene as BattleScene, this.species, this.level, this); + party.push(newPokemon); + ret = newPokemon; + } this.hp = 0; + + return ret; } } diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index e1117e004..f96394897 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -1,13 +1,16 @@ import { CommandPhase } from "../battle-phase"; import BattleScene from "../battle-scene"; import { addTextObject, TextStyle } from "../text"; +import { Type } from "../type"; import { Command } from "./command-ui-handler"; -import BattleMessageUiHandler from "./battle-message-ui-handler"; -import UI, { Mode } from "./ui"; +import { Mode } from "./ui"; import UiHandler from "./uiHandler"; +import * as Utils from "../utils"; export default class FightUiHandler extends UiHandler { private movesContainer: Phaser.GameObjects.Container; + private typeIcon: Phaser.GameObjects.Sprite; + private ppText: Phaser.GameObjects.Text; private cursorObj: Phaser.GameObjects.Image; constructor(scene: BattleScene) { @@ -17,10 +20,17 @@ export default class FightUiHandler extends UiHandler { setup() { const ui = this.getUi(); - const movesContainer = this.scene.add.container(18, -38.7); - ui.add(movesContainer); + this.movesContainer = this.scene.add.container(18, -38.7); + ui.add(this.movesContainer); - this.movesContainer = movesContainer; + this.typeIcon = this.scene.add.sprite((this.scene.game.canvas.width / 6) - 33, -31, 'types', 'unknown'); + this.typeIcon.setVisible(false); + ui.add(this.typeIcon); + + this.ppText = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 18, -15.5, ' / ', TextStyle.WINDOW); + this.ppText.setOrigin(1, 0.5); + this.ppText.setVisible(false); + ui.add(this.ppText); } show(args: any[]) { @@ -29,6 +39,8 @@ export default class FightUiHandler extends UiHandler { const messageHandler = this.getUi().getMessageHandler(); messageHandler.bg.setTexture('bg_fight'); this.setCursor(this.cursor); + this.typeIcon.setVisible(true); + this.ppText.setVisible(true); this.displayMoves(); } @@ -80,6 +92,14 @@ export default class FightUiHandler extends UiHandler { ui.add(this.cursorObj); } + const pokemonMove = (this.scene as BattleScene).getPlayerPokemon().moveset[cursor]; + this.typeIcon.setTexture('types', Type[pokemonMove.getMove().type].toLowerCase()); + + const maxPP = pokemonMove.getMove().pp + pokemonMove.ppUp; + const pp = maxPP - pokemonMove.ppUsed; + + this.ppText.setText(`${Utils.padInt(pp, 2, ' ')}/${Utils.padInt(maxPP, 2, ' ')}`); + this.cursorObj.setPosition(13 + (cursor % 2 === 1 ? 100 : 0), -31 + (cursor >= 2 ? 15 : 0)); return ret; @@ -98,6 +118,8 @@ export default class FightUiHandler extends UiHandler { clear() { super.clear(); this.clearMoves(); + this.typeIcon.setVisible(false); + this.ppText.setVisible(false); this.eraseCursor(); }