Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions docs/data/corespace-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,7 @@
]
},
{
"id": "machine",
"availableSkills": [
{
"skillId": "impervious",
"maxLevel": 3
}
]
"id": "tech"
}
],
"notes": "Balcor starts with Brutal Assault at level 2 and builds additional resilience and close combat tricks through Support or Marine class boards."
Expand Down
45 changes: 36 additions & 9 deletions docs/js/character-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,42 @@
return fallbackClasses;
}

return boards.map((board) => {
const global = state.globalClasses.get(board.id) || {};
return {
...global,
...board,
availableSkills: board.availableSkills || global.availableSkills || [],
description: board.description || global.description || '',
flavorText: board.flavorText || global.flavorText || '',
};
// Check if this is a machine-only character (only has machine/machineTech classes)
const isMachineOnly = boards.every(board =>
board.id === 'machine' || board.id === 'machineTech'
);

// Machine characters only get their restricted class options
if (isMachineOnly) {
return boards.map((board) => {
const global = state.globalClasses.get(board.id) || {};
return {
...global,
...board,
availableSkills: board.availableSkills || global.availableSkills || [],
description: board.description || global.description || '',
flavorText: board.flavorText || global.flavorText || '',
};
});
}

// Non-machine characters get all classes, with character-specific customizations merged in
const customBoards = new Map(boards.map(board => [board.id, board]));

return fallbackClasses.map((globalClass) => {
const customBoard = customBoards.get(globalClass.id);
if (customBoard) {
// Merge character-specific customizations with global class
return {
...globalClass,
...customBoard,
availableSkills: customBoard.availableSkills || globalClass.availableSkills || [],
description: customBoard.description || globalClass.description || '',
flavorText: customBoard.flavorText || globalClass.flavorText || '',
};
}
// Use global class definition as-is
return globalClass;
});
}

Expand Down
Loading