camelot-unchained
Version:
Camelot Unchained Client Library
86 lines (75 loc) • 3.1 kB
JavaScript
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Combatant = function () {
function Combatant() {
var combatant = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, Combatant);
this.name = combatant.name || "";
this.health = combatant.health || 0;
this.maxHealth = combatant.maxHealth || 0;
this.stamina = combatant.stamina || 0;
this.maxStamina = combatant.maxStamina || 0;
this.injuries = combatant.injuries || [];
}
/**
* Reset combatant state to nil [for when not got a target]
*/
_createClass(Combatant, [{
key: "reset",
value: function reset() {
this.name = "";
this.health = 0;
this.maxHealth = 0;
this.stamina = 0;
this.maxStamina = 0;
this.injuries = [];
}
}, {
key: "setRace",
value: function setRace(race) {} // override to support race
}, {
key: "setArchetype",
value: function setArchetype(archetype) {} /// override to support archetype
}, {
key: "setName",
value: function setName(name) {
this.name = name;
}
}, {
key: "setHealth",
value: function setHealth(health, maxHealth) {
this.health = health;
this.maxHealth = maxHealth;
}
}, {
key: "setStamina",
value: function setStamina(stamina, maxStamina) {
this.stamina = stamina;
this.maxStamina = maxStamina;
}
}, {
key: "setInjury",
value: function setInjury(part, health, maxHealth, wounds) {
var injury = this.injuries[part] = this.injuries[part] || {};
injury.part = part;
injury.health = health;
injury.maxHealth = maxHealth;
injury.wounds = wounds;
}
}], [{
key: "create",
value: function create() {
var a = new Combatant();
return a;
}
}]);
return Combatant;
}();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Combatant;