From b0396f625ae66da2c9ddef7afecfd2451f0c7e27 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Oct 2023 19:10:37 +0000 Subject: [PATCH] Updates --- asset-manifest.json | 6 +++--- index.html | 2 +- .../js/{main.3bfdb865.chunk.js => main.768e55cd.chunk.js} | 4 ++-- ...ain.3bfdb865.chunk.js.map => main.768e55cd.chunk.js.map} | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename static/js/{main.3bfdb865.chunk.js => main.768e55cd.chunk.js} (94%) rename static/js/{main.3bfdb865.chunk.js.map => main.768e55cd.chunk.js.map} (96%) diff --git a/asset-manifest.json b/asset-manifest.json index 00490cd..e76a95e 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,8 +1,8 @@ { "files": { "main.css": "/dungeon-solitaire/static/css/main.9e0252be.chunk.css", - "main.js": "/dungeon-solitaire/static/js/main.3bfdb865.chunk.js", - "main.js.map": "/dungeon-solitaire/static/js/main.3bfdb865.chunk.js.map", + "main.js": "/dungeon-solitaire/static/js/main.768e55cd.chunk.js", + "main.js.map": "/dungeon-solitaire/static/js/main.768e55cd.chunk.js.map", "runtime-main.js": "/dungeon-solitaire/static/js/runtime-main.bff351de.js", "runtime-main.js.map": "/dungeon-solitaire/static/js/runtime-main.bff351de.js.map", "static/js/2.7f90933b.chunk.js": "/dungeon-solitaire/static/js/2.7f90933b.chunk.js", @@ -15,6 +15,6 @@ "static/js/runtime-main.bff351de.js", "static/js/2.7f90933b.chunk.js", "static/css/main.9e0252be.chunk.css", - "static/js/main.3bfdb865.chunk.js" + "static/js/main.768e55cd.chunk.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index 2a07f27..8b7e811 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -dungeon solitaire
\ No newline at end of file +dungeon solitaire
\ No newline at end of file diff --git a/static/js/main.3bfdb865.chunk.js b/static/js/main.768e55cd.chunk.js similarity index 94% rename from static/js/main.3bfdb865.chunk.js rename to static/js/main.768e55cd.chunk.js index a2288fb..5311adc 100644 --- a/static/js/main.3bfdb865.chunk.js +++ b/static/js/main.768e55cd.chunk.js @@ -1,2 +1,2 @@ -(this["webpackJsonpdungeon-solitaire"]=this["webpackJsonpdungeon-solitaire"]||[]).push([[0],{34:function(e,i,t){},63:function(e,i,t){},64:function(e,i,t){"use strict";t.r(i);var s,c,a,l,n=t(11),o=t.n(n),u=t(19),r=t(4),d=t(26),b=t(7),h=t(25),v=t.n(h),j=t(35),y=t(38),p=t(0),f=t(88),k=t(86),O=t(87),x=t(66),m=(t(34),t(2)),g=function(e){var i=e.onClose,t=e.onOpen,s=e.storeFunction,c=e.gold,a=e.difficulty,l=Object(p.useState)(),n=Object(b.a)(l,2),o=n[0],u=n[1],r=function(e){"easy"===a?1===e?c>=5?(u("success"),s("attack",1,5)):u("notEnough"):2===e?c>=10?(u("success"),s("attack",3,10)):u("notEnough"):3===e&&(c>=5?(u("success"),s("health",10,5)):u("notEnough")):1===e?c>=10?(u("success"),s("attack",1,10)):u("notEnough"):2===e?c>=20?(u("success"),s("attack",3,20)):u("notEnough"):3===e&&(c>=5?(u("success"),s("health",5,5)):u("notEnough"))};return Object(m.jsx)(f.a,{onClose:function(){u(null),i()},open:t,children:Object(m.jsxs)("div",{style:{color:"white",backgroundColor:"#121E24",border:"2px solid white"},children:[Object(m.jsx)(k.a,{children:"store"}),Object(m.jsxs)(O.a,{children:[Object(m.jsxs)(x.a,{gutterBottom:!0,children:["buy more attack power",Object(m.jsxs)("button",{onClick:function(){return r(1)},children:["+1 (","easy"===a?"5":"10"," gold)"]}),Object(m.jsxs)("button",{onClick:function(){return r(2)},children:["+3 (","easy"===a?"10":"20"," gold)"]})]}),Object(m.jsxs)(x.a,{gutterBottom:!0,children:["buy more health","easy"===a?Object(m.jsx)("button",{onClick:function(){return r(3)},children:"+10 (5 gold)"}):Object(m.jsx)("button",{onClick:function(){return r(3)},children:"+5 (5 gold)"})]}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"success"===o?Object(m.jsx)("small",{style:{color:"lightgreen"},children:"success!"}):"notEnough"===o?Object(m.jsx)("small",{style:{color:"red"},children:"not enough gold"}):Object(m.jsx)("small",{style:{visibility:"hidden"},children:"-"})})]})]})})},w=function(e){var i=e.onOpen,t=e.onClose;return Object(m.jsx)(f.a,{onClose:function(){t()},open:i,children:Object(m.jsxs)("div",{style:{color:"white",backgroundColor:"#121E24",border:"2px solid white"},children:[Object(m.jsx)(k.a,{children:"how to play"}),Object(m.jsxs)(O.a,{children:[Object(m.jsx)(x.a,{gutterBottom:!0,children:"clear the dungeon of all its monsters and treasures!"}),Object(m.jsx)(x.a,{gutterBottom:!0,children:'begin by receiving an initial health value, randomly selected from 1-20, and an inital attack power value, randomly selected from 1-8. the game is played out of a 52 standard card deck, shuffled up and laid face-down in a 5*10 grid. the last 2 cards are presented to you face-up at the beginning of the game as a "soft" entrance into the dungeon - you select the one you want and the other is discarded.'}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"you then flip over each card and interact with it to clear it. you can only select those that are adjacent to an empty space except for the first card. hearts give you more health and diamonds give you more gold. you roll to determine how much health or gold you get depending on the card's value. for example, if you encountered the 5 of hearts, you will receive an increase in health - randomly selected from 1 to 5."}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"spades and clubs are the enemies of the dungeon. the health of an enemy is equivalent to their card's value. the damage you do to an enemy will be a random value between 1 and the value of your attack power. the damage an enemy does to you will be a random value between 1 and their card's value. a battle between an enemy will end when their health reaches 0 or when your health reaches 0. when you defeat a spade, roll for health, according to the card's value. when defeating a club, roll for gold."}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"use the gold you earn at the shop to upgrade your attack power or get more health. the difficulty of the game determines the prices at the shop."}),Object(m.jsxs)(x.a,{gutterBottom:!0,children:["any questions or concerns, contact me at shaefferjd at gmail dot com. the code for this project lives on"," ",Object(m.jsx)("a",{href:"https://github.com/jdshaeffer/dungeon-solitaire",children:"github"}),"."]})]})]})})},C=0,S=function(e){return Math.ceil(Math.random()*e)},E=function(){var e=Object(j.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=!0,e.next=3,new Promise((function(e){return setTimeout(e,1500)}));case 3:c=!1;case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=function(e){var i=e.difficulty,t=Object(p.useState)(0),n=Object(b.a)(t,2),o=n[0],u=n[1],r=Object(p.useState)(0),h=Object(b.a)(r,2),f=h[0],k=h[1],O=Object(p.useState)(0),x=Object(b.a)(O,2),N=x[0],B=x[1],F=Object(p.useState)(0),q=Object(b.a)(F,2),M=q[0],A=q[1],J=Object(p.useState)(null),I=Object(b.a)(J,2),P=I[0],T=I[1],z=Object(p.useState)("roll for initial health"),D=Object(b.a)(z,2),G=D[0],H=D[1],K=Object(p.useState)(0),L=Object(b.a)(K,2),Q=L[0],R=L[1],U=Object(p.useState)(!1),V=Object(b.a)(U,2),W=V[0],X=V[1],Y=Object(p.useState)(!1),Z=Object(b.a)(Y,2),$=Z[0],_=Z[1],ee=Object(p.useState)(function(e){for(var i,t=e.length;0!==t;){i=Math.floor(Math.random()*t),t--;var c=[e[i],e[t]];e[t]=c[0],e[i]=c[1]}return s=[e.pop(),e.pop()].map((function(e){return Object(y.a)(Object(y.a)({},e),{},{clicked:!0,display:"block",selected:!1})})),e}([{pow:2,value:"2",suit:"spades",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"spades",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"spades",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"spades",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"spades",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"spades",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"spades",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"spades",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"spades",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"spades",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"spades",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"spades",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"spades",clicked:!1,visibility:"visible"},{pow:2,value:"2",suit:"clubs",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"clubs",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"clubs",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"clubs",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"clubs",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"clubs",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"clubs",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"clubs",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"clubs",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"clubs",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"clubs",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"clubs",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"clubs",clicked:!1,visibility:"visible"},{pow:2,value:"2",suit:"hearts",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"hearts",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"hearts",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"hearts",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"hearts",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"hearts",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"hearts",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"hearts",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"hearts",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"hearts",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"hearts",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"hearts",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"hearts",clicked:!1,visibility:"visible"},{pow:2,value:"2",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"diamonds",clicked:!1,visibility:"visible"}])),ie=Object(b.a)(ee,2),te=ie[0],se=ie[1],ce=Object(p.useState)(s),ae=Object(b.a)(ce,2),le=ae[0],ne=ae[1],oe=Object(p.useState)(!1),ue=Object(b.a)(oe,2),re=ue[0],de=ue[1],be=function(e){var i=S(P.pow);"gold"===e?B(N+i):u(o+i),H("your ".concat(e," increased by ").concat(i)),a=!1,l=!1;var t=le.length?le[le.indexOf(P)]:te[te.indexOf(P)];t.visibility="hidden",te[te.indexOf(P)]=t,T(null),se(Object(d.a)(te))},he=function(){var e=Object(j.a)(v.a.mark((function e(){var i,t,s,n,r,b,h;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==M){e.next=5;break}u(S(20)),H("roll for initial attack power"),e.next=60;break;case 5:if(1!==M){e.next=10;break}k(S(8)),H("select one of the above cards to begin"),e.next=60;break;case 10:if(!P||c){e.next=60;break}if(!a){e.next=15;break}be("gold"),e.next=49;break;case 15:if(!l){e.next=19;break}be("health"),e.next=49;break;case 19:if(i=P.pow,"diamonds"!==P.suit){e.next=26;break}t=S(i),B(N+t),H("your gold increased by ".concat(t)),e.next=48;break;case 26:if("hearts"!==P.suit){e.next=32;break}s=S(i),u(o+s),H("your health increased by ".concat(s)),e.next=48;break;case 32:if(n=S(f),R(Q-n<0?0:Q-n),!(Q-n<1)&&Q){e.next=39;break}H("you dealt ".concat(n," damage.\n\t\t\t\t\t\t\t\tyou defeated the ").concat(P.value," of ").concat(P.suit,".\n\t\t\t\t\t\t\t\troll for ").concat("clubs"===P.suit?"gold":"health",".")),"clubs"===P.suit?a=!0:l=!0,e.next=48;break;case 39:return H("you dealt ".concat(n," damage...")),e.next=42,E();case 42:return H("the enemy is now attacking..."),e.next=45,E();case 45:r=S(i),u(o-r<0?0:o-r),o-r<1?(H("the enemy dealt ".concat(r," damage. you died. refresh to try again.")),ne([]),se([]),c=!0):H("the enemy dealt ".concat(r," damage. attack again."));case 48:Q<1&&T(null);case 49:if(!(P.display&&Q<1&&0!==o)){e.next=59;break}return e.next=52,E();case 52:return H("entering the dungeon..."),e.next=55,E();case 55:ne([]),H("select any card to begin"),e.next=60;break;case 59:Q<1&&(b=Object(d.a)(te),(h=te[te.indexOf(P)]).visibility="hidden",te[te.indexOf(P)]=h,se(b));case 60:A(M+1);case 61:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(p.useEffect)((function(){te.every((function(e){return"hidden"===e.visibility}))&&o>0&&de(!0)}),[o,te]),Object(m.jsxs)(m.Fragment,{children:[Object(m.jsx)("h1",{style:{display:re?"block":"none"},children:"bravo, you did it!"}),le.length||re?Object(m.jsx)(m.Fragment,{}):Object(m.jsx)("div",{className:"cards",children:te.map((function(e,i){return Object(m.jsx)("div",{className:"card",onClick:function(){return function(e){if(!e.clicked&&!P){var i=te.indexOf(e);if(te[i+1]&&"hidden"===te[i+1].visibility||te[i-1]&&"hidden"===te[i-1].visibility||te[i+10]&&"hidden"===te[i+10].visibility||te[Math.abs(i-10)]&&"hidden"===te[Math.abs(i-10)].visibility||0===C){var t=Object(d.a)(te),s=te[te.indexOf(e)];s.clicked=!0,te[te.indexOf(e)]=s,se(t),T(e),"spades"!==e.suit&&"clubs"!==e.suit||R(e.pow);var c="hearts"===e.suit?"for health":"diamonds"===e.suit?"for gold":"to attack";H("the ".concat(e.value," of ").concat(e.suit,". roll ").concat(c,".")),C++}else console.log("can't pick that one")}}(e)},style:{visibility:e.visibility},children:e.clicked?"".concat("10"===e.value?e.value.substring(0,2):e.value[0]," ").concat(e.suit[0]):""},i)}))}),M>1?Object(m.jsx)("div",{className:"entrance-cards",children:le.map((function(e,i){return Object(m.jsx)("div",{className:"card",onClick:function(){return function(e){if(!e.selected){var i=Object(d.a)(le),t=le[le.indexOf(e)];t.selected=!0,le[le.indexOf(e)]=t,ne(i.filter((function(e){return e.selected}))),T(e),"spades"!==e.suit&&"clubs"!==e.suit||R(e.pow);var s="hearts"===e.suit?"for health":"diamonds"===e.suit?"for gold":"to attack";H("you selected the ".concat(e.value," of ").concat(e.suit,". roll ").concat(s,"."))}}(e)},style:{display:e.display},children:e.clicked?"".concat("10"===e.value?e.value.substring(0,2):e.value[0]," ").concat(e.suit[0]):""},i)}))}):Object(m.jsx)(m.Fragment,{}),Object(m.jsxs)("div",{className:"stats-container",children:[Object(m.jsxs)("small",{className:"stat",children:["health: ",o]}),Object(m.jsxs)("small",{className:"stat",children:["attack: ",f]}),Object(m.jsxs)("small",{className:"stat",children:["gold: ",N]}),Q?Object(m.jsxs)("small",{className:"stat",children:["enemy health: ",Q]}):Object(m.jsx)(m.Fragment,{})]}),Object(m.jsx)("div",{children:Object(m.jsx)("small",{children:re?"refresh to play again, or try a different difficulty. thanks for playing!":G})}),Object(m.jsx)("div",{children:Object(m.jsx)("button",{onClick:he,style:{display:0===M||o>0&&!re?"block":"none"},children:"roll"})}),Object(m.jsx)("button",{onClick:function(){X(!0)},style:{position:"absolute",left:80,bottom:10,display:re?"none":"block "},children:"store"}),Object(m.jsx)("button",{onClick:function(){_(!0)},style:{position:"absolute",left:10,bottom:10},children:"help"}),Object(m.jsx)(g,{onOpen:W,onClose:function(){X(!1)},storeFunction:function(e,i,t){"attack"===e?k(f+i):"health"===e&&u(o+i),B(N-t)},gold:N,difficulty:i}),Object(m.jsx)(w,{onOpen:$,onClose:function(){_(!1)}})]})},B=function(){return Object(m.jsxs)(m.Fragment,{children:[Object(m.jsx)("h1",{children:"welcome to dungeon solitaire (in beta)"}),Object(m.jsx)("h3",{children:"pick a difficulty:"}),Object(m.jsxs)("div",{children:[Object(m.jsx)(u.b,{to:"dungeon-solitaire/easy",children:Object(m.jsx)("button",{children:"easy"})}),Object(m.jsx)(u.b,{to:"dungeon-solitaire/hard",children:Object(m.jsx)("button",{children:"hard"})})]})]})},F=function(){return Object(m.jsx)("div",{className:"App",children:Object(m.jsx)("header",{className:"App-header",children:Object(m.jsx)(u.a,{children:Object(m.jsxs)(r.c,{children:[Object(m.jsx)(r.a,{exact:!0,path:"/dungeon-solitaire",children:Object(m.jsx)(B,{})}),Object(m.jsx)(r.a,{exact:!0,path:"/dungeon-solitaire/easy",children:Object(m.jsx)(N,{difficulty:"easy"})}),Object(m.jsx)(r.a,{exact:!0,path:"/dungeon-solitaire/hard",children:Object(m.jsx)(N,{difficulty:"hard"})})]})})})})};t(63);o.a.render(Object(m.jsx)(u.a,{children:Object(m.jsx)(F,{})}),document.getElementById("root"))}},[[64,1,2]]]); -//# sourceMappingURL=main.3bfdb865.chunk.js.map \ No newline at end of file +(this["webpackJsonpdungeon-solitaire"]=this["webpackJsonpdungeon-solitaire"]||[]).push([[0],{34:function(e,i,t){},63:function(e,i,t){},64:function(e,i,t){"use strict";t.r(i);var s,c,a,l,n=t(11),o=t.n(n),u=t(19),r=t(4),d=t(26),b=t(7),h=t(25),v=t.n(h),j=t(35),y=t(38),p=t(0),f=t(88),k=t(86),O=t(87),x=t(66),m=(t(34),t(2)),g=function(e){var i=e.onClose,t=e.onOpen,s=e.storeFunction,c=e.gold,a=e.difficulty,l=Object(p.useState)(),n=Object(b.a)(l,2),o=n[0],u=n[1],r=function(e){"easy"===a?1===e?c>=5?(u("success"),s("attack",1,5)):u("notEnough"):2===e?c>=10?(u("success"),s("attack",3,10)):u("notEnough"):3===e&&(c>=5?(u("success"),s("health",10,5)):u("notEnough")):1===e?c>=10?(u("success"),s("attack",1,10)):u("notEnough"):2===e?c>=20?(u("success"),s("attack",3,20)):u("notEnough"):3===e&&(c>=5?(u("success"),s("health",5,5)):u("notEnough"))};return Object(m.jsx)(f.a,{onClose:function(){u(null),i()},open:t,children:Object(m.jsxs)("div",{style:{color:"white",backgroundColor:"#121E24",border:"2px solid white"},children:[Object(m.jsx)(k.a,{children:"store"}),Object(m.jsxs)(O.a,{children:[Object(m.jsxs)(x.a,{gutterBottom:!0,children:["buy more attack power",Object(m.jsxs)("button",{onClick:function(){return r(1)},children:["+1 (","easy"===a?"5":"10"," gold)"]}),Object(m.jsxs)("button",{onClick:function(){return r(2)},children:["+3 (","easy"===a?"10":"20"," gold)"]})]}),Object(m.jsxs)(x.a,{gutterBottom:!0,children:["buy more health","easy"===a?Object(m.jsx)("button",{onClick:function(){return r(3)},children:"+10 (5 gold)"}):Object(m.jsx)("button",{onClick:function(){return r(3)},children:"+5 (5 gold)"})]}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"success"===o?Object(m.jsx)("small",{style:{color:"lightgreen"},children:"success!"}):"notEnough"===o?Object(m.jsx)("small",{style:{color:"red"},children:"not enough gold"}):Object(m.jsx)("small",{style:{visibility:"hidden"},children:"-"})})]})]})})},w=function(e){var i=e.onOpen,t=e.onClose;return Object(m.jsx)(f.a,{onClose:function(){t()},open:i,children:Object(m.jsxs)("div",{style:{color:"white",backgroundColor:"#121E24",border:"2px solid white"},children:[Object(m.jsx)(k.a,{children:"how to play"}),Object(m.jsxs)(O.a,{children:[Object(m.jsx)(x.a,{gutterBottom:!0,children:"clear the dungeon of all its monsters and treasures!"}),Object(m.jsx)(x.a,{gutterBottom:!0,children:'begin by receiving an initial health value, randomly selected from 1-20, and an inital attack power value, randomly selected from 1-8. the game is played out of a 52 standard card deck, shuffled up and laid face-down in a 5*10 grid. the last 2 cards are presented to you face-up at the beginning of the game as a "soft" entrance into the dungeon - you select the one you want and the other is discarded.'}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"you then flip over each card and interact with it to clear it. you can only select those that are adjacent to an empty space except for the first card. hearts give you more health and diamonds give you more gold. you roll to determine how much health or gold you get depending on the card's value. for example, if you encountered the 5 of hearts, you will receive an increase in health - randomly selected from 1 to 5."}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"spades and clubs are the enemies of the dungeon. the health of an enemy is equivalent to their card's value. the damage you do to an enemy will be a random value between 1 and the value of your attack power. the damage an enemy does to you will be a random value between 1 and their card's value. a battle between an enemy will end when their health reaches 0 or when your health reaches 0. when you defeat a spade, roll for health, according to the card's value. when defeating a club, roll for gold."}),Object(m.jsx)(x.a,{gutterBottom:!0,children:"use the gold you earn at the shop to upgrade your attack power or get more health. the difficulty of the game determines the prices at the shop."}),Object(m.jsxs)(x.a,{gutterBottom:!0,children:["any questions or concerns, contact me at shaefferjd at gmail dot com. the code for this project lives on"," ",Object(m.jsx)("a",{href:"https://github.com/jdshaeffer/dungeon-solitaire",children:"github"}),"."]})]})]})})},C=0,S=function(e){return Math.ceil(Math.random()*e)},E=function(){var e=Object(j.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=!0,e.next=3,new Promise((function(e){return setTimeout(e,1500)}));case 3:c=!1;case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=function(e){var i=e.difficulty,t=Object(p.useState)(0),n=Object(b.a)(t,2),o=n[0],u=n[1],r=Object(p.useState)(0),h=Object(b.a)(r,2),f=h[0],k=h[1],O=Object(p.useState)(0),x=Object(b.a)(O,2),N=x[0],B=x[1],F=Object(p.useState)(0),q=Object(b.a)(F,2),M=q[0],A=q[1],J=Object(p.useState)(null),I=Object(b.a)(J,2),P=I[0],T=I[1],z=Object(p.useState)("roll for initial health"),D=Object(b.a)(z,2),G=D[0],H=D[1],K=Object(p.useState)(0),L=Object(b.a)(K,2),Q=L[0],R=L[1],U=Object(p.useState)(!1),V=Object(b.a)(U,2),W=V[0],X=V[1],Y=Object(p.useState)(!1),Z=Object(b.a)(Y,2),$=Z[0],_=Z[1],ee=Object(p.useState)(function(e){for(var i,t=e.length;0!==t;){i=Math.floor(Math.random()*t),t--;var c=[e[i],e[t]];e[t]=c[0],e[i]=c[1]}return s=[e.pop(),e.pop()].map((function(e){return Object(y.a)(Object(y.a)({},e),{},{clicked:!0,display:"block",selected:!1})})),e}([{pow:2,value:"2",suit:"spades",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"spades",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"spades",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"spades",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"spades",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"spades",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"spades",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"spades",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"spades",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"spades",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"spades",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"spades",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"spades",clicked:!1,visibility:"visible"},{pow:2,value:"2",suit:"clubs",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"clubs",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"clubs",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"clubs",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"clubs",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"clubs",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"clubs",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"clubs",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"clubs",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"clubs",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"clubs",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"clubs",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"clubs",clicked:!1,visibility:"visible"},{pow:2,value:"2",suit:"hearts",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"hearts",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"hearts",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"hearts",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"hearts",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"hearts",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"hearts",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"hearts",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"hearts",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"hearts",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"hearts",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"hearts",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"hearts",clicked:!1,visibility:"visible"},{pow:2,value:"2",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:3,value:"3",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:4,value:"4",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:5,value:"5",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:6,value:"6",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:7,value:"7",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:8,value:"8",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:9,value:"9",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:10,value:"10",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:11,value:"jack",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:12,value:"queen",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:13,value:"king",suit:"diamonds",clicked:!1,visibility:"visible"},{pow:14,value:"ace",suit:"diamonds",clicked:!1,visibility:"visible"}])),ie=Object(b.a)(ee,2),te=ie[0],se=ie[1],ce=Object(p.useState)(s),ae=Object(b.a)(ce,2),le=ae[0],ne=ae[1],oe=Object(p.useState)(!1),ue=Object(b.a)(oe,2),re=ue[0],de=ue[1],be=function(e){var i=S(P.pow);"gold"===e?B(N+i):u(o+i),H("your ".concat(e," increased by ").concat(i)),a=!1,l=!1;var t=le.length?le[le.indexOf(P)]:te[te.indexOf(P)];t.visibility="hidden",te[te.indexOf(P)]=t,T(null),se(Object(d.a)(te))},he=function(){var e=Object(j.a)(v.a.mark((function e(){var i,t,s,n,r,b,h;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==M){e.next=5;break}u(S(20)),H("roll for initial attack power"),e.next=60;break;case 5:if(1!==M){e.next=10;break}k(S(8)),H("select one of the above cards to begin"),e.next=60;break;case 10:if(!P||c){e.next=60;break}if(!a){e.next=15;break}be("gold"),e.next=49;break;case 15:if(!l){e.next=19;break}be("health"),e.next=49;break;case 19:if(i=P.pow,"diamonds"!==P.suit){e.next=26;break}t=S(i),B(N+t),H("your gold increased by ".concat(t)),e.next=48;break;case 26:if("hearts"!==P.suit){e.next=32;break}s=S(i),u(o+s),H("your health increased by ".concat(s)),e.next=48;break;case 32:if(n=S(f),R(Q-n<0?0:Q-n),!(Q-n<1)&&Q){e.next=39;break}H("you dealt ".concat(n," damage.\n\t\t\t\t\t\t\t\tyou defeated the ").concat(P.value," of ").concat(P.suit,".\n\t\t\t\t\t\t\t\troll for ").concat("clubs"===P.suit?"gold":"health",".")),"clubs"===P.suit?a=!0:l=!0,e.next=48;break;case 39:return H("you dealt ".concat(n," damage...")),e.next=42,E();case 42:return H("the enemy is now attacking..."),e.next=45,E();case 45:r=S(i),u(o-r<0?0:o-r),o-r<1?(H("the enemy dealt ".concat(r," damage. you died. refresh to try again.")),ne([]),se([]),c=!0):H("the enemy dealt ".concat(r," damage. attack again."));case 48:Q<1&&T(null);case 49:if(!(P.display&&Q<1&&0!==o)){e.next=59;break}return e.next=52,E();case 52:return H("entering the dungeon..."),e.next=55,E();case 55:ne([]),H("select any card to begin"),e.next=60;break;case 59:Q<1&&(b=Object(d.a)(te),(h=te[te.indexOf(P)]).visibility="hidden",te[te.indexOf(P)]=h,se(b));case 60:A(M+1);case 61:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(p.useEffect)((function(){te.every((function(e){return"hidden"===e.visibility}))&&o>0&&de(!0)}),[o,te]),Object(m.jsxs)(m.Fragment,{children:[Object(m.jsx)("h1",{style:{display:re?"block":"none"},children:"bravo, you did it!"}),le.length||re?Object(m.jsx)(m.Fragment,{}):Object(m.jsx)("div",{className:"cards",children:te.map((function(e,i){return Object(m.jsx)("div",{className:"card",onClick:function(){return function(e){if(!e.clicked&&!P){var i=te.indexOf(e);if(te[i+1]&&"hidden"===te[i+1].visibility||te[i-1]&&"hidden"===te[i-1].visibility||te[i+10]&&"hidden"===te[i+10].visibility||te[Math.abs(i-10)]&&"hidden"===te[Math.abs(i-10)].visibility||0===C){var t=Object(d.a)(te),s=te[te.indexOf(e)];s.clicked=!0,te[te.indexOf(e)]=s,se(t),T(e),"spades"!==e.suit&&"clubs"!==e.suit||R(e.pow);var c="hearts"===e.suit?"for health":"diamonds"===e.suit?"for gold":"to attack";H("the ".concat(e.value," of ").concat(e.suit,". roll ").concat(c,".")),C++}else console.log("can't pick that one")}}(e)},style:{visibility:e.visibility},children:e.clicked?"".concat("10"===e.value?e.value.substring(0,2):e.value[0]," ").concat(e.suit[0]):""},i)}))}),M>1?Object(m.jsx)("div",{className:"entrance-cards",children:le.map((function(e,i){return Object(m.jsx)("div",{className:"card",onClick:function(){return function(e){if(!e.selected){var i=Object(d.a)(le),t=le[le.indexOf(e)];t.selected=!0,le[le.indexOf(e)]=t,ne(i.filter((function(e){return e.selected}))),T(e),"spades"!==e.suit&&"clubs"!==e.suit||R(e.pow);var s="hearts"===e.suit?"for health":"diamonds"===e.suit?"for gold":"to attack";H("you selected the ".concat(e.value," of ").concat(e.suit,". roll ").concat(s,"."))}}(e)},style:{display:e.display},children:e.clicked?"".concat("10"===e.value?e.value.substring(0,2):e.value[0]," ").concat(e.suit[0]):""},i)}))}):Object(m.jsx)(m.Fragment,{}),Object(m.jsxs)("div",{className:"stats-container",children:[Object(m.jsxs)("small",{className:"stat",children:["health: ",o]}),Object(m.jsxs)("small",{className:"stat",children:["attack: ",f]}),Object(m.jsxs)("small",{className:"stat",children:["gold: ",N]}),Q?Object(m.jsxs)("small",{className:"stat",children:["enemy health: ",Q]}):Object(m.jsx)(m.Fragment,{})]}),Object(m.jsx)("div",{children:Object(m.jsx)("small",{children:re?"refresh to play again, or try a different difficulty. thanks for playing!":G})}),Object(m.jsx)("div",{children:Object(m.jsx)("button",{onClick:he,style:{display:0===M||o>0&&!re?"block":"none"},children:"roll"})}),Object(m.jsx)("button",{onClick:function(){X(!0)},style:{position:"absolute",left:80,bottom:10,display:re?"none":"block "},children:"store"}),Object(m.jsx)("button",{onClick:function(){_(!0)},style:{position:"absolute",left:10,bottom:10},children:"help"}),Object(m.jsx)(g,{onOpen:W,onClose:function(){X(!1)},storeFunction:function(e,i,t){"attack"===e?k(f+i):"health"===e&&u(o+i),B(N-t)},gold:N,difficulty:i}),Object(m.jsx)(w,{onOpen:$,onClose:function(){_(!1)}})]})},B=function(){return Object(m.jsxs)(m.Fragment,{children:[Object(m.jsx)("h1",{children:"welcome to dungeon solitaire (in beta)"}),Object(m.jsx)("h3",{children:"pick a difficulty:"}),Object(m.jsxs)("div",{children:[Object(m.jsx)(u.b,{to:"/dungeon-solitaire/easy",children:Object(m.jsx)("button",{children:"easy"})}),Object(m.jsx)(u.b,{to:"/dungeon-solitaire/hard",children:Object(m.jsx)("button",{children:"hard"})})]})]})},F=function(){return Object(m.jsx)("div",{className:"App",children:Object(m.jsx)("header",{className:"App-header",children:Object(m.jsx)(u.a,{children:Object(m.jsxs)(r.c,{children:[Object(m.jsx)(r.a,{exact:!0,path:"/dungeon-solitaire",children:Object(m.jsx)(B,{})}),Object(m.jsx)(r.a,{exact:!0,path:"/dungeon-solitaire/easy",children:Object(m.jsx)(N,{difficulty:"easy"})}),Object(m.jsx)(r.a,{exact:!0,path:"/dungeon-solitaire/hard",children:Object(m.jsx)(N,{difficulty:"hard"})})]})})})})};t(63);o.a.render(Object(m.jsx)(u.a,{children:Object(m.jsx)(F,{})}),document.getElementById("root"))}},[[64,1,2]]]); +//# sourceMappingURL=main.768e55cd.chunk.js.map \ No newline at end of file diff --git a/static/js/main.3bfdb865.chunk.js.map b/static/js/main.768e55cd.chunk.js.map similarity index 96% rename from static/js/main.3bfdb865.chunk.js.map rename to static/js/main.768e55cd.chunk.js.map index 38e1f2d..de4c264 100644 --- a/static/js/main.3bfdb865.chunk.js.map +++ b/static/js/main.768e55cd.chunk.js.map @@ -1 +1 @@ -{"version":3,"sources":["Game.js","Store.js","Tutorial.js","Intro.js","App.js","index.js"],"names":["enter","pause","goldAfterEnemy","healthAfterEnemy","Store","onClose","onOpen","storeFunction","gold","difficulty","useState","response","setResponse","handleStore","selection","Dialog","open","style","color","backgroundColor","border","DialogTitle","DialogContent","Typography","gutterBottom","onClick","visibility","Tutorial","href","cardCounter","rand","max","Math","ceil","random","sleep","a","Promise","r","setTimeout","Game","health","setHealth","attack","setAttack","setGold","counter","setCounter","currentCard","setCurrentCard","commentary","setCommentary","enemyHealth","setEnemyHealth","storeOpen","setStoreOpen","tutorialOpen","setTutorialOpen","arr","randomIndex","currentIndex","length","floor","pop","map","el","clicked","display","selected","shuffle","pow","value","suit","cards","setCards","entranceCards","setEntranceCards","win","setWin","afterEnemyPickup","type","increase","cardToChange","indexOf","roll","damage","enemyDamage","copyOfCards","useEffect","every","card","className","i","abs","action","console","log","onCardClick","substring","filter","onEntranceCardClick","position","left","bottom","amount","price","Intro","to","App","exact","path","ReactDOM","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,qB,MCb/BsG,IAASC,OACP,cAAC,IAAD,UACE,cAAC,EAAD,MAEFC,SAASC,eAAe,W","file":"static/js/main.3bfdb865.chunk.js","sourcesContent":["import { useState, useEffect } from 'react';\nimport Store from './Store';\nimport Tutorial from './Tutorial';\n\nlet enter;\nlet pause;\nlet goldAfterEnemy;\nlet healthAfterEnemy;\nlet cardCounter = 0;\n// the fisher-yates shuffle algorithm\nconst shuffle = (arr) => {\n let currentIndex = arr.length,\n randomIndex;\n // while there remain elements to shuffle\n while (currentIndex !== 0) {\n // pick a remaining element\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex--;\n // and swap it with the current element\n [arr[currentIndex], arr[randomIndex]] = [\n arr[randomIndex],\n arr[currentIndex],\n ];\n }\n\n enter = [arr.pop(), arr.pop()].map((el) => {\n return { ...el, clicked: true, display: 'block', selected: false };\n });\n return arr;\n};\n\nconst rand = (max) => {\n return Math.ceil(Math.random() * max);\n};\n\nconst sleep = async () => {\n pause = true;\n await new Promise((r) => setTimeout(r, 1500));\n pause = false;\n};\n\nconst Game = ({ difficulty }) => {\n const [health, setHealth] = useState(0);\n const [attack, setAttack] = useState(0);\n const [gold, setGold] = useState(0);\n const [counter, setCounter] = useState(0);\n const [currentCard, setCurrentCard] = useState(null);\n const [commentary, setCommentary] = useState('roll for initial health');\n const [enemyHealth, setEnemyHealth] = useState(0);\n const [storeOpen, setStoreOpen] = useState(false);\n const [tutorialOpen, setTutorialOpen] = useState(false);\n const [cards, setCards] = useState(\n shuffle([\n {\n pow: 2,\n value: '2',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 2,\n value: '2',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 2,\n value: '2',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 2,\n value: '2',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n ]),\n );\n const [entranceCards, setEntranceCards] = useState(enter);\n const [win, setWin] = useState(false);\n\n const onCardClick = (card) => {\n // flip over card\n if (!card.clicked && !currentCard) {\n // border check\n const i = cards.indexOf(card);\n if (\n (cards[i + 1] && cards[i + 1].visibility === 'hidden') ||\n (cards[i - 1] && cards[i - 1].visibility === 'hidden') ||\n (cards[i + 10] && cards[i + 10].visibility === 'hidden') ||\n (cards[Math.abs(i - 10)] &&\n cards[Math.abs(i - 10)].visibility === 'hidden') ||\n cardCounter === 0\n ) {\n let copyOfCards = [...cards];\n let cardToChange = cards[cards.indexOf(card)];\n cardToChange.clicked = true;\n cards[cards.indexOf(card)] = cardToChange;\n setCards(copyOfCards);\n setCurrentCard(card);\n\n // set up enemy health at card flip\n if (card.suit === 'spades' || card.suit === 'clubs') {\n setEnemyHealth(card.pow);\n }\n\n const action =\n card.suit === 'hearts'\n ? 'for health'\n : card.suit === 'diamonds'\n ? 'for gold'\n : 'to attack';\n setCommentary(`the ${card.value} of ${card.suit}. roll ${action}.`);\n cardCounter++;\n } else {\n console.log(`can't pick that one`);\n }\n }\n };\n\n const onEntranceCardClick = (card) => {\n if (!card.selected) {\n let copyOfCards = [...entranceCards];\n let cardToChange = entranceCards[entranceCards.indexOf(card)];\n cardToChange.selected = true;\n entranceCards[entranceCards.indexOf(card)] = cardToChange;\n setEntranceCards(copyOfCards.filter((card) => card.selected));\n setCurrentCard(card);\n\n // set up enemy health at card flip\n if (card.suit === 'spades' || card.suit === 'clubs') {\n setEnemyHealth(card.pow);\n }\n\n const action =\n card.suit === 'hearts'\n ? 'for health'\n : card.suit === 'diamonds'\n ? 'for gold'\n : 'to attack';\n setCommentary(\n `you selected the ${card.value} of ${card.suit}. roll ${action}.`,\n );\n }\n };\n\n const afterEnemyPickup = (type) => {\n // handling enemy drops - follows after enemy defeat - not super dry\n const increase = rand(currentCard.pow);\n type === 'gold' ? setGold(gold + increase) : setHealth(health + increase);\n setCommentary(`your ${type} increased by ${increase}`);\n goldAfterEnemy = false;\n healthAfterEnemy = false;\n\n let cardToChange = entranceCards.length\n ? entranceCards[entranceCards.indexOf(currentCard)]\n : cards[cards.indexOf(currentCard)];\n cardToChange.visibility = 'hidden';\n cards[cards.indexOf(currentCard)] = cardToChange;\n\n setCurrentCard(null);\n setCards([...cards]);\n };\n\n const roll = async () => {\n if (counter === 0) {\n // initial health set\n setHealth(rand(20));\n setCommentary(`roll for initial attack power`);\n } else if (counter === 1) {\n // initial attack set\n setAttack(rand(8));\n setCommentary(`select one of the above cards to begin`);\n } else {\n if (currentCard && !pause) {\n if (goldAfterEnemy) {\n afterEnemyPickup('gold');\n } else if (healthAfterEnemy) {\n afterEnemyPickup('health');\n } else {\n const value = currentCard.pow;\n if (currentCard.suit === 'diamonds') {\n // get gold\n const increase = rand(value);\n setGold(gold + increase);\n setCommentary(`your gold increased by ${increase}`);\n } else if (currentCard.suit === 'hearts') {\n // get health\n const increase = rand(value);\n setHealth(health + increase);\n setCommentary(`your health increased by ${increase}`);\n } else {\n // battle sequence\n const damage = rand(attack);\n setEnemyHealth(enemyHealth - damage < 0 ? 0 : enemyHealth - damage);\n\n if (enemyHealth - damage < 1 || !enemyHealth) {\n // when enemy dies\n setCommentary(`you dealt ${damage} damage.\n\t\t\t\t\t\t\t\tyou defeated the ${currentCard.value} of ${currentCard.suit}.\n\t\t\t\t\t\t\t\troll for ${currentCard.suit === 'clubs' ? 'gold' : 'health'}.`);\n if (currentCard.suit === 'clubs') {\n goldAfterEnemy = true;\n } else {\n healthAfterEnemy = true;\n }\n } else {\n setCommentary(`you dealt ${damage} damage...`);\n await sleep();\n setCommentary(`the enemy is now attacking...`);\n await sleep();\n const enemyDamage = rand(value);\n setHealth(health - enemyDamage < 0 ? 0 : health - enemyDamage);\n\n if (health - enemyDamage < 1) {\n // when player dies\n setCommentary(\n `the enemy dealt ${enemyDamage} damage. you died. refresh to try again.`,\n );\n setEntranceCards([]); // to cover entrance\n setCards([]);\n pause = true; // game end\n } else {\n setCommentary(\n `the enemy dealt ${enemyDamage} damage. attack again.`,\n ); // or roll away?\n }\n }\n }\n\n if (enemyHealth < 1) {\n setCurrentCard(null);\n }\n }\n\n if (currentCard.display && enemyHealth < 1 && health !== 0) {\n // handle entrance card disappearing after 1.5 seconds\n await sleep();\n setCommentary(`entering the dungeon...`);\n await sleep();\n setEntranceCards([]);\n setCommentary(`select any card to begin`);\n } else {\n // handle normal dissappearing of cards\n if (enemyHealth < 1) {\n let copyOfCards = [...cards];\n let cardToChange = cards[cards.indexOf(currentCard)];\n cardToChange.visibility = 'hidden';\n cards[cards.indexOf(currentCard)] = cardToChange;\n setCards(copyOfCards);\n }\n }\n }\n }\n\n setCounter(counter + 1);\n };\n\n const handleStoreOpen = () => {\n setStoreOpen(true);\n };\n\n const handleStoreClose = () => {\n setStoreOpen(false);\n };\n\n const storeFunction = (type, amount, price) => {\n if (type === 'attack') {\n setAttack(attack + amount);\n } else if (type === 'health') {\n setHealth(health + amount);\n }\n setGold(gold - price);\n };\n\n const handleTutorialOpen = () => {\n setTutorialOpen(true);\n };\n\n const handleTutorialClose = () => {\n setTutorialOpen(false);\n };\n\n useEffect(() => {\n if (cards.every((card) => card.visibility === 'hidden')) {\n if (health > 0) {\n setWin(true);\n }\n }\n }, [health, cards]);\n\n return (\n <>\n

bravo, you did it!

\n {!entranceCards.length && !win ? (\n
\n {cards.map((card, i) => {\n return (\n onCardClick(card)}\n style={{ visibility: card.visibility }}\n >\n {card.clicked\n ? `${\n card.value === '10'\n ? card.value.substring(0, 2)\n : card.value[0]\n } ${card.suit[0]}`\n : ``}\n
\n );\n })}\n \n ) : (\n <>\n )}\n {counter > 1 ? (\n
\n {entranceCards.map((card, i) => {\n return (\n onEntranceCardClick(card)}\n style={{ display: card.display }}\n >\n {card.clicked\n ? `${\n card.value === '10'\n ? card.value.substring(0, 2)\n : card.value[0]\n } ${card.suit[0]}`\n : ``}\n
\n );\n })}\n \n ) : (\n <>\n )}\n
\n health: {health}\n attack: {attack}\n gold: {gold}\n {enemyHealth ? (\n enemy health: {enemyHealth}\n ) : (\n <>\n )}\n
\n
\n \n {win\n ? 'refresh to play again, or try a different difficulty. thanks for playing!'\n : commentary}\n \n
\n
\n 0 && !win ? 'block' : 'none',\n }}\n >\n roll\n \n
\n \n store\n \n \n help\n \n \n \n \n );\n};\n\nexport default Game;\n","import { useState } from 'react';\nimport {\n Dialog,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@material-ui/core';\nimport './App.css';\n\nconst Store = ({ onClose, onOpen, storeFunction, gold, difficulty }) => {\n const [response, setResponse] = useState();\n\n const handleClose = () => {\n setResponse(null);\n onClose();\n };\n\n const handleStore = (selection) => {\n if (difficulty === 'easy') {\n if (selection === 1) {\n if (gold >= 5) {\n setResponse('success');\n storeFunction('attack', 1, 5);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 2) {\n if (gold >= 10) {\n setResponse('success');\n storeFunction('attack', 3, 10);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 3) {\n if (gold >= 5) {\n setResponse('success');\n storeFunction('health', 10, 5);\n } else {\n setResponse('notEnough');\n }\n }\n } else {\n if (selection === 1) {\n if (gold >= 10) {\n setResponse('success');\n storeFunction('attack', 1, 10);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 2) {\n if (gold >= 20) {\n setResponse('success');\n storeFunction('attack', 3, 20);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 3) {\n if (gold >= 5) {\n setResponse('success');\n storeFunction('health', 5, 5);\n } else {\n setResponse('notEnough');\n }\n }\n }\n };\n\n return (\n \n \n store\n \n \n buy more attack power\n \n \n \n \n buy more health\n {difficulty === 'easy' ? (\n \n ) : (\n \n )}\n \n \n {response === 'success' ? (\n success!\n ) : response === 'notEnough' ? (\n not enough gold\n ) : (\n -\n )}\n \n \n \n \n );\n};\n\nexport default Store;\n","import {\n Dialog,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@material-ui/core';\n\nconst Tutorial = ({ onOpen, onClose }) => {\n const handleClose = () => {\n onClose();\n };\n\n return (\n \n \n how to play\n \n \n clear the dungeon of all its monsters and treasures!\n \n \n begin by receiving an initial health value, randomly selected from\n 1-20, and an inital attack power value, randomly selected from 1-8.\n the game is played out of a 52 standard card deck, shuffled up and\n laid face-down in a 5*10 grid. the last 2 cards are presented to you\n face-up at the beginning of the game as a \"soft\" entrance into the\n dungeon - you select the one you want and the other is discarded.\n \n \n you then flip over each card and interact with it to clear it. you\n can only select those that are adjacent to an empty space except for\n the first card. hearts give you more health and diamonds give you\n more gold. you roll to determine how much health or gold you get\n depending on the card's value. for example, if you encountered the 5\n of hearts, you will receive an increase in health - randomly\n selected from 1 to 5.\n \n \n spades and clubs are the enemies of the dungeon. the health of an\n enemy is equivalent to their card's value. the damage you do to an\n enemy will be a random value between 1 and the value of your attack\n power. the damage an enemy does to you will be a random value\n between 1 and their card's value. a battle between an enemy will end\n when their health reaches 0 or when your health reaches 0. when you\n defeat a spade, roll for health, according to the card's value. when\n defeating a club, roll for gold.\n \n \n use the gold you earn at the shop to upgrade your attack power or\n get more health. the difficulty of the game determines the prices at\n the shop.\n \n \n any questions or concerns, contact me at shaefferjd at gmail dot\n com. the code for this project lives on{' '}\n github\n .\n \n \n \n \n );\n};\n\nexport default Tutorial;\n","import { Link } from 'react-router-dom';\nimport './App.css';\n\nconst Intro = () => {\n return (\n <>\n

welcome to dungeon solitaire (in beta)

\n

pick a difficulty:

\n
\n \n \n \n \n \n \n
\n \n );\n};\n\nexport default Intro;\n","import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';\nimport Game from './Game';\nimport Intro from './Intro';\nimport './App.css';\n\nconst App = () => {\n return (\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n );\n};\n\nexport default App;\n","import ReactDOM from 'react-dom';\nimport App from './App';\nimport { BrowserRouter } from 'react-router-dom';\nimport './index.css';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root'),\n);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["Game.js","Store.js","Tutorial.js","Intro.js","App.js","index.js"],"names":["enter","pause","goldAfterEnemy","healthAfterEnemy","Store","onClose","onOpen","storeFunction","gold","difficulty","useState","response","setResponse","handleStore","selection","Dialog","open","style","color","backgroundColor","border","DialogTitle","DialogContent","Typography","gutterBottom","onClick","visibility","Tutorial","href","cardCounter","rand","max","Math","ceil","random","sleep","a","Promise","r","setTimeout","Game","health","setHealth","attack","setAttack","setGold","counter","setCounter","currentCard","setCurrentCard","commentary","setCommentary","enemyHealth","setEnemyHealth","storeOpen","setStoreOpen","tutorialOpen","setTutorialOpen","arr","randomIndex","currentIndex","length","floor","pop","map","el","clicked","display","selected","shuffle","pow","value","suit","cards","setCards","entranceCards","setEntranceCards","win","setWin","afterEnemyPickup","type","increase","cardToChange","indexOf","roll","damage","enemyDamage","copyOfCards","useEffect","every","card","className","i","abs","action","console","log","onCardClick","substring","filter","onEntranceCardClick","position","left","bottom","amount","price","Intro","to","App","exact","path","ReactDOM","render","document","getElementById"],"mappings":"kLAIIA,EACAC,EACAC,EACAC,E,sICuGWC,EArGD,SAAC,GAA0D,IAAxDC,EAAuD,EAAvDA,QAASC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,cAAeC,EAAuB,EAA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ACLkD,QACc,IAAZrB,GAA0BL,EAAS,IAAMoC,GAAzB,QAAyC,QAJ/D,oBAUF,wBACEpD,QAjHkB,WACtB8B,GAAa,IAiHTtC,MAAO,CACLoF,SAAU,WACVC,KAAM,GACNC,OAAQ,GACRpC,QAASU,GAAM,OAAS,UAN5B,mBAWA,wBACEpD,QA3GqB,WACzBgC,GAAgB,IA2GZxC,MAAO,CAAEoF,SAAU,WAAYC,KAAM,GAAIC,OAAQ,IAFnD,kBAMA,cAAC,EAAD,CACEjG,OAAQgD,EACRjD,QA/HmB,WACvBkD,GAAa,IA+HThD,cA5HgB,SAACyE,EAAMwB,EAAQC,GACtB,WAATzB,EACFpC,EAAUD,EAAS6D,GACD,WAATxB,GACTtC,EAAUD,EAAS+D,GAErB3D,EAAQrC,EAAOiG,IAuHXjG,KAAMA,EACNC,WAAYA,IAEd,cAAC,EAAD,CAAUH,OAAQkD,EAAcnD,QAnHR,WAC1BoD,GAAgB,UGzlBLiD,EAjBD,WACZ,OACE,qCACE,wEACA,oDACA,gCACE,cAAC,IAAD,CAAMC,GAAG,0BAAT,SACE,4CAEF,cAAC,IAAD,CAAMA,GAAG,0BAAT,SACE,mDCcKC,EAtBH,WACV,OACE,qBAAKjB,UAAU,MAAf,SACE,wBAAQA,UAAU,aAAlB,SACE,cAAC,IAAD,UACE,eAAC,IAAD,WACE,cAAC,IAAD,CAAOkB,OAAK,EAACC,KAAK,qBAAlB,SACE,cAAC,EAAD,MAEF,cAAC,IAAD,CAAOD,OAAK,EAACC,KAAK,0BAAlB,SACE,cAAC,EAAD,CAAMrG,WAAW,WAEnB,cAAC,IAAD,CAAOoG,OAAK,EAACC,KAAK,0BAAlB,SACE,cAAC,EAAD,CAAMrG,WAAW,qB,MCb/BsG,IAASC,OACP,cAAC,IAAD,UACE,cAAC,EAAD,MAEFC,SAASC,eAAe,W","file":"static/js/main.768e55cd.chunk.js","sourcesContent":["import { useState, useEffect } from 'react';\nimport Store from './Store';\nimport Tutorial from './Tutorial';\n\nlet enter;\nlet pause;\nlet goldAfterEnemy;\nlet healthAfterEnemy;\nlet cardCounter = 0;\n// the fisher-yates shuffle algorithm\nconst shuffle = (arr) => {\n let currentIndex = arr.length,\n randomIndex;\n // while there remain elements to shuffle\n while (currentIndex !== 0) {\n // pick a remaining element\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex--;\n // and swap it with the current element\n [arr[currentIndex], arr[randomIndex]] = [\n arr[randomIndex],\n arr[currentIndex],\n ];\n }\n\n enter = [arr.pop(), arr.pop()].map((el) => {\n return { ...el, clicked: true, display: 'block', selected: false };\n });\n return arr;\n};\n\nconst rand = (max) => {\n return Math.ceil(Math.random() * max);\n};\n\nconst sleep = async () => {\n pause = true;\n await new Promise((r) => setTimeout(r, 1500));\n pause = false;\n};\n\nconst Game = ({ difficulty }) => {\n const [health, setHealth] = useState(0);\n const [attack, setAttack] = useState(0);\n const [gold, setGold] = useState(0);\n const [counter, setCounter] = useState(0);\n const [currentCard, setCurrentCard] = useState(null);\n const [commentary, setCommentary] = useState('roll for initial health');\n const [enemyHealth, setEnemyHealth] = useState(0);\n const [storeOpen, setStoreOpen] = useState(false);\n const [tutorialOpen, setTutorialOpen] = useState(false);\n const [cards, setCards] = useState(\n shuffle([\n {\n pow: 2,\n value: '2',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'spades',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 2,\n value: '2',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'clubs',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 2,\n value: '2',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'hearts',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 2,\n value: '2',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 3,\n value: '3',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 4,\n value: '4',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 5,\n value: '5',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 6,\n value: '6',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 7,\n value: '7',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 8,\n value: '8',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 9,\n value: '9',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 10,\n value: '10',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 11,\n value: 'jack',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 12,\n value: 'queen',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 13,\n value: 'king',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n {\n pow: 14,\n value: 'ace',\n suit: 'diamonds',\n clicked: false,\n visibility: 'visible',\n },\n ]),\n );\n const [entranceCards, setEntranceCards] = useState(enter);\n const [win, setWin] = useState(false);\n\n const onCardClick = (card) => {\n // flip over card\n if (!card.clicked && !currentCard) {\n // border check\n const i = cards.indexOf(card);\n if (\n (cards[i + 1] && cards[i + 1].visibility === 'hidden') ||\n (cards[i - 1] && cards[i - 1].visibility === 'hidden') ||\n (cards[i + 10] && cards[i + 10].visibility === 'hidden') ||\n (cards[Math.abs(i - 10)] &&\n cards[Math.abs(i - 10)].visibility === 'hidden') ||\n cardCounter === 0\n ) {\n let copyOfCards = [...cards];\n let cardToChange = cards[cards.indexOf(card)];\n cardToChange.clicked = true;\n cards[cards.indexOf(card)] = cardToChange;\n setCards(copyOfCards);\n setCurrentCard(card);\n\n // set up enemy health at card flip\n if (card.suit === 'spades' || card.suit === 'clubs') {\n setEnemyHealth(card.pow);\n }\n\n const action =\n card.suit === 'hearts'\n ? 'for health'\n : card.suit === 'diamonds'\n ? 'for gold'\n : 'to attack';\n setCommentary(`the ${card.value} of ${card.suit}. roll ${action}.`);\n cardCounter++;\n } else {\n console.log(`can't pick that one`);\n }\n }\n };\n\n const onEntranceCardClick = (card) => {\n if (!card.selected) {\n let copyOfCards = [...entranceCards];\n let cardToChange = entranceCards[entranceCards.indexOf(card)];\n cardToChange.selected = true;\n entranceCards[entranceCards.indexOf(card)] = cardToChange;\n setEntranceCards(copyOfCards.filter((card) => card.selected));\n setCurrentCard(card);\n\n // set up enemy health at card flip\n if (card.suit === 'spades' || card.suit === 'clubs') {\n setEnemyHealth(card.pow);\n }\n\n const action =\n card.suit === 'hearts'\n ? 'for health'\n : card.suit === 'diamonds'\n ? 'for gold'\n : 'to attack';\n setCommentary(\n `you selected the ${card.value} of ${card.suit}. roll ${action}.`,\n );\n }\n };\n\n const afterEnemyPickup = (type) => {\n // handling enemy drops - follows after enemy defeat - not super dry\n const increase = rand(currentCard.pow);\n type === 'gold' ? setGold(gold + increase) : setHealth(health + increase);\n setCommentary(`your ${type} increased by ${increase}`);\n goldAfterEnemy = false;\n healthAfterEnemy = false;\n\n let cardToChange = entranceCards.length\n ? entranceCards[entranceCards.indexOf(currentCard)]\n : cards[cards.indexOf(currentCard)];\n cardToChange.visibility = 'hidden';\n cards[cards.indexOf(currentCard)] = cardToChange;\n\n setCurrentCard(null);\n setCards([...cards]);\n };\n\n const roll = async () => {\n if (counter === 0) {\n // initial health set\n setHealth(rand(20));\n setCommentary(`roll for initial attack power`);\n } else if (counter === 1) {\n // initial attack set\n setAttack(rand(8));\n setCommentary(`select one of the above cards to begin`);\n } else {\n if (currentCard && !pause) {\n if (goldAfterEnemy) {\n afterEnemyPickup('gold');\n } else if (healthAfterEnemy) {\n afterEnemyPickup('health');\n } else {\n const value = currentCard.pow;\n if (currentCard.suit === 'diamonds') {\n // get gold\n const increase = rand(value);\n setGold(gold + increase);\n setCommentary(`your gold increased by ${increase}`);\n } else if (currentCard.suit === 'hearts') {\n // get health\n const increase = rand(value);\n setHealth(health + increase);\n setCommentary(`your health increased by ${increase}`);\n } else {\n // battle sequence\n const damage = rand(attack);\n setEnemyHealth(enemyHealth - damage < 0 ? 0 : enemyHealth - damage);\n\n if (enemyHealth - damage < 1 || !enemyHealth) {\n // when enemy dies\n setCommentary(`you dealt ${damage} damage.\n\t\t\t\t\t\t\t\tyou defeated the ${currentCard.value} of ${currentCard.suit}.\n\t\t\t\t\t\t\t\troll for ${currentCard.suit === 'clubs' ? 'gold' : 'health'}.`);\n if (currentCard.suit === 'clubs') {\n goldAfterEnemy = true;\n } else {\n healthAfterEnemy = true;\n }\n } else {\n setCommentary(`you dealt ${damage} damage...`);\n await sleep();\n setCommentary(`the enemy is now attacking...`);\n await sleep();\n const enemyDamage = rand(value);\n setHealth(health - enemyDamage < 0 ? 0 : health - enemyDamage);\n\n if (health - enemyDamage < 1) {\n // when player dies\n setCommentary(\n `the enemy dealt ${enemyDamage} damage. you died. refresh to try again.`,\n );\n setEntranceCards([]); // to cover entrance\n setCards([]);\n pause = true; // game end\n } else {\n setCommentary(\n `the enemy dealt ${enemyDamage} damage. attack again.`,\n ); // or roll away?\n }\n }\n }\n\n if (enemyHealth < 1) {\n setCurrentCard(null);\n }\n }\n\n if (currentCard.display && enemyHealth < 1 && health !== 0) {\n // handle entrance card disappearing after 1.5 seconds\n await sleep();\n setCommentary(`entering the dungeon...`);\n await sleep();\n setEntranceCards([]);\n setCommentary(`select any card to begin`);\n } else {\n // handle normal dissappearing of cards\n if (enemyHealth < 1) {\n let copyOfCards = [...cards];\n let cardToChange = cards[cards.indexOf(currentCard)];\n cardToChange.visibility = 'hidden';\n cards[cards.indexOf(currentCard)] = cardToChange;\n setCards(copyOfCards);\n }\n }\n }\n }\n\n setCounter(counter + 1);\n };\n\n const handleStoreOpen = () => {\n setStoreOpen(true);\n };\n\n const handleStoreClose = () => {\n setStoreOpen(false);\n };\n\n const storeFunction = (type, amount, price) => {\n if (type === 'attack') {\n setAttack(attack + amount);\n } else if (type === 'health') {\n setHealth(health + amount);\n }\n setGold(gold - price);\n };\n\n const handleTutorialOpen = () => {\n setTutorialOpen(true);\n };\n\n const handleTutorialClose = () => {\n setTutorialOpen(false);\n };\n\n useEffect(() => {\n if (cards.every((card) => card.visibility === 'hidden')) {\n if (health > 0) {\n setWin(true);\n }\n }\n }, [health, cards]);\n\n return (\n <>\n

bravo, you did it!

\n {!entranceCards.length && !win ? (\n
\n {cards.map((card, i) => {\n return (\n onCardClick(card)}\n style={{ visibility: card.visibility }}\n >\n {card.clicked\n ? `${\n card.value === '10'\n ? card.value.substring(0, 2)\n : card.value[0]\n } ${card.suit[0]}`\n : ``}\n
\n );\n })}\n \n ) : (\n <>\n )}\n {counter > 1 ? (\n
\n {entranceCards.map((card, i) => {\n return (\n onEntranceCardClick(card)}\n style={{ display: card.display }}\n >\n {card.clicked\n ? `${\n card.value === '10'\n ? card.value.substring(0, 2)\n : card.value[0]\n } ${card.suit[0]}`\n : ``}\n
\n );\n })}\n \n ) : (\n <>\n )}\n
\n health: {health}\n attack: {attack}\n gold: {gold}\n {enemyHealth ? (\n enemy health: {enemyHealth}\n ) : (\n <>\n )}\n
\n
\n \n {win\n ? 'refresh to play again, or try a different difficulty. thanks for playing!'\n : commentary}\n \n
\n
\n 0 && !win ? 'block' : 'none',\n }}\n >\n roll\n \n
\n \n store\n \n \n help\n \n \n \n \n );\n};\n\nexport default Game;\n","import { useState } from 'react';\nimport {\n Dialog,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@material-ui/core';\nimport './App.css';\n\nconst Store = ({ onClose, onOpen, storeFunction, gold, difficulty }) => {\n const [response, setResponse] = useState();\n\n const handleClose = () => {\n setResponse(null);\n onClose();\n };\n\n const handleStore = (selection) => {\n if (difficulty === 'easy') {\n if (selection === 1) {\n if (gold >= 5) {\n setResponse('success');\n storeFunction('attack', 1, 5);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 2) {\n if (gold >= 10) {\n setResponse('success');\n storeFunction('attack', 3, 10);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 3) {\n if (gold >= 5) {\n setResponse('success');\n storeFunction('health', 10, 5);\n } else {\n setResponse('notEnough');\n }\n }\n } else {\n if (selection === 1) {\n if (gold >= 10) {\n setResponse('success');\n storeFunction('attack', 1, 10);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 2) {\n if (gold >= 20) {\n setResponse('success');\n storeFunction('attack', 3, 20);\n } else {\n setResponse('notEnough');\n }\n } else if (selection === 3) {\n if (gold >= 5) {\n setResponse('success');\n storeFunction('health', 5, 5);\n } else {\n setResponse('notEnough');\n }\n }\n }\n };\n\n return (\n \n \n store\n \n \n buy more attack power\n \n \n \n \n buy more health\n {difficulty === 'easy' ? (\n \n ) : (\n \n )}\n \n \n {response === 'success' ? (\n success!\n ) : response === 'notEnough' ? (\n not enough gold\n ) : (\n -\n )}\n \n \n \n \n );\n};\n\nexport default Store;\n","import {\n Dialog,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@material-ui/core';\n\nconst Tutorial = ({ onOpen, onClose }) => {\n const handleClose = () => {\n onClose();\n };\n\n return (\n \n \n how to play\n \n \n clear the dungeon of all its monsters and treasures!\n \n \n begin by receiving an initial health value, randomly selected from\n 1-20, and an inital attack power value, randomly selected from 1-8.\n the game is played out of a 52 standard card deck, shuffled up and\n laid face-down in a 5*10 grid. the last 2 cards are presented to you\n face-up at the beginning of the game as a \"soft\" entrance into the\n dungeon - you select the one you want and the other is discarded.\n \n \n you then flip over each card and interact with it to clear it. you\n can only select those that are adjacent to an empty space except for\n the first card. hearts give you more health and diamonds give you\n more gold. you roll to determine how much health or gold you get\n depending on the card's value. for example, if you encountered the 5\n of hearts, you will receive an increase in health - randomly\n selected from 1 to 5.\n \n \n spades and clubs are the enemies of the dungeon. the health of an\n enemy is equivalent to their card's value. the damage you do to an\n enemy will be a random value between 1 and the value of your attack\n power. the damage an enemy does to you will be a random value\n between 1 and their card's value. a battle between an enemy will end\n when their health reaches 0 or when your health reaches 0. when you\n defeat a spade, roll for health, according to the card's value. when\n defeating a club, roll for gold.\n \n \n use the gold you earn at the shop to upgrade your attack power or\n get more health. the difficulty of the game determines the prices at\n the shop.\n \n \n any questions or concerns, contact me at shaefferjd at gmail dot\n com. the code for this project lives on{' '}\n github\n .\n \n \n \n \n );\n};\n\nexport default Tutorial;\n","import { Link } from 'react-router-dom';\nimport './App.css';\n\nconst Intro = () => {\n return (\n <>\n

welcome to dungeon solitaire (in beta)

\n

pick a difficulty:

\n
\n \n \n \n \n \n \n
\n \n );\n};\n\nexport default Intro;\n","import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';\nimport Game from './Game';\nimport Intro from './Intro';\nimport './App.css';\n\nconst App = () => {\n return (\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n );\n};\n\nexport default App;\n","import ReactDOM from 'react-dom';\nimport App from './App';\nimport { BrowserRouter } from 'react-router-dom';\nimport './index.css';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root'),\n);\n"],"sourceRoot":""} \ No newline at end of file