From 8f3f438704f54a249f9e86e5e50ec56bfb2e3c6e Mon Sep 17 00:00:00 2001 From: jollygrin Date: Sat, 30 Mar 2024 04:20:25 +0100 Subject: [PATCH] dont allow boost if a boost exists --- components/DeckPool/PoolFns.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/DeckPool/PoolFns.ts b/components/DeckPool/PoolFns.ts index 514aae5..9a6f1a7 100644 --- a/components/DeckPool/PoolFns.ts +++ b/components/DeckPool/PoolFns.ts @@ -183,6 +183,7 @@ export const commitCard = (pool: PoolType, cardIndex: number): PoolType => { export const boostCard = (pool: PoolType, cardIndex: number): PoolType => { if (!pool?.hand) return pool; + if (pool.commit.boost) return pool; pool.commit.boost = pool.hand[cardIndex]; pool.hand.splice(cardIndex, 1); return pool; @@ -190,18 +191,18 @@ export const boostCard = (pool: PoolType, cardIndex: number): PoolType => { export const cancelBoost = (pool: PoolType): PoolType => { if (!pool?.commit.boost) return pool; - pool.hand.push(pool.commit.boost); + pool.hand.unshift(pool.commit.boost); pool.commit.boost = null; return pool; }; export const discardCommit = (pool: PoolType): PoolType => { if (!pool.commit.main) return pool; - pool.discard.push(pool.commit.main); + pool.discard.unshift(pool.commit.main); pool.commit.main = null; if (pool.commit.boost) { - pool.discard.push(pool.commit.boost); + pool.discard.unshift(pool.commit.boost); pool.commit.boost = null; }