-
Notifications
You must be signed in to change notification settings - Fork 1
Fix worm targeting/kill semantics, increase Panel C rain density, and resize HUD timers #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8c315b1
15b1374
8785503
000eac4
2eb0a4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,7 +49,9 @@ console.log("🐛 Worm movement navigation loading..."); | |||||||||||||
| return false; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| const symbolsToSearch = this.getCachedAllSymbols(); | ||||||||||||||
| const symbolsToSearch = worm.isPurple | ||||||||||||||
| ? this.getCachedAllSymbols() | ||||||||||||||
| : this.getCachedRevealedSymbols(); | ||||||||||||||
|
Comment on lines
+52
to
+54
|
||||||||||||||
| const symbolsToSearch = worm.isPurple | |
| ? this.getCachedAllSymbols() | |
| : this.getCachedRevealedSymbols(); | |
| // Purple worms should only rush toward symbols they can actually steal. | |
| // Steal logic is restricted to revealed symbols, so we target only revealed. | |
| const symbolsToSearch = this.getCachedRevealedSymbols(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,8 +31,7 @@ | |
| return; | ||
| } | ||
|
|
||
| // FIX: Purple worms need access to ALL symbols (including hidden), not just revealed | ||
| const symbolsSource = this.getCachedAllSymbols(); | ||
| const symbolsSource = this.getCachedRevealedSymbols(); | ||
|
|
||
| // Get all available symbols (not stolen, not spaces, not completed) | ||
| const allAvailableSymbols = Array.from(symbolsSource).filter( | ||
|
|
@@ -42,37 +41,22 @@ | |
| !el.classList.contains("completed-row-symbol"), | ||
| ); | ||
|
|
||
| // PURPLE WORM LOGIC: Only steal blue symbols when NO red symbols available | ||
| // PURPLE WORM LOGIC: can only steal symbols currently visible to the user | ||
| let availableSymbols; | ||
| if (worm.canStealBlue && worm.isPurple) { | ||
| // First, try to get red (hidden) symbols only | ||
| const redSymbols = allAvailableSymbols.filter((el) => | ||
| el.classList.contains("hidden-symbol"), | ||
| availableSymbols = allAvailableSymbols.filter((el) => | ||
| el.classList.contains("revealed-symbol"), | ||
| ); | ||
| console.log( | ||
| `🟣 PURPLE WORM - ${availableSymbols.length} revealed symbols available`, | ||
| ); | ||
|
|
||
| if (redSymbols.length > 0) { | ||
| // Red symbols available - purple worm steals red symbols like normal | ||
| availableSymbols = redSymbols; | ||
| console.log( | ||
| `🟣 PURPLE WORM - ${redSymbols.length} red symbols available (preferring red)`, | ||
| ); | ||
| } else { | ||
| // NO red symbols - now purple worm can steal blue symbols! | ||
| const blueSymbols = allAvailableSymbols.filter((el) => | ||
| el.classList.contains("revealed-symbol"), | ||
| ); | ||
| availableSymbols = blueSymbols; | ||
| console.log( | ||
| `🟣 PURPLE WORM - NO red symbols! Stealing blue symbols (${blueSymbols.length} available)`, | ||
| ); | ||
| } | ||
| } else { | ||
| // Normal worm - only steal red (hidden) symbols | ||
| // All non-purple steal attempts are restricted to currently revealed symbols | ||
| availableSymbols = allAvailableSymbols.filter((el) => | ||
| el.classList.contains("hidden-symbol"), | ||
| el.classList.contains("revealed-symbol"), | ||
| ); | ||
| console.log( | ||
| `🐛 Normal worm - ${availableSymbols.length} red symbols available`, | ||
| `🐛 Normal worm - ${availableSymbols.length} revealed symbols available`, | ||
| ); | ||
|
Comment on lines
+44
to
60
|
||
| } | ||
|
|
||
|
|
@@ -178,18 +162,13 @@ | |
| )); | ||
|
|
||
| if (worm.isPurple && worm.canStealBlue) { | ||
| const redSymbols = allAvailableSymbols.filter((el) => | ||
| el.classList.contains("hidden-symbol"), | ||
| ); | ||
| if (redSymbols.length > 0) return redSymbols; | ||
|
|
||
| return allAvailableSymbols.filter((el) => | ||
| el.classList.contains("revealed-symbol"), | ||
| ); | ||
| } | ||
|
|
||
| return allAvailableSymbols.filter((el) => | ||
| el.classList.contains("hidden-symbol"), | ||
| el.classList.contains("revealed-symbol"), | ||
| ); | ||
|
Comment on lines
164
to
172
|
||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -208,9 +208,11 @@ | |||
| proto.createSlimeSplat = function(x, y) { | ||||
| const splat = document.createElement("div"); | ||||
| splat.className = "slime-splat"; | ||||
| splat.textContent = ""; | ||||
|
||||
| splat.textContent = ""; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,13 +57,13 @@ | |
| } | ||
|
|
||
| .hud-label { | ||
| font-size: 12px; | ||
| font-size: 8px; | ||
| letter-spacing: 2px; | ||
| opacity: 0.9; | ||
| } | ||
|
|
||
| .hud-value { | ||
| font-size: 28px; | ||
| font-size: 20px; | ||
|
Comment on lines
+60
to
+66
|
||
| font-weight: 900; | ||
| line-height: 1.05; | ||
| } | ||
|
|
@@ -158,7 +158,7 @@ | |
| } | ||
|
|
||
| .hud-value { | ||
| font-size: 22px; | ||
| font-size: 15px; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -81,4 +81,32 @@ test.describe("Worm behavior: aggression, targeting, and click rules", () => { | |||||||||||||||
|
|
||||||||||||||||
| expect(afterSecondClick).toBeFalsy(); | ||||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| test("purple worm click clones instead of dying", async ({ page }) => { | ||||||||||||||||
| await page.evaluate(() => { | ||||||||||||||||
| document.dispatchEvent(new CustomEvent("purpleWormTriggered")); | ||||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| await page.waitForFunction( | ||||||||||||||||
| () => window.wormSystem?.worms.some((w) => w.active && w.isPurple), | ||||||||||||||||
| ); | ||||||||||||||||
|
|
||||||||||||||||
| const beforeClickCount = await page.evaluate( | ||||||||||||||||
| () => window.wormSystem.worms.filter((w) => w.active && w.isPurple).length, | ||||||||||||||||
| ); | ||||||||||||||||
|
|
||||||||||||||||
| const purpleWorm = page.locator(".worm-container.purple-worm").first(); | ||||||||||||||||
| await purpleWorm.click({ force: true }); | ||||||||||||||||
|
|
||||||||||||||||
| await page.waitForTimeout(400); | ||||||||||||||||
|
||||||||||||||||
| await page.waitForTimeout(400); | |
| await page.waitForFunction( | |
| (previousCount) => | |
| window.wormSystem?.worms.filter((w) => w.active && w.isPurple).length > | |
| previousCount, | |
| beforeClickCount, | |
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doubling both symbolsPerWave (7→14) and poolSize (30→60) quadruples the total potential symbol pool while only doubling the spawning rate. This could lead to memory/DOM bloat if the animation cleanup doesn't keep pace, especially on lower-end devices. Consider monitoring DOM node count in the performance budget or implementing a more aggressive pool recycling strategy to prevent accumulation of inactive symbol elements.