Skip to content

Commit 3daa509

Browse files
Refactor dollar values to start from zero and enhance mobile layout with improved overflow handling
1 parent 9fec8a8 commit 3daa509

7 files changed

Lines changed: 39 additions & 9 deletions

File tree

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
content="A browser idle game about writing code, hiring developers, shipping faster, and surviving bugs and tech debt."
1010
/>
1111
<meta name="theme-color" content="#0a1224" />
12+
<meta name="mobile-web-app-capable" content="yes" />
1213
<meta name="apple-mobile-web-app-capable" content="yes" />
1314
<meta
1415
name="apple-mobile-web-app-status-bar-style"

src/game/engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function createInitialState(nowMs = Date.now()): GameState {
5252
return {
5353
loc: 0,
5454
lifetimeLoc: 0,
55-
dollars: 35,
55+
dollars: 0,
5656
lifetimeDollars: 0,
5757
aiAgents: 0,
5858
aiTokens: 0,

src/lib/css/styles.css

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ input {
14361436
grid-column: 1;
14371437
grid-row: 1;
14381438
min-height: 0;
1439-
overflow: auto;
1439+
overflow: visible;
14401440
display: none;
14411441
}
14421442

@@ -1479,7 +1479,7 @@ input {
14791479
.tile-shop,
14801480
.tile-utility,
14811481
.tile-owned {
1482-
max-height: 100%;
1482+
max-height: none;
14831483
}
14841484

14851485
.game-shell[data-mobile-screen="team"] .tile-devs,
@@ -1561,12 +1561,19 @@ input {
15611561
flex: 1 1 auto;
15621562
min-height: 0;
15631563
overflow: auto;
1564+
scrollbar-width: none;
1565+
}
1566+
1567+
.game-shell[data-mobile-screen="play"]
1568+
.tile-hero
1569+
.team-visual::-webkit-scrollbar {
1570+
display: none;
15641571
}
15651572

15661573
.game-shell[data-mobile-screen="play"] .tile-actions {
15671574
flex: 0 0 auto;
15681575
order: 3;
1569-
overflow: auto;
1576+
overflow: visible;
15701577
}
15711578

15721579
.game-shell[data-mobile-screen="play"] .tile-stats {

src/main.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ let state = store.getState();
2525
const STRATEGIC_DEBT_AUTO_POSTPONE_MS = 15_000;
2626
const KEYBOARD_WRITE_DEBOUNCE_MS = 180;
2727
const KEYBOARD_HINT_VISIBLE_MS = 6000;
28+
const TOUCH_WRITE_SUPPRESS_CLICK_MS = 500;
2829

2930
const app = document.querySelector("#app");
3031
if (!(app instanceof HTMLElement)) {
3132
throw new Error("Missing #app root");
3233
}
3334
const { elements, buttons, statCards } = mountGameShell(app);
3435
let lastKeyboardWriteAt = 0;
36+
let lastTouchWriteAt = 0;
3537
const audio = createAudioController({ isGameOver });
3638
const codeBackground = createCodeBackgroundController({
3739
container: elements.codeBackground,
@@ -62,6 +64,7 @@ const managementPanels = createManagementPanelsController({
6264
prestigeUpgradeList: elements.prestigeUpgradeList,
6365
goalTarget: elements.goalTarget,
6466
goalProgress: elements.goalProgress,
67+
goalProgressFill: elements.goalProgressFill,
6568
goalReward: elements.goalReward,
6669
prestigeReset: elements.prestigeReset,
6770
},
@@ -98,8 +101,26 @@ function applyAction(action: GameAction): void {
98101
render();
99102
}
100103

101-
buttons.click.addEventListener("click", () => {
104+
const performManualWriteFromUi = (): void => {
102105
manualWrite.performManualWrite(COMBO_CALLOUTS);
106+
};
107+
108+
buttons.click.addEventListener("pointerdown", (event) => {
109+
if (event.pointerType === "mouse") {
110+
return;
111+
}
112+
if (event.cancelable) {
113+
event.preventDefault();
114+
}
115+
lastTouchWriteAt = Date.now();
116+
performManualWriteFromUi();
117+
});
118+
119+
buttons.click.addEventListener("click", () => {
120+
if (Date.now() - lastTouchWriteAt < TOUCH_WRITE_SUPPRESS_CLICK_MS) {
121+
return;
122+
}
123+
performManualWriteFromUi();
103124
});
104125

105126
window.addEventListener("keydown", (event) => {

test/engine.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ test("click action applies gain, aura creation, and refactoring bug reduction",
265265

266266
expect(next.totalClicks).toBe(1);
267267
expect(next.loc).toBeGreaterThan(0);
268-
expect(next.dollars).toBeGreaterThan(35);
268+
expect(next.dollars).toBeGreaterThan(0);
269269
expect(next.clickAuras).toHaveLength(1);
270270
expect(next.bugs).toHaveLength(1);
271271
expect(next.bugs[0].id).toBe(2);
@@ -361,7 +361,7 @@ test("prestige reset carries prestige state and bootstrap bonuses forward", () =
361361
expect(next.prestigeUpgrades.momentum_bootstrap).toBe(4);
362362
expect(next.tradeoffMode).toBe("balanced");
363363
expect(next.developers.junior).toBe(2);
364-
expect(next.dollars).toBeGreaterThan(35);
364+
expect(next.dollars).toBeGreaterThan(0);
365365
});
366366

367367
test("risk summary reflects AI-heavy teams", () => {
@@ -518,7 +518,7 @@ test("tick accrues passive output, cleans expired effects, and respects game ove
518518

519519
const progressed = tick(state, { nowMs: 11_000, random: () => 0.99 });
520520
expect(progressed.loc).toBeGreaterThan(0);
521-
expect(progressed.dollars).toBeGreaterThan(35);
521+
expect(progressed.dollars).toBeGreaterThan(0);
522522
expect(progressed.activeBoosts).toHaveLength(0);
523523
expect(progressed.clickAuras).toHaveLength(0);
524524
expect(progressed.activeEvents).toHaveLength(0);

test/persistence.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ test("loadState creates a fresh state when storage is empty", () => {
8787
const loaded = loadState(createStorage(null), 7_000);
8888

8989
expect(loaded.lastTickAt).toBe(7_000);
90-
expect(loaded.dollars).toBe(35);
90+
expect(loaded.dollars).toBe(0);
9191
});
9292

9393
test("encode and decode use browser base64 helpers when available", () => {

test/uiModules.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ test("management panels controller initializes panels, renders data, and dispatc
230230
prestigeUpgradeList: elements.prestigeUpgradeList,
231231
goalTarget: elements.goalTarget,
232232
goalProgress: elements.goalProgress,
233+
goalProgressFill: elements.goalProgressFill,
233234
goalReward: elements.goalReward,
234235
prestigeReset: elements.prestigeReset,
235236
},

0 commit comments

Comments
 (0)