Remove legacy 6-class system, migrate to ShipUpgradeData 4-ship system#23
Conversation
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 948ebbcf4a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
js/Game.js
Outdated
| } | ||
|
|
||
| // Get ship upgrade data | ||
| const shipData = window.ShipUpgradeData?.getShipData(shipId); |
There was a problem hiding this comment.
Call an existing ShipUpgradeData accessor
The new level-up path calls window.ShipUpgradeData?.getShipData(shipId), but ShipUpgradeData only exposes SHIPS, getShipUpgrades, getUpgradeById, and calculateUpgradeStats (js/data/ShipUpgradeData.js), so this expression throws ...getShipData is not a function whenever the LEVEL_UP event is handled. Because the handler has already switched state to LEVEL_UP and set running = false, this runtime error can leave the run paused without upgrade choices.
Useful? React with 👍 / 👎.
| // Emit LEVEL_UP event to pause game and show UI | ||
| if (this.world.events) { | ||
| console.log('[PickupSystem] Emitting LEVEL_UP event...'); | ||
| this.world.events.emit('LEVEL_UP', { player, level: playerComp.level }); |
There was a problem hiding this comment.
Queue LEVEL_UP events instead of emitting immediately
collectXP() can level multiple times in one pickup (while (playerComp.xp >= playerComp.xpRequired)), and each iteration now emits LEVEL_UP synchronously. The game listener immediately opens a new level-up screen for each emit, so later emits overwrite earlier choices and the player can gain multiple levels but only make one selection. This occurs on large XP gains (e.g., boss drops/high XP bonus) and causes lost upgrade rewards.
Useful? React with 👍 / 👎.
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
696920c
into
copilot/refonte-systme-armement-bonus
Game used legacy 6-class IDs ("equilibre", "defenseur", etc.) mapped at runtime to 4 ShipUpgradeData ships. This removes the indirection layer entirely.
Changes
ShipUpgradeData.js
baseStats,color,difficulty,startingWeapon,unlockedto all 4 ships (ION_FRIGATE, BALLISTIC_DESTROYER, CATACLYSM_CRUISER, TECH_NEXUS)UISystem.js
ShipUpgradeData.SHIPSinstead ofShipData.getAllShips()Game.js
shipIdMaplegacy mappingcreatePlayer()andrecalculatePlayerStats()useselectedShipdirectly as ship IDgenerateLevelUpOptions()corrected to usegetShipUpgrades()instead ofgetShipData()index.html
Example
Before:
After:
ShipData remains available as fallback for backward compatibility.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.