Skip to content

Commit 9c08861

Browse files
Copilotjbampton
andauthored
fix: address code review issues (arguments.callee, xpEarned, skills split)
Agent-Logs-Url: https://github.com/NextCommunity/NextCommunity.github.io/sessions/e7dc0226-fa25-488a-a713-47a2399e85cd Co-authored-by: jbampton <418747+jbampton@users.noreply.github.com>
1 parent ef784cc commit 9c08861

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

src/assets/js/games/code-breaker.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,16 @@ const CodeBreaker = (function () {
225225
}).setOrigin(0.5);
226226

227227
// Keep label synced with the physics body each frame
228-
scene.events.on("update", function () {
228+
function syncLabel() {
229229
if (tile.active) {
230230
label.x = tile.x;
231231
label.y = tile.y;
232232
} else {
233233
label.destroy();
234-
scene.events.off("update", arguments.callee);
234+
scene.events.off("update", syncLabel);
235235
}
236-
});
236+
}
237+
scene.events.on("update", syncLabel);
237238

238239
scene.cb_tiles.add(tile);
239240
scene.cb_spawnDelay = Math.max(600, scene.cb_spawnDelay - 20);

src/assets/js/games/dev-duel.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,13 @@ const DevDuel = (function () {
247247
function _showResult(scene, challenger, opponent, cPower, oPower, W, H, theme) {
248248
const challengerWins = cPower >= oPower;
249249
const winner = challengerWins ? challenger : opponent;
250-
const xpEarned = XP_DEV_DUEL_WIN;
251250

252251
// Dim overlay
253252
const dimGfx = scene.add.graphics();
254253
dimGfx.fillStyle(0x000000, 0.6);
255254
dimGfx.fillRect(0, 0, W, H);
256255

257-
// Award XP and track stats
256+
// Award XP for playing (all players earn this) and track stats
258257
GameManager.awardXP(XP_DEV_DUEL_PLAY);
259258
const duels = GameManager.incrementStat("dev_duel_plays");
260259
if (duels >= 5) GameManager.grantAchievement("duelist");
@@ -290,7 +289,7 @@ const DevDuel = (function () {
290289
.setOrigin(0.5);
291290

292291
scene.add
293-
.text(W / 2, H / 2 + 35, "+" + xpEarned + " XP for playing!", {
292+
.text(W / 2, H / 2 + 35, "+" + XP_DEV_DUEL_PLAY + " XP for playing!", {
294293
fontSize: "18px",
295294
fill: "#10b981",
296295
fontStyle: "bold",
@@ -346,10 +345,8 @@ function getCardData(cardEl) {
346345
name: (cardEl.dataset.name || "").trim(),
347346
role: (cardEl.dataset.role || "").trim(),
348347
skills: (cardEl.dataset.skills || "")
349-
.split(",")
350-
.map(function (s) {
351-
return s.trim();
352-
})
348+
.trim()
349+
.split(/\s+/)
353350
.filter(Boolean),
354351
};
355352
}

0 commit comments

Comments
 (0)