First attack doesn't work due to prototyping
This commit is contained in:
parent
ce629299bb
commit
d48da33db2
2 changed files with 13 additions and 11 deletions
16
src/jsds.js
16
src/jsds.js
|
@ -7,24 +7,19 @@
|
||||||
*/
|
*/
|
||||||
this.info = {"pname": info["pname"]+"", "experience": info["experience"]*1, "race":info["race"]+"",
|
this.info = {"pname": info["pname"]+"", "experience": info["experience"]*1, "race":info["race"]+"",
|
||||||
"size":info["size"]*1};
|
"size":info["size"]*1};
|
||||||
console.log("Info ready");
|
|
||||||
this.attributes = {"body": attributes["body"]*1, "agility": attributes["agility"]*1,
|
this.attributes = {"body": attributes["body"]*1, "agility": attributes["agility"]*1,
|
||||||
"spirit": attributes["spirit"]*1};
|
"spirit": attributes["spirit"]*1};
|
||||||
console.log("Attr ready");
|
|
||||||
this.properties = {"strength": properties["strength"]*1 , "hardness": info["hardness"]*1,
|
this.properties = {"strength": properties["strength"]*1 , "hardness": info["hardness"]*1,
|
||||||
"movement": info["movement"]*1, "skill": properties["skill"]*1,
|
"movement": info["movement"]*1, "skill": properties["skill"]*1,
|
||||||
"mind": properties["mind"]*1, "aura": properties["aura"]*1};
|
"mind": properties["mind"]*1, "aura": properties["aura"]*1};
|
||||||
console.log("Prop ready");
|
|
||||||
this.graphelement = Crafty.e("Creature").creature(this.info["pname"],drawinfo["x"],drawinfo["y"],
|
this.graphelement = Crafty.e("Creature").creature(this.info["pname"],drawinfo["x"],drawinfo["y"],
|
||||||
drawinfo["w"],drawinfo["h"],drawinfo["col"]);
|
drawinfo["w"],drawinfo["h"],drawinfo["col"]);
|
||||||
console.log("Graph ready");
|
|
||||||
|
|
||||||
this.battle = {};
|
this.battle = {};
|
||||||
if(battle) {
|
if(battle) {
|
||||||
this.battle={"life": battle["life"], "defense": battle["defense"],"ini":battle["ini"],
|
this.battle={"life": battle["life"], "defense": battle["defense"],"ini":battle["ini"],
|
||||||
"walk": battle["walk"], "melee": battle["melee"], "shoot": battle["shoot"],
|
"walk": battle["walk"], "melee": battle["melee"], "shoot": battle["shoot"],
|
||||||
"chant": battle["chant"], "shoot_chant": battle["shoot_chant"]};
|
"chant": battle["chant"], "shoot_chant": battle["shoot_chant"]};
|
||||||
console.log("Battle ready");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.battle["life"] = this.attributes.body + this.properties.strength + 10;
|
this.battle["life"] = this.attributes.body + this.properties.strength + 10;
|
||||||
|
@ -35,13 +30,16 @@
|
||||||
this.battle["shoot"] = this.attributes.agility + this.properties.mind;
|
this.battle["shoot"] = this.attributes.agility + this.properties.mind;
|
||||||
this.battle["chant"] = this.attributes.spirit + this.properties.aura;
|
this.battle["chant"] = this.attributes.spirit + this.properties.aura;
|
||||||
this.battle["shoot_chant"] = this.attributes.spirit + this.properties.skill;
|
this.battle["shoot_chant"] = this.attributes.spirit + this.properties.skill;
|
||||||
console.log("Battle ready");
|
|
||||||
};
|
};
|
||||||
this.life = this.battle["life"]*1;
|
this.life = this.battle["life"]*1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Creature.prototype.attack(enem) {
|
Creature.prototype.attack = function(enem) {
|
||||||
return enem.*/
|
console.log("attack");
|
||||||
|
//console.log(this.cname+" greift "+enem.cname+" an!");
|
||||||
|
//console.log("Ergebnis: " + this.melee + ( this.melee > enem.defense? " > " : " < ") + enem.defense);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function Player(info,attributes,properties,drawinfo,battle){ // x,y,w,h,col) {
|
function Player(info,attributes,properties,drawinfo,battle){ // x,y,w,h,col) {
|
||||||
/* info: pname, cname,class, level, experience, race, size
|
/* info: pname, cname,class, level, experience, race, size
|
||||||
|
@ -63,6 +61,7 @@
|
||||||
this.battle.chant = this.battle.chant + this.extern.chant - this.extern.armor;
|
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;
|
this.battle.shoot_chant = this.battle.chant + this.extern.chant - this.extern.armor;
|
||||||
};
|
};
|
||||||
|
Player.prototype = new Creature();
|
||||||
|
|
||||||
Player.prototype.printoutput = function() {
|
Player.prototype.printoutput = function() {
|
||||||
$('#output').empty();
|
$('#output').empty();
|
||||||
|
@ -78,6 +77,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Creature.apply(this,arguments);
|
Creature.apply(this,arguments);
|
||||||
|
this.info.cname=this.info.pname;
|
||||||
};
|
};
|
||||||
|
|
||||||
Beast.prototype.printoutput = function() {
|
Beast.prototype.printoutput = function() {
|
||||||
|
|
|
@ -77,9 +77,11 @@
|
||||||
cur_sel.printoutput();
|
cur_sel.printoutput();
|
||||||
this.enableControl();
|
this.enableControl();
|
||||||
};
|
};
|
||||||
/* if(e.mouseButton === Crafty.mouseButtons.RIGHT) {
|
if(e.mouseButton === Crafty.mouseButtons.RIGHT) {
|
||||||
|
console.log(player[this.id]);
|
||||||
|
console.log(cur_sel);
|
||||||
cur_sel.attack(player[this.id]);
|
cur_sel.attack(player[this.id]);
|
||||||
};*/
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue