From baddc2e2123f119670e8a8299703a777341f0e45 Mon Sep 17 00:00:00 2001 From: juhyojeong Date: Sat, 24 Aug 2024 20:20:53 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EC=8A=A4=ED=8B=B0=EC=BB=A4=20?= =?UTF-8?q?=EB=9E=9C=EB=8D=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/constants/CasperCustom/casper.ts | 1 + client/src/contexts/casperCustomContext.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/constants/CasperCustom/casper.ts b/client/src/constants/CasperCustom/casper.ts index 0338d6fe..8127eb1e 100644 --- a/client/src/constants/CasperCustom/casper.ts +++ b/client/src/constants/CasperCustom/casper.ts @@ -301,6 +301,7 @@ export const OPTION_MAX_COUNT = { [CUSTOM_OPTION.EYES_DIRECTION]: CASPER_OPTION[CUSTOM_OPTION.EYES_DIRECTION].length, [CUSTOM_OPTION.MOUTH]: CASPER_OPTION[CUSTOM_OPTION.MOUTH].length, [CUSTOM_OPTION.COLOR]: CASPER_OPTION[CUSTOM_OPTION.COLOR].length, + [CUSTOM_OPTION.STICKER]: CASPER_OPTION[CUSTOM_OPTION.STICKER].length, }; export const enum CASPER_SIZE_OPTION { diff --git a/client/src/contexts/casperCustomContext.tsx b/client/src/contexts/casperCustomContext.tsx index c9ef55d2..37206358 100644 --- a/client/src/contexts/casperCustomContext.tsx +++ b/client/src/contexts/casperCustomContext.tsx @@ -53,7 +53,8 @@ const casperCustomReducer = ( } return state; } - case CASPER_ACTION.SHUFFLE_CASPER: + case CASPER_ACTION.SHUFFLE_CASPER: { + const hasSticker = state.selectedCasperIdx[CUSTOM_OPTION.STICKER] !== null; return { ...state, selectedCasperIdx: { @@ -64,8 +65,12 @@ const casperCustomReducer = ( ), [CUSTOM_OPTION.MOUTH]: getRandomInt(OPTION_MAX_COUNT[CUSTOM_OPTION.MOUTH]), [CUSTOM_OPTION.COLOR]: getRandomInt(OPTION_MAX_COUNT[CUSTOM_OPTION.COLOR]), + [CUSTOM_OPTION.STICKER]: hasSticker + ? getRandomInt(OPTION_MAX_COUNT[CUSTOM_OPTION.STICKER]) + : null, }, }; + } case CASPER_ACTION.RESET_CUSTOM: return initialState; default: