diff --git a/index.html b/index.html
index 32ee965..f0ed19a 100644
--- a/index.html
+++ b/index.html
@@ -8,9 +8,9 @@
JSDSH - Javascript Dungeonslayers Helper
+
-
diff --git a/src/jsds.js b/src/jsds.js
index 195cc25..850af19 100644
--- a/src/jsds.js
+++ b/src/jsds.js
@@ -1,5 +1,8 @@
{
- // OOP-Setup
+ // OOP-Setup, thanks to Florian Rappl for this piece of Code
+ // Source:
+ // http://www.florian-rappl.de/Articles/Page/116/super-mario5-article
+
var reflection = {};
(function(){
@@ -72,13 +75,10 @@
* properties: strength, hardness, movement, skill, mind, aura
* drawinfo: x,y,w,h,col
*/
- console.log("Creature called!");
this.info = {"pname": info["pname"]+"", "experience": info["experience"]*1, "race":info["race"]+"",
"size":info["size"]*1};
- console.log("Creature Ready!");
this.attributes = {"body": attributes["body"]*1, "agility": attributes["agility"]*1,
"spirit": attributes["spirit"]*1};
- console.log("Problem?");
this.properties = {"strength": properties["strength"]*1 , "hardness": properties["hardness"]*1,
"movement": properties["movement"]*1, "skill": properties["skill"]*1,
"mind": properties["mind"]*1, "aura": properties["aura"]*1};
@@ -102,12 +102,29 @@
this.battle["shoot_chant"] = this.attributes.spirit + this.properties.skill;
};
this.life = this.battle["life"]*1;
+ this.att = "melee";
+ console.log("Attack: "+this.att);
},
attack: function(enem) {
//console.log("attack");
console.log(this.info.cname+" greift "+enem.info.cname+" an!");
- console.log("Ergebnis: " + this.battle.melee + ( this.battle.melee > enem.battle.defense ? " > " : " < ") + enem.battle.defense);
+ console.log("Ergebnis: " + this.battle[this.att]
+ + ( this.battle[this.att] > enem.battle.defense ? " > " : " < ") + enem.battle.defense);
+ },
+ sel_att: function() {
+ var outstr="";
+ outstr += "Angriffstyp?
";
+ outstr += "";
+ $('#ui').html(outstr);
+ $('#att').bind("change", function() {cur_sel.att=this.value;});
+ $("#"+this.att).get(0).selected="true";
}
+
});
var Player = Creature.extend({
@@ -133,6 +150,7 @@
},
printoutput: function() {
$('#output').empty();
+ $('#ui').empty();
$('#output').html(this.info.cname+"
"+this.info.pname);
}
});
@@ -151,6 +169,7 @@
},
printoutput: function() {
$('#output').empty();
+ $('#ui').empty();
$('#output').html(this.info.race+"
"+this.info.pname);
}
});
diff --git a/src/jsds_crafty.js b/src/jsds_crafty.js
index 5bed572..e1a48a2 100644
--- a/src/jsds_crafty.js
+++ b/src/jsds_crafty.js
@@ -79,8 +79,9 @@
};
if(e.mouseButton === Crafty.mouseButtons.RIGHT) {
if ( !cur_sel ) { return; };
- if ( cur_sel == player[this.id])
+ if ( cur_sel == player[this.id] )
{
+ cur_sel.sel_att();
}
else {
cur_sel.attack(player[this.id]);