1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-23 19:32:11 +00:00
cards-database/interfaces/AbilityType.ts
Florian Bouillon 4190dd8e27
Update interfaces
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2020-02-08 00:41:23 +01:00

60 lines
987 B
TypeScript
Raw Blame History

enum AbilityType {
POKEBODY,
POKEPOWER,
TALENT,
ANCIENTTRAIT
}
const en = [
"Poké-Body",
"Poké-Power",
"Ability",
"Ancient Trait"
]
const fr = [
"Poké-Body",
"Poké-Power",
"Talent",
"Trait Ancien"
]
namespace AbilityType {
export function toLang(a: AbilityType, lang: string): string {
switch (lang) {
case "en":
return en[a]
case "fr":
return fr[a]
}
throw new Error(`Error , abilityType not translated! (${lang})`)
}
export function getFromText(txt: string): AbilityType {
switch (txt) {
case "Ability":
case "Talent":
return AbilityType.TALENT
case "Poké-Body":
case "Pok<6F><6B>-Body":
return AbilityType.POKEBODY
case "Poké-Power":
case "Pokémon Power":
case "Pok<6F><6B>-Power":
return AbilityType.POKEPOWER
case "Ancient Trait":
case "Trait Antique":
return AbilityType.ANCIENTTRAIT
default:
throw new Error(`Ability Type (${txt}) not found!`)
}
}
}
export default AbilityType