You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

262 line
8.3 KiB

  1. -- 合江跑得快
  2. local DEF = {}
  3. -- 规则文本
  4. DEF.RuleText =
  5. {
  6. --[1] =
  7. {
  8. title = "基础规则",
  9. content =
  10. {
  11. "1、牌数:52张牌加2张大小王。",
  12. "2、游戏人数:4人,3人或2人。",
  13. "3、定庄:首局最小牌的人为庄,且必须出最小牌,之后的牌局上一局先出完牌的人为庄。",
  14. "4、王(鬼):即癞子,可代替任意一张牌。",
  15. "5、打牌规则:游戏开始后每人发牌13张,可以出任意的牌型。接牌时,有压必压,不能过牌。当自己的下家剩余一张牌时,若出单张,必须从大到小开始出。",
  16. "6、乱带:上家3带一对出牌,下家可以3带2单张出牌,反过来也一样。",
  17. },
  18. },
  19. --[2] =
  20. --[[{
  21. title = "牌型介绍",
  22. content =
  23. {
  24. "1、单张:任意一张单牌,3<4<5<6<7<8<9<10<J<Q<K<A<2。",
  25. "2、对子:两张点数相同的牌。",
  26. "3、三张:3张点数相同的牌。",
  27. "4、三带二:3个点数一样的牌和2张其他牌,可为2散张,也可为1对。",
  28. "5、顺子:最少5张起,最多13张;2可以出现,A2345为最小,10JQKA最大。",
  29. "6、连对:相连2对及以上的牌,如5566、778899,接牌的玩家必须是点数更大的连对。KKAA最大,AA22最小。",
  30. "7、飞机:两个或两个以上相连的三同张牌。如555666、JJJQQQKKK;AAAKKK最大,AAA222最小。",
  31. "8、飞机带翅膀:两个或两个以上相连的三同张牌,且每个三同张牌必须带2张牌。",
  32. "9、炸弹:只能由4张相同点数的牌为炸弹。2222最大,3333最小。",
  33. }
  34. },
  35. --[3] =
  36. {
  37. title = "特殊牌型",
  38. content =
  39. {
  40. "1、连对特殊牌型:7788王王,可当做778899,也可当做777888;当用作管上家时,需按照上家牌型,进行组合。当自己作为上家首出,下家需用炸弹才可以管。",
  41. "2、顺子的特殊牌型:789鬼鬼,可以为78910J,也可以为78999;当用做管上家时,需按照上家牌型,进行组合。当自己作为上家首出,下家需用炸弹才可以管。",
  42. }
  43. },
  44. --[4] =
  45. {
  46. title = "算分规则",
  47. content =
  48. {
  49. "1、游戏结束剩余手牌张数为X,颗数为1/2/4/6:X=1时,扣0分。2≤X≤5,扣1分,5<X≤9,扣2分,小关:10≤X≤12,扣4分,黑关:X=13,扣6分",
  50. "2、炸弹算分:炸弹分立即收取和支付。炸弹被压,被压的炸弹不算分,只算后面那个炸弹的分。颗数为1/2/4/6:不加王玩法:四个2的炸弹4分,普通炸弹2分。加王玩法:四个2的炸弹4分,普通炸弹2分。",
  51. }
  52. },--]]
  53. }
  54. -- 玩法
  55. -- 必须跟服务器保持一致,增删都需要和server及web确认
  56. DEF.GameTypes =
  57. {
  58. Normal = 1,
  59. }
  60. -- 聊天快捷语
  61. DEF.ChatMessages =
  62. {
  63. [1] = {oggStandard = "res/sound/faceSound/chat_man_1.ogg", oggLocal = "res/sound/faceSound/chat_man_1.ogg",txt = "不好意思俺刚接了个电话。"},
  64. [2] = {oggStandard = "res/sound/faceSound/chat_man_2.ogg", oggLocal = "res/sound/faceSound/chat_man_2.ogg",txt = "房间没满房主再找几个嘛!"},
  65. [3] = {oggStandard = "res/sound/faceSound/chat_man_3.ogg", oggLocal = "res/sound/faceSound/chat_man_3.ogg",txt = "爆发吧我的小宇宙,这把我要通吃!"},
  66. [4] = {oggStandard = "res/sound/faceSound/chat_man_4.ogg", oggLocal = "res/sound/faceSound/chat_man_4.ogg",txt = "哥这招一柱擎天,稳如泰山!"},
  67. [5] = {oggStandard = "res/sound/faceSound/chat_man_5.ogg", oggLocal = "res/sound/faceSound/chat_man_5.ogg",txt = "别磨蹭了,时间就是金钱!"},
  68. [6] = {oggStandard = "res/sound/faceSound/chat_man_6.ogg", oggLocal = "res/sound/faceSound/chat_man_6.ogg",txt = "哎我滴妈呀手气有点旺!"},
  69. [7] = {oggStandard = "res/sound/faceSound/chat_man_7.ogg", oggLocal = "res/sound/faceSound/chat_man_7.ogg",txt = "把把都是赢你咋不上天!"},
  70. }
  71. DEF.GameTypesStr =
  72. {
  73. [0] = "合江跑得快",
  74. [1] = "合江跑得快",
  75. }
  76. DEF.GamePlayerCount = {
  77. [1] = "快速成局",
  78. [2] = "2人玩",
  79. [3] = "3人玩",
  80. [4] = "4人玩",
  81. }
  82. DEF.GameWanfa = {
  83. [0] = "必须管",
  84. [1] = "可不要",
  85. }
  86. DEF.GameGui = {
  87. [0] = "无鬼",
  88. [2] = "两鬼",
  89. [3] = "三鬼",
  90. }
  91. DEF.GameKeShu = {
  92. [1] = "1/2/4/6颗",
  93. [2] = "2/4/7/10颗",
  94. [3] = "3/5/10/15颗",
  95. }
  96. DEF.CreateParamsMean = {
  97. [0x0001] = '记牌器',
  98. [0x0002] = '有大必打',
  99. }
  100. DEF.GameTieYiXian = {
  101. [0] = "",
  102. [1] = "铁一线",
  103. }
  104. DEF.GameSanDaiYi= {
  105. [0] = "三带一不可出",
  106. [1] = "三带一可出",
  107. }
  108. DEF.Language = {
  109. PU_TONG_HUA = 1,
  110. FANG_YAN = 2,
  111. }
  112. --获取玩法规则
  113. function DEF.getRuleInfo(ruleStr)
  114. return "hejiangpdkwanfa"
  115. end
  116. --获取茶馆玩法规则
  117. function DEF.getClubRuleInfo(ruleStr, jushu)
  118. if not ruleStr then
  119. ruleStr = app.room.roomInfo.strGameInfo
  120. end
  121. --return "luzhouclubwanfa"
  122. local temp = {}
  123. if jushu then
  124. local jushuText = string.format("%d 局", jushu);
  125. table.insert(temp, 1, {name = "局数", value = {jushuText}})
  126. end
  127. local jsonData=json.decode(ruleStr)
  128. if jsonData.deductRule and jsonData.deductRule >= 0 then
  129. local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费"
  130. if specStr ~= "" then
  131. table.insert(temp, {name = "房费", value = {specStr}})
  132. end
  133. end
  134. if jsonData.gamerule and jsonData.gamerule>0 then
  135. local specStr = DEF.GameTypesStr[jsonData.gamerule] or ""
  136. if specStr ~= "" then
  137. table.insert(temp, {name = "玩法", value = {specStr}})
  138. end
  139. end
  140. if jsonData.jokerCount and jsonData.jokerCount>0 then
  141. local specStr = DEF.GameGui[jsonData.jokerCount] or ""
  142. if specStr ~= "" then
  143. table.insert(temp, {name = "带鬼", value = {specStr}})
  144. end
  145. end
  146. if jsonData.keCount and jsonData.keCount>0 then
  147. local specStr = DEF.GameKeShu[jsonData.keCount] or ""
  148. if specStr ~= "" then
  149. table.insert(temp, {name = "颗数", value = {specStr}})
  150. end
  151. end
  152. if jsonData.playnum and jsonData.playnum>=0 then
  153. local specStr = DEF.GamePlayerCount[jsonData.playnum] or ""
  154. if specStr ~= "" then
  155. table.insert(temp, {name = "人数", value = {specStr}})
  156. end
  157. end
  158. local function getRule( rule )
  159. local CreateParamsMean = DEF.CreateParamsMean
  160. local ruleStr = ""
  161. if getNumBand(rule, 0x0001)>0 then
  162. ruleStr = ruleStr..CreateParamsMean[0x0001]..","
  163. end
  164. if getNumBand(rule, 0x0002)>0 then
  165. ruleStr = ruleStr..CreateParamsMean[0x0002]..","
  166. end
  167. if string.len(ruleStr) > 0 then
  168. ruleStr = string.sub(ruleStr, 1, string.len(ruleStr)-1)
  169. end
  170. return ruleStr
  171. end
  172. if jsonData.specialRule and jsonData.specialRule>=0 then
  173. local specStr = getRule(jsonData.specialRule)
  174. if specStr ~= "" then
  175. table.insert(temp, {name = "可选", value = {specStr}})
  176. end
  177. end
  178. if jsonData.tieyixian and jsonData.tieyixian>=0 then
  179. local specStr = DEF.GameTieYiXian[jsonData.tieyixian] or ""
  180. if specStr ~= "" then
  181. table.insert(temp, {name = "铁一线", value = {specStr}})
  182. end
  183. end
  184. if jsonData.endsandaiyi and jsonData.endsandaiyi>=0 then
  185. local specStr = DEF.GameSanDaiYi[jsonData.endsandaiyi] or ""
  186. if specStr ~= "" then
  187. table.insert(temp, {name = "末手", value = {specStr}})
  188. end
  189. end
  190. if jsonData.baseMulti and jsonData.baseMulti > 0 then
  191. table.insert(temp, {name = "积分倍数", value = {"积分倍数x" .. jsonData.baseMulti}})
  192. end
  193. if jsonData.forbidProp and jsonData.forbidProp > 0 then
  194. table.insert(temp, {name = "其他", value = {"屏蔽聊天与互动道具"}})
  195. end
  196. return temp
  197. end
  198. --获取桌面玩法显示
  199. function DEF.getClubTableWanFaInfo(ruleStr)
  200. if not ruleStr then return "" end
  201. local jsonData = json.decode(ruleStr);
  202. local str = ""
  203. if jsonData.jokerCount and jsonData.jokerCount>=0 then
  204. local specStr = DEF.GameGui[jsonData.jokerCount] or ""
  205. if specStr ~= "" then
  206. str = str..specStr.." "
  207. end
  208. end
  209. if jsonData.keCount and jsonData.keCount>0 then
  210. local specStr = DEF.GameKeShu[jsonData.keCount] or ""
  211. if specStr ~= "" then
  212. str = str..specStr
  213. end
  214. end
  215. return str
  216. end
  217. ---
  218. -- 获取包间玩法信息
  219. -- @param gameId
  220. -- @param jushu
  221. -- @param ruleStr
  222. -- @param arena
  223. -- @return
  224. --
  225. function DEF.getRuleFromString( gameId, jushu, ruleStr,arena )
  226. local str = DEF.getClubRuleInfo(ruleStr, jushu)
  227. return str
  228. end
  229. ---
  230. -- 获取包间多玩法桌子上显示的信息
  231. -- @param gameId
  232. -- @param ruleStr
  233. -- @param playerNum
  234. -- @return
  235. --
  236. function DEF.getClubTableRuleString( gameId, ruleStr, playerNum )
  237. local str = DEF.getClubTableWanFaInfo(ruleStr)
  238. return str
  239. end
  240. return DEF