UI now has input-fields, although they are not binded by now.
This commit is contained in:
parent
3b67537a88
commit
f5ddc83e4d
1 changed files with 44 additions and 25 deletions
61
src/jsds.js
61
src/jsds.js
|
@ -125,28 +125,27 @@
|
||||||
/* Battle-info may either be set as an argument, or need to be calculated from attributes
|
/* Battle-info may either be set as an argument, or need to be calculated from attributes
|
||||||
* and properties
|
* and properties
|
||||||
*/
|
*/
|
||||||
|
this.battle_base = {};
|
||||||
this.battle={};
|
this.battle={};
|
||||||
|
|
||||||
if(battle) {
|
if(battle) {
|
||||||
this.battle={"life": battle["life"]*1, "defense": battle["defense"]*1,"ini":battle["ini"]*1,
|
this.battle_base={"life": battle["life"]*1, "defense": battle["defense"]*1,"ini":battle["ini"]*1,
|
||||||
"walk": battle["walk"]*1, "melee": battle["melee"]*1,
|
"walk": battle["walk"]*1, "melee": battle["melee"]*1,
|
||||||
"shoot": battle["shoot"]*1, "chant": battle["chant"]*1,
|
"shoot": battle["shoot"]*1, "chant": battle["chant"]*1,
|
||||||
"shoot_chant": battle["shoot_chant"]*1};
|
"shoot_chant": battle["shoot_chant"]*1};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This is given by DS-Rules
|
this.calc_battle_base();
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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
|
/* 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
|
/* Curent attack and whether it is defendible
|
||||||
*/
|
*/
|
||||||
this.att = "melee";
|
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
|
// The next three funcs are self-explaining
|
||||||
die: function() {
|
die: function() {
|
||||||
this.graphelement.destroy();
|
this.graphelement.destroy();
|
||||||
|
@ -218,10 +229,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Write out the UI for attack-selection, including binding.
|
// Write out the UI for attack-selection, including binding.
|
||||||
sel_att: function() {
|
sel_att: function() {
|
||||||
var outstr="<p>";
|
var outstr="<p>";
|
||||||
|
outstr += "Boni?<br>";
|
||||||
|
outstr += "Waffenbonus Nahkampf: <input id='wbn' type=numer step=1 min=0></input><br />";
|
||||||
|
outstr += "Waffenbonus Fernkampf: <input id='wbf' type=numer step=1 min=0></input><br>";
|
||||||
|
outstr += "Panzerungsbonus: <input id='pb' type=numer step=1 min=0></input><br>";
|
||||||
|
outstr += "Zauberbonus: <input id='zb' type=numer step=1 min=0></input><br>";
|
||||||
outstr += "Angriffstyp?<br>";
|
outstr += "Angriffstyp?<br>";
|
||||||
outstr += "<select id='att'>";
|
outstr += "<select id='att'>";
|
||||||
outstr += "<option value='melee' id='melee'>Melee (" + this.battle["melee"] + ")</option>";
|
outstr += "<option value='melee' id='melee'>Melee (" + this.battle["melee"] + ")</option>";
|
||||||
|
@ -256,19 +271,23 @@
|
||||||
this.info["class"]= info["class"]+"";
|
this.info["class"]= info["class"]+"";
|
||||||
this.info["level"]= info["level"]*1;
|
this.info["level"]= info["level"]*1;
|
||||||
|
|
||||||
// Set default battle-propoerties.
|
// Set default battle-properties.
|
||||||
this.extern = {"armor":0,"chant":0,"weapon":0};
|
this.extern = {"armor":0,"chant":0,"weapon_far":0,"weapon_near":0};
|
||||||
this.battle.defense += this.extern.armor;
|
this.recalc_battle();
|
||||||
this.battle.melee += this.extern.weapon;
|
|
||||||
this.battle.shoot += this.extern.weapon;
|
|
||||||
this.battle.chant = this.battle.chant + this.extern.chant - this.extern.armor;
|
|
||||||
this.battle.shoot_chant = this.battle.chant + this.extern.chant - this.extern.armor;
|
|
||||||
},
|
},
|
||||||
|
recalc_battle: function() {
|
||||||
|
this.battle.defense = this.battle_base.defense + this.extern.armor;
|
||||||
|
this.battle.melee = this.battle_base.melee + this.extern.weapon_near;
|
||||||
|
this.battle.shoot = this.battle_base.shoot + this.extern.weapon_far;
|
||||||
|
this.battle.chant = this.battle_base.chant + this.extern.chant - this.extern.armor;
|
||||||
|
this.battle.shoot_chant = this.battle_base.chant + this.extern.chant - this.extern.armor;
|
||||||
|
},
|
||||||
|
|
||||||
printoutput: function() {
|
printoutput: function() {
|
||||||
outstr = "<p>";
|
outstr = "<p>";
|
||||||
outstr += this.info.cname + " (gespielt von "+this.info.pname +")<br>";
|
outstr += this.info.cname + " (gespielt von "+this.info.pname +")<br>";
|
||||||
outstr += "Greift derzeit durch " + this.att + " mit einer Stärke von "
|
outstr += "Greift derzeit durch " + this.att + " mit einer Stärke von "
|
||||||
+ this.battle[this.att] + " an.<br>";
|
+ this.battle[this.att] + " an. (WB: "+ this.extern.defense +"<br>";
|
||||||
outstr += "Verteidigungsstärke: " + this.battle.defense + "<br>";
|
outstr += "Verteidigungsstärke: " + this.battle.defense + "<br>";
|
||||||
outstr += "Kraftpunkte: " + this.life;
|
outstr += "Kraftpunkte: " + this.life;
|
||||||
outstr += "</p>";
|
outstr += "</p>";
|
||||||
|
|
Loading…
Reference in a new issue