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 += "