mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
better handling of dangerousnes, etc. fixes #107
This commit is contained in:
parent
46f14c22c6
commit
aff23e8de0
4 changed files with 9 additions and 18 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue