« get me outta code hell

Don't let Cure or Curasa cause knockback - 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:
authorFlorrie <towerofnix@gmail.com>2018-08-20 11:14:03 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-20 11:14:03 -0300
commit6024c1014a727c5627ed0d0c5b919094361c6dfe (patch)
tree2a83a8d9fab014d7b50cda2b0de68f305e92b69f /index.js
parent311a15333d9fbb9a5b0cc249d6bd0c45d29a4782 (diff)
Don't let Cure or Curasa cause knockback
Diffstat (limited to 'index.js')
-rw-r--r--index.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/index.js b/index.js
index d9796ed..693b5e3 100644
--- a/index.js
+++ b/index.js
@@ -19,9 +19,9 @@ const actionDatabase = {
   fira: {id: 'fira',     chain: 'fire', label: 'Fira',   size: 2, target: 'enemy', color: '#F77', damage: 40, stun: 0.2},
   firaga: {id: 'firaga', chain: 'fire', label: 'Firaga', size: 3, target: 'enemy', color: '#F77', damage: 60, stun: 0.3},
 
-  cure: {id: 'cure', chain: 'cure', label: 'Cure', size: 1, target: 'ally', color: '#AFA', heal: 80},
+  cure: {id: 'cure', chain: 'cure', label: 'Cure', size: 1, target: 'ally', color: '#AFA', heal: 80, knockbackMultiplier: 0},
 
-  curasa: {id: 'curasa', chain: 'curasa', label: 'Curasa', size: 1, target: 'ally', color: '#AFA', healRelativeToDamageTaken: 0.25},
+  curasa: {id: 'curasa', chain: 'curasa', label: 'Curasa', size: 1, target: 'ally', color: '#AFA', healRelativeToDamageTaken: 0.25, knockbackMultiplier: 0},
 
   blizz: {id: 'blizz',       chain: 'blizz', label: 'Blizz',    size: 1, target: 'enemy', color: '#AAF', damage: 15, stun: 0.2},
   blizzara: {id: 'blizzara', chain: 'blizz', label: 'Blizzara', size: 2, target: 'enemy', color: '#AAF', damage: 30, stun: 0.35},
@@ -1315,8 +1315,10 @@ class MagicProjectile {
         if (rel) this.target.recoverHP(rel * (this.target.maxHP - this.target.hp))
       }
 
-      this.target.xvel += 2 * xvel * this.target.knockbackMultiplier
-      this.target.yvel += 2 * yvel * this.target.knockbackMultiplier
+      const actionKB = 'knockbackMultiplier' in this.action ? this.action.knockbackMultiplier : 1
+
+      this.target.xvel += 2 * xvel * this.target.knockbackMultiplier * actionKB
+      this.target.yvel += 2 * yvel * this.target.knockbackMultiplier * actionKB
 
       this.discarded = true
     }