compiler/endpoints/attackUtil.ts
Florian Bouillon ef866401a4
Moved files to link with the SDK
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2020-03-11 11:21:40 +01:00

15 lines
577 B
TypeScript

import Attack from "@tcgdex/sdk/interfaces/Attack";
import { Langs } from "@tcgdex/sdk/interfaces/LangList";
import Type from "@tcgdex/sdk/interfaces/Type";
import { AttackSingle } from "@tcgdex/sdk/interfaces/Attack";
import TranslationUtil from "@tcgdex/sdk/TranslationUtil";
export function attackToAttackSingle(attack: Attack, lang: Langs): AttackSingle {
return {
name: attack.name[lang],
cost: attack.cost && attack.cost.map(el => TranslationUtil.translate("type", el, lang)),
text: attack.text && attack.text[lang],
damage: attack.damage && attack.damage
}
}