« get me outta code hell

csb-game - Pixelly spin-off of the Command Synergy Battle system used in Final Fantasy XIII
summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/index.js b/index.js
index c927385..955fcb7 100644
--- a/index.js
+++ b/index.js
@@ -93,7 +93,11 @@ class ATBBar {
     ctx.rect(0, 0, Math.round(this.canvas.width * this.visualProgress), this.canvas.height)
     ctx.clip()
 
-    ctx.fillStyle = '#77F'
+    if (this.battleCharacter.stunIsSignificant) {
+      ctx.fillStyle = '#888'
+    } else {
+      ctx.fillStyle = '#77F'
+    }
     ctx.fillRect(0, 0, this.canvas.width, this.canvas.height)
 
     ctx.restore()
@@ -134,6 +138,15 @@ class ATBBar {
         i += action.size
       }
     }
+
+    if (this.battleCharacter.stunIsSignificant) {
+      ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'
+      ctx.fillRect(0, 0, this.canvas.width, this.canvas.height)
+      ctx.textAlign = 'left'
+      ctx.fillStyle = 'black'
+      ctx.font = '5px pixel-font'
+      ctx.fillText('Stunned!', 2, this.canvas.height / 2 + 2.5)
+    }
   }
 
   update(dt) {
@@ -247,7 +260,6 @@ class ATBBar {
       if (action.cooldown) {
         this.battleCharacter.cooldownTimers[action.id] = action.cooldown * this.segmentCount
         this.battleCharacter.cooldownTimers[action.id] -= this.segmentCount - this.getRemainingSpace()
-        console.log('Enqueued cooldown:', action.label, action.cooldown * this.segmentCount, this.battleCharacter.cooldownTimers[action.id])
       }
       this.queuedActions.push(action)
       return true