Add the KUDOS SLAM and GREAT MINDS achievements
authorCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 22:19:07 +0000 (15:19 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 22:19:07 +0000 (15:19 -0700)
At this point, I've implemented all of the achievements we originally
thought of, (except for TWINNER which is going to take a bit more code
to find cases where it applies).

empathy/empathy.jsx

index 37fd910e75eeca154e304b08dda107414456a9dc..39889f7d8d7d16e4aba10f4385d8564931696a57 100644 (file)
@@ -1245,11 +1245,15 @@ class Game extends React.PureComponent {
               if (score.score === state.active_prompt.items) {
                 quirkster = <span className="achievement">Quirkster!</span>;
               }
+              let kudos_slam = null;
+              if (score.kudos > 0 && score.kudos >= players_total - 1) {
+                kudos_slam = <span className="achievement">Kudos Slam!</span>;
+              }
               return (
                 <li key={score.players[0]}>
                   {score.players.join("/")}: {score.score}
                   {score.kudos ? `, ${'★'.repeat(score.kudos)}` : ""}
-                  {perfect} {quirkster}
+                  {' '}{perfect} {quirkster} {kudos_slam}
                 </li>
               );
             })}
@@ -1257,11 +1261,20 @@ class Game extends React.PureComponent {
           <h2>Words submitted</h2>
           <ul>
             {state.scores.words.map(word => {
+              let great_minds = null;
+              if (word.kudos.length && word.players.length > 1) {
+                great_minds = <span className="achievement">Great Minds!</span>;
+              }
+              let kudos_slam = null;
+              if (word.kudos.length > 0 && word.kudos.length >= players_total - 1) {
+                kudos_slam = <span className="achievement">Kudos Slam!</span>;
+              }
               return (
                 <li key={word.word}>
                   {word.word} ({word.players.length}
                   {word.kudos.length ? `, ${'★'.repeat(word.kudos.length)}` : ""}
                   ): {word.players.join(', ')}
+                  {' '}{great_minds}{kudos_slam}
                 </li>
               );
             })}