about summary refs log tree commit diff stats
path: root/html/tower/js/gameState.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/tower/js/gameState.js')
-rw-r--r--html/tower/js/gameState.js35
1 files changed, 24 insertions, 11 deletions
diff --git a/html/tower/js/gameState.js b/html/tower/js/gameState.js
index 41f25e5..ff64753 100644
--- a/html/tower/js/gameState.js
+++ b/html/tower/js/gameState.js
@@ -10,7 +10,8 @@ const TowerTypes = {
         range: 3,
         damage: 1,
         attackSpeed: 1,
-        color: '#3498db'
+        color: '#3498db',
+        maxAmmo: 15
     },
     SNIPER: {
         name: 'Sniper Tower',
@@ -18,7 +19,8 @@ const TowerTypes = {
         range: 6,
         damage: 2,
         attackSpeed: 0.5,
-        color: '#8e44ad'
+        color: '#8e44ad',
+        maxAmmo: 8
     },
     RAPID: {
         name: 'Rapid Tower',
@@ -26,7 +28,8 @@ const TowerTypes = {
         range: 2,
         damage: 0.5,
         attackSpeed: 2,
-        color: '#16a085'
+        color: '#16a085',
+        maxAmmo: 30
     },
     GOOP: {
         name: 'Goop Tower',
@@ -36,17 +39,19 @@ const TowerTypes = {
         attackSpeed: 1,
         color: '#27ae60',
         special: 'slow',
-        slowAmount: 0.5  // Reduces enemy speed by 50%
+        slowAmount: 0.75,
+        maxAmmo: 20
     },
     AOE: {
         name: 'AOE Tower',
         cost: 45,
         range: 2,
-        damage: 1.5,
+        damage: 3,
         attackSpeed: 0.3,
         color: '#d35400',
         special: 'aoe',
-        aoeRadius: 1  // Additional tiles affected
+        aoeRadius: 4,
+        maxAmmo: 10
     }
 };
 
@@ -96,13 +101,15 @@ const EnemyTypes = {
 };
 
 function createTower(type, position) {
+    const towerType = TowerTypes[type];
     return {
-        ...TowerTypes[type],
+        ...towerType,
         type,
         position,
         lastAttackTime: 0,
         currentHealth: 10,
-        maxHealth: 10
+        maxHealth: 10,
+        ammo: towerType.maxAmmo  // Initialize ammo
     };
 }
 
@@ -174,14 +181,20 @@ const gameState = {
     
     // Add method to advance to next level
     advanceToNextLevel() {
+        // Award bonus for remaining ammo
+        let ammoBonus = 0;
+        this.towers.forEach(tower => {
+            ammoBonus += tower.ammo * 2;
+        });
+        this.currency += ammoBonus;
+        
         this.level++;
         this.phase = GamePhase.PLACEMENT;
-        this.towers = [];  // Clear existing towers
+        this.towers = [];
         this.enemies = [];
         this.projectiles = [];
         this.particles = [];
         this.grid = Array(20).fill().map(() => Array(20).fill('empty'));
-        // Award bonus currency for reaching new level
-        this.currency += 10;
+        this.currency += 10;  // Level completion bonus
     }
 }; 
\ No newline at end of file