Skip to content

Commit

Permalink
fixed score achievements
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBacon committed Jul 9, 2020
1 parent be5ef38 commit 19723ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/src/constants/Achievements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
// }

export default {
"score-20": {
name: "Scored 20 points in a single game",
},
"score-50": {
name: "Scored 50 points in a single game",
},
Expand Down
9 changes: 9 additions & 0 deletions client/src/rematch/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ export const score = {
effects: {
updateTotal(current, { score }) {
const total = score.total + current;

if (current > 100) {
dispatch.achievements.unlock("score-100");
} else if (current > 50) {
dispatch.achievements.unlock("score-50");
} else if (current > 20) {
dispatch.achievements.unlock("score-20");
}

if (total > 10000) {
dispatch.achievements.unlock("total-score-10000");
} else if (total > 5000) {
Expand Down

0 comments on commit 19723ca

Please sign in to comment.