local gc=love.graphics local gc_translate=gc.translate local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth local gc_rectangle=gc.rectangle local gc_print=gc.print local max,min=math.max,math.min local ins,rem=table.insert,table.remove local deck0={} for i=1,9 do for _=1,4 do ins(deck0,'m'..i) ins(deck0,'p'..i) ins(deck0,'s'..i) if i<=7 then ins(deck0,'z'..i) end end end -- deck0[TABLE.find(deck0,'m5')]='m0' -- deck0[TABLE.find(deck0,'p5')]='p0' -- deck0[TABLE.find(deck0,'s5')]='s0' -- cardText['5m+']={COLOR.R,'五'} -- cardText['5p+']={COLOR.R,'⑤'} -- cardText['5s+']={COLOR.R,'5'} local cardText={ m1={COLOR.D,CHAR.mahjong.m1Base,COLOR.R,CHAR.mahjong.mComb}, m2={COLOR.D,CHAR.mahjong.m2Base,COLOR.R,CHAR.mahjong.mComb}, m3={COLOR.D,CHAR.mahjong.m3Base,COLOR.R,CHAR.mahjong.mComb}, m4={COLOR.D,CHAR.mahjong.m4Base,COLOR.R,CHAR.mahjong.mComb}, m5={COLOR.D,CHAR.mahjong.m5Base,COLOR.R,CHAR.mahjong.mComb}, m6={COLOR.D,CHAR.mahjong.m6Base,COLOR.R,CHAR.mahjong.mComb}, m7={COLOR.D,CHAR.mahjong.m7Base,COLOR.R,CHAR.mahjong.mComb}, m8={COLOR.D,CHAR.mahjong.m8Base,COLOR.R,CHAR.mahjong.mComb}, m9={COLOR.D,CHAR.mahjong.m9Base,COLOR.R,CHAR.mahjong.mComb}, p1={COLOR.D,CHAR.mahjong.p1}, p2={COLOR.D,CHAR.mahjong.p2Base,COLOR.D,CHAR.mahjong.p2Comb}, p3={COLOR.D,CHAR.mahjong.p3Base,COLOR.R,CHAR.mahjong.p3Comb1,COLOR.D,CHAR.mahjong.p3Comb2}, p4={COLOR.D,CHAR.mahjong.p4Base,COLOR.D,CHAR.mahjong.p4Comb}, p5={COLOR.D,CHAR.mahjong.p5Base,COLOR.D,CHAR.mahjong.p5Comb1,COLOR.R,CHAR.mahjong.p5Comb2}, p6={COLOR.D,CHAR.mahjong.p6Base,COLOR.R,CHAR.mahjong.p6Comb}, p7={COLOR.D,CHAR.mahjong.p7Base,COLOR.R,CHAR.mahjong.p7Comb}, p8={COLOR.D,CHAR.mahjong.p8}, p9={COLOR.D,CHAR.mahjong.p9Base,COLOR.R,CHAR.mahjong.p9Comb1,COLOR.D,CHAR.mahjong.p9Comb2}, s1={COLOR.D,CHAR.mahjong.s1jBase,COLOR.G,CHAR.mahjong.s1jComb}, s2={COLOR.G,CHAR.mahjong.s2}, s3={COLOR.G,CHAR.mahjong.s3}, s4={COLOR.G,CHAR.mahjong.s4}, s5={COLOR.G,CHAR.mahjong.s5Base,COLOR.R,CHAR.mahjong.s5Comb}, s6={COLOR.G,CHAR.mahjong.s6}, s7={COLOR.G,CHAR.mahjong.s7Base,COLOR.R,CHAR.mahjong.s7Comb}, s8={COLOR.G,CHAR.mahjong.s8}, s9={COLOR.G,CHAR.mahjong.s9Base,COLOR.R,CHAR.mahjong.s9Comb}, z1={COLOR.D,CHAR.mahjong.ton}, z2={COLOR.D,CHAR.mahjong.nan}, z3={COLOR.D,CHAR.mahjong.sha}, z4={COLOR.D,CHAR.mahjong.pe}, z5={COLOR.D,CHAR.mahjong.haku}, z6={COLOR.G,CHAR.mahjong.hatsu}, z7={COLOR.R,CHAR.mahjong.chun}, } for _,v in next,cardText do ins(v,COLOR.D)ins(v,CHAR.mahjong.frameComb) end local deck,hand,pool local selected local function _getPoolCardArea(i) local row=math.floor((i-1)/10) local col=i-row*10 return 240+70*col,45+95*row, 60,84 end local function _getHandCardArea(i) return 20+70*i+(i==14 and 30 or 0),480, 60,84 end local function _newGame() deck=TABLE.shift(deck0) hand={} pool={} for _=1,14 do ins(hand,(TABLE.popRandom(deck))) end table.sort(hand) end local function _checkWin() if #hand==14 then MES.new('info',"Coming soon!") end end local function _throwCard() if hand[selected] and #pool<40 then ins(pool,rem(hand,selected)) table.sort(hand) SFX.play('hold') SFX.play('lock') if #pool<40 then ins(hand,(TABLE.popRandom(deck))) end end end local scene={} function scene.enter() BG.set('fixColor',.26,.62,.26) _newGame() selected=false DiscordRPC.update("Playing Mahjong") end function scene.mouseMove(x,y) selected=false for i=1,#hand do local cx,cy,cw,ch=_getHandCardArea(i) if x>cx and xcy and y