diff --git a/db/281024_2257_migration.sql b/db/281024_2257_migration.sql new file mode 100644 index 0000000..508c0e9 --- /dev/null +++ b/db/281024_2257_migration.sql @@ -0,0 +1,2 @@ +INSERT INTO `passive` (`id`, `passiveName`, `passiveDescription`) VALUES (3, 'Taunt', 'Must be targetted by attacks'); + diff --git a/public/board.js b/public/board.js index afc3449..f71ec43 100644 --- a/public/board.js +++ b/public/board.js @@ -368,6 +368,10 @@ class Board{ this.printCenterText('R', positionX + (10*passiveCount), positionY); passiveCount++; } + if(itemKey in taunt){ + this.printCenterText('T', positionX + (10*passiveCount), positionY); + passiveCount++; + } } printColourRequirements(itemKey){ // Set the size(s) diff --git a/public/debug.js b/public/debug.js index 6074130..a71caf4 100644 --- a/public/debug.js +++ b/public/debug.js @@ -60,10 +60,25 @@ function debugEffectFunction(damageAmount = null, targetId = null, targetId2 = n console.log(targetId+' Reach: '+reach[targetId]); } + if(effect == 'taunt'){ + console.log(targetId+' Taunt: '+taunt[targetId]); + + console.log(effectAddRemove); + + if(effectAddRemove == 'remove'){ + removeTaunt(targetId); + }else{ + giveTaunt(targetId); + } + + console.log(targetId+' Taunt: '+reach[targetId]); + } if(effect == 'draw'){ drawCard(damageAmount, targetPlayer); } if(effect == 'equip'){} + + board.drawBoard(); } @@ -89,6 +104,8 @@ function debugTriggerFunction(targetId = null, trigger = null, triggerAmount = n if(trigger == 'pay'){ triggerPay(triggerAmount); } + + board.drawBoard(); } // Builds console log for card effect (inc. @@ -165,9 +182,9 @@ function debugEffectCanTrigger(){ if(doEffectTriggers(ecTriggerTargetId, ecTriggerIndex, true) != true){ console.log('Effect cannot be triggered'); - queueEffect(ecTriggerTargetId, ecTriggerIndex); + //queueEffect(ecTriggerTargetId, ecTriggerIndex); //doNextInQueue(); - loopTriggerQueue(); + //loopTriggerQueue(); return false; } @@ -179,7 +196,12 @@ function debugEffectCanTrigger(){ // Then queue the effects to happen (queued so they can be chained/countered) queueEffect(ecTriggerTargetId, ecTriggerIndex); + + // Do all effects in queue (for debug), in actual will do one, then allow chain triggers, etc. + loopTriggerQueue(); } + board.drawBoard(); + } diff --git a/public/effect.js b/public/effect.js index a006713..beaa3be 100644 --- a/public/effect.js +++ b/public/effect.js @@ -8,6 +8,7 @@ let triggerQueueTargets = []; // Whatever was targetted by the effect, etc. in t // Passive effects (just does stuff) let flight = {}; let reach = {}; +let taunt = {}; let equipped = {}; // Entity x has [a,b,c] equipped to it @@ -30,6 +31,7 @@ const basicEffects = { 3: 'Hurt', 4: 'Recruit', 5: 'Give Flight', + 6: 'Taunt', }; @@ -55,6 +57,17 @@ function removeReach(card){ } return false; } +function giveTaunt(card){ + taunt[card] = true; +} +function removeTaunt(card){ + // If the card has flight delete entity component + if(card in taunt){ + delete taunt[card]; + return true; + } + return false; +} // Active function equip(){ @@ -554,6 +567,11 @@ function doEffect(itemKey, effectIndex, effectStep, effectTriggerId){ givePassive(itemKey, effectIndex, effectStep, step['amount'], effectTriggerId, 'flight'); break; + // Give Taunt + case 6: + givePassive(itemKey, effectIndex, effectStep, step['amount'], effectTriggerId, 'taunt'); + break; + } // Add the selected targets to the queuedItem so it can be referred to in future diff --git a/public/index.html b/public/index.html index b2cfa00..e34efda 100644 --- a/public/index.html +++ b/public/index.html @@ -80,6 +80,7 @@ +