Feat : add tokens, handle mutex effects
This commit is contained in:
+11
-5
@@ -111,7 +111,9 @@ eventSource.addEventListener("message", async (message) => {
|
||||
const toContainer = containers.value[data.to as string];
|
||||
for (const card of data.cards) {
|
||||
queueAction(async () => {
|
||||
const index = fromContainer.cards.findIndex((c) => c._id == card._id);
|
||||
const index = fromContainer.cards.findIndex(
|
||||
(c) => !c || c._id == card._id
|
||||
);
|
||||
fromContainer.cards.splice(index, 1);
|
||||
await delay(settingsStore.animationSpeed);
|
||||
});
|
||||
@@ -134,7 +136,6 @@ eventSource.addEventListener("message", async (message) => {
|
||||
const playingPlayer = current_game.teams.find(
|
||||
(t) => t._id == current_game.currentTurn.currentTeam
|
||||
)?.players[0];
|
||||
console.log(playingPlayer);
|
||||
if (playingPlayer) {
|
||||
focusPlayer(playingPlayer);
|
||||
await delay(settingsStore.animationSpeed);
|
||||
@@ -151,9 +152,9 @@ eventSource.addEventListener("message", async (message) => {
|
||||
playSound("/sounds/teleport.mp3");
|
||||
current_game.teams.push(data.team);
|
||||
});
|
||||
} else if (data.type == "useEffect") {
|
||||
} else if (data.type == "lockEffect") {
|
||||
queueAction(async () => {
|
||||
current_game.currentTurn.effectsUsed.push(data.effect);
|
||||
current_game.currentTurn.lockedEffects.push(data.effect);
|
||||
await delay(settingsStore.animationSpeed);
|
||||
});
|
||||
} else if (data.type == "currentTurn.updateGold") {
|
||||
@@ -166,6 +167,11 @@ eventSource.addEventListener("message", async (message) => {
|
||||
console.log(`adding damage amount : ` + data.operation);
|
||||
current_game.currentTurn.damage = data.damage;
|
||||
});
|
||||
} else if (data.type == "currentTurn.addToken") {
|
||||
queueAction(async () => {
|
||||
current_game.currentTurn.tokens.push(data.token);
|
||||
await delay(settingsStore.animationSpeed);
|
||||
});
|
||||
} else if (data.type == "team.updateHealth") {
|
||||
queueAction(async () => {
|
||||
const team = game.value?.teams.find((t) => t._id == data.team);
|
||||
@@ -278,7 +284,7 @@ onUnmounted(() => {
|
||||
:fire_gems="game.fireGems"
|
||||
:marketStack="game.marketStack"
|
||||
></MarketCards>
|
||||
<!-- <div id="turnStats">{{ game.currentTurn.gold }} {{ game.currentTurn.damage }}</div> -->
|
||||
<div id="turnStats">{{ game.currentTurn.tokens }}</div>
|
||||
<div id="player_list_container">
|
||||
<div id="player_list">
|
||||
<PlayerListElement
|
||||
|
||||
Reference in New Issue
Block a user