1
0
Fork 0
This repository has been archived on 2023-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
chellaris-galaxy-political-.../types/stellaris.ts
2023-06-03 03:02:14 +02:00

67 lines
1.4 KiB
TypeScript

// Ethics Data should be stored differently after Game 15, class will stil be needed for compat reasons afterwards
export class EthicsDataG15 {
// Array index determines fanatic or regular, Index value represents number of occurences
private data: Array<number> = [0]
constructor(data: Array<number>) {
this.data[Scale.normal] = data[0],
this.data[Scale.fanatic] = data[1]
}
sum(weigthed: boolean): number {
let sum = 0;
// skip 0 index since it isn't used
this.data.slice(1,this.data.length).forEach((value, index) => {
// Since the index is accessed via scale enum this works, if not weighted override to 1
let factor = index + 1;
if (!weigthed) {
factor = 1;
}
sum = sum + value * factor;
});
return sum;
}
sumRegular(): number {
return this.data[Scale.normal];
}
}
export enum Ethics {
Egalitarian = 0,
Authoritarian = 1,
Militarist = 2,
Pacifist = 3,
Xenophobe = 4,
Xenophile = 5,
Competitive = 6,
Cooperative = 7,
Elitist = 8,
Pluralist = 9,
Materialist = 10,
Spiritualist = 11,
Ecologist = 12,
Industrialist = 13,
}
export enum Scale {
normal = 1,
fanatic = 2,
}
export enum Species {
Humanoid = 0,
Mammalian = 1,
Reptilian = 2,
Avian = 3,
Arthropod = 4,
Molluscoid = 5,
Fungoid = 6,
Plantoid = 7,
Lithoid = 8,
Necroid = 9,
Aquatic = 10,
Toxoid = 11,
Machine = 12,
}