diff --git a/src/jsds.js b/src/jsds.js index 30342e7..2a85bdb 100644 --- a/src/jsds.js +++ b/src/jsds.js @@ -125,28 +125,27 @@ /* Battle-info may either be set as an argument, or need to be calculated from attributes * and properties */ - this.battle = {}; + this.battle_base = {}; + this.battle={}; + if(battle) { - this.battle={"life": battle["life"]*1, "defense": battle["defense"]*1,"ini":battle["ini"]*1, - "walk": battle["walk"]*1, "melee": battle["melee"]*1, - "shoot": battle["shoot"]*1, "chant": battle["chant"]*1, - "shoot_chant": battle["shoot_chant"]*1}; + this.battle_base={"life": battle["life"]*1, "defense": battle["defense"]*1,"ini":battle["ini"]*1, + "walk": battle["walk"]*1, "melee": battle["melee"]*1, + "shoot": battle["shoot"]*1, "chant": battle["chant"]*1, + "shoot_chant": battle["shoot_chant"]*1}; } else { - // This is given by DS-Rules - this.battle["life"] = this.attributes.body + this.properties.strength + 10;; - this.battle["defense"] = this.attributes.body + this.properties.hardness; - this.battle["ini"] = this.attributes.agility + this.properties.movement; - this.battle["walk"] = (this.attributes.agility / 2) +1; - this.battle["melee"] = this.attributes.body + this.properties.strength; - this.battle["shoot"] = this.attributes.agility + this.properties.mind; - this.battle["chant"] = this.attributes.spirit + this.properties.aura; - this.battle["shoot_chant"] = this.attributes.spirit + this.properties.skill; + this.calc_battle_base(); }; + + for ( var i in this.battle_base ) { + this.battle[i] = this.battle_base[i]; + }; + /* Some special attributes: We need two "life" variables, one to have the maximum value - * (the one within battle), the other to see whether a character is dead or unconscious. + * (the one used within battle), the other to see whether a character is dead or unconscious. */ - this.life = this.battle["life"]*1; + this.life = this.battle_base["life"]*1; /* Curent attack and whether it is defendible */ this.att = "melee"; @@ -201,6 +200,18 @@ } }, + calc_battle_base: function() { + // This is given by DS-Rules + this.battle_base["life"] = this.attributes.body + this.properties.strength + 10;; + this.battle_base["defense"] = this.attributes.body + this.properties.hardness; + this.battle_base["ini"] = this.attributes.agility + this.properties.movement; + this.battle_base["walk"] = (this.attributes.agility / 2) +1; + this.battle_base["melee"] = this.attributes.body + this.properties.strength; + this.battle_base["shoot"] = this.attributes.agility + this.properties.mind; + this.battle_base["chant"] = this.attributes.spirit + this.properties.aura; + this.battle_base["shoot_chant"] = this.attributes.spirit + this.properties.skill; + }, + // The next three funcs are self-explaining die: function() { this.graphelement.destroy(); @@ -217,11 +228,15 @@ this.graphelement.color(this.graphelement.oldcolor); } }, - // Write out the UI for attack-selection, including binding. sel_att: function() { var outstr="
";
+ outstr += "Boni?
";
+ outstr += "Waffenbonus Nahkampf:
";
+ outstr += "Waffenbonus Fernkampf:
";
+ outstr += "Panzerungsbonus:
";
+ outstr += "Zauberbonus:
";
outstr += "Angriffstyp?
";
outstr += "