logic.js 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491
  1. 'use strict';
  2. //// 为什么选择 Lodash ?
  3. //// Lodash 通过降低 array、number、objects、string 等等的使用难度从而让 JavaScript 变得更简单。
  4. //// Lodash 的模块化方法 非常适用于:
  5. //// 遍历 array、object 和 string
  6. //// 对值进行操作和检测
  7. //// 创建符合功能的函数
  8. var _ = require('lodash');
  9. var quick = require('quick-pomelo');
  10. var logger = quick.logger.getLogger('fhmj', __filename);
  11. // 所有牌
  12. const CARDS = [
  13. 11, 12, 13, 14, 15, 16, 17, 18, 19, // 筒
  14. 21, 22, 23, 24, 25, 26, 27, 28, 29, // 万
  15. 31, 32, 33, 34, 35, 36, 37, 38, 39, // 条
  16. // 51, // 中
  17. 11, 12, 13, 14, 15, 16, 17, 18, 19, // 筒
  18. 21, 22, 23, 24, 25, 26, 27, 28, 29, // 万
  19. 31, 32, 33, 34, 35, 36, 37, 38, 39, // 条
  20. // 51, // 中
  21. 11, 12, 13, 14, 15, 16, 17, 18, 19, // 筒
  22. 21, 22, 23, 24, 25, 26, 27, 28, 29, // 万
  23. 31, 32, 33, 34, 35, 36, 37, 38, 39, // 条
  24. // 51, // 中
  25. 11, 12, 13, 14, 15, 16, 17, 18, 19, // 筒
  26. 21, 22, 23, 24, 25, 26, 27, 28, 29, // 万
  27. 31, 32, 33, 34, 35, 36, 37, 38, 39, // 条
  28. // 51, // 中
  29. ];
  30. // 块类型
  31. const STYLE = {
  32. NULL: 0, // 无效
  33. CHI: 1, // 吃牌
  34. SUN: 2, // 顺序
  35. PENG: 3, // 碰子
  36. KE: 4, // 刻子
  37. GANG: 5, // 杠子
  38. ANGANG: 6, // 暗杠
  39. ZMGANG: 7, // 自摸明杠
  40. BUDA:8, // TL++不搭
  41. // LIANGBD:9, // TL++两张百搭和一张普通牌组成一个块
  42. // SANBD:10, // TL++三张百搭和一张普通牌组成一个块
  43. };
  44. // 椅子数
  45. const CHAIR_COUNT = 4;
  46. const CARDS_COUNT = 13;
  47. // 构造方法
  48. var Logic = function (type,gameKindTL,playerAllCount,other) {
  49. // 类型
  50. this.type = type;
  51. this.other = other;//////TL++2人3人的游戏规则
  52. this.jiangmaType = -1;////奖码类型:-1:不奖码,1:159奖码,2:摸几奖几,3:一码全中
  53. this.jiangmaCount = -1;////奖码张数
  54. if(this.other & 1){
  55. this.jiangmaType = 1;
  56. if(this.other & 8) this.jiangmaCount = 2;
  57. else if(this.other & 16) this.jiangmaCount = 4;
  58. else if(this.other & 32) this.jiangmaCount = 6;
  59. }
  60. else if(this.other & 2){
  61. this.jiangmaType = 2;
  62. this.jiangmaCount = 0;
  63. }
  64. else if(this.other & 4){
  65. this.jiangmaType = 3;
  66. this.jiangmaCount = 1;
  67. }
  68. this.hzCount = 0;/////红中个数
  69. if(this.other & 64) this.hzCount = 4;
  70. else if(this.other & 1024) this.hzCount = 6;
  71. else if(this.other & 2048) this.hzCount = 8;
  72. this.isQGHJM = false;/////是否抢杠胡奖码
  73. if(this.other & 128) this.isQGHJM = true;
  74. this.isHZHG = false;/////是否荒庄荒杠
  75. if(this.other & 256) this.isHZHG = true;
  76. this.isWGHZJYM = false;/////无红中胡加一码
  77. if(this.other & 512) this.isWGHZJYM = true;
  78. this.isZNZM = this.type == 2;/////是否只能自摸,拉杠情况可以胡
  79. // console.warn("logic 奖码类型:-1:不奖码,1:159奖码,2:摸几奖几,3:一码全中 "+this.jiangmaType)
  80. // console.warn("logic 奖码张数 "+this.jiangmaCount)
  81. // console.warn("logic 是否红中赖子 "+this.isHZLZ)
  82. // console.warn("logic 是否抢杠胡奖码 "+this.isQGHJM)
  83. // console.warn("logic 是否荒庄荒杠 "+this.isHZHG)
  84. // console.warn("logic 无红中胡加一码 "+this.isWGHZJYM)
  85. // console.warn("logic 是否只能自摸 "+this.isZNZM)
  86. // 七对
  87. // this.has7d = true;/////TL++因为奉化麻将当中本身就可以胡7对
  88. // 全牌
  89. var cards = _.clone(CARDS);
  90. // 添加红中红中
  91. if (this.hzCount > 0){
  92. for (let i = 0; i < this.hzCount; ++i) {
  93. cards[cards.length] = 51;
  94. }
  95. }
  96. this.castCount = 0;
  97. this.disCount = 0;
  98. this.lastCount = cards.length;//////设置剩余牌数为了测试海底捞月
  99. this.cardsPool = cards;
  100. this.cardsyl = _.clone(cards);
  101. //////以下变量全是TL++
  102. this.gameKindTL = gameKindTL || 1;////平搓还是冲刺 = 1代表平搓 = 2代表冲刺
  103. this.playerAllCount = playerAllCount || 4;////游戏人数 = 2表示2人局 = 3表示3人局 = 4表示4人局
  104. this.setCardFilerIndex = 0
  105. this.baiDaCard = 51;/////TL++,拿到百搭牌
  106. this.baiDaList = [0,0,0];/////TL++,拿到百搭牌数组
  107. this.sbyBDList = []//////得到某人手中的百搭牌数组
  108. this.chuPaiCountTL = 0//////TL++,记录出牌的个数,为了判断天胡和地胡
  109. this.moPaiCountTL = 0//////TL++,记录出牌的个数,为了判断天胡和地胡
  110. this.lastMoPaiChairID = 0//////TL++,最后一个摸牌玩家的id
  111. this.addThisIsHu = 0//////TL++,胡牌判断时加上这张能不能胡
  112. this.isSeleCatcedCard = false//////判断能否胡牌的那张牌是自己抓的还是别人打出来的
  113. this.currChairIDTL = 0/////当前判断胡的chairID,用于得到当前玩家的胡牌情况
  114. this.isLaGang = false;//////TL++,是否刚刚被拉杠用于判断是否被拉杠胡
  115. this.isGuoHuList = [[false,0],[false,0],[false,0],[false,0],]/////TL++,各个玩家在本轮是否点击了过胡和点击过牌时的台数
  116. this.setCardFileName = '';/////设置手牌的文件名
  117. this.cardGroupIndex = 0;////要设置的牌型种类
  118. this.isZHYZ = false;/////是不是最后1张
  119. this.isMZWF = [0,1,2,3];/////是不是满足位风
  120. // console.warn("ppppppppppp 长度 "+cards.length+" cards "+cards);
  121. };
  122. Logic.setHCfileNameList =[/////全部设置牌型的文件名
  123. "setHandCard_tianhu",
  124. ]
  125. // 导出常量
  126. Logic.CARDS = CARDS;
  127. Logic.STYLE = STYLE;
  128. Logic.CHAIR_COUNT = CHAIR_COUNT;
  129. Logic.CARDS_COUNT = CARDS_COUNT;
  130. // 导出类
  131. module.exports = Logic;
  132. // 原型对象
  133. var proto = Logic.prototype;
  134. /////TL++为了得到百搭牌数组用于判断是否需要补花和手牌中百搭牌个数
  135. proto.setBDList = function () {
  136. this.baiDaList = [this.baiDaCard,this.baiDaCard,this.baiDaCard]/////TL++,拿到百搭牌
  137. };
  138. ///////TL++在table类中出牌函数中调用,为了判断天胡和地胡
  139. proto.chuPaiTL = function () {
  140. // console.warn("111c天胡判断不正确",this.chuPaiCountTL);
  141. this.chuPaiCountTL += 1//////这个其实并不是真实的出牌个数,因为这个方法的调用在判断吃碰杠胡之前调用的
  142. }
  143. ///////TL++在table类中出牌函数中调用,为了判断天胡和地胡
  144. proto.moPaiTL = function () {
  145. // console.warn("111c天胡判断不正确",this.chuPaiCountTL);
  146. this.moPaiCountTL += 1//////TL++,记录出牌的个数,为了判断天胡和地胡 += 1
  147. }
  148. ///////TL++重置默认数据,在每局游戏开始的洗牌函数中调用
  149. proto.resetDataOnGameStart = function () {
  150. this.chuPaiCountTL = 0//////TL++出牌个数
  151. this.moPaiCountTL = 0//////TL++,记录摸牌的个数,为了判断天胡和地胡
  152. this.lastMoPaiChairID = 0//////TL++,最后一个摸牌玩家的id
  153. this.addThisIsHu = 0//////TL++,胡牌判断时加上这张能不能胡
  154. this.isSeleCatcedCard = false//////判断能否胡牌的那张牌是自己抓的还是别人打出来的
  155. this.isLaGang = false;//////TL++,是否刚刚被拉杠用于判断是否被拉杠胡
  156. this.isGuoHuList = [[false,0],[false,0],[false,0],[false,0],]/////TL++,各个玩家在本轮是否点击了过胡和点击过牌时的台数
  157. this.isZHYZ = false;/////是不是最后1张
  158. }
  159. // 重新洗牌
  160. proto.shuffle = function () {
  161. this.castCount = 0;
  162. this.disCount = 0;
  163. this.cardsPool = _.clone(this.cardsyl);
  164. this.lastCount = this.cardsPool.length;
  165. this.cardsPool = _.shuffle(this.cardsPool);////随机打乱一个数组
  166. this.cardsPool = _.shuffle(this.cardsPool);////洗第二次牌
  167. // this.cardsPool = _.shuffle(this.cardsPool);////洗第三次牌
  168. };
  169. // 填充数组
  170. proto.fillDeep = function (array, o, isMore) {
  171. for (let i = 0; i < array.length; ++i) {
  172. if (!isMore) {
  173. array[i] = _.clone(o);
  174. } else {
  175. array[i] = _.cloneDeep(o);/////深度拷贝,就是重新分配内存空间,浅拷贝则是两个变量共用一个内存对象
  176. }
  177. }
  178. return array;
  179. };
  180. //////TL++ 深复制一个object类型的数据
  181. proto.deepCloneTL = function (obj){
  182. let objClone = Array.isArray(obj)?[]:{};
  183. if(obj && typeof obj==="object"){
  184. for(let key in obj){
  185. if(obj.hasOwnProperty(key)){
  186. //判断ojb子元素是否为对象,如果是,递归复制
  187. if(obj[key]&& typeof obj[key] ==="object"){
  188. objClone[key] = this.deepCloneTL(obj[key]);
  189. }else{
  190. //如果不是,简单复制
  191. objClone[key] = obj[key];
  192. }
  193. }
  194. }
  195. }
  196. return objClone;
  197. };
  198. // 获取类型
  199. proto.getType = function (card) {
  200. return Math.floor(card / 10);
  201. };
  202. // 获取牌值
  203. proto.getValue = function (card) {
  204. return card % 10;
  205. };
  206. // 手牌排序
  207. proto.sort = function (handCards) {
  208. return _.sortBy(handCards);///降序排序
  209. };
  210. // 删除手牌 /////TL++参数isBuHua表示是否因为补花而造成的删除牌
  211. proto.remove = function (handCards, cards) {
  212. if (typeof (cards) == 'number') {
  213. if (cards == handCards[handCards.length - 1]) {
  214. return (handCards.pop(), true);
  215. } else {
  216. let pos = handCards.indexOf(cards);
  217. if (pos == -1) return false;
  218. return (handCards.splice(pos, 1), true);
  219. }
  220. }
  221. var length = cards.length;
  222. if (length > 1 && cards[0] == cards[length - 1]) {
  223. if (cards[0] == handCards[handCards.length - 1]) {
  224. handCards.pop();
  225. length -= 1;
  226. }
  227. let pos = handCards.indexOf(cards[0]);
  228. if (pos == -1) return false;
  229. handCards.splice(pos, length);
  230. } else {
  231. for (let i = 0; i < length; ++i) {
  232. let pos = handCards.indexOf(cards[i]);
  233. if (pos == -1) return false;
  234. handCards.splice(pos, 1);
  235. }
  236. }
  237. return true;
  238. };
  239. // 调整手牌
  240. proto.adjust = function (handCards) {
  241. var length = handCards.length;
  242. if (length < 2) return false;
  243. if (handCards[length - 1] < handCards[length - 2]) {
  244. let moCard = handCards.pop();
  245. let pos = _.findIndex(handCards, (i) => (i >= moCard));
  246. if (pos == -1) handCards.push(moCard);
  247. else handCards.splice(pos, 0, moCard);
  248. }
  249. return true;
  250. };
  251. // 投骰子
  252. proto.dice = function () {
  253. return _.random(1, 6);
  254. };
  255. // 剩余牌数
  256. proto.leaveCount = function () {
  257. return this.lastCount;
  258. };
  259. //////TL++,人工设置测试牌型
  260. proto.setTestSendCardsTL = function () {
  261. this.setCardFileName = '';
  262. let fileName = "setHandCard_tianhu"
  263. if(!fileName) return;/////文件名字不存在
  264. // console.warn("设置手牌的文件名",fileName);
  265. this.setCardFileName = fileName
  266. var SetHandCardTL = require('./setcard/' + fileName);
  267. if(!SetHandCardTL) return;
  268. //////TL++,设置手牌的文件
  269. this.setHandCardTL = new SetHandCardTL();
  270. ////console.error("洗牌之后的牌",this.cardsPool);
  271. let ccc = this.setHandCardTL.getSCFP(this.cardGroupIndex)
  272. if(ccc){//////已经设置的手牌发完了就随机发牌
  273. this.cardsPool = ccc/////设置手牌的地方 设置牌
  274. this.cardGroupIndex += 1; ////此句是否存在代表是否只发某一种牌型
  275. // SetHandCardTL.cardGroupIndex += 1; ////此句是否存在代表是否只发某一种牌型
  276. // if(SetHandCardTL.cardGroupIndex == 1) SetHandCardTL.cardGroupIndex = 0
  277. }
  278. else{
  279. this.setCardFilerIndex += 1;
  280. this.cardGroupIndex = 0;
  281. // SetHandCardTL.cardGroupIndex = 0;
  282. if(Logic.setCardFilerIndex < Logic.setHCfileNameList.length) this.setTestSendCardsTL()
  283. }
  284. }
  285. // 初始手牌
  286. proto.handCards = function (chBanker,_PJHF,_over,recordid,_ctime) {
  287. this.resetDataOnGameStart()//////TL++
  288. this.shuffle();
  289. // if(this.hzCount == 8) {
  290. // this.cardsPool = [37,31,28,19,26,33,12,24,29,15,34,32,21,21,33,12,17,39,23,11,32,21,16,29,16,19,22,11,22,12,32,23,15,34,13,24,13,28,35,27,23,38,16,35,18,12,24,22,34,17,33,32,26,39,35,14,23,36,16,27,25,31,26,36,19,13,17,36,17,31,29,37,21,38,25,15,18,37,14,39,33,11,13,19,38,15,11,27,51,18,37,28,28,22,51,31,51,14,14,51,18,29,25,26,34,38,24,35,25,39,36,27]
  291. // this.setTestSendCardsTL()///////设置手牌的地方,设置发牌 不需要设置的时候注释掉这个方法就可以了
  292. // this.lastCount = this.cardsPool.length;//////设置剩余牌数设置剩余牌数,测试完这句要删掉
  293. // }
  294. let dqjs = _over + 1;
  295. _PJHF.writexpJson(this.deepCloneTL(this.cardsPool),dqjs,recordid,_ctime);
  296. //// 下面这个是随机发牌但是起手发lzgs张癞子的逻辑
  297. // let lzgs = 4//癞子个数
  298. // let djg = 0;
  299. // let djg2 = 31;
  300. // for (let i = 0; i < this.cardsPool.length; i++) {
  301. // if(this.cardsPool[i] == 51){
  302. // if(djg < 2){
  303. // let xx = this.cardsPool[djg]
  304. // this.cardsPool[djg] = 51;
  305. // this.cardsPool[i] = xx;
  306. // }
  307. // else{
  308. // let xx = this.cardsPool[djg2]
  309. // this.cardsPool[djg2] = 51;
  310. // this.cardsPool[i] = xx;
  311. // djg2++;
  312. // }
  313. // djg++
  314. // if(djg >= lzgs){
  315. // break
  316. // }
  317. // }
  318. // }
  319. /////TL++设置百搭牌数组
  320. this.setBDList()
  321. var result = [];
  322. var castCount = 0;
  323. for (let i = 0; i < this.playerAllCount; ++i) {
  324. let cardCount = CARDS_COUNT;
  325. if (i == chBanker) cardCount += 1;
  326. let cards = this.cardsPool.slice(castCount, castCount + cardCount);
  327. castCount += cardCount;
  328. result.push({ cards: this.sort(cards) });
  329. }
  330. this.castCount += castCount
  331. this.lastCount -= castCount;
  332. // this.lastCount -= this.disCountTL;////因为翻出来的百搭牌不能被摸走
  333. // console.error("发的手牌",result);
  334. return result;
  335. };
  336. // 是否无牌
  337. proto.isNoCards = function () {
  338. return this.lastCount <= 0;
  339. };
  340. // 摸牌函数
  341. proto.moCard = function (isgang) {
  342. // console.error("摸排摸排---------",isgang,this.disCountTL,this.lastCount);
  343. var card = 0;
  344. if (this.lastCount > 0) {
  345. card = this.cardsPool[this.castCount++];
  346. this.lastCount -= 1;
  347. }
  348. return { card: card };
  349. };
  350. // 是否将牌
  351. proto.isJang = function (lcard, rcard) {
  352. return lcard == rcard;
  353. };
  354. ////判断吃碰补之后是否只剩下百搭牌了,因为如果吃碰补之后只剩下百搭牌,而百搭牌又不允许打出会造成玩家无牌可出的局面
  355. proto.isCanCPB = function (handCards,opeate,type) {
  356. // console.warn("判断吃碰补之后是否只剩下百搭牌了 length "+handCards.length +" handCards "+JSON.stringify(handCards)+" opeate "+opeate+" type "+type);
  357. let length = handCards.length;
  358. let baiDaCount22 = this.getBDCount(handCards)
  359. let needCost = 0;//进行操作需要消耗的张数
  360. if(opeate == STYLE.CHI || opeate == STYLE.PENG) needCost = 2;
  361. else if(opeate == STYLE.GANG){
  362. //补牌,1-普通补, 2-暗补, 3-自摸补
  363. //1-普通杠, 2-暗杠, 3-自摸明杠
  364. if(type == 1) needCost = 3;
  365. else if(type == 2) needCost = 4;
  366. else if(type == 3) needCost = 1;
  367. }
  368. // console.warn("判断吃碰补之后是否只剩下百搭牌了 length "+length +" baiDaCount22 "+baiDaCount22+" needCost "+needCost);
  369. return (length - needCost - baiDaCount22 > 0);
  370. }
  371. // 可否碰牌
  372. proto.isPeng = function (handCards, card) {
  373. if(card == 51) return false;
  374. for (let i = 0; i < handCards.length - 1; ++i) {
  375. if (handCards[i] == card && handCards[i + 1] == card) {
  376. return true;
  377. }
  378. }
  379. return false;
  380. };
  381. // 碰牌 TL++参数chirID为了判断圈风和位风
  382. proto.peng = function (chirID,handCards, card) {
  383. if (this.isPeng(handCards, card)) {
  384. return { style: STYLE.PENG, cards: [card, card, card], disc: [card] };
  385. }
  386. };
  387. // 吃牌,1-@**左吃, 2-*@*中吃, 3-@**右吃
  388. proto.chi = function (handCards, card, type) {
  389. var chis = this.chiAnalyze(handCards, card, type);
  390. if (chis[0]) {
  391. let res = { style: STYLE.CHI, type: type, disc: [card] };
  392. if (type == 1) {
  393. res.cards = [card, card + 1, card + 2];
  394. if (this.getValue(card) < 7) {
  395. res.disc.push(card + 3);
  396. }
  397. } else if (type == 2) {
  398. res.cards = [card - 1, card, card + 1];
  399. } else {
  400. res.cards = [card - 2, card - 1, card];
  401. if (this.getValue(card) > 3) {
  402. res.disc.push(card - 3);
  403. }
  404. }
  405. return res;
  406. }
  407. };
  408. // 杠牌,1-普通杠, 2-暗杠, 3-自摸明杠 TL++参数chirID为了判断圈风和位风
  409. proto.gang = function (chirID,handCards, card, type) {
  410. // 结果
  411. var res = null;
  412. // 明杠
  413. if (type == 1) {
  414. let gang = this.gangAnalyze(handCards, card);
  415. if (gang) {
  416. res = { style: STYLE.GANG, cards: [card, card, card] };
  417. }
  418. }
  419. // 暗杠
  420. else if (type == 2) {
  421. let anGang = this.anGangAnalyze(handCards, card);
  422. if (anGang[0]) {
  423. res = { style: STYLE.ANGANG, cards: [card, card, card] };
  424. }
  425. }
  426. return res;
  427. };
  428. // 自摸明杠,1-普通杠, 2-暗杠, 3-自摸明杠 TL++参数chirID为了判断圈风和位风
  429. proto.zmGang = function (chirID,handCards, huCards, card) {
  430. var zmGang = this.zmGangAnalyze(handCards, huCards, card);
  431. if (zmGang[0]) {
  432. return { style: STYLE.ZMGANG, cards: [card, card, card] };
  433. }
  434. };
  435. // 吃牌分析,1-@**左吃, 2-*@*中吃, 3-@**右吃, type可以不传
  436. proto.chiAnalyze = function (handCards, card, type) {
  437. // 结果集合
  438. var result = [];
  439. if(card == 51) return result;
  440. // 排除风字
  441. if (handCards.length < 2 || card > 40) return result;
  442. // 查找句子
  443. var length = handCards.length;
  444. for (let i = 0; i < length; ++i) {
  445. // 牌面值
  446. let value = this.getValue(card);
  447. // @**左吃,吃类型(可以不指定)
  448. if (!type || type == 1) {
  449. if (value < 8 && i < length - 1) {
  450. if (handCards[i] == card + 1 && handCards[i + 1] == card + 2) {
  451. result.push({ type: 1, card: card });
  452. }
  453. }
  454. }
  455. // *@*中吃,吃类型(可以不指定)
  456. if (!type || type == 2) {
  457. if (value > 1 && value < 9 && i < length - 1) {
  458. if (handCards[i] == card - 1 && handCards[i + 1] != card - 1) {
  459. for (let j = i + 1; j < i + 5 && j < length; ++j) {
  460. if (handCards[j] == card + 1) {
  461. result.push({ type: 2, card: card });
  462. break;
  463. }
  464. }
  465. }
  466. }
  467. }
  468. // **@右吃,吃类型(可以不指定)
  469. if (!type || type == 3) {
  470. if (value > 2 && i < length - 1) {
  471. if (handCards[i] == card - 2 && handCards[i + 1] == card - 1) {
  472. result.push({ type: 3, card: card });
  473. }
  474. }
  475. }
  476. }
  477. return result;
  478. };
  479. // 普通杠分析,1-普通杠, 2-暗杠, 3-自摸明杠
  480. proto.gangAnalyze = function (handCards, card) {
  481. // 结果对象
  482. var result = null;
  483. if(card == 51 || this.lastCount <= 0) return result;//红中不能碰杠
  484. var length = handCards.length;
  485. if (length < 3) return result;
  486. // 查找同牌
  487. for (let i = 0; i < length - 2; ++i) {
  488. if (handCards[i] == card && handCards[i + 1] == card && handCards[i + 2] == card) {
  489. result = { type: 1, card: card };
  490. break;
  491. }
  492. }
  493. return result;
  494. };
  495. // 暗杠分析,1-普通杠, 2-暗杠, 3-自摸明杠, card可以不传
  496. proto.anGangAnalyze = function (handCards, card) {
  497. // 结果对象
  498. var result = [];
  499. if(this.lastCount <= 0) return result;//红中不能碰杠
  500. var length = handCards.length;
  501. if (length < 4) return result;
  502. // 查找同牌
  503. var moCard = handCards[length - 1];
  504. for (let i = 0; i < length - 3; ++i) {
  505. // 指定杠牌,可以不指定
  506. if (card && handCards[i] != card) continue;
  507. // 判定是否刻子
  508. if (handCards[i] == handCards[i + 1] && handCards[i] == handCards[i + 2]) {
  509. // 手上有杠牌
  510. if (handCards[i] == handCards[i + 3]) {
  511. if(handCards[i] != 51){
  512. result.push({ type: 2, card: handCards[i] });
  513. }
  514. }
  515. // 刚摸到杠牌
  516. else if (handCards[i] == moCard) {
  517. if(handCards[i] != 51){
  518. result.push({ type: 2, card: moCard });
  519. }
  520. }
  521. }
  522. }
  523. return result;
  524. };
  525. // 自摸杠分析,1-普通杠, 2-暗杠, 3-自摸明杠, card可以不传
  526. proto.zmGangAnalyze = function (handCards, huCards, card) {
  527. // 返回结果
  528. var result = [];
  529. if(card == 51 || this.lastCount <= 0) return result;//红中不能碰杠
  530. // 遍历句子
  531. for (let i = 0; i < huCards.length; ++i) {
  532. if (huCards[i].style != STYLE.PENG) {
  533. continue;
  534. }
  535. let _card = huCards[i].cards[0];
  536. if (card && _card != card) continue;
  537. let pos = handCards.indexOf(_card);
  538. if (pos != -1) {
  539. result.push({ type: 3, card: _card });
  540. if (card) break;
  541. }
  542. }
  543. return result;
  544. };
  545. // 分析牌型
  546. proto.parseBlock = function (card1, card2, card3) {
  547. // 刻子
  548. if (card1 && card1 == card2 && card1 == card3) {
  549. return { style: STYLE.KE, cards: [card1, card2, card3] };
  550. }
  551. // 顺子(排除风字)
  552. var cards = this.sort([card1, card2, card3]);
  553. if (cards[2] < 40) {
  554. if (cards[2] == cards[1] + 1 && cards[1] == cards[0] + 1) {
  555. return { style: STYLE.SUN, cards: cards };
  556. }
  557. }
  558. };
  559. // TL++,得到手牌中百搭牌的个数
  560. proto.getBDCount = function (cards) {
  561. ////TL++,整个for循环判断手牌中的百搭牌个数
  562. let baiDaCount = 0
  563. for (let i = 0; i < cards.length; ++i) {
  564. if(cards[i] == this.baiDaCard) baiDaCount = baiDaCount + 1
  565. }
  566. return baiDaCount
  567. }
  568. // TL++,得到手牌中百搭牌的shuzu数组
  569. proto.getBDListZZ = function (cards) {
  570. this.sbyBDList = []//////重置某人手牌中的百搭牌数组
  571. ////TL++,整个for循环判断手牌中的百搭牌个数
  572. let baiDaCount = 0
  573. let baiDali = []
  574. for (let i = 0; i < cards.length; ++i) {
  575. if(cards[i] == this.baiDaCard){
  576. baiDali[baiDaCount] = cards[i]
  577. baiDaCount = baiDaCount + 1
  578. }
  579. }
  580. return baiDali
  581. }
  582. // TL++,得到手牌中百搭牌的index数组
  583. proto.getBDIndexList = function (cards) {
  584. ////TL++,整个for循环判断手牌中的百搭牌个数
  585. let baiDali = []
  586. for (let i = 0; i < cards.length; ++i) {
  587. let cardTL = cards[i];
  588. if(this.baiDaList[0] && cardTL == this.baiDaList[0]) baiDali[baiDali.length] = i;
  589. else if(this.baiDaList[1] && cardTL == this.baiDaList[1]) baiDali[baiDali.length] = i;
  590. else if(this.baiDaList[2] && cardTL == this.baiDaList[2]) baiDali[baiDali.length] = i;
  591. }
  592. return baiDali
  593. }
  594. // TL++,得到手牌中百搭牌的index,用于删除手牌中的百搭牌
  595. proto.getBDIndex = function (cards) {
  596. ////TL++,整个for循环判断手牌中的百搭牌个数
  597. let baiDali = []
  598. for (let i = 0; i < cards.length; ++i) {
  599. let cardTL = cards[i];
  600. if(this.sbyBDList[0] && cardTL == this.sbyBDList[0]) baiDali[baiDali.length] = i;
  601. if(this.sbyBDList[1] && cardTL == this.sbyBDList[1]) baiDali[baiDali.length] = i;
  602. if(this.sbyBDList[2] && cardTL == this.sbyBDList[2]) baiDali[baiDali.length] = i;
  603. }
  604. return baiDali
  605. }
  606. // TL++,得到默认手牌中百搭牌当的数组 cards: 手牌去除百搭之后的牌
  607. proto.getBDMakeList = function (cards,isNeedAllZi) {
  608. if(cards.length == 0){
  609. ////手上就剩百搭牌的时候 需要把所有牌都当一遍
  610. let reslist = [
  611. 11, 12, 13, 14, 15, 16, 17, 18, 19, // 筒
  612. 21, 22, 23, 24, 25, 26, 27, 28, 29, // 万
  613. 31, 32, 33, 34, 35, 36, 37, 38, 39, // 条
  614. ]
  615. return reslist;
  616. }
  617. ////TL++,整个for循环按照手牌情况确定百搭牌当的范围
  618. let makeList = this.deepCloneTL(cards)
  619. for (let i = 0; i < cards.length; ++i) {
  620. let cardTL = cards[i];
  621. let type = this.getType(cardTL);
  622. let vale = this.getValue(cardTL);
  623. if(type < 4){
  624. if(vale == 1){
  625. let makeValue = cardTL + 1;
  626. if(makeList.indexOf(makeValue) == -1) makeList[makeList.length] = makeValue;
  627. let makeValue2 = cardTL + 2;
  628. if(makeList.indexOf(makeValue2) == -1) makeList[makeList.length] = makeValue2;
  629. }
  630. else if(vale == 9){
  631. let makeValue = cardTL - 1;
  632. if(makeList.indexOf(makeValue) == -1) makeList[makeList.length] = makeValue;
  633. let makeValue2 = cardTL - 2;
  634. if(makeList.indexOf(makeValue2) == -1) makeList[makeList.length] = makeValue2;
  635. }
  636. else if(vale == 2){
  637. let makeValue = cardTL - 1;
  638. if(makeList.indexOf(makeValue) == -1) makeList[makeList.length] = makeValue;
  639. let makeValue2 = cardTL + 1;
  640. if(makeList.indexOf(makeValue2) == -1) makeList[makeList.length] = makeValue2;
  641. let makeValue3 = cardTL + 2;
  642. if(makeList.indexOf(makeValue3) == -1) makeList[makeList.length] = makeValue3;
  643. }
  644. else if(vale == 8){
  645. let makeValue = cardTL - 1;
  646. if(makeList.indexOf(makeValue) == -1) makeList[makeList.length] = makeValue;
  647. let makeValue2 = cardTL - 2;
  648. if(makeList.indexOf(makeValue2) == -1) makeList[makeList.length] = makeValue2;
  649. let makeValue3 = cardTL + 1;
  650. if(makeList.indexOf(makeValue3) == -1) makeList[makeList.length] = makeValue3;
  651. }
  652. else if(vale > 2 && vale < 8){
  653. let makeValue = cardTL - 1;
  654. if(makeList.indexOf(makeValue) == -1) makeList[makeList.length] = makeValue;
  655. let makeValue2 = cardTL + 1;
  656. if(makeList.indexOf(makeValue2) == -1) makeList[makeList.length] = makeValue2;
  657. let makeValue3 = cardTL - 2;
  658. if(makeList.indexOf(makeValue3) == -1) makeList[makeList.length] = makeValue3;
  659. let makeValue4 = cardTL + 2;
  660. if(makeList.indexOf(makeValue4) == -1) makeList[makeList.length] = makeValue4;
  661. }
  662. }
  663. }
  664. // let makeList2 = makeList.concat([41,42,43,44,51,52,53])/////给当的数组拼接字牌
  665. // var xx = [1,1,2,3,4,1,2]
  666. // var xx22 = _.uniq(xx)
  667. // console.warn("数组去重",xx,xx22);///[ 1, 1, 2, 3, 4, 1, 2 ] [ 1, 2, 3, 4 ]
  668. // xx[1] = 6
  669. // console.warn("22数组去重",xx,xx22);////[ 1, 6, 2, 3, 4, 1, 2 ] [ 1, 2, 3, 4 ]
  670. return _.uniq(makeList);
  671. }
  672. // 提取成句 card:手上的所有牌删除2张用来做将的牌之后剩下的牌 整理是否为刻子或者顺子
  673. proto._dumpFixed = function (cards, huCards) {
  674. // if(this.currChairIDTL == 0){
  675. // console.error("sscc提取成句没有百搭cards",cards);
  676. // console.error("sscc提取成ju没有百搭huCards",huCards);
  677. // }
  678. for (let i = 0; i < cards.length - 2; ++i) {
  679. let card = cards[i];
  680. if (card <= 0) continue;
  681. if (card == cards[i + 1] && card == cards[i + 2]) {
  682. huCards.push({ style: STYLE.KE, cards: [card, card, card] });
  683. cards[i] = 0; cards[i + 1] = 0; cards[i + 2] = 0;
  684. i += 2; continue;
  685. }
  686. if (card > 40 || this.getValue(card) > 7) continue;
  687. let second = -1, third = -1;
  688. for (let j = i + 1; j < cards.length; ++j) {
  689. if (cards[j] == card + 1) second = j;
  690. if (cards[j] == card + 2) third = j;
  691. if (cards[j] > card + 2) break;
  692. if (second != -1 && third != -1) break;
  693. }
  694. if (second != -1 && third != -1) {
  695. huCards.push({ style: STYLE.SUN, cards: [card, cards[second], cards[third]] });
  696. cards[i] = 0; cards[second] = 0; cards[third] = 0;
  697. }
  698. }
  699. };
  700. proto._dumpFixedc = function (cards,huCards,baidaCount) {
  701. let spkzgs = 4 - huCards.length;//手牌可组个数
  702. let spkzzh = [];//手牌可组组合(1为刻2为顺)
  703. if(spkzgs == 1) spkzzh = [[1],[2]];
  704. else if(spkzgs == 2) spkzzh = [[1,1],[1,2],[2,2],[2,1]];
  705. else if(spkzgs == 3) spkzzh = [[1,1,1],[1,2,1],[1,1,2],[1,2,2],[2,2,2],[2,1,2],[2,2,1],[2,1,1]];
  706. else if(spkzgs == 4){
  707. spkzzh = [[1,1,1,1],[1,2,1,1],[1,1,2,1],[1,1,1,2],
  708. [1,2,2,1],[1,1,2,2],[1,2,1,2],[1,2,2,2],
  709. [2,2,2,2],[2,1,2,2],[2,2,1,2],[2,2,2,1],
  710. [2,1,1,2],[2,2,1,1],[2,1,2,1],[2,1,1,1]
  711. ]
  712. }
  713. //找到目标牌
  714. var getMBCard = (cscards) => {
  715. for (let i = 0; i < cscards.length; ++i) {
  716. let card = cscards[i];
  717. if (card <= 0) continue;
  718. else return card;
  719. }
  720. return -100;
  721. };
  722. // let mbpailist = [12,15,15,15,16,17,18,25,26,27]
  723. // let islog = true;
  724. // if(mbpailist.length == cards.length){
  725. // for (let i = 0; i < cards.length; ++i) {
  726. // if(mbpailist[i] != cards[i]) islog = false;
  727. // }
  728. // }
  729. // else{
  730. // islog = false;
  731. // }
  732. // let mbpailist2 = [15,15,16,17,18,25,26,27,28,28,28]
  733. // if(islog) console.warn("_dumpFixedc 提取成句 baidaCount "+baidaCount+" cards "+cards+ " indexof "+mbpailist2.indexOf(15));
  734. // console.warn("所有的判断组合 长度 "+spkzzh.length+" spkzzh "+JSON.stringify(spkzzh) )
  735. let dqdpd = [0,0]//当前的判断
  736. for (let x = 0; x < spkzzh.length; ++x) {
  737. let copyCards = this.deepCloneTL(cards)
  738. let bdCount = baidaCount;
  739. let huCards22 = [];
  740. // console.warn("当前的判断组合 "+dqdpd+" spkzzh[x] "+spkzzh[x]+" x "+x);
  741. // if(islog && x == 5) console.warn("当前的判断组合 "+dqdpd+" spkzzh[x] "+spkzzh[x]+" x "+x);
  742. for (let y = 0; y < spkzzh[x].length; ++y) {
  743. let ckORcs = spkzzh[x][y]//成刻或成顺(1为刻2为顺)
  744. // if(islog && x == 5) console.warn("当前的判断 "+dqdpd+" ckORcs "+ckORcs);
  745. if(ckORcs == 1){
  746. let mbCard = getMBCard(copyCards);//目标card(mbCard这次应该成刻)
  747. if(mbCard > 0){
  748. let index1 = copyCards.indexOf(mbCard);
  749. if(index1 != -1) copyCards[index1] = 0;
  750. // else console.error("这里不正常,都没有目标牌");
  751. let cj = [mbCard];//成句
  752. let index2 = copyCards.indexOf(mbCard);
  753. if(index2 != -1){
  754. cj[cj.length] = mbCard;
  755. copyCards[index2] = 0;
  756. }
  757. else {
  758. if(bdCount > 0){
  759. cj[cj.length] = 51;
  760. bdCount -= 1;
  761. }
  762. }
  763. let index3 = copyCards.indexOf(mbCard);
  764. if(index3 != -1){
  765. cj[cj.length] = mbCard;
  766. copyCards[index3] = 0;
  767. }
  768. else {
  769. if(bdCount > 0){
  770. cj[cj.length] = 51;
  771. bdCount -= 1;
  772. }
  773. }
  774. if(cj.length == 3){
  775. huCards22.push({ style: STYLE.KE, cards: cj });
  776. }
  777. else{
  778. //mbCard不能成刻,说明spkzzh[x]这种组合是不行的,剩下的就不用判断了
  779. // console.warn("mbCard不能成刻,说明spkzzh[x]这种组合是不行的,剩下的就不用判断了");
  780. break;
  781. }
  782. }
  783. else{
  784. //手牌全部都判断过了
  785. if(bdCount >= 3){
  786. huCards22.push({ style: STYLE.KE, cards: [51, 51, 51] });
  787. bdCount -= 3;
  788. }
  789. //因为手里最多8张百搭,最多可以有6张百搭做成2个百搭刻,所以需要两次if
  790. if(bdCount >= 3){
  791. huCards22.push({ style: STYLE.KE, cards: [51, 51, 51] });
  792. bdCount -= 3;
  793. }
  794. break;
  795. }
  796. }
  797. else if(ckORcs == 2){
  798. let mbCard = getMBCard(copyCards);//目标card(mbCard这次应该成刻)
  799. // if(islog && x == 5) console.warn("mbCard "+mbCard+" copyCards "+copyCards);
  800. if (mbCard < 40){
  801. if(mbCard > 0){
  802. let index1 = copyCards.indexOf(mbCard);
  803. if(index1 != -1) copyCards[index1] = 0;
  804. // else console.error("这里不正常,都没有目标牌");
  805. let cj = [mbCard];//成句
  806. if(this.getValue(mbCard) <= 7){
  807. let index2 = copyCards.indexOf(mbCard+1);
  808. if(index2 != -1){
  809. cj[cj.length] = copyCards[index2];
  810. copyCards[index2] = 0;
  811. }
  812. else {
  813. if(bdCount > 0){
  814. cj[cj.length] = 51;
  815. bdCount -= 1;
  816. }
  817. }
  818. let index3 = copyCards.indexOf(mbCard+2);
  819. if(index3 != -1){
  820. cj[cj.length] = copyCards[index3];
  821. copyCards[index3] = 0;
  822. }
  823. else {
  824. if(bdCount > 0){
  825. cj[cj.length] = 51;
  826. bdCount -= 1;
  827. }
  828. }
  829. }
  830. else if(this.getValue(mbCard) == 8){
  831. let index2 = copyCards.indexOf(mbCard+1);
  832. if(index2 != -1){
  833. cj[cj.length] = copyCards[index2];
  834. copyCards[index2] = 0;
  835. }
  836. else {
  837. if(bdCount > 0){
  838. cj[cj.length] = 51;
  839. bdCount -= 1;
  840. }
  841. }
  842. if(bdCount > 0){
  843. cj[cj.length] = 51;
  844. bdCount -= 1;
  845. }
  846. }
  847. else if(this.getValue(mbCard) == 9){
  848. if(bdCount > 1){
  849. cj[cj.length] = 51;
  850. cj[cj.length] = 51;
  851. bdCount -= 2;
  852. }
  853. }
  854. if(cj.length == 3){
  855. huCards22.push({ style: STYLE.SUN, cards: cj });
  856. }
  857. else{
  858. //mbCard不能成顺,说明spkzzh[x]这种组合是不行的,剩下的就不用判断了
  859. break;
  860. }
  861. }
  862. else{
  863. //手牌全部都判断过了
  864. if(bdCount >= 3){
  865. huCards22.push({ style: STYLE.SUN, cards: [51, 51, 51] });
  866. bdCount -= 3;
  867. }
  868. //因为手里最多8张百搭,最多可以有6张百搭做成2个百搭刻,所以需要两次if
  869. if(bdCount >= 3){
  870. huCards22.push({ style: STYLE.SUN, cards: [51, 51, 51] });
  871. bdCount -= 3;
  872. }
  873. break;
  874. }
  875. }
  876. }
  877. // if(y < spkzzh[x].length-1) dqdpd=[x,y+1];
  878. // else dqdpd=[x+1,0];
  879. }
  880. // if(islog && x == 5) console.warn("提取成句 组合 "+" spkzzh[x] "+spkzzh[x]+" huCards22 "+JSON.stringify(huCards22) );
  881. if(huCards22.length + huCards.length == 4){
  882. //已经可以胡牌了,其他的组合就不需要判断了
  883. for (var i = 0; i < huCards22.length; i++) {
  884. huCards.push(huCards22[i]);
  885. }
  886. break;
  887. }
  888. }
  889. };
  890. //////TL++,判断一手张牌是否为百搭牌
  891. proto.judgeACardISBD = function (card) {
  892. return card == this.baiDaCard;
  893. }
  894. // 胡牌分析 chairID(TL++这个参数) 手牌 加上这张判断能不能胡 手上的吃碰杠牌 是否自己摸上来的
  895. proto.huAnalyze = function (chairID,handCards, card, huCards, isTouch) {
  896. // console.error("sscc777胡牌分析card",card);
  897. // console.error("sscc777胡牌分析handCards",handCards);
  898. // console.error("sscc777胡牌分析huCards",huCards);
  899. // console.error("sscc777胡牌分析isTouch",isTouch);
  900. // this.isHanDa = false;//////TL++,是否还搭(百搭牌用作原牌型,不累计)
  901. this.isPaoDa = false/////TL++,当前是不是抛搭,因为是抛搭的话不能打倒胡(吃胡)
  902. this.isQiDui = false;//////TL++,是否7对
  903. let tempAllTai = 0/////临时总台数
  904. let tempres = {}///本函数的返回值
  905. this.addThisIsHu = card//////TL++,胡牌判断时加上这张能不能胡
  906. this.isSeleCatcedCard = isTouch//////判断能否胡牌的那张牌是自己抓的还是别人打出来的
  907. this.currChairIDTL = chairID/////当前判断胡的chairID,用于得到当前玩家的花牌情况
  908. this.dangAfterBDListTL = [];/////7月18日+的
  909. // console.warn("胡牌分析 isGuoHuList ",this.isGuoHuList," chairID ",chairID," isTouch ",isTouch);
  910. if(this.isGuoHuList[chairID][0]){
  911. // console.warn("此人点过胡了 ",chairID," isTouch ",(!isTouch));
  912. if(!isTouch){
  913. // console.warn("不是此人摸牌 ",chairID,isTouch);
  914. return false;
  915. }
  916. }
  917. let baiDaCount22 = 0
  918. let bdIndexlist = []
  919. if (!isTouch){
  920. baiDaCount22 = this.getBDCount(handCards)
  921. this.sbyBDList = this.getBDListZZ(handCards)
  922. handCards = handCards.concat(card);/////不是自己抓的就把这张牌拼接进手牌中
  923. handCards = this.sort(handCards);
  924. bdIndexlist = this.getBDIndexList(handCards)
  925. }
  926. else{
  927. handCards = this.sort(handCards);
  928. baiDaCount22 = this.getBDCount(handCards)
  929. this.sbyBDList = this.getBDListZZ(handCards)
  930. bdIndexlist = this.getBDIndexList(handCards)
  931. }
  932. // console.warn("判断13不搭手上百搭牌个数出错了?????",baiDaCount22,this.sbyBDList,bdIndexlist)
  933. handCards = this.sort(handCards);
  934. var huRes = { card: card, jiang: 0, huCards: [] };
  935. // 重设将牌
  936. var resetHuRes = (jiang) => {
  937. huRes.jiang = jiang;
  938. huRes.huCards = [];
  939. for (let huCard of huCards) huRes.huCards.push(huCard);
  940. };
  941. // 手牌不全
  942. var length = handCards.length;
  943. if (length % 3 != 2) return;
  944. let hucardTL = huCards//////TL++,保存碰杠牌的初始值,因为这个参数会在下面的代码中被修改掉
  945. if(baiDaCount22 == 4 && this.hzCount == 4){
  946. //选择4红中规则的时候,手里有4张红中的话可以直接胡,6红中8红中不可直接胡
  947. // tempres = huCards
  948. return huRes;
  949. }
  950. if(baiDaCount22 == 0){/////没有百搭的时候
  951. // 确定将牌
  952. for (let i = 0; i < length - 1; ++i) {
  953. if (!this.isJang(handCards[i], handCards[i + 1])) continue;
  954. resetHuRes(handCards[i]);////设置将牌
  955. let cards = handCards.slice(0, i);////手牌数组的前i个元素
  956. cards = cards.concat(handCards.slice(i + 2));////给数组cards拼接上手牌的第 i+2 个以后的全部数组元素 这句是将手牌删除2张将牌之后得到的牌
  957. this._dumpFixed(cards, huRes.huCards);
  958. i += 1;/////TL++,为了减少运算
  959. if(huRes.huCards.length >= 4){
  960. return huRes;
  961. }
  962. }
  963. }
  964. else{/////有百搭的时候
  965. let card2 = []//////用于存放手牌中将所有百搭牌去掉之后的手牌
  966. for (let xx = 0; xx < this.sbyBDList.length; ++xx){
  967. card2 = handCards.slice(0,bdIndexlist[xx] - xx)////得到数组中的前bdIndexlist[xx] 个元素
  968. card2 = card2.concat(handCards.slice(bdIndexlist[xx]+1 - xx))////得到数组中的最后bdIndexlist[xx] +1 个元素
  969. handCards = card2
  970. // console.error("有百搭删除掉百搭牌",handCards,card2);
  971. }
  972. // console.warn("删除百搭之后的手牌222",handCards);
  973. let bdzs = this.sbyBDList.length;/////百搭张数
  974. let copyhandCards = this.deepCloneTL(handCards)
  975. var huResTL = [];
  976. for (let huCard of huCards) huResTL.push(huCard);
  977. // console.warn("去掉百搭之后的手牌 copyhandCards "+copyhandCards);
  978. if(copyhandCards.length == 0) return huRes;
  979. //下面的for循环是用手牌的两张牌做将牌看能不能胡牌
  980. for (let i = 0; i < copyhandCards.length - 1; ++i) {
  981. let cards22 = this.deepCloneTL(copyhandCards)
  982. if (!this.isJang(cards22[i], cards22[i + 1])) continue;
  983. let huRes3 = { card: card, jiang: 0, huCards: [] };
  984. // 重设将牌
  985. huRes3.jiang = cards22[i];
  986. huRes3.huCards = [];
  987. for (let huCard of huCards) huRes3.huCards.push(huCard);
  988. let cards2 = cards22.slice(0, i);////手牌数组的前i个元素
  989. cards2 = cards2.concat(cards22.slice(i + 2));////给数组cards拼接上手牌的第 i+2 个以后的全部数组元素 这句是将手牌删除2张将牌之后得到的牌
  990. this._dumpFixedc(cards2, huRes3.huCards,bdzs);
  991. // console.warn("判胡 2张手牌做将length "+huRes3.huCards.length+" jiang "+huRes3.jiang+" huRes3.huCards "+JSON.stringify(huRes3.huCards));
  992. if (huRes3.huCards.length >= 4){
  993. return huRes3;
  994. }
  995. i += 1;/////TL++,为了减少运算
  996. }
  997. //下面的for循环是用一张手牌和一张百搭牌做将牌看能不能胡牌
  998. let bcjp = 0;///////本次的将牌
  999. for (let i = 0; i < copyhandCards.length; ++i) {
  1000. let cards22 = this.deepCloneTL(copyhandCards);
  1001. if(cards22[i] == bcjp) continue;
  1002. let huRes3 = { card: card, jiang: 0, huCards: [] };
  1003. // 重设将牌
  1004. huRes3.jiang = cards22[i];
  1005. huRes3.huCards = [];
  1006. for (let huCard of huCards) huRes3.huCards.push(huCard);
  1007. bcjp = cards22[i]; ///////本次的将牌
  1008. let cards2 = cards22.slice(0, i);////手牌数组的前i个元素
  1009. cards2 = cards2.concat(cards22.slice(i + 1));////给数组cards拼接上手牌的第 i+2 个以后的全部数组元素 这句是将手牌删除2张将牌之后得到的牌
  1010. // console.warn("判胡 1张手牌做将length "+huRes3.huCards.length+" jiang "+huRes3.jiang+" huRes3.huCards "+JSON.stringify(huRes3.huCards));
  1011. this._dumpFixedc(cards2, huRes3.huCards,bdzs-1);
  1012. if (huRes3.huCards.length >= 4){
  1013. return huRes3;
  1014. }
  1015. }
  1016. }
  1017. };
  1018. // // TL++胡牌提示 chairID(TL++这个参数) 手牌 手上的吃碰杠牌 这个是胡牌提示里不统计台数
  1019. proto.hutip = function (chairID,_handCards, _huCards,_allhuCards,outCards) {
  1020. // return {
  1021. // renyi:0,//////是否可胡任意牌,0表示不满足1表示满足
  1022. // kehuData:[]/////对象数组,分别表示打哪张可胡哪几张数据
  1023. // };////服务端运算量太大放到前端去计算了
  1024. this.yscs = 0
  1025. // console.warn("hutip777胡牌提示handCards ",chairID,_handCards,_huCards,this.yscs);
  1026. // console.error("sscc777胡牌提示huCards",_huCards);
  1027. let hutipRes = [];
  1028. let handCards1 = _.clone(_handCards);
  1029. // if(chairID == 1) console.warn("sscc777胡牌提示handCards1 ",chairID,_handCards);
  1030. let huCards = _.clone(_huCards);
  1031. let allhuCards = _.clone(_allhuCards);////用统计胡牌提示的剩余牌
  1032. let baiDaCount22 = this.getBDCount(_handCards);
  1033. let dangPaiList = this.getBDMakeList(handCards1);
  1034. if(baiDaCount22 == 4 && this.hzCount == 4){
  1035. //选择4红中规则的时候,手里有4张红中的话可以直接胡,6红中8红中不可直接胡
  1036. let kehuData2 = {
  1037. renyi:1,//////是否可胡任意牌,0表示不满足1表示满足
  1038. kehuData:[]/////对象数组,分别表示打哪张可胡哪几张数据
  1039. };
  1040. return kehuData2;
  1041. }
  1042. if(baiDaCount22 < this.hzCount && this.hzCount > 0 && _handCards.indexOf(this.baiDaCard) == -1 && this.baiDaCard < 60){
  1043. dangPaiList[dangPaiList.length] = this.baiDaCard;
  1044. }
  1045. // if(chairID == 1) console.warn("hutip777胡牌提示 dangPaiList ",dangPaiList.length,dangPaiList);
  1046. let kdcdp = 0;////可打出的牌 就是打出这个牌之后可以胡
  1047. let dczhkhdp = [];////打出kdcdp之后可以胡的牌
  1048. let yjpdgdsp = 0;////已经判断过的手牌 为了减少运算量判断过的手牌就不再判断了
  1049. // let yjpdgdzh = [];////已经判断过的组合 把28换成26 和 把26换成28 的结果是一样的所以可以剔除以减少运算
  1050. for (var i = 0; i < handCards1.length; i++) {
  1051. if(this.judgeACardISBD(handCards1[i])) continue;
  1052. kdcdp = handCards1[i];////可打出的牌
  1053. dczhkhdp = [];
  1054. if(handCards1[i] == yjpdgdsp) continue;////已经判断过的手牌 为了减少运算量判断过的手牌就不再判断了
  1055. yjpdgdsp = handCards1[i];////已经判断过的手牌 为了减少运算量判断过的手牌就不再判断了
  1056. var huResTL = [];
  1057. for (let huCard of huCards) huResTL.push(huCard);
  1058. let copyhandCards = this.deepCloneTL(_handCards)
  1059. for (let x = 0; x < copyhandCards.length; ++x) {
  1060. if(this.judgeACardISBD(copyhandCards[x])){
  1061. copyhandCards[x] = 0;////剔除手里的百搭去判断抛搭
  1062. }
  1063. }
  1064. copyhandCards[i] = 0;///剔除手里的百搭和打出那张之后剩下的手牌去判断抛搭
  1065. let copyhandCardsqbd = _.compact(_.clone(copyhandCards));
  1066. copyhandCardsqbd = this.sort(copyhandCardsqbd);
  1067. // let ispd = this.hutipJudgePAODA(baiDaCount22,copyhandCardsqbd,dangPaiList,huResTL.length,kdcdp);////打出kdcdp之后是否抛搭
  1068. //上面是旧的算法,下面是新的算法
  1069. let ispd = false;
  1070. if(copyhandCardsqbd.length == 0){
  1071. ispd = true;//手上全是百搭肯定抛搭了
  1072. }
  1073. else{
  1074. if(baiDaCount22 > 0){
  1075. ispd = this.hutipJudgePAODA2(baiDaCount22-1,copyhandCardsqbd,huResTL,kdcdp);////打出kdcdp之后是否抛搭
  1076. }
  1077. }
  1078. // console.warn("打出kdcdp之后是否抛搭 ",kdcdp,ispd,this.yscs);
  1079. if(ispd){
  1080. ////打出kdcdp之后可以抛搭了
  1081. let data = {
  1082. "canTing": kdcdp,////表示打出这张牌之后可以听牌
  1083. "youjin": 1,////打出这张牌之后是不是游金(抛搭)这个在象山麻将里面没有用
  1084. "tpxq": dczhkhdp
  1085. }
  1086. hutipRes[hutipRes.length] = data;
  1087. }
  1088. else{
  1089. ////打出kdcdp之后不能抛搭
  1090. for (var k = 0; k < dangPaiList.length; k++) {
  1091. this.yscs++;
  1092. let handCards = _.clone(handCards1);
  1093. // console.error("222sscc777胡牌提示huCards",i,handCards[i] , dangPaiList[k],handCards);
  1094. handCards[i] = dangPaiList[k];
  1095. handCards = this.sort(handCards);
  1096. // 手牌不全
  1097. var length = handCards.length;
  1098. if (length % 3 != 2) return;
  1099. // console.warn("pandau 0ceccewcde -------开始调用 hutip33");
  1100. let huRes22 = this.hutip33(chairID,handCards, dangPaiList[k], huCards,false);
  1101. if (huRes22) {
  1102. // console.warn("胡牌提示 打出 "+kdcdp+" 如果摸到 "+dangPaiList[k]+" 可以胡");
  1103. ////打出kdcdp如果摸到dangPaiList[k]可以胡
  1104. let syzs = this.getACardSYZS(dangPaiList[k],_handCards,allhuCards,outCards);
  1105. // console.warn("111????????????????????????????????",dangPaiList[k],syzs);
  1106. dczhkhdp[dczhkhdp.length] = [dangPaiList[k],-1,syzs];////[可胡的牌,剩余张数]
  1107. }
  1108. }
  1109. // console.warn("222????????????????????????????????",dczhkhdp.length);
  1110. if(dczhkhdp.length > 0){
  1111. ////至此表示打出handCards[i]之后可以听牌
  1112. let data = {
  1113. "canTing": kdcdp,////表示打出这张牌之后可以听牌
  1114. "youjin": 0,////打出这张牌之后是不是游金(抛搭)这个在象山麻将里面没有用
  1115. "tpxq": dczhkhdp
  1116. }
  1117. hutipRes[hutipRes.length] = data;
  1118. }
  1119. }
  1120. }
  1121. // console.warn("333????????????????????????????????",hutipRes);
  1122. // console.warn("222sscc777胡牌提示handCards ",chairID,_handCards,_huCards,this.yscs);
  1123. let kehuData3 = {
  1124. renyi:0,//////是否可胡任意牌,0表示不满足1表示满足
  1125. kehuData:hutipRes/////对象数组,分别表示打哪张可胡哪几张数据
  1126. };
  1127. return kehuData3;
  1128. // return hutipRes;
  1129. };
  1130. ////TL++得到一张牌的剩余张数 用于胡牌提示提示该张的剩余张数
  1131. proto.getACardSYZS = function (card,_handCards,allhuCards,outCards) {
  1132. ////下面这段是适合胡牌提示里用的剩余牌数统计
  1133. let yjcxdzs = 0;////该牌已经出现的张数
  1134. for (var i = 0; i < _handCards.length; i++) {
  1135. if(card == _handCards[i]) yjcxdzs++;////该牌已经出现在自己手牌里的张数
  1136. }
  1137. // console.warn("111得到一张牌的剩余张数 手牌张数",yjcxdzs,_handCards);
  1138. for (var i = 0; i < allhuCards.length; i++) {
  1139. if(allhuCards[i].length == 0) continue;////该玩家没有碰杠牌
  1140. // console.warn("222得到一张牌的剩余张数 碰杠杠牌",card,yjcxdzs,i,JSON.stringify(_.clone(allhuCards[i])));
  1141. for (var k = 0; k < allhuCards[i].length; k++) {
  1142. let pgp = allhuCards[i][k].cards;
  1143. if(!pgp) continue;
  1144. for (var j = 0; j < pgp.length; j++) {
  1145. if(card == pgp[j]) yjcxdzs++;////该牌已经出现在自己手牌里的张数
  1146. }
  1147. }
  1148. }
  1149. for (var i = 0; i < outCards.length; i++) {
  1150. if(outCards[i].length == 0) continue;////该玩家没有碰杠牌
  1151. // console.warn("2得到一张牌的剩余张数 打出去的牌",card,yjcxdzs,i,JSON.stringify(_.clone(outCards[i])));
  1152. for (var k = 0; k < outCards[i].length; k++) {
  1153. if(card == outCards[i][k]) yjcxdzs++;////该牌已经出现在所有打出去牌里的张数;
  1154. }
  1155. }
  1156. let zs = 4
  1157. if(card == 51) zs = this.hzCount;
  1158. // if(this.judgeACardISBD(card)) zs = 3;
  1159. let syzs = zs - yjcxdzs;////剩余张数 = 总张数 - 已经出现的张数
  1160. // console.warn("333得到一张牌的剩余张数",card,syzs);
  1161. return syzs;
  1162. };
  1163. //////TL++,胡牌提示判断抛搭
  1164. proto.hutipJudgePAODA2 = function (_baidacount,_hd,_huCards,_addThisIsHu) {
  1165. // console.warn("胡牌提示判断抛搭 _baidacount "+_baidacount+" _hd.length "+_hd.length +" _hd "+_hd);
  1166. let cards2 = this.deepCloneTL(_hd);
  1167. let huRes3 = { card: 0, jiang: 0, huCards: [] };
  1168. huRes3.huCards = [];
  1169. for (let huCard of _huCards) huRes3.huCards.push(huCard);
  1170. this._dumpFixedc(cards2, huRes3.huCards,_baidacount);
  1171. // console.warn("胡牌提示 判断判断抛搭 length "+huRes3.huCards.length+" huRes3.huCards "+ JSON.stringify(huRes3.huCards));
  1172. if (huRes3.huCards.length >= 4){
  1173. // console.warn("胡牌提示 判断判断抛搭 可以抛搭222 length "+huRes3.huCards.length+" huRes3.huCards "+ JSON.stringify(huRes3.huCards));
  1174. return true;
  1175. }
  1176. // console.warn("不能抛搭");
  1177. return false;
  1178. }
  1179. // 胡牌分析 chairID(TL++这个参数) 手牌 加上这张判断能不能胡 手上的吃碰杠牌 是否自己摸上来的
  1180. proto.hutip33 = function (chairID,handCards, card, huCards, isTouch) {
  1181. // console.error("sscc777胡牌分析card",card);
  1182. // console.error("sscc777胡牌分析handCards",handCards);
  1183. // console.error("sscc777胡牌分析huCards",huCards);
  1184. // console.error("sscc777胡牌分析isTouch",isTouch);
  1185. let tempres = {}///本函数的返回值
  1186. // this.addThisIsHu = card//////TL++,胡牌判断时加上这张能不能胡
  1187. // console.error("sscc777胡牌分析333this.addThisIsHu ",this.addThisIsHu);
  1188. // this.isSeleCatcedCard = isTouch//////判断能否胡牌的那张牌是自己抓的还是别人打出来的
  1189. // this.currChairIDTL = chairID/////当前判断胡的chairID,用于得到当前玩家的花牌情况
  1190. this.dangAfterBDListTL = [];/////7月18日+的
  1191. let baiDaCount22 = 0
  1192. let bdIndexlist = []
  1193. handCards = this.sort(handCards);
  1194. baiDaCount22 = this.getBDCount(handCards)
  1195. this.sbyBDList = this.getBDListZZ(handCards)
  1196. bdIndexlist = this.getBDIndexList(handCards)
  1197. // console.warn("判断13不搭手上百搭牌个数出错了?????",baiDaCount22,this.sbyBDList,bdIndexlist)
  1198. // 手牌不全
  1199. var length = handCards.length;
  1200. // console.warn("胡牌提示 length "+length+" baiDaCount22 "+baiDaCount22);
  1201. if (length % 3 != 2) return;
  1202. if(baiDaCount22 == 0){/////没有百搭的时候
  1203. var huRes = { card: card, jiang: 0, huCards: [] };
  1204. // 重设将牌
  1205. var resetHuRes = (jiang) => {
  1206. huRes.jiang = jiang;
  1207. huRes.huCards = [];
  1208. for (let huCard of huCards) huRes.huCards.push(huCard);
  1209. };
  1210. // let hucardTL = huCards//////TL++,保存碰杠牌的初始值,因为这个参数会在下面的代码中被修改掉
  1211. // 确定将牌
  1212. for (let i = 0; i < length - 1; ++i) {
  1213. if (!this.isJang(handCards[i], handCards[i + 1])) continue;
  1214. resetHuRes(handCards[i]);////设置将牌
  1215. let cards = handCards.slice(0, i);////手牌数组的前i个元素
  1216. cards = cards.concat(handCards.slice(i + 2));////给数组cards拼接上手牌的第 i+2 个以后的全部数组元素 这句是将手牌删除2张将牌之后得到的牌
  1217. this._dumpFixed(cards, huRes.huCards);
  1218. i += 1;/////TL++,为了减少运算
  1219. // let tempres22 = this.outHures(huRes,handCards,hucardTL);
  1220. if(huRes.huCards.length >= 4){
  1221. return true;
  1222. }
  1223. }
  1224. }
  1225. else{/////有百搭的时候
  1226. let card2 = []//////用于存放手牌中将所有百搭牌去掉之后的手牌
  1227. for (let xx = 0; xx < this.sbyBDList.length; ++xx){
  1228. card2 = handCards.slice(0,bdIndexlist[xx] - xx)////得到数组中的前bdIndexlist[xx] 个元素
  1229. card2 = card2.concat(handCards.slice(bdIndexlist[xx]+1 - xx))////得到数组中的最后bdIndexlist[xx] +1 个元素
  1230. handCards = card2
  1231. // console.error("有百搭删除掉百搭牌",handCards,card2);
  1232. }
  1233. // console.warn("胡牌提示 删除百搭之后的手牌222",handCards);
  1234. let bdzs = this.sbyBDList.length;/////百搭张数
  1235. let copyhandCards = this.deepCloneTL(handCards)
  1236. // console.warn("去掉百搭之后的手牌 copyhandCards "+copyhandCards);
  1237. if(copyhandCards.length == 0) return true;
  1238. //下面的for循环是用手牌的两张牌做将牌看能不能胡牌
  1239. for (let i = 0; i < copyhandCards.length - 1; ++i) {
  1240. let cards22 = this.deepCloneTL(copyhandCards)
  1241. if (!this.isJang(cards22[i], cards22[i + 1])) continue;
  1242. let huRes3 = { card: card, jiang: 0, huCards: [] };
  1243. // 重设将牌
  1244. huRes3.jiang = cards22[i];
  1245. huRes3.huCards = [];
  1246. for (let huCard of huCards) huRes3.huCards.push(huCard);
  1247. let cards2 = cards22.slice(0, i);////手牌数组的前i个元素
  1248. cards2 = cards2.concat(cards22.slice(i + 2));////给数组cards拼接上手牌的第 i+2 个以后的全部数组元素 这句是将手牌删除2张将牌之后得到的牌
  1249. this._dumpFixedc(cards2, huRes3.huCards,bdzs);
  1250. if (huRes3.huCards.length >= 4){
  1251. // console.warn("胡牌提示 判断结果222 length "+huRes3.huCards.length+" huRes3.huCards "+ JSON.stringify(huRes3.huCards));
  1252. return true;
  1253. }
  1254. i += 1;/////TL++,为了减少运算
  1255. }
  1256. //下面的for循环是用一张手牌和一张百搭牌做将牌看能不能胡牌
  1257. let bcjp = 0;///////本次的将牌
  1258. for (let i = 0; i < copyhandCards.length; ++i) {
  1259. let cards22 = this.deepCloneTL(copyhandCards);
  1260. if(cards22[i] == bcjp) continue;
  1261. let huRes3 = { card: card, jiang: 0, huCards: [] };
  1262. // 重设将牌
  1263. huRes3.jiang = cards22[i];
  1264. huRes3.huCards = [];
  1265. for (let huCard of huCards) huRes3.huCards.push(huCard);
  1266. bcjp = cards22[i]; ///////本次的将牌
  1267. let cards2 = cards22.slice(0, i);////手牌数组的前i个元素
  1268. cards2 = cards2.concat(cards22.slice(i + 1));////给数组cards拼接上手牌的第 i+2 个以后的全部数组元素 这句是将手牌删除2张将牌之后得到的牌
  1269. this._dumpFixedc(cards2, huRes3.huCards,bdzs-1);
  1270. // console.warn("胡牌提示 判断结果233 length "+huRes3.huCards.length+" huRes3.huCards "+ JSON.stringify(huRes3.huCards));
  1271. if (huRes3.huCards.length >= 4){
  1272. return true;
  1273. }
  1274. }
  1275. }
  1276. return false;
  1277. };
  1278. // 获得奖码列表和计算奖码分数函数
  1279. proto.getJiangmaInfo = function (isMZJYM) {
  1280. // console.warn("获得奖码列表函数 奖码类型:-1:不奖码,1:159奖码,2:摸几奖几,3:一码全中 "+this.jiangmaType)
  1281. let jiangmaList = []
  1282. let jmzs = 0;//奖码张数
  1283. if(this.jiangmaType == 2){
  1284. //摸几奖几
  1285. jmzs = this.getValue(this.addThisIsHu);//胡的那张牌的牌值
  1286. if(this.addThisIsHu == 51) jmzs = 10;
  1287. // console.warn("摸几奖几 奖码樟树 addThisIsHu "+this.addThisIsHu+" jmzs "+jmzs);
  1288. }
  1289. else{
  1290. //159奖码 一码全中
  1291. jmzs = this.jiangmaCount;
  1292. if(isMZJYM ){
  1293. //满足无红中加1码
  1294. jmzs++;
  1295. }
  1296. }
  1297. if(this.isLaGang){
  1298. // console.warn("现在 是 拉杠胡了");
  1299. if(!this.isQGHJM){
  1300. //没有选择抢杠胡奖码
  1301. jmzs = 0;
  1302. // console.warn("现在 是 拉杠胡了 选则了抢杠胡不奖码 现在不奖码");
  1303. }
  1304. }
  1305. else{
  1306. // console.warn("现在 不是 拉杠胡了");
  1307. }
  1308. let castC1 = this.castCount;//已经消耗的
  1309. let lastC1 = this.lastCount;
  1310. for (var i = 0; i < jmzs; i++) {
  1311. let card = 0;
  1312. if (lastC1 > 0) {
  1313. card = this.cardsPool[castC1++];
  1314. lastC1 -= 1;
  1315. }
  1316. if(card > 0) jiangmaList[i] = card;
  1317. else break;
  1318. }
  1319. // console.warn("获得奖码列表函数 奖码列表 ",jiangmaList," 长度 ",jiangmaList.length," addThisIsHu ",this.addThisIsHu)
  1320. //下面是计算奖码分数
  1321. let mafen = 0;
  1322. if(this.jiangmaType == 1 || this.jiangmaType == 2){
  1323. //159奖码 摸几奖几
  1324. let count = 0
  1325. for (var i = 0; i < jiangmaList.length; i++) {
  1326. let pz = this.getValue(jiangmaList[i]);//牌值
  1327. if (pz == 1 || pz == 5 || pz == 9 || jiangmaList[i] == 51 ){
  1328. count++
  1329. }
  1330. }
  1331. mafen = 2 * count;
  1332. }
  1333. else if(this.jiangmaType == 3){
  1334. //一码全中
  1335. // console.warn("一码全中 jiangmaList ",jiangmaList)
  1336. if(jiangmaList.length == 1){
  1337. let count = this.getValue(jiangmaList[0]);
  1338. if(jiangmaList[0] == 51) count = 10;
  1339. mafen = count;
  1340. }
  1341. }
  1342. // console.warn("获得奖码分数 mafen ",mafen)
  1343. return { jiangmaList:jiangmaList,mafen:mafen}
  1344. };