2015-01-28 00:00:00 +00:00
|
|
|
/// <reference path="../LootTemplate.ts"/>
|
|
|
|
|
2017-02-09 00:00:35 +00:00
|
|
|
module TS.SpaceTac.Equipments {
|
2015-01-28 00:00:00 +00:00
|
|
|
// Base convenience class for weapons
|
|
|
|
export class AbstractWeapon extends LootTemplate {
|
2015-01-28 00:00:00 +00:00
|
|
|
// Boolean set to true if the weapon can target space
|
|
|
|
can_target_space: boolean;
|
|
|
|
|
2015-02-27 00:00:00 +00:00
|
|
|
constructor(name: string, min_damage: number = 0, max_damage: number = null) {
|
2015-01-28 00:00:00 +00:00
|
|
|
super(SlotType.Weapon, name);
|
|
|
|
|
2015-01-28 00:00:00 +00:00
|
|
|
this.can_target_space = false;
|
|
|
|
|
2017-01-17 00:02:38 +00:00
|
|
|
if (min_damage > 0 || (max_damage != null && max_damage > 0)) {
|
2017-02-09 22:21:39 +00:00
|
|
|
this.addDamage(min_damage, max_damage);
|
2017-01-17 00:02:38 +00:00
|
|
|
}
|
2015-01-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2015-01-28 00:00:00 +00:00
|
|
|
// Set the range for this weapon
|
|
|
|
// Pay attention that *min_distance* means the MAXIMAL reachable distance, but on a low-power loot
|
|
|
|
setRange(min_distance: number, max_distance: number = null, can_target_space: boolean = false): void {
|
|
|
|
this.distance = new Range(min_distance, max_distance);
|
|
|
|
this.can_target_space = can_target_space;
|
|
|
|
}
|
|
|
|
|
2015-03-06 00:00:00 +00:00
|
|
|
// Set the effect radius (blast) for this weapon
|
|
|
|
setBlast(min_blast: number, max_blast: number = null): void {
|
2017-01-17 00:02:38 +00:00
|
|
|
this.blast = new IntegerRange(min_blast, max_blast);
|
2015-03-06 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2015-01-28 00:00:00 +00:00
|
|
|
protected getActionForEquipment(equipment: Equipment): BaseAction {
|
2015-01-28 00:00:00 +00:00
|
|
|
var result = new FireWeaponAction(equipment, this.can_target_space);
|
2015-01-28 00:00:00 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|