Skip to content

Commit 8b814be

Browse files
lonelone
authored andcommitted
feat(dev): support 'secret' playable units; load in development builds for materialization (fixes #2184)
1 parent 014d2a5 commit 8b814be

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/data/units.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ type Stats = {
3232
type UnitDataStructure = readonly {
3333
id: number;
3434
name: string;
35-
playable: boolean;
35+
// playable can be:
36+
// - true: fully available
37+
// - false: not available
38+
// - 'secret': materializable in development builds only
39+
playable: boolean | 'secret';
3640
level: number | string;
3741
realm: string;
3842
size: UnitSize;
@@ -203,7 +207,7 @@ export const unitData: UnitDataStructure = [
203207
sonic: 5,
204208
mental: 8,
205209
},
206-
drop: {
210+
drop: {
207211
name: 'gold coin',
208212
meditation: 6,
209213
initiative: 4,

src/game.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ export default class Game {
276276
this.creatureData = data;
277277

278278
data.forEach((creature) => {
279-
if (!creature.playable) {
279+
const isSecret = creature.playable === 'secret';
280+
const isDev = process.env.NODE_ENV === 'development';
281+
const isPlayable = creature.playable === true || (isSecret && isDev);
282+
if (!isPlayable) {
280283
return;
281284
}
282285

0 commit comments

Comments
 (0)