about summary refs log tree commit diff stats
path: root/html/tower/js/mechanics.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/tower/js/mechanics.js')
-rw-r--r--html/tower/js/mechanics.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/html/tower/js/mechanics.js b/html/tower/js/mechanics.js
index d172025..c1dcb1c 100644
--- a/html/tower/js/mechanics.js
+++ b/html/tower/js/mechanics.js
@@ -35,6 +35,8 @@ function updateEnemies() {
         // Handle path completion
         if (enemy.progress >= 1) {
             gameState.enemiesEscaped++;
+            // Deduct currency when enemy escapes
+            gameState.currency = Math.max(0, gameState.currency - 10);
             return false;
         }
         
@@ -236,7 +238,10 @@ function createSlimeTrail(enemy, cellSize) {
  * @param {number} cellSize - Grid cell size
  */
 function handleTowerAttack(tower, target, projectiles, particles, timestamp, cellSize) {
-    // Decrease ammo
+    // Only attack if we have ammo
+    if (tower.ammo <= 0) return;
+    
+    // Decrease ammo (already checked it's > 0)
     tower.ammo--;
     
     // Create projectile