Feat : add most token effects

This commit is contained in:
2024-07-14 00:05:55 +02:00
parent b1c9644941
commit 3c5b30be9e
6 changed files with 166 additions and 11 deletions
+56
View File
@@ -153,3 +153,59 @@ export async function lockEffect(game: string, effectId: string) {
}
);
}
export async function makeDiscard(
game: string,
playerId: string,
amount: number = 1
) {
const config = useRuntimeConfig();
await $fetch(
new URL(
`games/${game}/turn/makeDiscard/${playerId}`,
config.public.endpoint
).href,
{
method: "POST",
credentials: "include",
}
);
}
export async function damagePlayer(
game: string,
playerId: string,
amount: number = 1
) {
const config = useRuntimeConfig();
await $fetch(
new URL(
`games/${game}/turn/damagePlayer/${playerId}`,
config.public.endpoint
).href,
{
method: "POST",
credentials: "include",
body: { amount },
}
);
}
export async function damageChampion(
game: string,
playerId: string,
cardId: string
) {
const config = useRuntimeConfig();
await $fetch(
new URL(
`games/${game}/turn/damageChampion/${cardId}`,
config.public.endpoint
).href,
{
method: "POST",
credentials: "include",
body: { playerId },
}
);
}
+11
View File
@@ -41,6 +41,16 @@ export enum CardEffects {
PICK_FACTION = "pick_faction",
}
export enum CardType {
HERO = "hero",
HERO_ABILITY = "hero_ability",
CURRENCY = "currency",
WEAPON = "weapon",
CHAMPION = "champion",
ACTION = "action",
ITEM = "item",
}
export interface GameObject {
_id: string;
}
@@ -95,5 +105,6 @@ export interface Effect extends GameObject {
}
export interface Card extends GameObject {
cardId: number;
cardType: CardType;
effects: Effect[];
}