From 58ba0ec52d0e5258b4945aca313bb4349a1f7e76 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 20 Feb 2024 22:53:33 -0500 Subject: [PATCH] Add starter moves on starter select (WiP) --- public/images/ui/type_bgs.json | 419 ++++++++++++++++++++++++++++ public/images/ui/type_bgs.png | Bin 0 -> 882 bytes src/battle-scene.ts | 1 + src/ui/starter-select-ui-handler.ts | 48 ++++ 4 files changed, 468 insertions(+) create mode 100644 public/images/ui/type_bgs.json create mode 100644 public/images/ui/type_bgs.png diff --git a/public/images/ui/type_bgs.json b/public/images/ui/type_bgs.json new file mode 100644 index 000000000..6b98a733d --- /dev/null +++ b/public/images/ui/type_bgs.json @@ -0,0 +1,419 @@ +{ + "textures": [ + { + "image": "type_bgs.png", + "format": "RGBA8888", + "size": { + "w": 14, + "h": 266 + }, + "scale": 1, + "frames": [ + { + "filename": "unknown", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + } + }, + { + "filename": "bug", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 14, + "w": 14, + "h": 14 + } + }, + { + "filename": "dark", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 28, + "w": 14, + "h": 14 + } + }, + { + "filename": "dragon", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 42, + "w": 14, + "h": 14 + } + }, + { + "filename": "electric", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 56, + "w": 14, + "h": 14 + } + }, + { + "filename": "fairy", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 70, + "w": 14, + "h": 14 + } + }, + { + "filename": "fighting", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 84, + "w": 14, + "h": 14 + } + }, + { + "filename": "fire", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 98, + "w": 14, + "h": 14 + } + }, + { + "filename": "flying", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 112, + "w": 14, + "h": 14 + } + }, + { + "filename": "ghost", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 126, + "w": 14, + "h": 14 + } + }, + { + "filename": "grass", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 140, + "w": 14, + "h": 14 + } + }, + { + "filename": "ground", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 154, + "w": 14, + "h": 14 + } + }, + { + "filename": "ice", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 168, + "w": 14, + "h": 14 + } + }, + { + "filename": "normal", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 182, + "w": 14, + "h": 14 + } + }, + { + "filename": "poison", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 196, + "w": 14, + "h": 14 + } + }, + { + "filename": "psychic", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 210, + "w": 14, + "h": 14 + } + }, + { + "filename": "rock", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 224, + "w": 14, + "h": 14 + } + }, + { + "filename": "steel", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 238, + "w": 14, + "h": 14 + } + }, + { + "filename": "water", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 14, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 14, + "h": 14 + }, + "frame": { + "x": 0, + "y": 252, + "w": 14, + "h": 14 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:f14cf47d9a8f1d40c8e03aa6ba00fff3:6fc4227b57a95d429a1faad4280f7ec8:5961efbfbf4c56b8745347e7a663a14f$" + } +} diff --git a/public/images/ui/type_bgs.png b/public/images/ui/type_bgs.png new file mode 100644 index 0000000000000000000000000000000000000000..6e682d9c327bd34373a88ef17d35a2193f402f08 GIT binary patch literal 882 zcmV-&1C9KNP)mj~U(yTffScU0Gsa);7p?;UFL z6j(hH5jFXsMy}MV2Bax{>>UyOO`ya0az{CE?l8^XI~Kih@gV`k`!>KSuGYMQcw0nw zMDPHpZ9+rZCU~`gl57F5-VxqDC{TX>CFk(=5&rx8U#isb_7P<3O>{>D4}h~9X=rw@ z-Z4D5RNhR}-a8%{7atk`^6ZLW7tf{gTLRHV9^Dba17M$~G}Nc*CvyjT)=3I0;%yQ9 z!j+obfD;P=fM23=BFKJ>0l+SPcL)1XzFN2Uj$|O`$kzm7v=6K0%FT)dCl&&L)%vKM zFAo|s(~vRq?vCa@a!b9r-rZ4_ck(b-L+0Tb*mBGAj&DEGtYhEt{r#V)oG%Z$Rnd@J z)vuY=jhtC6yE|IVo##{ni1v@5EH{9ziWJhCTg)91JOHkW-*>F)wePrhS4wtsr(e0l zw_NT>dJ*s2uovpueJFMR*ut+X)wtfp{ z<%Dki7G!iT_KpZ10KMYf;nm9>!!U6Z-R7~Mtg0%bpL%vq2Wz>5pmRFNJh#yu5j>L0 z7ycHaS?sS=UXiI>?e3`ahI--v1#z7UhFr3j*9&C2PSG6^JaV!+und^}ay*sqxkGa| z*pur`#OozsbX=`<4)OOsx+8)Iz%g+&G$!toyYkzEyT8&*fULR>Zsl5Co)r-G!b?<6 z1b5Jy1KU93Kbgv%)7<|%@~en*I;<-<3eK`8PAmif>zYR8#N44LK6mJ8cSqMYl*qe& z*xkWSk?K4b8J!DOU8quvYJ=3nGxm-M9sn;}M?;sbJMNDE0Tm;SxY$>r(f|Me07*qo IM6N<$f*D$*H2?qr literal 0 HcmV?d00001 diff --git a/src/battle-scene.ts b/src/battle-scene.ts index f0d18dc30..14559a97c 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -241,6 +241,7 @@ export default class BattleScene extends Phaser.Scene { this.loadImage('icon_spliced', 'ui'); this.loadImage('icon_tera', 'ui'); this.loadImage('type_tera', 'ui'); + this.loadAtlas('type_bgs', 'ui'); this.loadImage('pb_tray_overlay_player', 'ui'); this.loadImage('pb_tray_overlay_enemy', 'ui'); diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index a690caed5..3057838d8 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -18,6 +18,9 @@ import { Nature, getNatureName } from "../data/nature"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import { pokemonFormChanges } from "../data/pokemon-forms"; import { Tutorial, handleTutorial } from "../tutorial"; +import { pokemonSpeciesLevelMoves } from "../data/pokemon-level-moves"; +import { allMoves } from "../data/move"; +import { Type } from "../data/type"; export type StarterSelectCallback = (starters: Starter[]) => void; @@ -46,6 +49,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler { private pokemonNatureText: BBCodeText; private pokemonCaughtCountLabelText: Phaser.GameObjects.Text; private pokemonCaughtCountText: Phaser.GameObjects.Text; + private pokemonMoveContainers: Phaser.GameObjects.Container[]; + private pokemonMoveBgs: Phaser.GameObjects.NineSlice[]; + private pokemonMoveLabels: Phaser.GameObjects.Text[]; private genOptionsText: Phaser.GameObjects.Text; private instructionsText: Phaser.GameObjects.Text; private starterSelectMessageBox: Phaser.GameObjects.NineSlice; @@ -171,6 +177,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonCaughtCountText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonCaughtCountText); + this.pokemonMoveContainers = []; + this.pokemonMoveBgs = []; + this.pokemonMoveLabels = []; + this.genOptionsText = addTextObject(this.scene, 124, 7, '', TextStyle.WINDOW, { fontSize: 72, lineSpacing: 39, align: 'center' }); this.genOptionsText.setShadowOffset(4.5, 4.5); this.genOptionsText.setOrigin(0.5, 0); @@ -290,6 +300,27 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonSprite = this.scene.add.sprite(53, 63, `pkmn__sub`); this.starterSelectContainer.add(this.pokemonSprite); + for (let m = 0; m < 4; m++) { + const moveContainer = this.scene.add.container(102, 16 + 7 * m); + moveContainer.setScale(0.5); + + const moveBg = this.scene.add.nineslice(0, 0, 'type_bgs', 'unknown', 92, 14, 2, 2, 2, 2); + moveBg.setOrigin(1, 0); + + const moveLabel = addTextObject(this.scene, -moveBg.width / 2, 0, 'Thunder Wave', TextStyle.PARTY); + moveLabel.setOrigin(0.5, 0); + + this.pokemonMoveBgs.push(moveBg); + this.pokemonMoveLabels.push(moveLabel); + + moveContainer.add(moveBg); + moveContainer.add(moveLabel); + + this.pokemonMoveContainers.push(moveContainer); + + this.starterSelectContainer.add(moveContainer); + } + this.instructionsText = addTextObject(this.scene, 4, 156, '', TextStyle.PARTY, { fontSize: '42px' }); this.starterSelectContainer.add(this.instructionsText); @@ -492,6 +523,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.toggleStatsMode(); ui.setMode(Mode.STARTER_SELECT); } + }, + { + label: 'Cancel', + handler: () => { + ui.setMode(Mode.STARTER_SELECT); + } } ], yOffset: 47 @@ -861,6 +898,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.assetLoadCancelled = null; } + const starterMoves = []; + if (species) { const dexEntry = this.scene.gameData.dexData[species.speciesId]; if (!dexEntry.caughtAttr) { @@ -934,6 +973,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonAbilityText.setShadowColor(getTextColor(!isHidden ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true)); this.pokemonNatureText.setText(getNatureName(natureIndex as unknown as Nature, true, true)); + + starterMoves.push(...pokemonSpeciesLevelMoves[species.speciesId].slice(0, 4).filter(lm => lm[0] <= 5).map(lm => lm[1])); } else { this.pokemonAbilityText.setText(''); this.pokemonNatureText.setText(''); @@ -944,6 +985,13 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonNatureText.setText(''); } + for (let m = 0; m < 4; m++) { + const move = m < starterMoves.length ? allMoves[starterMoves[m]] : null; + this.pokemonMoveBgs[m].setFrame(Type[move ? move.type : Type.UNKNOWN].toString().toLowerCase()); + this.pokemonMoveLabels[m].setText(move ? move.name : '-'); + this.pokemonMoveContainers[m].setVisible(!!move); + } + this.updateInstructions(); }