123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /// <reference path="../Clothing.ts" />
- /// <reference path="../Person/Attribute.ts" />
- interface WeaponOptions extends ClothingOptions {
- leftHand : boolean;
- rightHand : boolean;
- attribute? : Attribute;
- attackCost? : number;
- attributeDamageFactor? : number;
- attributeForceFactor? : number;
- accuracy? : number;
- }
- class Weapon extends Clothing implements Weaponized {
- private attribute : Attribute;
- private attributeDamageFactor : number;
- private attackCost : number;
- private attributeForceFactor : number;
- private accuracy : number;
- constructor (t : WeaponOptions) {
- super(t);
- if (t.leftHand) {
- this.slots.push(Humanoid.SLOT_LEFTHAND);
- }
- if (t.rightHand) {
- this.slots.push(Humanoid.SLOT_RIGHTHAND);
- }
- this.attackCost = t.attackCost == undefined ? 1 : t.attackCost;
- this.attributeDamageFactor = t.attributeDamageFactor == undefined ? 1 : t.attributeDamageFactor;
- this.attributeForceFactor = t.attributeForceFactor == undefined ? 1 : t.attributeForceFactor;
- this.accuracy = t.accuracy == undefined ? 0 : t.accuracy;
- this.attribute = t.attribute;
- }
- /**
- * Implements Weaponized
- */
- public getAttribute () {
- return this.attribute;
- }
- public getAttributeDamageFactor () {
- return this.attributeDamageFactor;
- }
- public getAttributeForceFactor () {
- return this.attributeForceFactor;
- }
- public getAccuracy () {
- return this.accuracy;
- }
- public getCost () {
- return this.attackCost;
- }
- }
|