95 lines
1.8 KiB
TypeScript
95 lines
1.8 KiB
TypeScript
|
export namespace Ethics {
|
||
|
|
||
|
class eth_template {
|
||
|
protected key: string = "";
|
||
|
private data: Array<{type: Scale, value: number}> = []
|
||
|
|
||
|
constructor(data: Array<{type: Scale, value: number}>) {
|
||
|
this.data = data;
|
||
|
}
|
||
|
|
||
|
sum(): number {
|
||
|
let sum = 0;
|
||
|
this.data.forEach((element) => {
|
||
|
sum = sum + element.value * element.type;
|
||
|
});
|
||
|
return sum;
|
||
|
}
|
||
|
|
||
|
entries(): number {
|
||
|
let sum = 0;
|
||
|
this.data.forEach((element) => {
|
||
|
sum = sum + element.value;
|
||
|
});
|
||
|
return sum;
|
||
|
}
|
||
|
|
||
|
getKey(): string {
|
||
|
return this.key
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
export class ega extends eth_template {
|
||
|
protected key = "Egalitarian";
|
||
|
}
|
||
|
|
||
|
export class aut extends eth_template {
|
||
|
protected key = "Authoritarian";
|
||
|
}
|
||
|
|
||
|
export class mil extends eth_template {
|
||
|
protected key = "Militarist";
|
||
|
}
|
||
|
|
||
|
export class pac extends eth_template {
|
||
|
protected key = "Pacifist";
|
||
|
}
|
||
|
|
||
|
export class pho extends eth_template {
|
||
|
protected key = "Xenophobe";
|
||
|
}
|
||
|
|
||
|
export class phi extends eth_template {
|
||
|
protected key = "Xenophile";
|
||
|
}
|
||
|
|
||
|
export class com extends eth_template {
|
||
|
protected key = "Competitive";
|
||
|
}
|
||
|
|
||
|
export class coo extends eth_template {
|
||
|
protected key = "Cooperative";
|
||
|
}
|
||
|
|
||
|
export class eli extends eth_template {
|
||
|
protected key = "Elitist";
|
||
|
}
|
||
|
|
||
|
export class plu extends eth_template {
|
||
|
protected key = "Pluralist";
|
||
|
}
|
||
|
|
||
|
export class mat extends eth_template {
|
||
|
protected key = "Materialsit";
|
||
|
}
|
||
|
|
||
|
export class spi extends eth_template {
|
||
|
protected key = "Spiritualist";
|
||
|
}
|
||
|
|
||
|
export class eco extends eth_template {
|
||
|
protected key = "Ecologist";
|
||
|
}
|
||
|
|
||
|
export class ind extends eth_template {
|
||
|
protected key = "Industrialist";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export enum Scale {
|
||
|
normal = 1,
|
||
|
fanatic = 2
|
||
|
}
|
||
|
|