better handling of dangerousnes, etc. fixes #107

This commit is contained in:
Jeena 2015-04-02 22:49:43 +02:00
parent 46f14c22c6
commit aff23e8de0
4 changed files with 9 additions and 18 deletions

View file

@ -60,29 +60,19 @@ function (Parent, Nc) {
}
};
Player.prototype.addDamage = function(damage, enemy, byItem, reheal) {
Player.prototype.addDamage = function(damage, enemy, byItem) {
this.stats.health -= damage;
if(this.stats.health > 100) this.stats.health = 100;
if(this.stats.health < 0) this.stats.health = 0;
/*
if(this.stats.health <= 0) {
if(enemy != this) enemy.score();
this.kill(enemy, byItem);
} else {
this.broadcastStats();
}
*/
this.broadcastStats();
if (!reheal) {
// reheal hack after 1 second
var self = this;
setTimeout(function(){
self.addDamage(-100, enemy, byItem, true);
}, 2500);
}
};
Player.prototype.spawn = function(x, y) {
@ -104,8 +94,6 @@ function (Parent, Nc) {
item: byItem ? byItem.options.name : "Suicide"
});
Nc.trigger(Nc.ns.channel.events.game.player.killed, this, killedByPlayer); // sends endround
if(this.ragDoll) {