From b57936ab3ba3fda6298055babb7a4a86c652538c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Thu, 25 Sep 2014 16:19:12 +0200 Subject: [PATCH] Attacks may now be undefendible --- src/jsds.js | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/jsds.js b/src/jsds.js index c1dc90d..a667db8 100644 --- a/src/jsds.js +++ b/src/jsds.js @@ -125,6 +125,7 @@ }; this.life = this.battle["life"]*1; this.att = "melee"; + this.defendible = true; }, attack: function(enem) { @@ -136,23 +137,27 @@ output.append('Angriff Fehlgeschlagen!
'); } else { - output.append(this.info.cname + " trifft mit " + attack_val + "
"); - var defense_val = dice(this.battle.defense); - console.log(attack_val + ", " + defense_val); - attack_val -= defense_val; - attack_val = Math.max(attack_val, 0); - if ( ! defense_val ) { - output.append(enem.info.cname + " kann sich nicht wehren!
"); + output.append(this.info.cname + " trifft mit " + attack_val + "
"); + if ( this.defendible ) { + var defense_val = dice(this.battle.defense); + console.log(attack_val + ", " + defense_val); + attack_val -= defense_val; + attack_val = Math.max(attack_val, 0); + if ( ! defense_val ) { + output.append(enem.info.cname + " kann sich nicht wehren!
"); + } + else { + output.append(enem.info.cname + " wehrt sich mit " + defense_val+".
"); + } + if ( attack_val === 0 ) { + output.append("Vollständig Abgewehrt!
"); + return; + } } else { - output.append(enem.info.cname + " wehrt sich mit " + defense_val+".
"); - } - if ( attack_val === 0 ) { - output.append("Vollständig Abgewehrt!
"); - } - else { - output.append("Schaden: "+attack_val+"
"); + output.append("Nicht abwehrbar!
"); }; + output.append("Schaden: "+attack_val+"
"); enem.life -= attack_val; if( enem.life <= 0 ) { if ( enem.enem ){ @@ -191,14 +196,20 @@ outstr += ""; outstr += ""; - outstr += ""; + outstr += "
"; + + outstr += "Abwehrbar? "; + outstr += "