Skip to content

Remove legacy 6-class system, migrate to ShipUpgradeData 4-ship system#23

Merged
Linkatplug merged 20 commits intocopilot/refonte-systme-armement-bonusfrom
copilot/analyse-amelioration-joueur
Feb 14, 2026
Merged

Remove legacy 6-class system, migrate to ShipUpgradeData 4-ship system#23
Linkatplug merged 20 commits intocopilot/refonte-systme-armement-bonusfrom
copilot/analyse-amelioration-joueur

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

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

  • Added baseStats, color, difficulty, startingWeapon, unlocked to all 4 ships (ION_FRIGATE, BALLISTIC_DESTROYER, CATACLYSM_CRUISER, TECH_NEXUS)
  • Ships now contain complete data for both menu display and gameplay

UISystem.js

  • Ship selection reads directly from ShipUpgradeData.SHIPS instead of ShipData.getAllShips()
  • Added console logging for ship availability and selection
  • Hardcoded fallback if ShipUpgradeData unavailable

Game.js

  • Removed shipIdMap legacy mapping
  • createPlayer() and recalculatePlayerStats() use selectedShip directly as ship ID
  • Added guard: defaults to "ION_FRIGATE" if no ship selected
  • generateLevelUpOptions() corrected to use getShipUpgrades() instead of getShipData()

index.html

  • Menu title changed from "SÉLECTIONNEZ VOTRE CLASSE" to "SÉLECTIONNEZ VOTRE VAISSEAU"

Example

Before:

// Game.js - Legacy mapping
const shipIdMap = {
    'equilibre': 'ION_FRIGATE',
    'defenseur': 'BALLISTIC_DESTROYER',
    // ...
};
playerComp.shipId = shipIdMap[this.gameState.selectedShip] || 'ION_FRIGATE';

After:

// Game.js - Direct usage
const shipId = this.gameState.selectedShip || 'ION_FRIGATE';
playerComp.shipId = shipId;

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.

Copilot AI and others added 5 commits February 13, 2026 22:27
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>
Copilot AI changed the title [WIP] Analyse des problèmes concernant l'expérience joueur Fix soft-lock when level-up generates no upgrade options Feb 13, 2026
Copilot AI requested a review from Linkatplug February 13, 2026 22:35
Copilot AI and others added 5 commits February 13, 2026 22:39
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>
Copilot AI changed the title Fix soft-lock when level-up generates no upgrade options Fix critical gameplay bugs: overheat soft-lock, level-up, enemy behavior, collision system Feb 13, 2026
@Linkatplug Linkatplug marked this pull request as ready for review February 13, 2026 22:48
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>
Copilot AI changed the title Fix critical gameplay bugs: overheat soft-lock, level-up, enemy behavior, collision system Add missing defense and heat components to player entity Feb 13, 2026
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>
Copilot AI changed the title Add missing defense and heat components to player entity Guard XP and heat calculations against undefined stats causing NaN Feb 13, 2026
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Copilot AI changed the title Guard XP and heat calculations against undefined stats causing NaN Remove legacy 6-class system, migrate to ShipUpgradeData 4-ship system Feb 13, 2026
@Linkatplug Linkatplug merged commit 696920c into copilot/refonte-systme-armement-bonus Feb 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants