Skip to content

Commit

Permalink
Merge pull request #208 from softeerbootcamp4th/dev
Browse files Browse the repository at this point in the history
[Chore] 스티커 랜덤 로직 추가
  • Loading branch information
jhj2713 authored Aug 24, 2024
2 parents ac8cf0d + c5e3c26 commit 940dfda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/src/constants/CasperCustom/casper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 6 additions & 1 deletion client/src/contexts/casperCustomContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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:
Expand Down

0 comments on commit 940dfda

Please sign in to comment.