2021-06-17 23:37:05 +02:00
|
|
|
import { IMults, UpgradeType } from "./data/upgrades";
|
2021-06-14 21:42:38 +02:00
|
|
|
|
|
|
|
export class GangMemberUpgrade {
|
|
|
|
name: string;
|
|
|
|
cost: number;
|
2021-06-17 23:37:05 +02:00
|
|
|
type: UpgradeType;
|
2021-06-14 21:42:38 +02:00
|
|
|
desc: string;
|
|
|
|
mults: IMults;
|
|
|
|
|
2021-06-17 23:37:05 +02:00
|
|
|
constructor(name = "", cost = 0, type: UpgradeType = UpgradeType.Weapon, mults: IMults = {}) {
|
2021-06-14 21:42:38 +02:00
|
|
|
this.name = name;
|
|
|
|
this.cost = cost;
|
|
|
|
this.type = type;
|
|
|
|
this.mults = mults;
|
|
|
|
|
|
|
|
this.desc = this.createDescription();
|
|
|
|
}
|
|
|
|
|
|
|
|
createDescription(): string {
|
|
|
|
const lines = ["Increases:"];
|
|
|
|
if (this.mults.str != null) {
|
|
|
|
lines.push(`* Strength by ${Math.round((this.mults.str - 1) * 100)}%`);
|
|
|
|
}
|
|
|
|
if (this.mults.def != null) {
|
|
|
|
lines.push(`* Defense by ${Math.round((this.mults.def - 1) * 100)}%`);
|
|
|
|
}
|
|
|
|
if (this.mults.dex != null) {
|
|
|
|
lines.push(`* Dexterity by ${Math.round((this.mults.dex - 1) * 100)}%`);
|
|
|
|
}
|
|
|
|
if (this.mults.agi != null) {
|
|
|
|
lines.push(`* Agility by ${Math.round((this.mults.agi - 1) * 100)}%`);
|
|
|
|
}
|
|
|
|
if (this.mults.cha != null) {
|
|
|
|
lines.push(`* Charisma by ${Math.round((this.mults.cha - 1) * 100)}%`);
|
|
|
|
}
|
|
|
|
if (this.mults.hack != null) {
|
|
|
|
lines.push(`* Hacking by ${Math.round((this.mults.hack - 1) * 100)}%`);
|
|
|
|
}
|
|
|
|
return lines.join("<br>");
|
|
|
|
}
|
|
|
|
|
2021-06-16 08:26:10 +02:00
|
|
|
// User friendly version of type.
|
|
|
|
getType(): string {
|
|
|
|
switch (this.type) {
|
2021-06-17 23:37:05 +02:00
|
|
|
case UpgradeType.Weapon:
|
2021-06-16 08:26:10 +02:00
|
|
|
return "Weapon";
|
2021-06-17 23:37:05 +02:00
|
|
|
case UpgradeType.Armor:
|
2021-06-16 08:26:10 +02:00
|
|
|
return "Armor";
|
2021-06-17 23:37:05 +02:00
|
|
|
case UpgradeType.Vehicle:
|
2021-06-16 08:26:10 +02:00
|
|
|
return "Vehicle";
|
2021-06-17 23:37:05 +02:00
|
|
|
case UpgradeType.Rootkit:
|
2021-06-16 08:26:10 +02:00
|
|
|
return "Rootkit";
|
2021-06-17 23:37:05 +02:00
|
|
|
case UpgradeType.Augmentation:
|
2021-06-16 08:26:10 +02:00
|
|
|
return "Augmentation";
|
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
2021-06-14 21:42:38 +02:00
|
|
|
}
|