Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] 스티커 랜덤 로직 추가 #208

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading