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: