Attacks may now be undefendible
This commit is contained in:
parent
e2d4a73d81
commit
b57936ab3b
1 changed files with 28 additions and 17 deletions
17
src/jsds.js
17
src/jsds.js
|
@ -125,6 +125,7 @@
|
||||||
};
|
};
|
||||||
this.life = this.battle["life"]*1;
|
this.life = this.battle["life"]*1;
|
||||||
this.att = "melee";
|
this.att = "melee";
|
||||||
|
this.defendible = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
attack: function(enem) {
|
attack: function(enem) {
|
||||||
|
@ -137,6 +138,7 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
output.append(this.info.cname + " trifft mit " + attack_val + "<br>");
|
output.append(this.info.cname + " trifft mit " + attack_val + "<br>");
|
||||||
|
if ( this.defendible ) {
|
||||||
var defense_val = dice(this.battle.defense);
|
var defense_val = dice(this.battle.defense);
|
||||||
console.log(attack_val + ", " + defense_val);
|
console.log(attack_val + ", " + defense_val);
|
||||||
attack_val -= defense_val;
|
attack_val -= defense_val;
|
||||||
|
@ -149,10 +151,13 @@
|
||||||
}
|
}
|
||||||
if ( attack_val === 0 ) {
|
if ( attack_val === 0 ) {
|
||||||
output.append("Vollständig Abgewehrt!<br>");
|
output.append("Vollständig Abgewehrt!<br>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
output.append("Schaden: "+attack_val+"<br>");
|
output.append("Nicht abwehrbar!<br>");
|
||||||
};
|
};
|
||||||
|
output.append("Schaden: "+attack_val+"<br>");
|
||||||
enem.life -= attack_val;
|
enem.life -= attack_val;
|
||||||
if( enem.life <= 0 ) {
|
if( enem.life <= 0 ) {
|
||||||
if ( enem.enem ){
|
if ( enem.enem ){
|
||||||
|
@ -191,12 +196,18 @@
|
||||||
outstr += "<option value='shoot' id='shoot'>Schuss (" + this.battle["shoot"] + ")</option>";
|
outstr += "<option value='shoot' id='shoot'>Schuss (" + this.battle["shoot"] + ")</option>";
|
||||||
outstr += "<option value='shoot_chant' id='shoot_chant'>Zielzauber (" +this.battle["shoot_chant"]
|
outstr += "<option value='shoot_chant' id='shoot_chant'>Zielzauber (" +this.battle["shoot_chant"]
|
||||||
+")</option>";
|
+")</option>";
|
||||||
outstr += "</select>";
|
outstr += "</select><br>";
|
||||||
|
|
||||||
|
outstr += "Abwehrbar? ";
|
||||||
|
outstr += "<select id='defendible'>";
|
||||||
|
outstr += "<option value=true selected=true>Ja</option>";
|
||||||
|
outstr += "<option value=false>Nein</option>";
|
||||||
|
|
||||||
$('#ui').html(outstr);
|
$('#ui').html(outstr);
|
||||||
$('#att').bind("change", function() {cur_sel.att=this.value;});
|
$('#att').bind("change", function() {cur_sel.att=this.value;});
|
||||||
|
$('#defendible').bind("change", function() { cur_sel.defendible = (this.value === "true" ? true : false);});
|
||||||
$("#"+this.att).get(0).selected="true";
|
$("#"+this.att).get(0).selected="true";
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var Player = Creature.extend({
|
var Player = Creature.extend({
|
||||||
|
|
Loading…
Reference in a new issue