init福禄寿
parent
38333c4be4
commit
302f5d22bd
|
|
@ -0,0 +1,10 @@
|
||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 已忽略包含查询文件的默认文件夹
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
|
||||||
|
<gameSetting>
|
||||||
|
<host>192.168.1.6</host>
|
||||||
|
<intranet>192.168.1.6</intranet>
|
||||||
|
<port>8971</port>
|
||||||
|
<serverId>8971</serverId>
|
||||||
|
<gameId>107</gameId>
|
||||||
|
<loggerDebug>true</loggerDebug>
|
||||||
|
</gameSetting>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||||
|
|
||||||
|
# ConsoleAppender
|
||||||
|
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||||
|
|
||||||
|
|
||||||
|
# Regular FileAppender
|
||||||
|
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||||
|
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||||
|
log4j.appender.fileAppender.Encoding=UTF-8
|
||||||
|
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||||
|
log4j.appender.dailyFile.Append=true
|
||||||
|
|
||||||
|
# The file is rolled over very day
|
||||||
|
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<serivce-core>
|
||||||
|
<log4jPath>log4j.properties</log4jPath>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<id>redis</id>
|
||||||
|
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||||
|
|
||||||
|
<poolConfig>
|
||||||
|
<!-- 最大连接数, 默认8个 -->
|
||||||
|
<maxTotal>80</maxTotal>
|
||||||
|
<!-- 最大空闲连接数, 默认8个 -->
|
||||||
|
<maxIdle>20</maxIdle>
|
||||||
|
<!-- 最小空闲连接数, 默认0个 -->
|
||||||
|
<minIdle>5</minIdle>
|
||||||
|
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||||
|
<maxWaitMillis>-1</maxWaitMillis>
|
||||||
|
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||||
|
<testOnBorrow>true</testOnBorrow>
|
||||||
|
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||||
|
<testOnReturn>true</testOnReturn>
|
||||||
|
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||||
|
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||||
|
<testWhileIdle>true</testWhileIdle>
|
||||||
|
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||||
|
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||||
|
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||||
|
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||||
|
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||||
|
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||||
|
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||||
|
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||||
|
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||||
|
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||||
|
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||||
|
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||||
|
<blockWhenExhausted>true</blockWhenExhausted>
|
||||||
|
</poolConfig>
|
||||||
|
|
||||||
|
<infos>
|
||||||
|
<info name="group1_db0" host="120.25.102.202" password="cssq@2020" port="6379" database="0" timeout="5000"/>
|
||||||
|
<info name="group1_db1" host="120.25.102.202" password="cssq@2020" port="6379" database="1" timeout="5000"/>
|
||||||
|
<info name="group1_db5" host="120.25.102.202" password="cssq@2020" port="6379" database="5" timeout="5000"/>
|
||||||
|
<info name="group1_db8" host="120.25.102.202" password="cssq@2020" port="6379" database="8" timeout="5000"/>
|
||||||
|
<info name="group1_db9" host="120.25.102.202" password="cssq@2020" port="6379" database="9" timeout="5000"/>
|
||||||
|
<info name="group1_db10" host="120.25.102.202" password="cssq@2020" port="6379" database="10" timeout="5000"/>
|
||||||
|
<info name="group1_db11" host="120.25.102.202" password="cssq@2020" port="6379" database="11" timeout="5000"/>
|
||||||
|
</infos>
|
||||||
|
</plugin>
|
||||||
|
</serivce-core>
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<server>
|
||||||
|
<!-- 计时器线程池大小-->
|
||||||
|
<timerThreadPoolSize>1</timerThreadPoolSize>
|
||||||
|
<!-- 协议包压缩门槛 (单位字节),当协议包大于设定的值则会进行压缩 -->
|
||||||
|
<protocolCompression>512</protocolCompression>
|
||||||
|
<!-- 读缓冲区类型 nio Direct Buffer 或者 Heap Buffer-->
|
||||||
|
<readBufferType>Heap</readBufferType>
|
||||||
|
<!-- 写入冲区类型 nio Direct Buffer 或者 Heap Buffer-->
|
||||||
|
<writeBufferType>Heap</writeBufferType>
|
||||||
|
<!-- 最大的数据包大小 -->
|
||||||
|
<maxPacketSize>524288</maxPacketSize>
|
||||||
|
<!-- 最大读取缓存大小 -->
|
||||||
|
<maxReadBufferSize>1024</maxReadBufferSize>
|
||||||
|
<!-- 最大写入缓存大小 -->
|
||||||
|
<maxWriteBufferSize>32768</maxWriteBufferSize>
|
||||||
|
<!-- 会话队列的大小-->
|
||||||
|
<sessionPacketQueueSize>160</sessionPacketQueueSize>
|
||||||
|
|
||||||
|
<!-- Thread Pool Size of the 3 main stages of the Bitswarm Engine -->
|
||||||
|
<socketAcceptorThreadPoolSize>1</socketAcceptorThreadPoolSize>
|
||||||
|
<socketReaderThreadPoolSize>2</socketReaderThreadPoolSize>
|
||||||
|
<socketWriterThreadPoolSize>1</socketWriterThreadPoolSize>
|
||||||
|
|
||||||
|
<!-- Enable disable Nagle algorithm on sockets, true == disable -->
|
||||||
|
<tcpNoDelay>true</tcpNoDelay>
|
||||||
|
<!-- 会话超时时间(单位秒)-->
|
||||||
|
<sessionTimeout>15</sessionTimeout>
|
||||||
|
|
||||||
|
<!-- Bind socket addresses -->
|
||||||
|
<socketAddresses>
|
||||||
|
<socket address="0.0.0.0" port="8971" type="TCP" />
|
||||||
|
</socketAddresses>
|
||||||
|
|
||||||
|
<!-- Ip addresses filter-->
|
||||||
|
<ipFilter>
|
||||||
|
<addressBlackList>
|
||||||
|
<string>1.2.3.4</string>
|
||||||
|
</addressBlackList>
|
||||||
|
<addressWhiteList>
|
||||||
|
<string>127.0.0.1</string>
|
||||||
|
</addressWhiteList>
|
||||||
|
<maxConnectionsPerAddress>10000</maxConnectionsPerAddress>
|
||||||
|
</ipFilter>
|
||||||
|
|
||||||
|
<webSocket>
|
||||||
|
<isActive>false</isActive>
|
||||||
|
<address>0.0.0.0</address>
|
||||||
|
<port>80</port>
|
||||||
|
</webSocket>
|
||||||
|
|
||||||
|
<!-- Main extension class -->
|
||||||
|
<extensionConfig>
|
||||||
|
<name>extension - test</name>
|
||||||
|
<className>extend.mj.EXMainServer</className>
|
||||||
|
</extensionConfig>
|
||||||
|
|
||||||
|
<!-- The system thread pool config -->
|
||||||
|
<systemThreadPoolConfig>
|
||||||
|
<name>Sys</name>
|
||||||
|
<corePoolSize>2</corePoolSize>
|
||||||
|
<maxPoolSize>8</maxPoolSize>
|
||||||
|
<keepAliveTime>60000</keepAliveTime>
|
||||||
|
<maxQueueSize>20000</maxQueueSize>
|
||||||
|
</systemThreadPoolConfig>
|
||||||
|
|
||||||
|
<!-- The extension thread pool config -->
|
||||||
|
<extensionThreadPoolConfig>
|
||||||
|
<name>Ext</name>
|
||||||
|
<corePoolSize>2</corePoolSize>
|
||||||
|
<maxPoolSize>8</maxPoolSize>
|
||||||
|
<keepAliveTime>60000</keepAliveTime>
|
||||||
|
<maxQueueSize>20000</maxQueueSize>
|
||||||
|
</extensionThreadPoolConfig>
|
||||||
|
|
||||||
|
</server>
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.game</groupId>
|
||||||
|
<artifactId>game_mj_fulushou</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>game_mj_fulushou</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!--依赖 game_common -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.game</groupId>
|
||||||
|
<artifactId>game_common</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>game_mj_fulushou</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
<configuration>
|
||||||
|
<!-- <compilerArgument>-parameters</compilerArgument> -->
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
|
||||||
|
public class CardNiao {
|
||||||
|
public int card;
|
||||||
|
|
||||||
|
public int playerId=0;
|
||||||
|
public int seat = 0;
|
||||||
|
public int score = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public ITObject toMP(){
|
||||||
|
ITObject obj = TObject.newInstance();
|
||||||
|
obj.putInt("card", card);
|
||||||
|
obj.putInt("score", score);
|
||||||
|
obj.putInt("playerId", playerId);
|
||||||
|
obj.putInt("seat", seat);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,203 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
public class Config {
|
||||||
|
public static final int XIPAI_SCORE = 10;
|
||||||
|
public static final int ANCHOU_SCORE = 10;
|
||||||
|
|
||||||
|
public static final String ROOM_CONFIG_CHUIPAI = "chipai"; //吃牌
|
||||||
|
public static final String ROOM_CONFIG_DIANPAO = "dianpao"; //接炮胡
|
||||||
|
public static final String ROOM_CONFIG_HUNYISE = "hunyise"; //混一色
|
||||||
|
public static final String ROOM_CONFIG_QINGYISE = "qingyise"; //清一色
|
||||||
|
public static final String ROOM_CONFIG_PENGPENGHU = "pengpenghu"; //碰碰胡
|
||||||
|
public static final String ROOM_CONFIG_QIDUI = "qidui"; //七小对
|
||||||
|
public static final String ROOM_CONFIG_HAOHUA_QIDUI = "haohua_qidui"; //豪华七小对
|
||||||
|
public static final String ROOM_CONFIG_HAOHUA2_QIDUI = "haohua2_qidui"; //双豪华七小对
|
||||||
|
public static final String ROOM_CONFIG_HAOHUA3_QIDUI = "haohua3_qidui"; //三豪华七小对
|
||||||
|
public static final String ROOM_CONFIG_GANGSHANGKAIHUA_2bei = "gangshangkaihua"; //杠上开花2倍
|
||||||
|
public static final String ROOM_CONFIG_GANGSHANGPAO_2bei = "gangshangpao_2bei"; //杠上炮2倍
|
||||||
|
public static final String ROOM_CONFIG_SHISHANGYAO = "shishanyao"; //十三幺
|
||||||
|
public static final String ROOM_CONFIG_TIANDIHU = "tiandihu"; //天地胡
|
||||||
|
public static final String ROOM_CONFIG_SHIBALUOHAN = "shibaluohan"; //十八罗汉
|
||||||
|
public static final String ROOM_CONFIG_XIAOSHANYUAN = "xiaoshanyuan"; //小三元
|
||||||
|
public static final String ROOM_CONFIG_XIAOSIXI = "xiaosixi"; //小四喜
|
||||||
|
public static final String ROOM_CONFIG_DASHANYUAN = "dashanyuan"; //大三元
|
||||||
|
public static final String ROOM_CONFIG_DASIXI = "dasixi"; //大四喜
|
||||||
|
public static final String ROOM_CONFIG_LOUHU = "louhu"; //漏胡
|
||||||
|
public static final String ROOM_CONFIG_GUO_PENG = "guopeng"; //过碰不碰
|
||||||
|
public static final String ROOM_CONFIG_GUO_GONG = "guogang"; //过杠不杠
|
||||||
|
public static final String ROOM_CONFIG_YAO_JIU = "yao_jiu"; //混幺九
|
||||||
|
public static final String ROOM_CONFIG_QING_YAO_JIU = "qing_yao_jiu"; //清幺九
|
||||||
|
public static final String ROOM_CONFIG_LAIZI4_HU = "laizi4_hu"; //四鬼胡牌
|
||||||
|
public static final String ROOM_CONFIG_LAIZI4_HU_2BEI = "laizi4_hu_2bei"; //四鬼胡牌两倍
|
||||||
|
public static final String ROOM_CONFIG_QUAN_FENG = "quan_feng"; //全风
|
||||||
|
public static final String ROOM_CONFIG_12ZHANG_LUODI_QUANBAO = "twelve_zhang_luodi_quanbao";//12张落地全包
|
||||||
|
public static final String ROOM_CONFIG_QUAN_FENG_SCORE = "quan_qiu_ren"; //全求人
|
||||||
|
public static final String ROOM_CONFIG_han19 = "han19"; //含19即可
|
||||||
|
public static final String ROOM_CONFIG_ZIYISE = "ziyise"; //字一色
|
||||||
|
public static final String ROOM_CONFIG_HAI_DI_NAO_YUE = "haidinaoyue"; //海底捞月
|
||||||
|
|
||||||
|
public static final String ROOM_CONFIG_XIPAI = "xi_pai";
|
||||||
|
public static final String ROOM_CONFIG_XIPAI_SCORE = "xi_pai_score";
|
||||||
|
|
||||||
|
public static final String ROOM_CONFIG_ANCHOU_SCORE = "an_chou_score";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飘分玩法
|
||||||
|
*/
|
||||||
|
public static final String ROOM_CONFIG_PIAO = "piao"; // 0:不嫖 1:热票 2:冷票 3:固定票分
|
||||||
|
public static final String ROOM_CONFIG_PIAO_FEN = "piao_fen"; // 固定票分时, 票分
|
||||||
|
public static final String ROOM_CONFIG_ZHUANGXIAN = "zhuangxian";
|
||||||
|
public static final String ROOM_CONFIG_QIDUI_JIA_FAN = "qidui_jiafan"; //七对2倍
|
||||||
|
public static final String ROOM_CONFIG_QIDUI_4BEI = "qidui_4bei"; //七对4倍
|
||||||
|
public static final String ROOM_CONFIG_NIAO = "niao"; //0无马 1有马 2爆炸马 3抓马
|
||||||
|
public static final String ROOM_CONFIG_NIAO_OPT = "niao_opt"; //爆炸马 0 加分 1 加倍
|
||||||
|
public static final String ROOM_CONFIG_MAI_NIAO = "mai_niao"; //0无马 1有马
|
||||||
|
public static final String ROOM_CONFIG_MAI_NIAO_OPT = "mai_niao_opt"; //1买一码 2买二马 3罚一码 4罚二马
|
||||||
|
public static final String ROOM_CONFIG_WU_FENG = "wu_feng";
|
||||||
|
public static final String ROOM_CONFIG_LAIZI = "laizi"; ////0 无鬼 1白板做鬼 2翻鬼(随机一个牌做鬼) 3翻双鬼 4红中做鬼
|
||||||
|
|
||||||
|
public static final String ROOM_CONFIG_QIANGKONG = "qiangkong"; //可抢杠胡
|
||||||
|
public static final String ROOM_CONFIG_QIANGKONG_2BEI = "qiangkong_2bei"; //可抢杠胡2倍
|
||||||
|
public static final String ROOM_CONFIG_QIANGKONG_MING = "qiangkong_ming"; //明杠可抢
|
||||||
|
public static final String ROOM_CONFIG_QIANGKONG_NIAO = "qiangkong_niao";
|
||||||
|
public static final String ROOM_CONFIG_NONEALL = "none_is_all";
|
||||||
|
public static final String ROOM_CONFIG_NIAO_SCORE = "niao_score";
|
||||||
|
public static final String ROOM_CONFIG_QG_TYPE = "qianggang_type"; //抢杠全包
|
||||||
|
public static final String ROOM_CONFIG_GANGBAO_TYPE = "gangbao_type"; //杠爆全包
|
||||||
|
public static final String ROOM_CONFIG_JIANGMA = "jiangma";
|
||||||
|
public static final String ROOM_CONFIG_HZ_HU = "hz_hu";
|
||||||
|
public static final String ROOM_CONFIG_GENGZHUAN = "geng_zhuan";
|
||||||
|
public static final String ROOM_CONFIG_JIEJIEGAO = "jiejiegao";
|
||||||
|
public static final String ROOM_CONFIG_JIEJIEGAO_FIRST_NO = "jiejiegao_first";
|
||||||
|
public static final String ROOM_CONFIG_LIAN_ZHUANG = "lian_zhuang";
|
||||||
|
public static final String ROOM_CONFIG_WUGUI_JIABEI = "wuguijiabei";
|
||||||
|
public static final String ROOM_CONFIG_NO_WAN = "no_wan";
|
||||||
|
public static final String ROOM_CONFIG_MA_GEN_DI_FEN = "ma_gen_di_fen";//马跟底分
|
||||||
|
public static final String ROOM_CONFIG_MA_GEN_GONG = "ma_gen_gong";//马跟杠
|
||||||
|
public static final String ROOM_CONFIG_LIU_GOU_MA = "liu_gou_ma";//留够马牌
|
||||||
|
public static final String ROOM_CONFIG_HUANGZHUANGHUANGGANG = "huangzhuang_huanggang";//荒庄荒杠
|
||||||
|
public static final String ROOM_CONFIG_LIUJU_2BEI = "liuju_2bei";//流局翻倍
|
||||||
|
public static final String ROOM_CONFIG_DAHU_CHENG = "da_hu_cheng";//大胡相乘
|
||||||
|
public static final String ROOM_CONFIG_JIHU_NOTCHIHU = "jihunotchihu"; //鸡胡不能吃胡
|
||||||
|
public static final String ROOM_CONFIG_XIAOHU_BEI = "xiaohu_bei"; //小胡的倍数另算
|
||||||
|
public static final String ROOM_CONFIG_SPECAIL_ZIMO = "special_zimo"; //潮州特殊自摸
|
||||||
|
public static final String ROOM_CONFIG_MUST_HU = "must_hu"; //必胡,必须胡牌,不能过
|
||||||
|
public static final String ROOM_CONFIG_10_BEI_BUJIFEN = "10bei_bu_jifen"; //十倍不计分
|
||||||
|
public static final String ROOM_CONFIG_10_BEI_FENGDING = "10bei_fengding"; //封顶十倍
|
||||||
|
public static final String ROOM_CONFIG_ZI_DONG_HU = "zi_dong_hu"; //自动胡
|
||||||
|
public static final String ROOM_CONFIG_USE_BASE_HU_SCORE = "use_base_hu_score"; //使用默认基础胡分
|
||||||
|
public static final String ROOM_CONFIG_MENG_QING = "men qing"; //门清
|
||||||
|
public static final String ROOM_CONFIG_JIHU_SHI_PINGHU = "ji hu shi ping hu"; //没有鸡胡,统一叫平胡
|
||||||
|
|
||||||
|
public static final String ROOM_CONFIG_XUAN_ZHUANG = "xuan_zhuang"; // 0:轮庄 1:胡牌庄
|
||||||
|
public static final String ROOM_CONFIG_QING_ZUI_HU = "qing_zui_hu"; // 0:亲嘴0胡 1:亲嘴2胡
|
||||||
|
public static final String ROOM_CONFIG_GANG_ZHAO_LIU_XI = "gang_zhao_liu_xi"; //杠招6息 bool
|
||||||
|
public static final String ROOM_CONFIG_SPECIAL_PENG_PENG_HU = "special_peng_peng_hu"; //碰碰胡每个字不少于2个
|
||||||
|
public static final String ROOM_CONFIG_FEN_DIEJIA = "fen_diejia"; //算分叠加
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final String SETTLE_DIAN_PAO = "dian_pao";
|
||||||
|
public static final String SETTLE_JIE_PAO = "jie_pao";
|
||||||
|
public static final String SETTLE_ZIMO = "zimo";
|
||||||
|
public static final String SETTLE_AN_KONG = "an_kong";
|
||||||
|
public static final String SETTLE_MING_KONG = "ming_kong";
|
||||||
|
|
||||||
|
public static final int MING_GANG_SCORE = 3;
|
||||||
|
public static final int BU_GANG_SCORE = 1;
|
||||||
|
public static final int AN_GANG_SCORE = 2;
|
||||||
|
|
||||||
|
|
||||||
|
public static final int NIAO_TYPE_WU =0;
|
||||||
|
public static final int NIAO_TYPE_159 =1;
|
||||||
|
public static final int NIAO_TYPE_ALL =2; //爆炸马
|
||||||
|
public static final int NIAO_TYPE_ZHUAMA =3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_PLAYER_DEAL = "811";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_DIS_CARD = "611";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_DISCARD = "812";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_DISCARD_TIP = "813";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_FZTIPS = "814";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_ACTION = "612";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static final String GAME_EVT_ACTION = "815";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_HU = "816";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_RESULT1 = "817";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_RESULT2 = "818";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_DRAW = "819";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_CHANGE_ACTIVE_PLAYER = "820";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_NIAO = "821";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_MAI_NIAO = "20822";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_PIAONIAO_TIP = "833";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String GAME_PIAO = "1015";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飘鸟提示
|
||||||
|
*/
|
||||||
|
public static final String GAME_EVT_PIAO_TIP = "2031";
|
||||||
|
public static final String GAME_EVT_PIAO = "2032";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
public class EXActionEvent {
|
||||||
|
|
||||||
|
public static final String EVENT_ACTION = "action";
|
||||||
|
|
||||||
|
public static final String EVENT_DISCARD = "discard";
|
||||||
|
|
||||||
|
public static final String EVENT_OTHER_DISCARD = "other_discard";
|
||||||
|
|
||||||
|
public static final String EVENT_START_GAME ="start_game";
|
||||||
|
|
||||||
|
public static final String EVENT_EXIT_ROOM = "exit_room";
|
||||||
|
|
||||||
|
public static final String EVENT_KONG_WIN = "kong_win";
|
||||||
|
|
||||||
|
public static final String EVENT_OTHER_PAO = "other_pao";
|
||||||
|
public static final String EVENT_PIAO= "1015";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,576 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.game.GameController;
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
import com.taurus.core.routes.ActionKey;
|
||||||
|
import com.taurus.permanent.data.Session;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
import extend.mj.tip.TipManager;
|
||||||
|
import extend.mj.uitl.CardUtil;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* EXGameController.java
|
||||||
|
*/
|
||||||
|
public class EXGameController extends GameController {
|
||||||
|
|
||||||
|
public EXGameController() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ActionKey(Config.GAME_ACTION)
|
||||||
|
public void RouterAction(Session sender,ITObject params,int gid,Player owner) {
|
||||||
|
if(Global.loggerDebug) {
|
||||||
|
int id = params.getInt("id");
|
||||||
|
if(id ==0) {
|
||||||
|
Global.logger.info(owner + " pass!");
|
||||||
|
}else {
|
||||||
|
TipManager tipMgr =((EXPlayer)owner).tipMgr;
|
||||||
|
if(tipMgr.tipMap.containsKey(id)) {
|
||||||
|
Tip tip = tipMgr.tipMap.get(id);
|
||||||
|
Global.logger.info(owner + " select_action type:"+tip.weight+" card:"+tip.card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
owner.stateMachine.execute(EXActionEvent.EVENT_ACTION, 0, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ActionKey(Config.GAME_DIS_CARD)
|
||||||
|
public void RouterDisCard(Session sender,ITObject params,int gid,Player owner) {
|
||||||
|
owner.stateMachine.execute(EXActionEvent.EVENT_DISCARD, 0, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ActionKey(Config.GAME_PIAO)
|
||||||
|
public void RouterPiao(Session sender,ITObject params,int gid,Player owner) {
|
||||||
|
owner.stateMachine.execute(EXActionEvent.EVENT_PIAO, 0, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeActiveSeat(EXRoom owner,int activeSeat) {
|
||||||
|
owner.activeSeat = activeSeat;
|
||||||
|
TObject param = new TObject();
|
||||||
|
param.putInt("seat", activeSeat);
|
||||||
|
owner.broadCastToClient(0, Config.GAME_EVT_CHANGE_ACTIVE_PLAYER, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getCard(EXPlayer player,int leftCount){
|
||||||
|
ITObject otherParam = new TObject();
|
||||||
|
otherParam.putInt("card", 0);
|
||||||
|
otherParam.putInt("seat", player.room.activeSeat);
|
||||||
|
otherParam.putInt("left_count", leftCount);
|
||||||
|
|
||||||
|
ITObject param = new TObject();
|
||||||
|
param.putInt( "card", player.drawCard );
|
||||||
|
param.putInt("seat", player.room.activeSeat);
|
||||||
|
param.putInt("left_count", leftCount);
|
||||||
|
player.cardInhand.add(player.drawCard);
|
||||||
|
param.putTArray("card_list", Util.toTArray(player.cardInhand));
|
||||||
|
param.putTArray("outcard_list", Util.toTArray(player.outcardList));
|
||||||
|
long start_time = System.currentTimeMillis();
|
||||||
|
param.putTArray("ting_list", getTingList(player));
|
||||||
|
long use_time = System.currentTimeMillis() - start_time;
|
||||||
|
Global.logger.info("---------------getTingList use time:" + use_time);
|
||||||
|
player.sendEvent(Config.GAME_EVT_DRAW, param);
|
||||||
|
if(Global.loggerDebug) {
|
||||||
|
Global.logger.info(player + " drawcard["+player.drawCard+"]");
|
||||||
|
}
|
||||||
|
player.room.broadCastToClient(player.playerid, Config.GAME_EVT_DRAW, otherParam);
|
||||||
|
((EXPlayBack)player.getRoom().playBackData).addGetCardCommand(player.room.activeSeat, player.drawCard,leftCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outCard(EXPlayer player,int discard){
|
||||||
|
ITObject response = new TObject();
|
||||||
|
response.putInt("seat", player.seat);
|
||||||
|
response.putInt("card", discard);
|
||||||
|
player.room.broadCastToClient(0, Config.GAME_EVT_DISCARD, response);
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
((EXPlayBack)room.playBackData).addOutCardCommand(player.seat, discard);
|
||||||
|
|
||||||
|
room.activeCard = discard;
|
||||||
|
room.lastDiscardSeat = player.seat;
|
||||||
|
room.currenDiscardSeat = 0;
|
||||||
|
if (room.isGengZhuang)
|
||||||
|
{
|
||||||
|
if (room.bankerSeat == player.seat && player.opCardList.size() == 0 && player.outcardList.size() == 0)
|
||||||
|
{
|
||||||
|
if (room.gent_zhuan_nextSeat == 0 && room.first_zhuang_card == 0)
|
||||||
|
{
|
||||||
|
room.first_zhuang_card = discard;
|
||||||
|
room.geng_zhuan_num = 1;
|
||||||
|
room.gent_zhuan_nextSeat = player.nextSeat;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
room.isGengZhuang = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (room.gent_zhuan_nextSeat == player.seat && player.opCardList.size() == 0 && player.outcardList.size() == 0 && room.first_zhuang_card == discard)
|
||||||
|
{
|
||||||
|
room.geng_zhuan_num += 1;
|
||||||
|
room.gent_zhuan_nextSeat = player.nextSeat;
|
||||||
|
if (room.geng_zhuan_num >= room.maxPlayers)
|
||||||
|
{
|
||||||
|
if (room.config.getBoolean(Config.ROOM_CONFIG_GENGZHUAN))
|
||||||
|
{
|
||||||
|
EXPlayer bankerPlayer = (EXPlayer)room.playerMapBySeat.get(room.bankerSeat);
|
||||||
|
for (Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
|
||||||
|
EXPlayer otherPlayer = (EXPlayer) entry.getValue();
|
||||||
|
if (otherPlayer.playerid != bankerPlayer.playerid)
|
||||||
|
{
|
||||||
|
room.addScore(otherPlayer,bankerPlayer, 1, EXScore.GENG_ZHUAN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
room.isGengZhuang = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
room.isGengZhuang = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.outcardList.add(discard);
|
||||||
|
Util.removeCard(player.cardInhand, discard, 1);
|
||||||
|
if(Global.loggerDebug) {
|
||||||
|
Global.logger.info(player + " outcard["+discard+"]");
|
||||||
|
}
|
||||||
|
room.broadCastToServer(player.playerid, EXActionEvent.EVENT_OTHER_DISCARD, discard);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void actionCard(EXPlayer player,int card,int type,int from_seat,ITArray opcardArray){
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
ITObject paramBroadCast = new TObject();
|
||||||
|
paramBroadCast.putInt("playerid", player.playerid);
|
||||||
|
paramBroadCast.putInt("card", card);
|
||||||
|
paramBroadCast.putInt("type", type);
|
||||||
|
paramBroadCast.putInt("from_seat", from_seat);
|
||||||
|
int huxi = player.getShowHuXi(true);
|
||||||
|
paramBroadCast.putInt("hu_xi", huxi);
|
||||||
|
if(opcardArray!=null){
|
||||||
|
paramBroadCast.putTArray("opcard", opcardArray);
|
||||||
|
}
|
||||||
|
ITArray result = new TArray();
|
||||||
|
for (Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
|
||||||
|
EXPlayer __player = (EXPlayer) entry.getValue();
|
||||||
|
ITObject __info = new TObject();
|
||||||
|
__info.putInt("playerid", __player.playerid);
|
||||||
|
__info.putTArray("outcard_list", Util.toTArray(__player.outcardList));
|
||||||
|
result.addTObject(__info);
|
||||||
|
}
|
||||||
|
paramBroadCast.putTArray("outcard_list", result);
|
||||||
|
|
||||||
|
if(Global.loggerDebug) {
|
||||||
|
Global.logger.info(String.format("%s from_seat:%d card:%d type:%d ", player,from_seat,card,type));
|
||||||
|
}
|
||||||
|
room.broadCastToClient(player.playerid, Config.GAME_EVT_ACTION, paramBroadCast);
|
||||||
|
|
||||||
|
if (type == RuleWeight.TYPE_CHOW || type == RuleWeight.TYPE_PONG)
|
||||||
|
{
|
||||||
|
paramBroadCast.putTArray("ting_list", getTingList(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendEvent(Config.GAME_EVT_ACTION, paramBroadCast);
|
||||||
|
|
||||||
|
((EXPlayBack)room.playBackData).addActionCommand(player.seat, type, card, from_seat,opcardArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dealCard(EXRoom owner) {
|
||||||
|
for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer)entry.getValue();
|
||||||
|
player.cardInhand = owner.card.deal();
|
||||||
|
Collections.sort(player.cardInhand);
|
||||||
|
if(Global.loggerDebug) {
|
||||||
|
Global.logger.info(player + " cardlist:" + player.cardInhand);
|
||||||
|
}
|
||||||
|
if (owner.config.getInt(Config.ROOM_CONFIG_MAI_NIAO) == 1)
|
||||||
|
{
|
||||||
|
int maiNiaoOpt = owner.config.getInt(Config.ROOM_CONFIG_MAI_NIAO_OPT);
|
||||||
|
//买一马
|
||||||
|
if (maiNiaoOpt == 1)
|
||||||
|
{
|
||||||
|
CardNiao niao = new CardNiao();
|
||||||
|
niao.playerId = player.playerid;
|
||||||
|
niao.seat = player.seat;
|
||||||
|
niao.card = owner.card.pop();
|
||||||
|
niao.score = 0;
|
||||||
|
player.mai_niao.add(niao);
|
||||||
|
}
|
||||||
|
//买二马
|
||||||
|
else if (maiNiaoOpt == 2)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
CardNiao niao = new CardNiao();
|
||||||
|
niao.playerId = player.playerid;
|
||||||
|
niao.seat = player.seat;
|
||||||
|
niao.card = owner.card.pop();
|
||||||
|
niao.score = 0;
|
||||||
|
player.mai_niao.add(niao);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//罚一马
|
||||||
|
else if (maiNiaoOpt == 3)
|
||||||
|
{
|
||||||
|
if (player.seat == owner.bankerSeat)
|
||||||
|
{
|
||||||
|
CardNiao niao = new CardNiao();
|
||||||
|
niao.playerId = player.playerid;
|
||||||
|
niao.seat = player.seat;
|
||||||
|
niao.card = owner.card.pop();
|
||||||
|
niao.score = 0;
|
||||||
|
player.mai_niao.add(niao);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//罚二马
|
||||||
|
else if (maiNiaoOpt == 4)
|
||||||
|
{
|
||||||
|
if (player.seat == owner.bankerSeat)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
CardNiao niao = new CardNiao();
|
||||||
|
niao.playerId = player.playerid;
|
||||||
|
niao.seat = player.seat;
|
||||||
|
niao.card = owner.card.pop();
|
||||||
|
niao.score = 0;
|
||||||
|
player.mai_niao.add(niao);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ITObject param = new TObject();
|
||||||
|
ITArray handCard = Util.toTArray(player.cardInhand);
|
||||||
|
param.putTArray("card_list", handCard);
|
||||||
|
param.putInt("bank_seat", player.room.bankerSeat);
|
||||||
|
param.putInt("laiziCard", owner.card.laiziCard);
|
||||||
|
param.putInt("laiziCard2", owner.card.laiziCard2);
|
||||||
|
param.putInt("laiziCardBefore", owner.card.laiziCardBefore);
|
||||||
|
param.putInt("laiziCard2Before", owner.card.laiziCard2Before);
|
||||||
|
player.sendEvent(Config.GAME_EVT_PLAYER_DEAL, param);
|
||||||
|
player.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tipEvent(EXPlayer owner) {
|
||||||
|
ITObject param = owner.tipMgr.toMP();
|
||||||
|
owner.sendEvent(Config.GAME_EVT_FZTIPS, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void discardTipEvent(EXPlayer owner) {
|
||||||
|
owner.getRoom().currenDiscardSeat = owner.seat;
|
||||||
|
owner.sendEvent(Config.GAME_EVT_DISCARD_TIP, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void winEvent(EXPlayer owner,int from_seat,int win_card) {
|
||||||
|
ITArray cardInHand = TArray.newInstance();
|
||||||
|
for (int card1 : owner.cardInhand) {
|
||||||
|
cardInHand.addInt(card1);
|
||||||
|
}
|
||||||
|
ITObject param = new TObject();
|
||||||
|
param.putTArray("card", cardInHand);
|
||||||
|
param.putInt("seat", owner.seat);
|
||||||
|
param.putInt("win_card", win_card);
|
||||||
|
param.putInt("from_seat", from_seat);
|
||||||
|
ITArray array = CardUtil.toMPData_WinMap(owner.winMap);
|
||||||
|
if (array != null) {
|
||||||
|
param.putTArray("win_list", array);
|
||||||
|
}
|
||||||
|
if(Global.loggerDebug) {
|
||||||
|
Global.logger.info(owner + " hupai!["+(owner.seat == from_seat?"self":"other")+"]");
|
||||||
|
}
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
room.broadCastToClient(0, Config.GAME_EVT_HU, param);
|
||||||
|
((EXPlayBack)room.playBackData).addWinCardCommand(owner.seat, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendNiaoEvt(EXPlayer owner, int seat) {
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
ITObject param = new TObject();
|
||||||
|
// param.putInt("playerid", owner.playerid);
|
||||||
|
ITArray array = new TArray();
|
||||||
|
for (int index = 0; index < room.niao.size(); index++) {
|
||||||
|
array.addTObject(room.niao.get(index).toMP());
|
||||||
|
}
|
||||||
|
param.putTArray("niao", array);
|
||||||
|
param.putInt("start_seat", seat);
|
||||||
|
|
||||||
|
room.broadCastToClient(0, Config.GAME_EVT_NIAO, param);
|
||||||
|
((EXPlayBack)room.playBackData).addNiaoCommand(owner.seat, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMaiNiaoEvt(EXPlayer owner, int seat) {
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
ITObject param = new TObject();
|
||||||
|
ITArray array = new TArray();
|
||||||
|
for (Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
for (int index = 0; index < player.mai_niao.size(); index++) {
|
||||||
|
array.addTObject(player.mai_niao.get(index).toMP());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
param.putTArray("mai_niao", array);
|
||||||
|
param.putInt("start_seat", seat);
|
||||||
|
|
||||||
|
room.broadCastToClient(0, Config.GAME_EVT_MAI_NIAO, param);
|
||||||
|
((EXPlayBack)room.playBackData).addMaiNiaoCommand(owner.seat, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ʊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||||
|
* @param owner
|
||||||
|
*/
|
||||||
|
public void piaoNiaoTipEvent(EXPlayer owner) {
|
||||||
|
owner.sendEvent(Config.GAME_EVT_PIAONIAO_TIP, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ITObject getRoomResultData(EXRoom owner) {
|
||||||
|
ITObject mp = TObject.newInstance();
|
||||||
|
mp.putBoolean("liuju", owner.liuju);
|
||||||
|
mp.putInt("active_player", owner.playerMapBySeat.get(owner.activeSeat).playerid);
|
||||||
|
mp.putInt("xipai_score", owner.xi_pai_score);
|
||||||
|
mp.putInt("anchou_score", owner.an_chou_score);
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
long t = time / 1000;
|
||||||
|
mp.putLong("time", t);
|
||||||
|
ITArray niao = new TArray();
|
||||||
|
for (int index = 0; index < owner.niao.size(); index++) {
|
||||||
|
niao.addTObject(owner.niao.get(index).toMP());
|
||||||
|
}
|
||||||
|
mp.putTArray("niao", niao);
|
||||||
|
mp.putTArray("left_card", Util.toTArray(owner.card.cardList));
|
||||||
|
ITArray infoList = new TArray();
|
||||||
|
for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
ITObject param = new TObject();
|
||||||
|
param.putInt("seat", player.seat);
|
||||||
|
param.putInt("win_card", player.winCard);
|
||||||
|
param.putInt("piao", player.piao);
|
||||||
|
param.putBoolean("is_win", player.winer == 1);
|
||||||
|
param.putInt("hu_score", player.score.round_log.get(EXScore.WIN));
|
||||||
|
param.putInt("niao_score", player.score.round_log.get(EXScore.NIAO));
|
||||||
|
param.putInt("gang_score", player.score.round_log.get(EXScore.KONG));
|
||||||
|
param.putInt("piao_niao_score", player.score.round_log.get(EXScore.PIAO_NIAO));
|
||||||
|
param.putInt("geng_zhuan", player.score.round_log.get(EXScore.GENG_ZHUAN));
|
||||||
|
param.putInt("ma_geng_gong", player.score.round_log.get(EXScore.MA_GENG_GONG));
|
||||||
|
if ((owner.config.getBoolean(Config.ROOM_CONFIG_JIEJIEGAO) || owner.config.getBoolean(Config.ROOM_CONFIG_LIAN_ZHUANG)) && player.repeat_win > 0)
|
||||||
|
{
|
||||||
|
param.putInt("repeat_win", player.repeat_win);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
param.putInt("repeat_win", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
param.putInt("mai_niao_score", player.score.round_log.get(EXScore.MAI_NIAO));
|
||||||
|
player.hp_info(param);
|
||||||
|
param.putInt("round_score", player.score.round_score);
|
||||||
|
param.putInt("total_score", player.score.total_score);
|
||||||
|
ITArray handCard = Util.toTArray(player.cardInhand);
|
||||||
|
param.putTArray("hand_card", handCard);
|
||||||
|
ITArray array = CardUtil.toMPData_WinMap(player.winMap);
|
||||||
|
if (array != null) {
|
||||||
|
param.putTArray("win_list", array);
|
||||||
|
}
|
||||||
|
ITArray mai_niao = new TArray();
|
||||||
|
for (int index = 0; index < player.mai_niao.size(); index++) {
|
||||||
|
mai_niao.addTObject(player.mai_niao.get(index).toMP());
|
||||||
|
}
|
||||||
|
param.putTArray("mai_niao", mai_niao);
|
||||||
|
param.putInt("ming_gang_num", player.ming_gang_num);
|
||||||
|
param.putInt("an_gang_num", player.an_gang_num);
|
||||||
|
param.putInt("dian_gang_num", player.dian_gang_num);
|
||||||
|
ITArray opCardList = TArray.newInstance();
|
||||||
|
|
||||||
|
for (OpCard opCard : player.opCardList) {
|
||||||
|
ITObject obj = TObject.newInstance();
|
||||||
|
obj.putInt("type", opCard.type);
|
||||||
|
obj.putInt("card", opCard.card);
|
||||||
|
if(opCard.opCard!=null) {
|
||||||
|
obj.putTArray("opcard", opCard.opCard);
|
||||||
|
}
|
||||||
|
opCardList.addTObject(obj);
|
||||||
|
}
|
||||||
|
param.putTArray("opCardList", opCardList);
|
||||||
|
|
||||||
|
infoList.addTObject(param);
|
||||||
|
}
|
||||||
|
mp.putTArray("info_list", infoList);
|
||||||
|
return mp;
|
||||||
|
}
|
||||||
|
public void roomResult(EXRoom owner) {
|
||||||
|
ITObject mp = TObject.newInstance();
|
||||||
|
mp.putInt("type", 0);
|
||||||
|
ITObject result = getRoomResultData(owner);
|
||||||
|
owner.playBackData.addResult(result);
|
||||||
|
mp.putTObject("result", result);
|
||||||
|
owner.broadCastToClient(0, Config.GAME_EVT_RESULT1, mp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void roomTotalResult(EXRoom owner,boolean dissmiss) {
|
||||||
|
ITObject data = TObject.newInstance();
|
||||||
|
long t = System.currentTimeMillis() / 1000;
|
||||||
|
data.putLong("time", t);
|
||||||
|
ITArray infoList = new TArray();
|
||||||
|
for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
ITObject param = new TObject();
|
||||||
|
param.putInt("seat", player.seat);
|
||||||
|
param.putTObject("settle_log", player.settleLog.toTObject());
|
||||||
|
param.putInt("total_score", player.score.total_score);
|
||||||
|
player.hp_info(param);
|
||||||
|
infoList.addTObject(param);
|
||||||
|
}
|
||||||
|
data.putTArray("info_list", infoList);
|
||||||
|
|
||||||
|
ITObject mp = TObject.newInstance();
|
||||||
|
mp.putInt("type", dissmiss?2:1);
|
||||||
|
if(!dissmiss) {
|
||||||
|
ITObject result = getRoomResultData(owner);
|
||||||
|
owner.playBackData.addResult(result);
|
||||||
|
mp.putTObject("result", result);
|
||||||
|
}
|
||||||
|
mp.putTObject("total_result", data);
|
||||||
|
|
||||||
|
owner.broadCastToClient(0, Config.GAME_EVT_RESULT1, mp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 票鸟提示
|
||||||
|
* @param owner
|
||||||
|
*/
|
||||||
|
public void piaoTipEvent(EXPlayer owner,int reload) {
|
||||||
|
ITObject response = new TObject();
|
||||||
|
response.putInt("piao", owner.room.config.getInt(Config.ROOM_CONFIG_PIAO));
|
||||||
|
response.putInt("last_piao", owner.last_piao);
|
||||||
|
response.putInt("last_winer", owner.last_winer);
|
||||||
|
response.putInt("reload", reload);
|
||||||
|
owner.sendEvent(Config.GAME_EVT_PIAO_TIP, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 票鸟事件
|
||||||
|
* @param owner
|
||||||
|
*/
|
||||||
|
public void piaoEvent(EXPlayer owner) {
|
||||||
|
if(owner.piao==-1)return;
|
||||||
|
|
||||||
|
ITObject param = new TObject();
|
||||||
|
param.putInt("seat", owner.seat);
|
||||||
|
param.putInt("piao", owner.piao);
|
||||||
|
owner.room.broadCastToClient(0, Config.GAME_EVT_PIAO, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTingPai(EXPlayer player, int drawCard, List<Integer> delPai, List<OpCard> opCards)
|
||||||
|
{
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
|
||||||
|
List<Integer> tempList = new ArrayList<Integer>();
|
||||||
|
for (int index = 1; index <= 8; index++) {
|
||||||
|
tempList.add(100*index + 1);
|
||||||
|
tempList.add(100*index + 2);
|
||||||
|
tempList.add(100*index + 3);
|
||||||
|
}
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
List<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
tempCardList.addAll(player.cardInhand);
|
||||||
|
if (drawCard > 0)
|
||||||
|
{
|
||||||
|
Util.removeCard(tempCardList, drawCard, 1);
|
||||||
|
}
|
||||||
|
if (delPai != null)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < delPai.size(); i++)
|
||||||
|
{
|
||||||
|
Util.removeCard(tempCardList, delPai.get(i), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int j = 0; j < tempList.size(); j++)
|
||||||
|
{
|
||||||
|
int laizi = room.config.getInt(Config.ROOM_CONFIG_LAIZI);
|
||||||
|
map.clear();
|
||||||
|
WinCard win = new WinCard(tempCardList, tempList.get(j), room.card.laiziCard, room.card.laiziCard2, laizi > 0 ? true : false, true, true);
|
||||||
|
if (win.checkWinOpList(map, player, opCards, room, true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITArray getTingList(EXPlayer player)
|
||||||
|
{
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
|
||||||
|
Map<Integer, ITArray> cardMap = new HashMap<>();
|
||||||
|
List<Integer> tempList = new ArrayList<Integer>();
|
||||||
|
for (int index = 1; index <= 8; index++) {
|
||||||
|
tempList.add(100*index + 1);
|
||||||
|
tempList.add(100*index + 2);
|
||||||
|
tempList.add(100*index + 3);
|
||||||
|
}
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
|
||||||
|
for(int i = 0; i < player.cardInhand.size(); i++)
|
||||||
|
{
|
||||||
|
int tempCard = player.cardInhand.get(i);
|
||||||
|
if (player.getRoom().isLaizi(tempCard))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
tempCardList.addAll(player.cardInhand);
|
||||||
|
Util.removeCard(tempCardList, tempCard, 1);
|
||||||
|
|
||||||
|
for(int j = 0; j < tempList.size(); j++)
|
||||||
|
{
|
||||||
|
int laizi = room.config.getInt(Config.ROOM_CONFIG_LAIZI);
|
||||||
|
map.clear();
|
||||||
|
WinCard win = new WinCard(tempCardList, tempList.get(j), room.card.laiziCard, room.card.laiziCard2, laizi > 0 ? true : false, true, true);
|
||||||
|
if (win.checkWin(map, player, room, true)) {
|
||||||
|
if (!cardMap.containsKey(tempCard))
|
||||||
|
{
|
||||||
|
ITArray cardMapList = new TArray();
|
||||||
|
cardMapList.addInt(tempList.get(j));
|
||||||
|
cardMap.put(tempCard, cardMapList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ITArray cardMapList = cardMap.get(tempCard);
|
||||||
|
cardMapList.addInt(tempList.get(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ITArray array = TArray.newInstance();
|
||||||
|
for (Map.Entry<Integer, ITArray> entry : cardMap.entrySet()) {
|
||||||
|
ITObject obj = TObject.newInstance();
|
||||||
|
obj.putInt("card", entry.getKey());
|
||||||
|
obj.putTArray("value", entry.getValue());
|
||||||
|
Global.logger.info("del card:"+entry.getKey()+" hu card:"+ entry.getValue().toJson());
|
||||||
|
array.addTObject(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.game.GameController;
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.MainServer;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.data.Room;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.game.room.state.RoomStartGameState;
|
||||||
|
|
||||||
|
import extend.mj.player.rulestate.*;
|
||||||
|
import extend.mj.player.state.EXPlayerDisCardTipState;
|
||||||
|
import extend.mj.player.state.EXPlayerDiscardState;
|
||||||
|
import extend.mj.player.state.EXPlayerDrawState;
|
||||||
|
import extend.mj.player.state.EXPlayerKongDrawState;
|
||||||
|
import extend.mj.player.state.EXPlayerDrawTipState;
|
||||||
|
import extend.mj.player.state.EXPlayerKongWinState;
|
||||||
|
import extend.mj.player.state.EXPlayerPiaoNiaoTipState;
|
||||||
|
import extend.mj.player.state.EXPlayerWaitKongWinState;
|
||||||
|
import extend.mj.player.state.EXPlayerWaitState;
|
||||||
|
import extend.mj.room.state.EXRoomDealState;
|
||||||
|
import extend.mj.room.state.EXRoomPiaoState;
|
||||||
|
import extend.mj.room.state.EXRoomSetpState;
|
||||||
|
import extend.mj.room.state.EXRoomStartGameState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* EXMainServer.java
|
||||||
|
*/
|
||||||
|
public class EXMainServer extends MainServer{
|
||||||
|
|
||||||
|
|
||||||
|
public static PlayerRuleManager playerRuleMgr;
|
||||||
|
|
||||||
|
public static EXGameController gameCtr;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
gameCtr = (EXGameController)Global.gameCtr;
|
||||||
|
|
||||||
|
registerState();
|
||||||
|
|
||||||
|
playerRuleMgr = new PlayerRuleManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private final void registerState() {
|
||||||
|
Global.registerState(RoomStartGameState.class, new EXRoomStartGameState());
|
||||||
|
Global.registerState(EXRoomSetpState.class, new EXRoomSetpState());
|
||||||
|
Global.registerState(EXRoomDealState.class, new EXRoomDealState());
|
||||||
|
Global.registerState(EXRoomPiaoState.class, new EXRoomPiaoState());
|
||||||
|
|
||||||
|
Global.registerState(PlayerWaitState.class, new EXPlayerWaitState());
|
||||||
|
Global.registerState(EXPlayerDrawState.class, new EXPlayerDrawState());
|
||||||
|
Global.registerState(EXPlayerKongDrawState.class, new EXPlayerKongDrawState());
|
||||||
|
|
||||||
|
Global.registerState(EXPlayerDiscardState.class, new EXPlayerDiscardState());
|
||||||
|
Global.registerState(EXPlayerDisCardTipState.class, new EXPlayerDisCardTipState());
|
||||||
|
Global.registerState(EXPlayerDrawTipState.class, new EXPlayerDrawTipState());
|
||||||
|
Global.registerState(EXPlayerWaitKongWinState.class, new EXPlayerWaitKongWinState());
|
||||||
|
Global.registerState(EXPlayerKongWinState.class, new EXPlayerKongWinState());
|
||||||
|
Global.registerState(EXPlayerPiaoNiaoTipState.class, new EXPlayerPiaoNiaoTipState());
|
||||||
|
|
||||||
|
Global.registerState(PROtherKongState.class, new PROtherKongState());
|
||||||
|
Global.registerState(PROtherWinState.class, new PROtherWinState());
|
||||||
|
Global.registerState(PRPongState.class, new PRPongState());
|
||||||
|
Global.registerState(PRChowState.class, new PRChowState());
|
||||||
|
Global.registerState(PRSelfKongState.class, new PRSelfKongState());
|
||||||
|
Global.registerState(PRSelfWinState.class, new PRSelfWinState());
|
||||||
|
Global.registerState(PROtherGongSelfWinState.class, new PROtherGongSelfWinState());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Room newRoom(String roomid, Map<String, String> redis_room_map) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new EXRoom(roomid, redis_room_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Player newPlayer(int playerid, Room room, String session_id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new EXPlayer(playerid, room, session_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GameController newController() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new EXGameController();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.BasePlayBack;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
|
||||||
|
public class EXPlayBack extends BasePlayBack{
|
||||||
|
|
||||||
|
|
||||||
|
public EXPlayBack(EXRoom room){
|
||||||
|
super(room);
|
||||||
|
info.putInt("left_card", room.card.getCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ITObject getPlayerInfo(Player player) {
|
||||||
|
ITObject obj =super.getPlayerInfo(player);
|
||||||
|
EXPlayer p = (EXPlayer)player;
|
||||||
|
ITArray cardInhand = Util.toTArray(p.cardInhand);
|
||||||
|
obj.putTArray("hand_card", cardInhand);
|
||||||
|
obj.putInt("score", player.score.total_score);
|
||||||
|
obj.putInt("piao", p.piao);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addGetCardCommand(int seat,int card,int left_count){
|
||||||
|
ITObject data = TObject.newInstance();
|
||||||
|
data.putInt("card", card);
|
||||||
|
data.putInt("left_count", left_count);
|
||||||
|
addCommand("GetCard",seat,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addOutCardCommand(int seat,int card){
|
||||||
|
ITObject data = TObject.newInstance();
|
||||||
|
data.putInt("card", card);
|
||||||
|
addCommand("OutCard",seat,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOutCardKongCommand(int seat,ITArray card){
|
||||||
|
ITObject data = TObject.newInstance();
|
||||||
|
data.putTArray("cardList", card);
|
||||||
|
addCommand("OutCardKong",seat,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addActionCommand(int seat,int type,int card,int from_seat,ITArray opcardArray){
|
||||||
|
ITObject cmdData = TObject.newInstance();
|
||||||
|
cmdData.putInt("card", card);
|
||||||
|
cmdData.putInt("type", type);
|
||||||
|
cmdData.putInt("from_seat", from_seat);
|
||||||
|
if(opcardArray!=null)
|
||||||
|
cmdData.putTArray("opcard", opcardArray);
|
||||||
|
addCommand("Action",seat,cmdData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addWinCardCommand(int seat,boolean zimo){
|
||||||
|
ITObject cmdData = TObject.newInstance();
|
||||||
|
addCommand("Win",seat,cmdData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNiaoCommand(int seat,ITObject param){
|
||||||
|
addCommand("Niao",seat,param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMaiNiaoCommand(int seat,ITObject param){
|
||||||
|
addCommand("Mai_Niao",seat,param);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,262 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.data.Room;
|
||||||
|
import com.game.data.Score;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
import extend.mj.tip.TipManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayer.java
|
||||||
|
*/
|
||||||
|
public class EXPlayer extends Player {
|
||||||
|
// <20><><EFBFBD><EFBFBD>
|
||||||
|
public List<Integer> cardInhand;
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
public List<Integer> outcardList;
|
||||||
|
|
||||||
|
public ITArray opCard;
|
||||||
|
|
||||||
|
public List<int[]> pongGroup;
|
||||||
|
public List<int[]> kongGroup;
|
||||||
|
public List<int[]> selfKongGroup;
|
||||||
|
public List<OpCard> opCardList;
|
||||||
|
|
||||||
|
public int drawCard = 0;
|
||||||
|
public int winCard = 0;
|
||||||
|
|
||||||
|
public TipManager tipMgr;
|
||||||
|
|
||||||
|
public SettleLog settleLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ©<EFBFBD><EFBFBD>
|
||||||
|
*/
|
||||||
|
public boolean louhu = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ǿ<EFBFBD>Ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*/
|
||||||
|
public boolean forceCheckWin = false;
|
||||||
|
/**
|
||||||
|
* 0 С<EFBFBD><EFBFBD> 1 <EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD>
|
||||||
|
*/
|
||||||
|
public int winType = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0 无 1 胡 2 输
|
||||||
|
*/
|
||||||
|
public int last_winer = 0;
|
||||||
|
|
||||||
|
public List<Integer> notPongKongList = new ArrayList<>();
|
||||||
|
public List<Integer> notPongList = new ArrayList<>();
|
||||||
|
|
||||||
|
public int niaoCount;
|
||||||
|
|
||||||
|
public int repeat_win;
|
||||||
|
|
||||||
|
public Map<Integer, WinCardType> winMap;
|
||||||
|
|
||||||
|
public int niao_score;
|
||||||
|
|
||||||
|
public int hu_score;
|
||||||
|
|
||||||
|
public int di_score;
|
||||||
|
|
||||||
|
public ArrayList<CardNiao> mai_niao;
|
||||||
|
|
||||||
|
public int ming_gang_num = 0;
|
||||||
|
public int an_gang_num = 0;
|
||||||
|
public int dian_gang_num = 0;
|
||||||
|
|
||||||
|
public boolean tinghu10bei = false;
|
||||||
|
|
||||||
|
public boolean gangshangpao = false;
|
||||||
|
|
||||||
|
public int piao = -1;
|
||||||
|
public int last_piao = -1;
|
||||||
|
|
||||||
|
public boolean is_gang = false;
|
||||||
|
|
||||||
|
public EXPlayer(int playerid, Room table, String session_id) {
|
||||||
|
super(playerid, table, session_id);
|
||||||
|
|
||||||
|
cardInhand = new ArrayList<>();
|
||||||
|
outcardList = new ArrayList<>();
|
||||||
|
|
||||||
|
pongGroup = new ArrayList<>();
|
||||||
|
kongGroup = new ArrayList<>();
|
||||||
|
selfKongGroup = new ArrayList<>();
|
||||||
|
opCardList = new ArrayList<>();
|
||||||
|
|
||||||
|
opCard = new TArray();
|
||||||
|
|
||||||
|
tipMgr = new TipManager(this);
|
||||||
|
|
||||||
|
settleLog = new SettleLog();
|
||||||
|
settleLog.put(Config.SETTLE_DIAN_PAO, 0);
|
||||||
|
settleLog.put(Config.SETTLE_JIE_PAO, 0);
|
||||||
|
settleLog.put(Config.SETTLE_ZIMO, 0);
|
||||||
|
settleLog.put(Config.SETTLE_AN_KONG, 0);
|
||||||
|
settleLog.put(Config.SETTLE_MING_KONG, 0);
|
||||||
|
|
||||||
|
repeat_win = -1;
|
||||||
|
niao_score = 2;
|
||||||
|
hu_score = 0;
|
||||||
|
di_score = 0;
|
||||||
|
|
||||||
|
ming_gang_num = 0;
|
||||||
|
an_gang_num = 0;
|
||||||
|
dian_gang_num = 0;
|
||||||
|
|
||||||
|
last_winer = 0;
|
||||||
|
|
||||||
|
tinghu10bei = false;
|
||||||
|
gangshangpao = false;
|
||||||
|
is_gang = false;
|
||||||
|
|
||||||
|
this.mai_niao = new ArrayList<CardNiao>();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Score newScore() {
|
||||||
|
return new EXScore(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initOpCard(ITArray opcard) {
|
||||||
|
this.opCard.clear();
|
||||||
|
for (int i = 0; i < opcard.size(); ++i) {
|
||||||
|
this.opCard.addInt(opcard.getInt(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITObject getReloadInfo() {
|
||||||
|
ITObject playerData = super.getReloadInfo();
|
||||||
|
ITArray disCard = Util.toTArray(this.outcardList);
|
||||||
|
playerData.putTArray("outcard_list", disCard);
|
||||||
|
playerData.putInt("card_count", cardInhand.size());
|
||||||
|
playerData.putInt("score", score.total_score);
|
||||||
|
playerData.putInt("piao", this.piao);
|
||||||
|
playerData.putInt("last_piao", this.last_piao);
|
||||||
|
ITArray opcards = TArray.newInstance();
|
||||||
|
for (OpCard opcard : opCardList) {
|
||||||
|
ITObject opcardParam = new TObject();
|
||||||
|
opcardParam.putInt("type", opcard.type);
|
||||||
|
opcardParam.putInt("card", opcard.card);
|
||||||
|
if(opcard.opCard!=null) {
|
||||||
|
opcardParam.putTArray("opcard", opcard.opCard);
|
||||||
|
}
|
||||||
|
opcards.addTObject(opcardParam);
|
||||||
|
}
|
||||||
|
playerData.putTArray("opcard", opcards);
|
||||||
|
|
||||||
|
return playerData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
super.clear();
|
||||||
|
this.cardInhand.clear();
|
||||||
|
this.notPongKongList.clear();
|
||||||
|
this.notPongList.clear();
|
||||||
|
this.winer = 0;
|
||||||
|
this.louhu = false;
|
||||||
|
this.outcardList.clear();
|
||||||
|
this.drawCard = 0;
|
||||||
|
this.kongGroup.clear();
|
||||||
|
this.pongGroup.clear();
|
||||||
|
this.selfKongGroup.clear();
|
||||||
|
this.opCardList.clear();
|
||||||
|
this.score.resetRound();
|
||||||
|
this.niaoCount = 0;
|
||||||
|
this.winMap = null;
|
||||||
|
this.niao_score = 2;
|
||||||
|
this.hu_score = 0;
|
||||||
|
this.di_score = 0;
|
||||||
|
this.mai_niao.clear();
|
||||||
|
this.ming_gang_num = 0;
|
||||||
|
this.an_gang_num = 0;
|
||||||
|
this.dian_gang_num = 0;
|
||||||
|
this.tinghu10bei = false;
|
||||||
|
this.piao = -1;
|
||||||
|
this.is_gang = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getShowHuXi(boolean self) {
|
||||||
|
int huXi = 0;
|
||||||
|
for (OpCard opCard : this.opCardList) {
|
||||||
|
/*if (!self) {
|
||||||
|
if (opCard.type == RuleWeight.TYPE_KAN || opCard.type == RuleWeight.TYPE_WEI) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {*/
|
||||||
|
if (opCard.type == RuleWeight.TYPE_CHOW) {
|
||||||
|
huXi += 4;
|
||||||
|
}
|
||||||
|
if (opCard.type == RuleWeight.TYPE_PONG) {
|
||||||
|
if (IsShangFu(opCard.card))
|
||||||
|
{
|
||||||
|
huXi += 3 * 4;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
huXi += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(opCard.type == RuleWeight.TYPE_KONG){
|
||||||
|
if (room.config.getBoolean(Config.ROOM_CONFIG_GANG_ZHAO_LIU_XI)) {
|
||||||
|
huXi += 6;
|
||||||
|
}else{
|
||||||
|
huXi += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(opCard.type == RuleWeight.TYPE_SELF_KONG){
|
||||||
|
if (room.config.getBoolean(Config.ROOM_CONFIG_GANG_ZHAO_LIU_XI)) {
|
||||||
|
huXi += 6;
|
||||||
|
}else{
|
||||||
|
huXi += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(opCard.type == RuleWeight.TYPE_ZHAO){
|
||||||
|
if (room.config.getBoolean(Config.ROOM_CONFIG_GANG_ZHAO_LIU_XI)) {
|
||||||
|
huXi += 6;
|
||||||
|
}else{
|
||||||
|
huXi += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(opCard.type == RuleWeight.TYPE_SELF_ZHAO){
|
||||||
|
if (room.config.getBoolean(Config.ROOM_CONFIG_GANG_ZHAO_LIU_XI)) {
|
||||||
|
huXi += 6;
|
||||||
|
}else{
|
||||||
|
huXi += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return huXi;
|
||||||
|
}
|
||||||
|
public boolean IsShangFu(int card)
|
||||||
|
{
|
||||||
|
if (card == 101 || card == 801)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EXRoom getRoom() {
|
||||||
|
return (EXRoom) room;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,790 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.data.Room;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import extend.mj.player.state.EXPlayerDisCardTipState;
|
||||||
|
import extend.mj.tip.Action;
|
||||||
|
import extend.mj.tip.TipManager;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
public class EXRoom extends Room {
|
||||||
|
|
||||||
|
//
|
||||||
|
public Map<Integer, TipManager> tipMap;
|
||||||
|
public List<Action> actionList;
|
||||||
|
|
||||||
|
public RoomCard card;
|
||||||
|
|
||||||
|
public int activeCard;
|
||||||
|
public int currenDiscardSeat;
|
||||||
|
public int lastDiscardSeat;
|
||||||
|
public int winCount = 0;
|
||||||
|
public boolean liuju = false;
|
||||||
|
public boolean last_liuju = false;
|
||||||
|
|
||||||
|
public ArrayList<CardNiao> niao;
|
||||||
|
|
||||||
|
public int piaoNiaoCount;
|
||||||
|
public int adminSeat = 0;
|
||||||
|
public int lastWinPlayerId = 0;
|
||||||
|
public boolean isGengZhuang = false;
|
||||||
|
public int first_zhuang_card = 0;
|
||||||
|
public int geng_zhuan_num = 0;
|
||||||
|
public int gent_zhuan_nextSeat = 0;
|
||||||
|
/*
|
||||||
|
* 上一次庄家座位号
|
||||||
|
*/
|
||||||
|
public int lastBankerSeat = 0;
|
||||||
|
public int piaoCount = 0;
|
||||||
|
|
||||||
|
public EXRoom(String roomid, Map<String, String> redis_room_map) {
|
||||||
|
super(roomid, redis_room_map);
|
||||||
|
card = new RoomCard(this);
|
||||||
|
|
||||||
|
this.tipMap = new HashMap<Integer, TipManager>();
|
||||||
|
this.actionList = new ArrayList<Action>();
|
||||||
|
this.niao = new ArrayList<CardNiao>();
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_DIANPAO))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_DIANPAO, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_HUNYISE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_HUNYISE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QINGYISE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QINGYISE, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_PENGPENGHU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_PENGPENGHU, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QIDUI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QIDUI, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_HAOHUA_QIDUI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_HAOHUA_QIDUI, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_HAOHUA2_QIDUI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_HAOHUA2_QIDUI, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_HAOHUA3_QIDUI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_HAOHUA3_QIDUI, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_GANGSHANGKAIHUA_2bei))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_GANGSHANGKAIHUA_2bei, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_SHISHANGYAO))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_SHISHANGYAO, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_TIANDIHU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_TIANDIHU, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_SHIBALUOHAN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_SHIBALUOHAN, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_XIAOSHANYUAN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_XIAOSHANYUAN, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_DASHANYUAN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_DASHANYUAN, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_DASIXI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_DASIXI, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_XIAOSIXI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_XIAOSIXI, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LOUHU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_LOUHU, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_GUO_PENG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_GUO_PENG, false);
|
||||||
|
}
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_GUO_GONG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_NONEALL, false);
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_ZHUANGXIAN, false);
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QIANGKONG_NIAO, true);
|
||||||
|
|
||||||
|
//可抢杠胡
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QIANGKONG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QIANGKONG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//可抢杠胡2倍
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QIANGKONG_2BEI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QIANGKONG_2BEI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//明杠可抢
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QIANGKONG_MING))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QIANGKONG_MING, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//抢杠全包
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QG_TYPE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QG_TYPE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//杠爆全包
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_GANGBAO_TYPE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_GANGBAO_TYPE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_HZ_HU, false);
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_GENGZHUAN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_GENGZHUAN, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_JIEJIEGAO))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_JIEJIEGAO, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_JIEJIEGAO_FIRST_NO))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_JIEJIEGAO_FIRST_NO, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LIAN_ZHUANG)) {
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_LIAN_ZHUANG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_WUGUI_JIABEI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_WUGUI_JIABEI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_NO_WAN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_NO_WAN, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QIDUI_JIA_FAN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QIDUI_JIA_FAN, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QIDUI_4BEI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QIDUI_4BEI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_MA_GEN_GONG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_MA_GEN_GONG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_WU_FENG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_WU_FENG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
////幺九
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_YAO_JIU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_YAO_JIU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//清幺九
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QING_YAO_JIU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QING_YAO_JIU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//有没有癞子
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LAIZI))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_LAIZI, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//四鬼胡牌
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LAIZI4_HU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_LAIZI4_HU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//四鬼胡牌两倍
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LAIZI4_HU_2BEI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_LAIZI4_HU_2BEI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//全风
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QUAN_FENG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QUAN_FENG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
////12张落地全包
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_12ZHANG_LUODI_QUANBAO))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_12ZHANG_LUODI_QUANBAO, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
////留够马牌
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LIU_GOU_MA))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_LIU_GOU_MA, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//全求人
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QUAN_FENG_SCORE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QUAN_FENG_SCORE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ROOM_CONFIG_han19 = "han19"; //含19即可
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_han19))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_han19, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_ZIYISE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_ZIYISE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//大胡相乘
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_DAHU_CHENG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_DAHU_CHENG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//鸡胡不能吃胡
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_JIHU_NOTCHIHU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_JIHU_NOTCHIHU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//小胡的倍数另算
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_XIAOHU_BEI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_XIAOHU_BEI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//流局两倍
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LIUJU_2BEI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_LIUJU_2BEI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//荒庄荒杠
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_HUANGZHUANGHUANGGANG))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_HUANGZHUANGHUANGGANG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//潮州特殊自摸
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_SPECAIL_ZIMO))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_SPECAIL_ZIMO, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//必胡,必须胡牌,不能过
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_MUST_HU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_MUST_HU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_LIU_GOU_MA))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_LIU_GOU_MA, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//买马,提前预定马,猜谁胡
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_MAI_NIAO))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_MAI_NIAO, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//买马值
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_MAI_NIAO_OPT))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_MAI_NIAO_OPT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_MA_GEN_DI_FEN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_MA_GEN_DI_FEN, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_NIAO))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_NIAO, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_NIAO_OPT))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_NIAO_OPT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//10倍不计分
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_10_BEI_BUJIFEN))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_10_BEI_BUJIFEN, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//封顶十倍
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_10_BEI_FENGDING))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_10_BEI_FENGDING, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//自动胡
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_ZI_DONG_HU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_ZI_DONG_HU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//海底捞月
|
||||||
|
//自动胡
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_HAI_DI_NAO_YUE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_HAI_DI_NAO_YUE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
////使用默认基础胡分
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_USE_BASE_HU_SCORE))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_USE_BASE_HU_SCORE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//门清
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_MENG_QING))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_MENG_QING, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//没有鸡胡,统一叫平胡
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_JIHU_SHI_PINGHU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_JIHU_SHI_PINGHU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//杠上炮2倍
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_GANGSHANGPAO_2bei))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_GANGSHANGPAO_2bei, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_CHUIPAI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_CHUIPAI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_PIAO))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_PIAO, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_PIAO_FEN))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_PIAO_FEN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_XUAN_ZHUANG))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_XUAN_ZHUANG, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_QING_ZUI_HU))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_QING_ZUI_HU, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_GANG_ZHAO_LIU_XI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_QING_ZUI_HU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_SPECIAL_PENG_PENG_HU))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_SPECIAL_PENG_PENG_HU, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_FEN_DIEJIA))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_FEN_DIEJIA, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_XIPAI_SCORE))
|
||||||
|
{
|
||||||
|
this.config.putInt(Config.ROOM_CONFIG_XIPAI_SCORE, 0);
|
||||||
|
this.xi_pai_score = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.xi_pai_score = this.config.getInt(Config.ROOM_CONFIG_XIPAI_SCORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_ANCHOU_SCORE))
|
||||||
|
{
|
||||||
|
this.config.putFloat(Config.ROOM_CONFIG_ANCHOU_SCORE, 0);
|
||||||
|
this.an_chou_score = 1;
|
||||||
|
}else {
|
||||||
|
this.an_chou_score = this.config.getInt(Config.ROOM_CONFIG_ANCHOU_SCORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!this.config.containsKey(Config.ROOM_CONFIG_XIPAI))
|
||||||
|
{
|
||||||
|
this.config.putBoolean(Config.ROOM_CONFIG_XIPAI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isEntrust=true;
|
||||||
|
this.adminSeat = 0;
|
||||||
|
this.lastWinPlayerId =0;
|
||||||
|
|
||||||
|
this.first_zhuang_card = 0;
|
||||||
|
this.geng_zhuan_num = 0;
|
||||||
|
this.gent_zhuan_nextSeat = 0;
|
||||||
|
|
||||||
|
if (this.config.getBoolean(Config.ROOM_CONFIG_GENGZHUAN))
|
||||||
|
{
|
||||||
|
this.isGengZhuang = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastBankerSeat = 0;
|
||||||
|
this.last_liuju = false;
|
||||||
|
|
||||||
|
//初始化房间的特殊参数
|
||||||
|
WinCardType.InitRoomSpecialConfig(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLiuJu()
|
||||||
|
{
|
||||||
|
if (card.cardList.size() == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endGameByLiuJu()
|
||||||
|
{
|
||||||
|
if (config.getBoolean(Config.ROOM_CONFIG_HUANGZHUANGHUANGGANG))
|
||||||
|
{
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
int score = player.score.round_log.get(EXScore.KONG);
|
||||||
|
player.score.round_score -= score;
|
||||||
|
player.score.total_score -= score;
|
||||||
|
player.score.round_log.put(EXScore.KONG, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
liuju = true;
|
||||||
|
clear_repeatwin();
|
||||||
|
|
||||||
|
endGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endGame()
|
||||||
|
{
|
||||||
|
last_liuju = liuju;
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
if (player.winer != 1)
|
||||||
|
{
|
||||||
|
player.last_winer = 0;
|
||||||
|
player.repeat_win = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.last_winer = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.endGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAction(Action action) {
|
||||||
|
if (this.actionList.size() == 0) {
|
||||||
|
this.actionList.add(action);
|
||||||
|
} else if (action.tip.weight > this.actionList.get(0).tip.weight) {
|
||||||
|
this.actionList.clear();
|
||||||
|
this.actionList.add(action);
|
||||||
|
} else if (action.tip.weight == this.actionList.get(0).tip.weight) {
|
||||||
|
this.actionList.add(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLaizi(int card) {
|
||||||
|
return this.card.isLaizi(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkAction() {
|
||||||
|
boolean isWeightest = this.isWeightestAction();
|
||||||
|
if (!isWeightest) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.isAllPass()) {
|
||||||
|
Player activePlayer = this.playerMapBySeat.get(this.activeSeat);
|
||||||
|
activePlayer.stateMachine.toNextState();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (Action action : this.actionList) {
|
||||||
|
action.run();
|
||||||
|
}
|
||||||
|
this.actionList.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAllPass() {
|
||||||
|
return this.actionList.size() == 0 && this.tipMap.size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeightestAction() {
|
||||||
|
|
||||||
|
if (this.isAllPass()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (this.actionList.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action curaction = this.actionList.get(0);
|
||||||
|
for (Entry<Integer, TipManager> entry : this.tipMap.entrySet()) {
|
||||||
|
TipManager tip = entry.getValue();
|
||||||
|
if (curaction.tip.weight <= tip.getWeightest()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
if (player.stateMachine.curState instanceof EXPlayerDisCardTipState) {
|
||||||
|
player.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取房间信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ITObject getRoomInfo() {
|
||||||
|
ITObject data = super.getRoomInfo();
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
data.putInt("laiziCard", this.card.laiziCard);
|
||||||
|
data.putInt("laiziCard2", this.card.laiziCard2);
|
||||||
|
data.putInt("laiziCardBefore", this.card.laiziCardBefore);
|
||||||
|
data.putInt("laiziCard2Before", this.card.laiziCard2Before);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITObject getReloadInfo(Player player) {
|
||||||
|
ITObject data = super.getReloadInfo(player);
|
||||||
|
EXPlayer p = (EXPlayer) player;
|
||||||
|
data.putTArray("hand_card", Util.toTArray(p.cardInhand));
|
||||||
|
data.putInt("left_card", card.getCount());
|
||||||
|
data.putInt("curren_outcard_seat", currenDiscardSeat);
|
||||||
|
data.putInt("last_outcard_seat", lastDiscardSeat);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addScore(EXPlayer destPlayer, EXPlayer fromPlayer, int score, int type) {
|
||||||
|
boolean zhuangxian = this.config.getBoolean(Config.ROOM_CONFIG_ZHUANGXIAN);
|
||||||
|
if(type == EXScore.WIN) {
|
||||||
|
if (zhuangxian) {
|
||||||
|
if (destPlayer.seat == this.bankerSeat || fromPlayer.seat == this.bankerSeat) {
|
||||||
|
score += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == EXScore.WIN || type == EXScore.NIAO)
|
||||||
|
{
|
||||||
|
if (fromPlayer.tinghu10bei)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
destPlayer.score.round_log.put(type, destPlayer.score.round_log.get(type) + score);
|
||||||
|
fromPlayer.score.round_log.put(type, fromPlayer.score.round_log.get(type) - score);
|
||||||
|
|
||||||
|
destPlayer.score.round_score += score;
|
||||||
|
destPlayer.score.total_score += score;
|
||||||
|
|
||||||
|
fromPlayer.score.round_score -= score;
|
||||||
|
fromPlayer.score.total_score -= score;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMaGengGongScore(EXPlayer destPlayer, EXPlayer fromPlayer, int score) {
|
||||||
|
this.addScore(destPlayer, fromPlayer, score, EXScore.MA_GENG_GONG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAllMaGengGongScore(EXPlayer destPlayer, int score) {
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(destPlayer.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
addMaGengGongScore(destPlayer, fromPlayer, score);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetGongScore(EXPlayer destPlayer)
|
||||||
|
{
|
||||||
|
return destPlayer.score.round_log.get(EXScore.KONG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAllScore(EXPlayer destPlayer, int socre, int type) {
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(destPlayer.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
this.addScore(destPlayer, fromPlayer, socre, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMaiNiaoScore(EXPlayer destPlayer, EXPlayer fromPlayer, int score) {
|
||||||
|
this.addScore(destPlayer, fromPlayer, score, EXScore.MAI_NIAO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAllMaiNiaoScore(EXPlayer destPlayer, int score) {
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(destPlayer.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
addMaiNiaoScore(destPlayer, fromPlayer, score);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNiaoScore(EXPlayer destPlayer, EXPlayer fromPlayer, int score) {
|
||||||
|
this.addScore(destPlayer, fromPlayer, score, EXScore.NIAO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAllNiaoScore(EXPlayer destPlayer, int score) {
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(destPlayer.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
addNiaoScore(destPlayer, fromPlayer, score);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPiaoNiaoScore(EXPlayer destPlayer, EXPlayer fromPlayer) {
|
||||||
|
int piao_niao = this.config.getInt(Config.ROOM_CONFIG_PIAO); //0:热票 1:冷票 2:不嫖 3:固定票分
|
||||||
|
if(piao_niao == 0)return;
|
||||||
|
this.addScore(destPlayer, fromPlayer,destPlayer.piao + fromPlayer.piao, EXScore.PIAO_NIAO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAllPiaoNiaoScore(EXPlayer destPlayer) {
|
||||||
|
int piao_niao = this.config.getInt(Config.ROOM_CONFIG_PIAO); //0:不嫖 1:冷票 2: 3:固定票分
|
||||||
|
if(piao_niao == 0)return;
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(destPlayer.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
addPiaoNiaoScore(destPlayer,fromPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handle_repeatwin(EXPlayer owner)
|
||||||
|
{
|
||||||
|
if (owner.last_winer == 1)
|
||||||
|
{
|
||||||
|
owner.repeat_win += 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
owner.repeat_win += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear_repeatwin()
|
||||||
|
{
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
player.repeat_win = -1;
|
||||||
|
player.last_winer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveMilitaryTotal(boolean dissmiss) {
|
||||||
|
super.saveMilitaryTotal(dissmiss);
|
||||||
|
EXMainServer.gameCtr.roomTotalResult(this, dissmiss);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void roomResult() {
|
||||||
|
EXMainServer.gameCtr.roomResult(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
super.clear();
|
||||||
|
|
||||||
|
this.liuju = false;
|
||||||
|
this.activeSeat = this.lastDiscardSeat = this.currenDiscardSeat = 0;
|
||||||
|
this.winCount = this.piaoNiaoCount = 0;
|
||||||
|
this.niao.clear();
|
||||||
|
|
||||||
|
this.isGengZhuang = false;
|
||||||
|
this.first_zhuang_card = 0;
|
||||||
|
this.geng_zhuan_num = 0;
|
||||||
|
this.gent_zhuan_nextSeat = 0;
|
||||||
|
if (this.config.getBoolean(Config.ROOM_CONFIG_GENGZHUAN))
|
||||||
|
{
|
||||||
|
this.isGengZhuang = true;
|
||||||
|
}
|
||||||
|
this.lastBankerSeat = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void winCallback(EXPlayer owner, int card) {
|
||||||
|
this.endGame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.game.data.Score;
|
||||||
|
|
||||||
|
|
||||||
|
public class EXScore extends Score{
|
||||||
|
public static final int WIN = 1;
|
||||||
|
public static final int KONG = 2;
|
||||||
|
public static final int NIAO = 3;
|
||||||
|
public static final int PIAO_NIAO = 4;
|
||||||
|
public static final int GENG_ZHUAN = 5;
|
||||||
|
public static final int MA_GENG_GONG = 6;
|
||||||
|
public static final int MAI_NIAO = 7;
|
||||||
|
|
||||||
|
public EXScore(EXPlayer owner){
|
||||||
|
super(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initLog() {
|
||||||
|
this.round_log.put(WIN, 0);
|
||||||
|
this.round_log.put(KONG, 0);
|
||||||
|
this.round_log.put(NIAO, 0);
|
||||||
|
this.round_log.put(PIAO_NIAO, 0);
|
||||||
|
this.round_log.put(GENG_ZHUAN, 0);
|
||||||
|
this.round_log.put(MA_GENG_GONG, 0);
|
||||||
|
this.round_log.put(MAI_NIAO, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
|
||||||
|
public class OpCard {
|
||||||
|
public int type;
|
||||||
|
public int card;
|
||||||
|
public int card_seat;
|
||||||
|
public ITArray opCard;
|
||||||
|
public int huXi;
|
||||||
|
|
||||||
|
public OpCard(int type, int card) {
|
||||||
|
this.type = type;
|
||||||
|
this.card = card;
|
||||||
|
this.card_seat = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpCard(int type, int card, int card_seat) {
|
||||||
|
this.type = type;
|
||||||
|
this.card = card;
|
||||||
|
this.card_seat = card_seat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
|
||||||
|
import extend.mj.player.rule.*;
|
||||||
|
import extend.mj.player.state.EXPlayerDisCardTipState;
|
||||||
|
import extend.mj.player.state.EXPlayerDrawTipState;
|
||||||
|
import extend.mj.player.state.EXPlayerKongWinState;
|
||||||
|
import extend.mj.player.state.EXPlayerTipState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>9<EFBFBD><EFBFBD>19<EFBFBD><EFBFBD> PlayerRuleManager.java
|
||||||
|
*/
|
||||||
|
public class PlayerRuleManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD><EFBFBD>
|
||||||
|
*/
|
||||||
|
public static final int DRAW_RULE = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*/
|
||||||
|
public static final int OTHER_DISCARD_RULE = 2;
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*/
|
||||||
|
public static final int KONG_HU_RULE = 3;
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*/
|
||||||
|
public static final int CHOW_PONG_DISCARD_RULE = 7;
|
||||||
|
|
||||||
|
public static final int KONG_DRAW_RULE = 8;
|
||||||
|
|
||||||
|
public HashMap<Integer, List<IRuleBase>> ruleMap = null;
|
||||||
|
public HashMap<Integer, EXPlayerTipState> tipMap = null;
|
||||||
|
|
||||||
|
public PlayerRuleManager() {
|
||||||
|
ruleMap = new HashMap<Integer, List<IRuleBase>>();
|
||||||
|
|
||||||
|
tipMap = new HashMap<Integer, EXPlayerTipState>();
|
||||||
|
tipMap.put(PlayerRuleManager.DRAW_RULE, (EXPlayerTipState) Global.getState(EXPlayerDrawTipState.class));
|
||||||
|
tipMap.put(PlayerRuleManager.KONG_DRAW_RULE, (EXPlayerTipState) Global.getState(EXPlayerDrawTipState.class));
|
||||||
|
tipMap.put(PlayerRuleManager.OTHER_DISCARD_RULE, (EXPlayerTipState) Global.getState(EXPlayerDisCardTipState.class));
|
||||||
|
tipMap.put(PlayerRuleManager.KONG_HU_RULE, (EXPlayerKongWinState) Global.getState(EXPlayerKongWinState.class));
|
||||||
|
tipMap.put(PlayerRuleManager.CHOW_PONG_DISCARD_RULE, (EXPlayerDrawTipState) Global.getState(EXPlayerDrawTipState.class));
|
||||||
|
|
||||||
|
List<IRuleBase> drawRuleList = new ArrayList<IRuleBase>();
|
||||||
|
drawRuleList.add(new RuleSelfKong());
|
||||||
|
//drawRuleList.add(new RulePongKong());
|
||||||
|
drawRuleList.add(new RuleSelfWin());
|
||||||
|
ruleMap.put(PlayerRuleManager.DRAW_RULE, drawRuleList);
|
||||||
|
|
||||||
|
List<IRuleBase> kongDrawRuleList = new ArrayList<IRuleBase>();
|
||||||
|
kongDrawRuleList.add(new RuleSelfKong());
|
||||||
|
//kongDrawRuleList.add(new RulePongKong());
|
||||||
|
kongDrawRuleList.add(new RuleOtherKongSelfWin());
|
||||||
|
ruleMap.put(PlayerRuleManager.KONG_DRAW_RULE, kongDrawRuleList);
|
||||||
|
|
||||||
|
List<IRuleBase> otherDiscardList = new ArrayList<IRuleBase>();
|
||||||
|
otherDiscardList.add(new RuleOtherKong());
|
||||||
|
otherDiscardList.add(new RulePong());
|
||||||
|
otherDiscardList.add(new RuleChow());
|
||||||
|
otherDiscardList.add(new RuleOtherWin());
|
||||||
|
ruleMap.put(PlayerRuleManager.OTHER_DISCARD_RULE, otherDiscardList);
|
||||||
|
|
||||||
|
List<IRuleBase> konghuList = new ArrayList<IRuleBase>();
|
||||||
|
ruleMap.put(PlayerRuleManager.KONG_HU_RULE, konghuList);
|
||||||
|
|
||||||
|
List<IRuleBase> cpDiscardRuleList = new ArrayList<IRuleBase>();
|
||||||
|
cpDiscardRuleList.add(new RuleSelfKong());
|
||||||
|
//cpDiscardRuleList.add(new RulePongKong());
|
||||||
|
ruleMap.put(PlayerRuleManager.CHOW_PONG_DISCARD_RULE, cpDiscardRuleList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean condition(int type, EXPlayer player) {
|
||||||
|
return condition(type, player, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean condition(int type, EXPlayer player, boolean tonextState) {
|
||||||
|
List<IRuleBase> ruleList = this.ruleMap.get(type);
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
for (IRuleBase rule : ruleList) {
|
||||||
|
result = rule.condition(player) || result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
player.stateMachine.changeState(this.tipMap.get(type));
|
||||||
|
} else {
|
||||||
|
if (tonextState)
|
||||||
|
player.stateMachine.toNextState();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,139 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class RoomCard {
|
||||||
|
public List<Integer> cardList;
|
||||||
|
EXRoom room;
|
||||||
|
public ArrayList<Integer> subCardList;
|
||||||
|
public Integer laiziCard;
|
||||||
|
public Integer laiziCard2;
|
||||||
|
public Integer laiziCardBefore;
|
||||||
|
public Integer laiziCard2Before;
|
||||||
|
|
||||||
|
public RoomCard(EXRoom table) {
|
||||||
|
this.cardList = new ArrayList<Integer>();
|
||||||
|
subCardList = new ArrayList<>();
|
||||||
|
this.room = table;
|
||||||
|
laiziCard = 0;
|
||||||
|
laiziCard2 = 0;
|
||||||
|
laiziCardBefore = 0;
|
||||||
|
laiziCard2Before = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
this.cardList.clear();
|
||||||
|
this.subCardList.clear();
|
||||||
|
this.initCard();
|
||||||
|
this.shuffle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initCard() {
|
||||||
|
for (int index = 1; index <= 8; index++) {
|
||||||
|
for (int index2 = 0; index2 < 4; index2++) {
|
||||||
|
this.cardList.add(100*index + 1);
|
||||||
|
this.cardList.add(100*index + 2);
|
||||||
|
this.cardList.add(100*index + 3);
|
||||||
|
}
|
||||||
|
this.cardList.add(100*index + 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initCard2() {
|
||||||
|
List list = Arrays.asList(101, 101, 101, 202, 204, 302, 302, 304, 402, 403, 502, 502, 504, 801, 701, 701, 701);
|
||||||
|
List list2 = Arrays.asList(101, 101, 101, 802, 202, 204, 302, 302, 304, 402, 403, 502, 502, 504, 801, 701, 701, 701);
|
||||||
|
List list3 = Arrays.asList(701,202, 202, 203, 301,302, 303, 303, 304, 501, 502, 501, 502, 601, 602, 802);
|
||||||
|
|
||||||
|
this.cardList.addAll(list);
|
||||||
|
this.cardList.addAll(list2);
|
||||||
|
this.cardList.addAll(list3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shuffle() {
|
||||||
|
Collections.shuffle(this.cardList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLaizi(int card)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reInitCards(List<Integer> cards) {
|
||||||
|
//从底牌移除
|
||||||
|
for(Integer card : cards) {
|
||||||
|
for(int i = cardList.size() - 1;i >= 0;i--) {
|
||||||
|
if(cardList.get(i).intValue() == card.intValue()) {
|
||||||
|
if(cardList.remove(i) > 0) {
|
||||||
|
this.subCardList.add(card);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public int pop() {
|
||||||
|
//
|
||||||
|
// if (this.cardList.size() == 0) {
|
||||||
|
// this.room.bankerSeat = this.room.activeSeat;
|
||||||
|
//// this.room.roundSettle();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// int card = this.cardList.remove(0);
|
||||||
|
//
|
||||||
|
// return card;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
public int pop() {
|
||||||
|
Global.logger.info("pop cardlist size=>"+this.cardList.size()+":sub size==>"+subCardList.size());
|
||||||
|
int card = 0;
|
||||||
|
if (this.cardList.size() == 0) {
|
||||||
|
if(this.subCardList.size() > 0) {
|
||||||
|
card = this.subCardList.remove(0);
|
||||||
|
}else {
|
||||||
|
this.room.bankerSeat = this.room.activeSeat;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
card = this.cardList.remove(0);
|
||||||
|
}
|
||||||
|
return card;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int popsub() {
|
||||||
|
Global.logger.info("pop sub cardlist size=>"+this.cardList.size()+":sub size==>"+subCardList.size());
|
||||||
|
int card = 0;
|
||||||
|
if (this.subCardList.size() == 0) {
|
||||||
|
if (this.cardList.size() == 0) {
|
||||||
|
this.room.bankerSeat = this.room.activeSeat;
|
||||||
|
}else {
|
||||||
|
card = this.cardList.remove(0);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
card = this.subCardList.remove(0);
|
||||||
|
}
|
||||||
|
return card;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return this.cardList.size() + this.subCardList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> deal() {
|
||||||
|
List<Integer> dealCards = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
for (int index = 0; index < 18; index++) {
|
||||||
|
dealCards.add(this.pop());
|
||||||
|
}
|
||||||
|
|
||||||
|
return dealCards;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
public class RuleWeight {
|
||||||
|
public final static int CHOW = 0b00001;
|
||||||
|
public final static int PONG = 0b00010;
|
||||||
|
public final static int ZHAO = 0b00100;
|
||||||
|
public final static int SELFZHAO = 0b00100;
|
||||||
|
public final static int KONG = 0b01000;
|
||||||
|
public final static int SELFKONG = 0b01000;
|
||||||
|
public final static int WIN = 0b10000;
|
||||||
|
public final static int SELF_WIN = 0b100000;
|
||||||
|
|
||||||
|
|
||||||
|
public final static int TYPE_CHOW = 1;
|
||||||
|
public final static int TYPE_PONG = 2;
|
||||||
|
public final static int TYPE_KONG = 3;
|
||||||
|
public final static int TYPE_SELF_KONG = 4;
|
||||||
|
public final static int TYPE_ZHAO = 5;
|
||||||
|
public final static int TYPE_SELF_ZHAO = 6;
|
||||||
|
public final static int TYPE_WIN = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
|
||||||
|
public class SettleLog {
|
||||||
|
private Map<String,Integer> log;
|
||||||
|
|
||||||
|
public SettleLog() {
|
||||||
|
log = new HashMap<String,Integer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void put(String key,Integer value) {
|
||||||
|
log.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(String key) {
|
||||||
|
if(!log.containsKey(key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int value = log.get(key);
|
||||||
|
value++;
|
||||||
|
log.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer get(String key) {
|
||||||
|
if(!log.containsKey(key)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return log.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITObject toTObject() {
|
||||||
|
ITObject obj = TObject.newInstance();
|
||||||
|
for (Entry<String, Integer> entry : this.log.entrySet()) {
|
||||||
|
obj.putInt(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TagAnalyseItem {
|
||||||
|
//分析子项
|
||||||
|
public int cbCardEye; //牌眼麻将
|
||||||
|
public int huxi;
|
||||||
|
public List<ITArray> cbCardEyeList; //牌眼麻将
|
||||||
|
public List<OpCard> cbOpCard; //组合类型
|
||||||
|
|
||||||
|
public TagAnalyseItem()
|
||||||
|
{
|
||||||
|
this.huxi = 0;
|
||||||
|
this.cbCardEye = 0;
|
||||||
|
this.cbOpCard = new ArrayList<OpCard>();
|
||||||
|
this.cbCardEyeList = new ArrayList<ITArray>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TagKindItem {
|
||||||
|
public int type; //组合类型
|
||||||
|
public int card; //中心麻将
|
||||||
|
public Integer[] cbCardList; //麻将索引
|
||||||
|
|
||||||
|
public TagKindItem()
|
||||||
|
{
|
||||||
|
type = 0;
|
||||||
|
card = 0;
|
||||||
|
cbCardList = new Integer[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,173 @@
|
||||||
|
package extend.mj;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
|
||||||
|
public class WinCardType {
|
||||||
|
public static final int JIHU = 1; //鸡胡类型
|
||||||
|
|
||||||
|
public static final int PINGHU = 2; //平胡类型
|
||||||
|
|
||||||
|
public static final int QIXIAODUI = 3; //七小对
|
||||||
|
|
||||||
|
public static final int HAOHUA_QIXIAODUI = 4; //豪华七小对
|
||||||
|
|
||||||
|
public static final int HAOHUA2_QIXIAODUI = 5; //双豪华七小对
|
||||||
|
|
||||||
|
public static final int HAOHUA3_QIXIAODUI = 6; //三豪华七小对
|
||||||
|
|
||||||
|
public static final int QINGYISE = 7; //清一色
|
||||||
|
|
||||||
|
public static final int PENGPENGHU = 8; //碰碰胡
|
||||||
|
|
||||||
|
public static final int GANGSHANGHUA = 9; //杠上开花
|
||||||
|
|
||||||
|
public static final int GANGSHANGPAO = 10; //杠上炮
|
||||||
|
|
||||||
|
public static final int QIANG_GANG_HU = 11; //抢杠胡
|
||||||
|
|
||||||
|
public static final int HUN_YI_SE = 12; //混一色
|
||||||
|
|
||||||
|
public static final int SHI_SHAN_YAO = 13; //十三幺
|
||||||
|
|
||||||
|
public static final int TIAN_HU = 14; //天胡 十倍
|
||||||
|
|
||||||
|
public static final int DI_HU = 15; //地胡 十倍
|
||||||
|
|
||||||
|
public static final int REN_HU = 16; //人胡 十倍
|
||||||
|
|
||||||
|
public static final int SHI_BA_LUO_HAN = 17; //十八罗汉
|
||||||
|
|
||||||
|
public static final int XIAO_SHAN_YUAN = 18; //小三元
|
||||||
|
|
||||||
|
public static final int DA_SHAN_YUAN = 19; //大三元
|
||||||
|
|
||||||
|
public static final int XIAO_SI_XI = 20; //小四喜
|
||||||
|
|
||||||
|
public static final int DA_SI_XI = 21; //大四喜
|
||||||
|
|
||||||
|
public static final int YAO_JIU = 22; //幺九
|
||||||
|
|
||||||
|
public static final int LAIZI4_HU = 23; //四鬼胡牌
|
||||||
|
|
||||||
|
public static final int QUAN_FENG = 24;//全风
|
||||||
|
|
||||||
|
public static final int QUAN_QIU_REN = 25;//全求人
|
||||||
|
|
||||||
|
public static final int QING_YAO_JIU = 26; //清幺九
|
||||||
|
|
||||||
|
public static final int ZI_YI_SE = 27; //字一色
|
||||||
|
|
||||||
|
public static final int WU_GUI_JIABEI = 28; //无鬼两倍
|
||||||
|
public static final int LIU_JU_2BEI = 29; //流局两倍
|
||||||
|
public static final int HAI_DI_NAO_YUE = 30; //海底捞月
|
||||||
|
public static final int MEN_QING = 31; //门清 捉炮门清
|
||||||
|
public static final int XIAO_HU_ZHONG_DA_HU = 32; //选小胡有大胡的情况下,不显示具体的胡牌类型,只显示大胡几分
|
||||||
|
public static final int MAN_TIAN_HU = 33; //满天胡
|
||||||
|
public static final int ZIMO_MEN_QING = 34; //自摸门清
|
||||||
|
public static final int GUN_GUN = 35; //滚滚
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
public static int BASE_HU_SCORE = 2; //基础分数
|
||||||
|
public static int DA_HU_BEI_SCORE = 1; //大胡倍数
|
||||||
|
public static int JIHU_SCORE = 1; //鸡胡类型
|
||||||
|
public static int PINGHU_SCORE = 1; //平胡类型
|
||||||
|
public static int MENGQING_SCORE = 3; //门清类型
|
||||||
|
public static int QIXIAODUI_SOCRE = 1; //七小对 倍数
|
||||||
|
public static int HAOHUA_QIXIAODUI_SCORE = 1; //豪华七小对
|
||||||
|
public static int HAOHUA2_QIXIAODUI_SCORE = 1; //双豪华七小对
|
||||||
|
public static int HAOHUA3_QIXIAODUI_SCORE = 1; //三豪华七小对
|
||||||
|
public static int QINGYISE_SCORE = 1; //清一色
|
||||||
|
public static int GANGSHANGHUA_SCORE = 3; //杠上开花
|
||||||
|
public static int PENGPENGHU_SCORE = 3; //碰碰胡
|
||||||
|
public static int GANGSHANGPAO_SOCRE = 3; //杠上炮
|
||||||
|
public static int QIANG_GANG_HU_SOCRE = 1; //抢杠胡
|
||||||
|
public static int HUN_YI_SE_SCORE = 1; //混一色
|
||||||
|
public static int SHI_SHAN_YAO_SCORE = 1; //十三幺
|
||||||
|
public static int TIAN_DI_HU_SCORE = 1; //天地胡 十倍
|
||||||
|
public static int TIAN_HU_SCORE = 1; //天胡 20倍
|
||||||
|
public static int DI_HU_SCORE = 1; //地胡 10倍
|
||||||
|
public static int SHI_BA_LUO_HAN_SCORE = 1; //十八罗汉
|
||||||
|
public static int DA_SHAN_YUAN_SCORE = 1; //大三元
|
||||||
|
public static int XIAO_SHAN_YUAN_SCORE = 1; //小三元
|
||||||
|
public static int XIAO_SI_XI_SCORE = 1; //小四喜
|
||||||
|
public static int DA_SI_XI_SCORE = 1; //大四喜
|
||||||
|
public static int YAO_JIU_SCORE = 1; //幺九
|
||||||
|
public static int LAIZI4_HU_SCORE = 1; //四鬼胡牌
|
||||||
|
public static int QUAN_FENG_SCORE = 1;//全风
|
||||||
|
public static int QUAN_QIU_REN_SCORE = 1;//全求人
|
||||||
|
public static int QING_YAO_JIU_SCORE = 1; //清幺九
|
||||||
|
public static int ZI_YI_SE_SCORE = 1; //字一色
|
||||||
|
public static int WU_GUI_JIABEI_SCORE = 1; //无鬼两倍
|
||||||
|
public static int LIU_JU_2BEI_SCORE = 1; //流局两倍
|
||||||
|
public static int HAI_DI_NAO_YUE_SCORE = 3; //海底捞月
|
||||||
|
public static int MAN_TIAN_HU_SCORE = 1;//满天胡
|
||||||
|
public static int ZIMO_MEN_QING_SCORE = 3; //自摸门清
|
||||||
|
public static int GUN_GUN_SCORE = 5; //滚滚
|
||||||
|
|
||||||
|
public int type;
|
||||||
|
|
||||||
|
public int value;
|
||||||
|
|
||||||
|
public int score;
|
||||||
|
|
||||||
|
public boolean is_dahu;
|
||||||
|
|
||||||
|
public String desc;
|
||||||
|
|
||||||
|
public ITArray opcard;
|
||||||
|
|
||||||
|
//初始化房间的特殊参数
|
||||||
|
static public void InitRoomSpecialConfig(EXRoom room)
|
||||||
|
{
|
||||||
|
//潮汕鬼牌特殊配置
|
||||||
|
//this.config.putInt(Config.ROOM_CONFIG_LAIZI, 0); //没有癞子
|
||||||
|
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_PENGPENGHU, true);
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_MENG_QING, true);
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_MENG_QING, true);
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_HAI_DI_NAO_YUE, true);
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_CHUIPAI, true);
|
||||||
|
//荒庄荒杠
|
||||||
|
if (!room.config.containsKey(Config.ROOM_CONFIG_HUANGZHUANGHUANGGANG))
|
||||||
|
{
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_HUANGZHUANGHUANGGANG, true);
|
||||||
|
}
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_USE_BASE_HU_SCORE, true);
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_JIHU_SHI_PINGHU, true);
|
||||||
|
room.config.putBoolean(Config.ROOM_CONFIG_DIANPAO, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public WinCardType(int type, int value, int score, boolean is_dahu, String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.value = value;
|
||||||
|
this.score = score;
|
||||||
|
this.is_dahu = is_dahu;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean IsDaHu()
|
||||||
|
{
|
||||||
|
return is_dahu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITObject toTObject() {
|
||||||
|
return toTObject(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITObject toTObject(boolean is_opcard) {
|
||||||
|
ITObject obj = TObject.newInstance();
|
||||||
|
obj.putInt("type", type);
|
||||||
|
obj.putInt("value", value);
|
||||||
|
obj.putInt("score", score);
|
||||||
|
if(is_opcard&&opcard!=null) {
|
||||||
|
obj.putTArray("opcard", opcard);
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "type:" + type + " value:" + value + " score:" + score + " desc:" + desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
package extend.mj.player.rule;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.Config;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.EXRoom;
|
||||||
|
import extend.mj.RuleWeight;
|
||||||
|
import extend.mj.player.rulestate.PRChowState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
import extend.mj.uitl.CardUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>11<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>
|
||||||
|
* PRChowRule.java
|
||||||
|
*/
|
||||||
|
public class RuleChow implements IRuleBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean condition(EXPlayer player) {
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
if (player.isEntrust() || !room.config.getBoolean(Config.ROOM_CONFIG_CHUIPAI)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.lastSeat != room.activeSeat) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.is_gang)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(room.activeSeat);
|
||||||
|
if (activePlayer.gangshangpao)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int eventCard = room.activeCard;
|
||||||
|
boolean result = check(player,eventCard);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean check(EXPlayer player,int eventCard){
|
||||||
|
if (eventCard % 100 == 4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean result = false;
|
||||||
|
List<Integer> cardInhand = player.cardInhand;
|
||||||
|
if (Util.checkCard(eventCard - 1, cardInhand) && Util.checkCard(eventCard - 2, cardInhand) && (eventCard-1) % 100 != 4 && (eventCard-2) % 100 != 4) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard - 1);
|
||||||
|
opcard.addInt(eventCard - 2);
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.CHOW,this, RuleWeight.TYPE_CHOW);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
result = result || true;
|
||||||
|
}
|
||||||
|
if (Util.checkCard(eventCard - 1, cardInhand) && (eventCard-1) % 100 != 4 && Util.checkCard(eventCard / 100 * 100 + 4, cardInhand)) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard - 1);
|
||||||
|
opcard.addInt(eventCard / 100 * 100 + 4);
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.CHOW,this, RuleWeight.TYPE_CHOW);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
result = result || true;
|
||||||
|
}
|
||||||
|
if (Util.checkCard(eventCard - 2, cardInhand) && (eventCard-2) % 100 != 4 && Util.checkCard(eventCard / 100 * 100 + 4, cardInhand)) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard - 2);
|
||||||
|
opcard.addInt(eventCard / 100 * 100 + 4);
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.CHOW,this, RuleWeight.TYPE_CHOW);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
result = result || true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Util.checkCard(eventCard + 1, cardInhand) && Util.checkCard(eventCard - 1, cardInhand) && (eventCard + 1) % 100 != 4 && (eventCard - 1) % 100 != 4) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard + 1);
|
||||||
|
opcard.addInt(eventCard - 1);
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.CHOW,this, RuleWeight.TYPE_CHOW);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
result = result || true;
|
||||||
|
}
|
||||||
|
if (Util.checkCard(eventCard + 1, cardInhand) && (eventCard + 1) % 100 != 4 && Util.checkCard(eventCard / 100 * 100 + 4, cardInhand)) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard + 1);
|
||||||
|
opcard.addInt(eventCard / 100 * 100 + 4);
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.CHOW,this, RuleWeight.TYPE_CHOW);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
result = result || true;
|
||||||
|
}
|
||||||
|
if (Util.checkCard(eventCard + 1, cardInhand) && Util.checkCard(eventCard + 2, cardInhand) && (eventCard + 1) % 100 != 4 && (eventCard + 2) % 100 != 4) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard + 1);
|
||||||
|
opcard.addInt(eventCard + 2);
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.CHOW,this, RuleWeight.TYPE_CHOW);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
result = result || true;
|
||||||
|
}
|
||||||
|
if (Util.checkCard(eventCard + 2, cardInhand) && (eventCard + 2) % 100 != 4 && Util.checkCard(eventCard / 100 * 100 + 4, cardInhand)) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard + 2);
|
||||||
|
opcard.addInt(eventCard / 100 * 100 + 4);
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.CHOW,this, RuleWeight.TYPE_CHOW);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
result = result || true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void action(EXPlayer player,Tip tip) {
|
||||||
|
player.getRoom().activeCard = tip.card;
|
||||||
|
player.stateMachine.changeState(Global.getState(PRChowState.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
package extend.mj.player.rule;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.rulestate.PROtherKongState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* RuleOtherKong.java
|
||||||
|
*/
|
||||||
|
public class RuleOtherKong implements IRuleBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean condition(EXPlayer player) {
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
|
||||||
|
int eventCard = room.activeCard;
|
||||||
|
if (player.isEntrust()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.is_gang)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(room.activeSeat);
|
||||||
|
if (activePlayer.gangshangpao)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Util.checkCard(eventCard, player.cardInhand, 3)) {
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
if (player.notPongKongList.contains(eventCard))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard);
|
||||||
|
player.is_gang = false;
|
||||||
|
|
||||||
|
List<Integer> delPai = new ArrayList<>();
|
||||||
|
delPai.add(eventCard);
|
||||||
|
delPai.add(eventCard);
|
||||||
|
delPai.add(eventCard);
|
||||||
|
List<OpCard> opCards = new ArrayList<>();
|
||||||
|
opCards.addAll(player.opCardList);
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_KONG, eventCard);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(eventCard);
|
||||||
|
pongCard.opCard.addInt(eventCard);
|
||||||
|
pongCard.opCard.addInt(eventCard);
|
||||||
|
pongCard.opCard.addInt(eventCard);
|
||||||
|
opCards.add(pongCard);
|
||||||
|
if (((EXGameController) Global.gameCtr).isTingPai(player, 0, delPai, opCards))
|
||||||
|
{
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.SELFKONG,this, RuleWeight.TYPE_KONG);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
Tip tip2 = new Tip(eventCard,opcard, RuleWeight.SELFZHAO,this, RuleWeight.TYPE_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.SELFZHAO,this, RuleWeight.TYPE_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
player.notPongKongList.add(eventCard);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (Util.checkCard(eventCard, player.cardInhand, 2) && Util.checkCard(eventCard /100 * 100 + 4, player.cardInhand, 1)) {
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
if (player.notPongKongList.contains(eventCard))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard);
|
||||||
|
opcard.addInt(eventCard /100 * 100 + 4);
|
||||||
|
player.is_gang = false;
|
||||||
|
List<Integer> delPai = new ArrayList<>();
|
||||||
|
delPai.add(eventCard);
|
||||||
|
delPai.add(eventCard);
|
||||||
|
delPai.add(eventCard /100 * 100 + 4);
|
||||||
|
List<OpCard> opCards = new ArrayList<>();
|
||||||
|
opCards.addAll(player.opCardList);
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_KONG, eventCard);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(eventCard);
|
||||||
|
pongCard.opCard.addInt(eventCard);
|
||||||
|
pongCard.opCard.addInt(eventCard);
|
||||||
|
pongCard.opCard.addInt(eventCard /100 * 100 + 4);
|
||||||
|
opCards.add(pongCard);
|
||||||
|
if (((EXGameController) Global.gameCtr).isTingPai(player, 0, delPai, opCards))
|
||||||
|
{
|
||||||
|
Tip tip = new Tip(eventCard,opcard, RuleWeight.SELFKONG,this, RuleWeight.TYPE_KONG);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
Tip tip2 = new Tip(eventCard,opcard, RuleWeight.SELFZHAO,this, RuleWeight.TYPE_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Tip tip = new Tip(eventCard, opcard, RuleWeight.ZHAO, this, RuleWeight.TYPE_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
player.notPongKongList.add(eventCard);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void action(EXPlayer player, Tip tip) {
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
Util.removeCard(player.notPongKongList, tip.card, 4);
|
||||||
|
}
|
||||||
|
if (tip.type == RuleWeight.TYPE_KONG)
|
||||||
|
{
|
||||||
|
player.is_gang = true;
|
||||||
|
if (tip.card > 0)
|
||||||
|
{
|
||||||
|
for (Map.Entry<Integer, Player> entry : player.getRoom().playerMapById.entrySet()) {
|
||||||
|
EXPlayer pp = (EXPlayer) entry.getValue();
|
||||||
|
pp.notPongList.add(tip.card/100*100+1);
|
||||||
|
pp.notPongList.add(tip.card/100*100+2);
|
||||||
|
pp.notPongList.add(tip.card/100*100+3);
|
||||||
|
pp.notPongList.add(tip.card/100*100+4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.stateMachine.changeState(Global.getState(PROtherKongState.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package extend.mj.player.rule;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.rulestate.PROtherGongSelfWinState;
|
||||||
|
import extend.mj.player.rulestate.PRSelfWinState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* RuleSelfWin.java
|
||||||
|
*/
|
||||||
|
public class RuleOtherKongSelfWin implements IRuleBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean condition(EXPlayer player) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
ITObject config = player.room.config;
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
int laizi = config.getInt(Config.ROOM_CONFIG_LAIZI);
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
if (player.is_gang)
|
||||||
|
{
|
||||||
|
if (room.config.getBoolean(Config.ROOM_CONFIG_GANGSHANGKAIHUA_2bei))
|
||||||
|
{
|
||||||
|
WinCard.putWinCardType(map, WinCardType.GANGSHANGHUA, 1,WinCardType.GANGSHANGHUA_SCORE*2, true, "杠上开花");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WinCard.putWinCardType(map, WinCardType.GANGSHANGHUA, 1,WinCardType.GANGSHANGHUA_SCORE, true, "杠上开花");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WinCard win = new WinCard(player.cardInhand, room.card.laiziCard, room.card.laiziCard2, laizi > 0 ? true : false, false);
|
||||||
|
if (win.checkWin(map, player, room, true)) {
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(player.drawCard);
|
||||||
|
Tip tip = new Tip(player.drawCard,opcard, RuleWeight.SELF_WIN,this, RuleWeight.TYPE_WIN);
|
||||||
|
tip.winMap = map;
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void action(EXPlayer player,Tip tip) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
player.is_gang = false;
|
||||||
|
player.winType = 1;
|
||||||
|
player.winCard = tip.card;
|
||||||
|
player.drawCard = tip.card;
|
||||||
|
|
||||||
|
player.winMap = tip.winMap;
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
player.niao_score = WinCardType.BASE_HU_SCORE;
|
||||||
|
player.hu_score = WinCardType.BASE_HU_SCORE;
|
||||||
|
player.di_score = WinCardType.BASE_HU_SCORE;
|
||||||
|
|
||||||
|
Global.logger.info("player:" + player.playerid + " di fen:" + player.di_score + " hu fen:" + player.hu_score + " niao fen:" + player.niao_score);
|
||||||
|
|
||||||
|
room.handle_repeatwin(player);
|
||||||
|
boolean isDaHu = false;
|
||||||
|
for (Map.Entry<Integer, WinCardType> entry : player.winMap.entrySet()) {
|
||||||
|
WinCardType cardType = entry.getValue();
|
||||||
|
Global.logger.info("player:" + player.playerid + " hu:" + cardType.toString());
|
||||||
|
if (cardType.IsDaHu())
|
||||||
|
{
|
||||||
|
isDaHu = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDaHu)
|
||||||
|
{
|
||||||
|
player.hu_score = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.is_gang)
|
||||||
|
{
|
||||||
|
player.stateMachine.changeState(Global.getState(PROtherGongSelfWinState.class));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player.stateMachine.changeState(Global.getState(PRSelfWinState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
package extend.mj.player.rule;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.rulestate.PROtherWinState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* RuleOtherWin.java
|
||||||
|
*/
|
||||||
|
public class RuleOtherWin implements IRuleBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean condition(EXPlayer player) {
|
||||||
|
if(player.louhu)return false;
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
ITObject config = room.config;
|
||||||
|
if (!config.getBoolean(Config.ROOM_CONFIG_DIANPAO)) {
|
||||||
|
if (!config.getBoolean(Config.ROOM_CONFIG_SPECAIL_ZIMO))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.lastSeat != room.activeSeat) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(room.activeSeat == player.seat)return false;
|
||||||
|
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(room.activeSeat);
|
||||||
|
|
||||||
|
if (player.cardInhand.size() == 1 && room.isLaizi(player.cardInhand.get(0)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (room.activeCard % 100 == 4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int activieCard = room.activeCard;
|
||||||
|
int laizi = room.config.getInt(Config.ROOM_CONFIG_LAIZI);
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
if (activePlayer.gangshangpao)
|
||||||
|
{
|
||||||
|
if ( room.config.getBoolean(Config.ROOM_CONFIG_GANGSHANGPAO_2bei))
|
||||||
|
{
|
||||||
|
WinCard.putWinCardType(map, WinCardType.GANGSHANGPAO, 1,WinCardType.GANGSHANGPAO_SOCRE*2, true, "杠上炮");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
WinCard.putWinCardType(map, WinCardType.GANGSHANGPAO, 1,WinCardType.GANGSHANGPAO_SOCRE, true, "杠上炮");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WinCard win = new WinCard(player.cardInhand, room.activeCard, room.card.laiziCard, room.card.laiziCard2, laizi > 0 ? true : false, false, false);
|
||||||
|
if (win.checkWin(map, player, room, false)) {
|
||||||
|
if (map.containsKey(WinCardType.MEN_QING) || map.containsKey(WinCardType.PENGPENGHU) || map.containsKey(WinCardType.GANGSHANGPAO))
|
||||||
|
{
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(activieCard);
|
||||||
|
Tip tip = new Tip(room.activeCard,opcard, RuleWeight.WIN,this, RuleWeight.TYPE_WIN);
|
||||||
|
tip.winType = player.forceCheckWin? 1 :0;
|
||||||
|
tip.winMap = map;
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void action(EXPlayer player,Tip tip) {
|
||||||
|
player.winType = tip.winType;
|
||||||
|
player.getRoom().activeCard = tip.card;
|
||||||
|
player.winMap = tip.winMap;
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
player.niao_score = WinCardType.BASE_HU_SCORE;
|
||||||
|
|
||||||
|
player.hu_score = 1;
|
||||||
|
player.di_score = 1;
|
||||||
|
|
||||||
|
if (tip.winMap.containsKey(WinCardType.PENGPENGHU))
|
||||||
|
{
|
||||||
|
player.hu_score = WinCardType.PENGPENGHU_SCORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Global.logger.info("player:" + player.playerid + " di fen:" + player.di_score + " hu fen:" + player.hu_score + " niao fen:" + player.niao_score);
|
||||||
|
|
||||||
|
room.handle_repeatwin(player);
|
||||||
|
|
||||||
|
player.stateMachine.changeState(Global.getState(PROtherWinState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
package extend.mj.player.rule;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.Config;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.EXRoom;
|
||||||
|
import extend.mj.RuleWeight;
|
||||||
|
import extend.mj.player.rulestate.PRPongState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* RulePong.java
|
||||||
|
*/
|
||||||
|
public class RulePong implements IRuleBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean condition(EXPlayer player) {
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
int eventCard = room.activeCard;
|
||||||
|
if (player.isEntrust()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_PENG))
|
||||||
|
{
|
||||||
|
if (player.notPongList.contains(eventCard))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventCard % 100 == 4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.is_gang)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(room.activeSeat);
|
||||||
|
if (activePlayer.gangshangpao)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Util.checkCard(eventCard, player.cardInhand, 2)) {
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard);
|
||||||
|
Tip tip = new Tip(eventCard, opcard, RuleWeight.PONG, this, RuleWeight.TYPE_PONG);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_PENG))
|
||||||
|
{
|
||||||
|
player.notPongList.add(eventCard);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (Util.checkCard(eventCard, player.cardInhand, 1) && Util.checkCard(eventCard /100 * 100 + 4, player.cardInhand, 1))
|
||||||
|
{
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(eventCard);
|
||||||
|
opcard.addInt(eventCard /100 * 100 + 4);
|
||||||
|
Tip tip = new Tip(eventCard, opcard, RuleWeight.PONG, this, RuleWeight.TYPE_PONG);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_PENG))
|
||||||
|
{
|
||||||
|
player.notPongList.add(eventCard);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void action(EXPlayer player, Tip tip) {
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_PENG))
|
||||||
|
{
|
||||||
|
Util.removeCard(player.notPongList, tip.card, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.stateMachine.changeState(Global.getState(PRPongState.class));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
package extend.mj.player.rule;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.rulestate.PRSelfKongState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* RuleSelfKong.java
|
||||||
|
*/
|
||||||
|
public class RuleSelfKong implements IRuleBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean condition(EXPlayer player) {
|
||||||
|
if (player.isEntrust()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.is_gang)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Integer, Integer> cardMap = Util.getCardNumMap(player.cardInhand);
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
for (Entry<Integer, Integer> entry : cardMap.entrySet()) {
|
||||||
|
|
||||||
|
int card = entry.getKey();
|
||||||
|
|
||||||
|
int num = entry.getValue();
|
||||||
|
if (num >= 4) {
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
if (player.notPongKongList.contains(card))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
player.is_gang = false;
|
||||||
|
List<Integer> delPai = new ArrayList<>();
|
||||||
|
delPai.add(card);
|
||||||
|
delPai.add(card);
|
||||||
|
delPai.add(card);
|
||||||
|
delPai.add(card);
|
||||||
|
List<OpCard> opCards = new ArrayList<>();
|
||||||
|
opCards.addAll(player.opCardList);
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_KONG, card);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
opCards.add(pongCard);
|
||||||
|
if (((EXGameController) Global.gameCtr).isTingPai(player, 0, delPai, opCards))
|
||||||
|
{
|
||||||
|
Tip tip = new Tip(card,opcard, RuleWeight.SELFKONG,this, RuleWeight.TYPE_SELF_KONG);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
Tip tip2 = new Tip(card,opcard, RuleWeight.SELFZHAO,this, RuleWeight.TYPE_SELF_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Tip tip = new Tip(card,opcard, RuleWeight.SELFZHAO,this, RuleWeight.TYPE_SELF_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = true;
|
||||||
|
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
player.notPongKongList.add(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (num == 3 && Util.checkCard(card /100 * 100 + 4, player.cardInhand, 1)) {
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
if (player.notPongKongList.contains(card))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card /100 * 100 + 4);
|
||||||
|
player.is_gang = false;
|
||||||
|
|
||||||
|
List<Integer> delPai = new ArrayList<>();
|
||||||
|
delPai.add(card);
|
||||||
|
delPai.add(card);
|
||||||
|
delPai.add(card);
|
||||||
|
delPai.add(card /100 * 100 + 4);
|
||||||
|
List<OpCard> opCards = new ArrayList<>();
|
||||||
|
opCards.addAll(player.opCardList);
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_KONG, card);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card /100 * 100 + 4);
|
||||||
|
opCards.add(pongCard);
|
||||||
|
if (((EXGameController) Global.gameCtr).isTingPai(player, 0, delPai, opCards))
|
||||||
|
{
|
||||||
|
Tip tip = new Tip(card,opcard, RuleWeight.SELFKONG,this, RuleWeight.TYPE_SELF_KONG);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
Tip tip2 = new Tip(card,opcard, RuleWeight.SELFZHAO,this, RuleWeight.TYPE_SELF_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Tip tip = new Tip(card,opcard, RuleWeight.SELFZHAO,this, RuleWeight.TYPE_SELF_ZHAO);
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = true;
|
||||||
|
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
player.notPongKongList.add(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void action(EXPlayer player,Tip tip) {
|
||||||
|
if (player.getRoom().config.getBoolean(Config.ROOM_CONFIG_GUO_GONG))
|
||||||
|
{
|
||||||
|
Util.removeCard(player.notPongKongList, tip.card, 4);
|
||||||
|
}
|
||||||
|
if (tip.type == RuleWeight.TYPE_SELF_KONG)
|
||||||
|
{
|
||||||
|
player.is_gang = true;
|
||||||
|
if (tip.card > 0)
|
||||||
|
{
|
||||||
|
for (Entry<Integer, Player> entry : player.getRoom().playerMapById.entrySet()) {
|
||||||
|
EXPlayer pp = (EXPlayer) entry.getValue();
|
||||||
|
pp.notPongList.add(tip.card/100*100+1);
|
||||||
|
pp.notPongList.add(tip.card/100*100+2);
|
||||||
|
pp.notPongList.add(tip.card/100*100+3);
|
||||||
|
pp.notPongList.add(tip.card/100*100+4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.stateMachine.changeState(Global.getState(PRSelfKongState.class));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
package extend.mj.player.rule;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.rulestate.PRSelfWinState;
|
||||||
|
import extend.mj.tip.IRuleBase;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* RuleSelfWin.java
|
||||||
|
*/
|
||||||
|
public class RuleSelfWin implements IRuleBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean condition(EXPlayer player) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
ITObject config = player.room.config;
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
int laizi = config.getInt(Config.ROOM_CONFIG_LAIZI);
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
WinCard win = new WinCard(player.cardInhand, room.card.laiziCard, room.card.laiziCard2, laizi > 0 ? true : false, false);
|
||||||
|
if (win.checkWin(map, player, room, true)) {
|
||||||
|
if (player.cardInhand.size() == 0 && player.opCardList.size() == 6)
|
||||||
|
{
|
||||||
|
//WinCard.putWinCardType(map, WinCardType.MAN_TIAN_HU, 1,WinCardType.MAN_TIAN_HU_SCORE, false, "满天胡");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map.containsKey(WinCardType.PENGPENGHU))
|
||||||
|
{
|
||||||
|
if (room.maxPlayers == 4 && (room.bankerSeat+2)%room.maxPlayers+1 == player.seat)
|
||||||
|
{
|
||||||
|
map.remove(WinCardType.PENGPENGHU);
|
||||||
|
WinCard.putWinCardType(map, WinCardType.GUN_GUN, 1,WinCardType.GUN_GUN_SCORE, true, "滚滚");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(player.drawCard);
|
||||||
|
Tip tip = new Tip(player.drawCard,opcard, RuleWeight.SELF_WIN,this, RuleWeight.TYPE_WIN);
|
||||||
|
tip.winMap = map;
|
||||||
|
tip.self = true;
|
||||||
|
player.tipMgr.addTip(tip);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void action(EXPlayer player,Tip tip) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
player.winCard = tip.card;
|
||||||
|
player.drawCard = tip.card;
|
||||||
|
player.winMap = tip.winMap;
|
||||||
|
EXRoom room = player.getRoom();
|
||||||
|
|
||||||
|
player.niao_score = WinCardType.BASE_HU_SCORE;
|
||||||
|
player.hu_score = WinCardType.BASE_HU_SCORE;
|
||||||
|
player.di_score = WinCardType.BASE_HU_SCORE;
|
||||||
|
|
||||||
|
Global.logger.info("player:" + player.playerid + " di fen:" + player.di_score + " hu fen:" + player.hu_score + " niao fen:" + player.niao_score);
|
||||||
|
|
||||||
|
room.handle_repeatwin(player);
|
||||||
|
boolean isDaHu = false;
|
||||||
|
for (Map.Entry<Integer, WinCardType> entry : player.winMap.entrySet()) {
|
||||||
|
WinCardType cardType = entry.getValue();
|
||||||
|
Global.logger.info("player:" + player.playerid + " hu:" + cardType.toString());
|
||||||
|
if (cardType.IsDaHu())
|
||||||
|
{
|
||||||
|
isDaHu = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDaHu)
|
||||||
|
{
|
||||||
|
player.hu_score = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.stateMachine.changeState(Global.getState(PRSelfWinState.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package extend.mj.player.rulestate;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.state.EXPlayerDiscardState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PRChowState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(owner.room.activeSeat);
|
||||||
|
if(activePlayer.outcardList.get(activePlayer.outcardList.size() - 1)!=room.activeCard){
|
||||||
|
activePlayer.outcardList.remove(activePlayer.outcardList.size() - 2);
|
||||||
|
}else{
|
||||||
|
activePlayer.outcardList.remove(activePlayer.outcardList.size() - 1);
|
||||||
|
}
|
||||||
|
activePlayer.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
int fromseat = activePlayer.seat;
|
||||||
|
EXMainServer.gameCtr.changeActiveSeat(room, owner.seat);
|
||||||
|
|
||||||
|
ITArray opcard = owner.opCard;
|
||||||
|
int chowcard1 = opcard.getInt(0);
|
||||||
|
int chowcard2 = opcard.getInt(1);
|
||||||
|
int card= room.activeCard;
|
||||||
|
Util.removeCard(owner.cardInhand, chowcard1, 1);
|
||||||
|
Util.removeCard(owner.cardInhand, chowcard2, 1);
|
||||||
|
room.activeCard = 0;
|
||||||
|
|
||||||
|
|
||||||
|
OpCard opc = new OpCard(RuleWeight.TYPE_CHOW, card);
|
||||||
|
opc.opCard = new TArray();
|
||||||
|
opc.opCard.addInt(card);
|
||||||
|
opc.opCard.addInt(chowcard1);
|
||||||
|
opc.opCard.addInt(chowcard2);
|
||||||
|
owner.opCardList.add(opc);
|
||||||
|
|
||||||
|
ITArray opcard2 = TArray.newInstance();
|
||||||
|
opcard2.addInt(chowcard1);
|
||||||
|
opcard2.addInt(chowcard2);
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_CHOW, fromseat, opcard2);
|
||||||
|
|
||||||
|
if(!EXMainServer.playerRuleMgr.condition(PlayerRuleManager.CHOW_PONG_DISCARD_RULE, owner,false)){
|
||||||
|
toNextState(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerDiscardState.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
package extend.mj.player.rulestate;
|
||||||
|
|
||||||
|
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import extend.mj.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* PRSelfWinState.java
|
||||||
|
*/
|
||||||
|
public class PROtherGongSelfWinState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
owner.winCard = owner.drawCard;
|
||||||
|
owner.winer = 1;
|
||||||
|
Util.removeCard(owner.cardInhand, owner.winCard, 1);
|
||||||
|
if (owner.opCardList.size() > 0)
|
||||||
|
{
|
||||||
|
OpCard opCard = owner.opCardList.get(owner.opCardList.size()-1);
|
||||||
|
if ((opCard.type == RuleWeight.TYPE_KONG) && opCard.card_seat > 0)
|
||||||
|
{
|
||||||
|
owner.room.activeSeat = opCard.card_seat;
|
||||||
|
|
||||||
|
room.addAllScore(owner, owner.hu_score, EXScore.WIN);
|
||||||
|
|
||||||
|
room.addAllPiaoNiaoScore(owner);
|
||||||
|
for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(owner.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
fromPlayer.winer = 2;
|
||||||
|
fromPlayer.last_winer = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.winEvent(owner,owner.seat,owner.winCard);
|
||||||
|
if (room.lastBankerSeat == 0)
|
||||||
|
{
|
||||||
|
room.lastBankerSeat = room.bankerSeat;
|
||||||
|
}
|
||||||
|
owner.room.bankerSeat = owner.seat;
|
||||||
|
owner.settleLog.add(Config.SETTLE_ZIMO);
|
||||||
|
|
||||||
|
room.endGame();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (opCard.type == RuleWeight.TYPE_SELF_KONG
|
||||||
|
|| (opCard.type == RuleWeight.TYPE_KONG && opCard.card_seat == 0))
|
||||||
|
{
|
||||||
|
room.addAllScore(owner, owner.hu_score,EXScore.WIN);
|
||||||
|
|
||||||
|
room.addAllPiaoNiaoScore(owner);
|
||||||
|
for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(owner.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
fromPlayer.winer = 2;
|
||||||
|
fromPlayer.last_winer = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.winEvent(owner,owner.seat,owner.winCard);
|
||||||
|
if (room.lastBankerSeat == 0)
|
||||||
|
{
|
||||||
|
room.lastBankerSeat = room.bankerSeat;
|
||||||
|
}
|
||||||
|
owner.room.bankerSeat = owner.seat;
|
||||||
|
owner.settleLog.add(Config.SETTLE_ZIMO);
|
||||||
|
|
||||||
|
room.endGame();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
package extend.mj.player.rulestate;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.state.EXPlayerKongDrawState;
|
||||||
|
import extend.mj.player.state.EXPlayerWaitKongWinState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* PROtherKongState.java
|
||||||
|
*/
|
||||||
|
public class PROtherKongState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(owner.room.activeSeat);
|
||||||
|
activePlayer.outcardList.remove(activePlayer.outcardList.size()-1);
|
||||||
|
activePlayer.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
int fromseat = activePlayer.seat;
|
||||||
|
//room.addScore(owner,activePlayer, Config.MING_GANG_SCORE,EXScore.KONG);
|
||||||
|
owner.ming_gang_num++;
|
||||||
|
activePlayer.dian_gang_num++;
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.changeActiveSeat(room,owner.seat);
|
||||||
|
owner.cardInhand.add(owner.getRoom().activeCard);
|
||||||
|
|
||||||
|
|
||||||
|
int [] kongGroup = new int [4];
|
||||||
|
int card = room.activeCard;
|
||||||
|
if (Util.checkCard(card, owner.cardInhand, 4)) {
|
||||||
|
kongGroup[0] = card;
|
||||||
|
kongGroup[1] = card;
|
||||||
|
kongGroup[2] = card;
|
||||||
|
kongGroup[3] = card;
|
||||||
|
|
||||||
|
owner.kongGroup.add(kongGroup);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_KONG, card, activePlayer.seat);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
owner.gangshangpao = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_ZHAO, card, activePlayer.seat);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.removeCard(owner.cardInhand, card, 4);
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_KONG, fromseat,opcard);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_ZHAO, fromseat,opcard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Util.checkCard(card, owner.cardInhand, 3) && Util.checkCard(card /100 * 100 + 4, owner.cardInhand, 1)) {
|
||||||
|
kongGroup[0] = card;
|
||||||
|
kongGroup[1] = card;
|
||||||
|
kongGroup[2] = card;
|
||||||
|
kongGroup[3] = card /100 * 100 + 4;
|
||||||
|
|
||||||
|
owner.kongGroup.add(kongGroup);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_KONG, card, activePlayer.seat);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card /100 * 100 + 4);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
owner.gangshangpao = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_ZHAO, card, activePlayer.seat);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card /100 * 100 + 4);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.removeCard(owner.cardInhand, card, 3);
|
||||||
|
Util.removeCard(owner.cardInhand, card /100 * 100 + 4, 1);
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card /100 * 100 + 4);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_KONG, fromseat,opcard);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_ZHAO, fromseat,opcard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
room.activeCard = card;
|
||||||
|
boolean qiangkong = room.config.getBoolean(Config.ROOM_CONFIG_QIANGKONG_MING);
|
||||||
|
if(qiangkong) {
|
||||||
|
owner.room.broadCastToServer(owner.playerid, EXActionEvent.EVENT_KONG_WIN, null);
|
||||||
|
if(room.tipMap.size() == 0){
|
||||||
|
room.activeCard = 0;
|
||||||
|
room.lastDiscardSeat = 0;
|
||||||
|
owner.settleLog.add(Config.SETTLE_MING_KONG);
|
||||||
|
toNextState(owner);
|
||||||
|
}else{
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerWaitKongWinState.class));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
room.activeCard = 0;
|
||||||
|
room.lastDiscardSeat = 0;
|
||||||
|
owner.settleLog.add(Config.SETTLE_MING_KONG);
|
||||||
|
toNextState(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerKongDrawState.class));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package extend.mj.player.rulestate;
|
||||||
|
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* PROtherWinState.java
|
||||||
|
*/
|
||||||
|
public class PROtherWinState extends StateBase<EXPlayer>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
EXRoom room = (EXRoom) owner.room;
|
||||||
|
owner.winer = 1;
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(owner.room.activeSeat);
|
||||||
|
|
||||||
|
room.addScore(owner,activePlayer, owner.hu_score, EXScore.WIN);
|
||||||
|
|
||||||
|
room.addPiaoNiaoScore(owner, activePlayer);
|
||||||
|
activePlayer.settleLog.add(Config.SETTLE_DIAN_PAO);
|
||||||
|
activePlayer.winer = 2;
|
||||||
|
activePlayer.last_winer = 2;
|
||||||
|
|
||||||
|
owner.settleLog.add(Config.SETTLE_JIE_PAO);
|
||||||
|
EXMainServer.gameCtr.winEvent(owner,activePlayer.seat,room.activeCard);
|
||||||
|
|
||||||
|
if (room.lastBankerSeat == 0)
|
||||||
|
{
|
||||||
|
room.lastBankerSeat = room.bankerSeat;
|
||||||
|
}
|
||||||
|
room.bankerSeat = owner.seat;
|
||||||
|
room.winCount += 1;
|
||||||
|
|
||||||
|
owner.winCard = room.activeCard;
|
||||||
|
|
||||||
|
room.winCallback( owner ,owner.winCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
package extend.mj.player.rulestate;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.state.EXPlayerDiscardState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* PRPongState.java
|
||||||
|
*/
|
||||||
|
public class PRPongState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
EXRoom room = (EXRoom) owner.room;
|
||||||
|
EXPlayer activePlayer = (EXPlayer)room.playerMapBySeat.get(owner.room.activeSeat);
|
||||||
|
activePlayer.outcardList.remove(activePlayer.outcardList.size() - 1);
|
||||||
|
activePlayer.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
int fromseat = activePlayer.seat;
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.changeActiveSeat(room, owner.seat);
|
||||||
|
owner.cardInhand.add(room.activeCard);
|
||||||
|
|
||||||
|
int[] pongGroup = new int[3];
|
||||||
|
int card = room.activeCard;
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_PONG, card, activePlayer.seat);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
if (Util.checkCard(card, owner.cardInhand, 3)) {
|
||||||
|
pongGroup[0] = card;
|
||||||
|
pongGroup[1] = card;
|
||||||
|
pongGroup[2] = card;
|
||||||
|
owner.pongGroup.add(pongGroup);
|
||||||
|
Util.removeCard(owner.cardInhand, card, 3);
|
||||||
|
|
||||||
|
room.activeCard = 0;
|
||||||
|
room.lastDiscardSeat = 0;
|
||||||
|
|
||||||
|
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_PONG, fromseat,opcard);
|
||||||
|
}
|
||||||
|
else if (Util.checkCard(card, owner.cardInhand, 2) && Util.checkCard(card / 100 * 100 + 4, owner.cardInhand, 1)) {
|
||||||
|
pongGroup[0] = card;
|
||||||
|
pongGroup[1] = card;
|
||||||
|
pongGroup[2] = card / 100 * 100 + 4;
|
||||||
|
owner.pongGroup.add(pongGroup);
|
||||||
|
Util.removeCard(owner.cardInhand, card, 2);
|
||||||
|
Util.removeCard(owner.cardInhand, card / 100 * 100 + 4, 1);
|
||||||
|
|
||||||
|
room.activeCard = 0;
|
||||||
|
room.lastDiscardSeat = 0;
|
||||||
|
|
||||||
|
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card / 100 * 100 + 4);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card / 100 * 100 + 4);
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_PONG, fromseat,opcard);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!EXMainServer.playerRuleMgr.condition(PlayerRuleManager.CHOW_PONG_DISCARD_RULE, owner,false)){
|
||||||
|
toNextState(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
owner.drawCard = 0;
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerDiscardState.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
package extend.mj.player.rulestate;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.state.EXPlayerDrawState;
|
||||||
|
import extend.mj.player.state.EXPlayerKongDrawState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* PRSelfKongState.java
|
||||||
|
*/
|
||||||
|
public class PRSelfKongState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
|
||||||
|
ITArray opCard = owner.opCard;
|
||||||
|
int card = opCard.getInt(0);
|
||||||
|
int [] kongGroup = new int [4];
|
||||||
|
if (opCard.size() >= 2)
|
||||||
|
{
|
||||||
|
Util.removeCard(owner.cardInhand, card, 3);
|
||||||
|
Util.removeCard(owner.cardInhand, card/100*100+4, 1);
|
||||||
|
kongGroup[0] = card;
|
||||||
|
kongGroup[1] = card;
|
||||||
|
kongGroup[2] = card;
|
||||||
|
kongGroup[3] = card/100*100+4;
|
||||||
|
owner.selfKongGroup.add(kongGroup);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_SELF_KONG, card);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card/100*100+4);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
owner.gangshangpao = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_SELF_ZHAO, card);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card/100*100+4);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card/100*100+4);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_SELF_KONG, owner.seat,opcard);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_SELF_ZHAO, owner.seat,opcard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Util.removeCard(owner.cardInhand, card, 4);
|
||||||
|
kongGroup[0] = card;
|
||||||
|
kongGroup[1] = card;
|
||||||
|
kongGroup[2] = card;
|
||||||
|
kongGroup[3] = card;
|
||||||
|
owner.selfKongGroup.add(kongGroup);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_SELF_KONG, card);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
owner.gangshangpao = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OpCard pongCard = new OpCard(RuleWeight.TYPE_SELF_ZHAO, card);
|
||||||
|
pongCard.opCard = new TArray();
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
pongCard.opCard.addInt(card);
|
||||||
|
owner.opCardList.add(pongCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
ITArray opcard = TArray.newInstance();
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
opcard.addInt(card);
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_SELF_KONG, owner.seat,opcard);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EXMainServer.gameCtr.actionCard(owner, card, RuleWeight.TYPE_SELF_ZHAO, owner.seat,opcard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//room.addAllScore(owner, Config.AN_GANG_SCORE, EXScore.KONG);
|
||||||
|
owner.an_gang_num++;
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerKongDrawState.class));
|
||||||
|
owner.settleLog.add(Config.SETTLE_AN_KONG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package extend.mj.player.rulestate;
|
||||||
|
|
||||||
|
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import extend.mj.*;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* PRSelfWinState.java
|
||||||
|
*/
|
||||||
|
public class PRSelfWinState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
owner.winCard = owner.drawCard;
|
||||||
|
owner.winer = 1;
|
||||||
|
|
||||||
|
Util.removeCard(owner.cardInhand, owner.winCard, 1);
|
||||||
|
|
||||||
|
room.addAllScore(owner, owner.hu_score,EXScore.WIN);
|
||||||
|
|
||||||
|
room.addAllPiaoNiaoScore(owner);
|
||||||
|
for (Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
|
||||||
|
if (entry.getKey().equals(owner.playerid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
|
fromPlayer.winer = 2;
|
||||||
|
fromPlayer.last_winer = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.winEvent(owner,owner.seat,owner.winCard);
|
||||||
|
|
||||||
|
if (room.lastBankerSeat == 0)
|
||||||
|
{
|
||||||
|
room.lastBankerSeat = room.bankerSeat;
|
||||||
|
}
|
||||||
|
owner.room.bankerSeat = owner.seat;
|
||||||
|
owner.settleLog.add(Config.SETTLE_ZIMO);
|
||||||
|
room.endGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.game.ActionEvent;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
|
||||||
|
import extend.mj.EXActionEvent;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.RuleWeight;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayerDisCardTipState.java
|
||||||
|
*/
|
||||||
|
public class EXPlayerDisCardTipState extends EXPlayerTipState {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
super.enter(owner);
|
||||||
|
owner.getRoom().tipMap.put(owner.playerid, owner.tipMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
super.exit(owner);
|
||||||
|
owner.getRoom().tipMap.remove(owner.playerid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
super.execute(owner, cmd, gid, param);
|
||||||
|
if (cmd.equals(EXActionEvent.EVENT_ACTION)) {
|
||||||
|
ITObject netParam = (ITObject) param;
|
||||||
|
int id = netParam.getInt("id");
|
||||||
|
owner.tipMgr.choicAction(id);
|
||||||
|
}else if(cmd.equals(ActionEvent.EVENT_TIMER_AUTO)) {
|
||||||
|
int id = 0;
|
||||||
|
for (Entry<Integer, Tip> entry : owner.tipMgr.tipMap.entrySet()) {
|
||||||
|
Tip tip = entry.getValue();
|
||||||
|
if(tip.type == RuleWeight.TYPE_WIN) {
|
||||||
|
id = tip.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
owner.tipMgr.choicAction(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import com.game.ActionEvent;
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Router;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.player.state.PlayerPauseState;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.*;
|
||||||
|
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.room.state.EXRoomSetpState;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class EXPlayerDiscardState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
owner.louhu = false;
|
||||||
|
int discard = owner.drawCard;
|
||||||
|
if(owner.drawCard == 0) {
|
||||||
|
discard = owner.cardInhand.get(owner.cardInhand.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.outCard(owner, discard);
|
||||||
|
owner.gangshangpao = false;
|
||||||
|
|
||||||
|
if (owner.getRoom().tipMap.size() != 0) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(PlayerPauseState.class));
|
||||||
|
} else {
|
||||||
|
this.toNextState(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EXMainServer.gameCtr.discardTipEvent(owner);
|
||||||
|
owner.startActionTimer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
owner.room.stateMachine.changeState(Global.getState(EXRoomSetpState.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
owner.stopActionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reload(EXPlayer owner) {
|
||||||
|
owner.startActionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
switch (cmd) {
|
||||||
|
case EXActionEvent.EVENT_DISCARD:
|
||||||
|
ITObject netParam = (ITObject) param;
|
||||||
|
int discard = netParam.getInt("card");
|
||||||
|
|
||||||
|
if (!Util.checkCard(discard, owner.cardInhand)) {
|
||||||
|
ITObject reconParam = new TObject();
|
||||||
|
owner.sendEvent(Router.GAME_EVT__UPDATE_RECONECT, reconParam);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
owner.louhu = false;
|
||||||
|
EXMainServer.gameCtr.outCard(owner, discard);
|
||||||
|
owner.gangshangpao = false;
|
||||||
|
|
||||||
|
if (owner.getRoom().tipMap.size() != 0) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(PlayerPauseState.class));
|
||||||
|
} else {
|
||||||
|
this.toNextState(owner);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ActionEvent.EVENT_TIMER_AUTO:
|
||||||
|
owner.louhu = false;
|
||||||
|
discard = owner.drawCard;
|
||||||
|
if(owner.drawCard == 0) {
|
||||||
|
discard = owner.cardInhand.get(owner.cardInhand.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.outCard(owner, discard);
|
||||||
|
owner.gangshangpao = false;
|
||||||
|
|
||||||
|
if (owner.getRoom().tipMap.size() != 0) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(PlayerPauseState.class));
|
||||||
|
} else {
|
||||||
|
this.toNextState(owner);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ActionEvent.EVENT_ENTRUST:
|
||||||
|
owner.startActionTimer();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,199 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.Util;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayerDrawState.java
|
||||||
|
*/
|
||||||
|
public class EXPlayerDrawState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
if (room.isLiuJu()) {
|
||||||
|
room.endGameByLiuJu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ITObject config = room.config;
|
||||||
|
boolean hz_hu = config.getBoolean(Config.ROOM_CONFIG_HZ_HU);
|
||||||
|
boolean laizi = room.config.getInt(Config.ROOM_CONFIG_LAIZI) > 0 ? true : false;
|
||||||
|
|
||||||
|
if(owner.seat == room.adminSeat) {
|
||||||
|
ArrayList<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
int count = 0;
|
||||||
|
do {
|
||||||
|
int drawCard = room.card.pop();
|
||||||
|
|
||||||
|
if (!IsGoodCard(owner, drawCard, laizi)) {
|
||||||
|
if (room.card.cardList.size() != 0 && count++ <= 5) {
|
||||||
|
tempCardList.add(drawCard);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
owner.drawCard = drawCard;
|
||||||
|
break;
|
||||||
|
} while (true);
|
||||||
|
room.card.cardList.addAll(tempCardList);
|
||||||
|
} else {
|
||||||
|
double rand = Math.random() % 100 * 100;
|
||||||
|
if (room.while_list && owner.is_white && rand > room.white_value) {
|
||||||
|
ArrayList<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
int count = 0;
|
||||||
|
do {
|
||||||
|
int drawCard = room.card.pop();
|
||||||
|
|
||||||
|
if (!IsGoodCard(owner, drawCard, laizi)) {
|
||||||
|
if (room.card.cardList.size() != 0 && count++ <= 5) {
|
||||||
|
tempCardList.add(drawCard);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
owner.drawCard = drawCard;
|
||||||
|
break;
|
||||||
|
} while (true);
|
||||||
|
room.card.cardList.addAll(tempCardList);
|
||||||
|
} else {
|
||||||
|
if (owner.black_white_status == 2) {
|
||||||
|
double rand1 = Math.random() % 100 * 100;
|
||||||
|
if (rand1 <= owner.black_white_rate) {
|
||||||
|
ArrayList<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
int count = 0;
|
||||||
|
do {
|
||||||
|
int drawCard = room.card.pop();
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
if (IsGoodCard(owner, drawCard, laizi)) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag) {
|
||||||
|
if (room.card.cardList.size() > 0 && count++ <= 5) {
|
||||||
|
tempCardList.add(drawCard);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
owner.drawCard = drawCard;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (true);
|
||||||
|
room.card.cardList.addAll(tempCardList);
|
||||||
|
} else {
|
||||||
|
owner.drawCard = room.card.pop();
|
||||||
|
}
|
||||||
|
} else if (owner.black_white_status == 1) {
|
||||||
|
double rand1 = Math.random() % 100 * 100;
|
||||||
|
if (rand1 <= owner.black_white_rate) {
|
||||||
|
ArrayList<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
int count = 0;
|
||||||
|
do {
|
||||||
|
int drawCard = room.card.pop();
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
if (IsGoodCard(owner, drawCard, laizi)) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
if (room.card.cardList.size() > 0 && count++ <= 5) {
|
||||||
|
tempCardList.add(drawCard);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
owner.drawCard = drawCard;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (true);
|
||||||
|
room.card.cardList.addAll(tempCardList);
|
||||||
|
} else {
|
||||||
|
owner.drawCard = room.card.pop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
owner.drawCard = room.card.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int leftCount = room.card.getCount();
|
||||||
|
((EXGameController)Global.gameCtr).getCard(owner, leftCount);
|
||||||
|
|
||||||
|
EXMainServer.playerRuleMgr.condition(PlayerRuleManager.DRAW_RULE, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean IsGoodCard(EXPlayer player, int drawCard, boolean laizi) {
|
||||||
|
if (player.getRoom().isLaizi(drawCard))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Util.cardNum(drawCard, player.cardInhand) >= 2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int[] cardGroup : player.pongGroup) {
|
||||||
|
if (drawCard == cardGroup[0]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
WinCard win = new WinCard(player.cardInhand, drawCard, player.getRoom().card.laiziCard, player.getRoom().card.laiziCard2, laizi, true, true);
|
||||||
|
if (win.checkWin(map, player, player.getRoom(), true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawCard < 400)
|
||||||
|
{
|
||||||
|
if (drawCard % 100 <= 7)
|
||||||
|
{
|
||||||
|
if (Util.cardNum(drawCard+1, player.cardInhand) >= 1 && Util.cardNum(drawCard+2, player.cardInhand) >= 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawCard % 100 >= 3)
|
||||||
|
{
|
||||||
|
if (Util.cardNum(drawCard-1, player.cardInhand) >= 1 && Util.cardNum(drawCard-2, player.cardInhand) >= 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawCard % 100 >= 2 && drawCard % 100 <= 8)
|
||||||
|
{
|
||||||
|
if (Util.cardNum(drawCard-1, player.cardInhand) >= 1 && Util.cardNum(drawCard+1, player.cardInhand) >= 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerDiscardState.class));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.game.ActionEvent;
|
||||||
|
import com.game.Global;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
|
||||||
|
import extend.mj.EXActionEvent;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.RuleWeight;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ״̬
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class EXPlayerDrawTipState extends EXPlayerTipState {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
super.execute(owner, cmd, gid, param);
|
||||||
|
if (cmd.equals(EXActionEvent.EVENT_ACTION)) {
|
||||||
|
ITObject netParam = (ITObject) param;
|
||||||
|
int id = netParam.getInt("id");
|
||||||
|
boolean win = (owner.tipMgr.weight &RuleWeight.SELF_WIN)!=0 ;
|
||||||
|
if(Global.gameId == 1 && win && id == 0)return;
|
||||||
|
owner.tipMgr.doAction(id);
|
||||||
|
}else if(cmd.equals(ActionEvent.EVENT_TIMER_AUTO)) {
|
||||||
|
int id = 0;
|
||||||
|
for (Entry<Integer, Tip> entry : owner.tipMgr.tipMap.entrySet()) {
|
||||||
|
Tip tip = entry.getValue();
|
||||||
|
if(tip.type == RuleWeight.TYPE_WIN) {
|
||||||
|
id = tip.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
owner.tipMgr.doAction(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.player.state.PlayerPauseState;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.permanent.TPServer;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.room.state.EXRoomSetpState;
|
||||||
|
import extend.mj.uitl.WinCard;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayerDrawState.java
|
||||||
|
*/
|
||||||
|
public class EXPlayerKongDrawState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
EXRoom room = owner.getRoom();
|
||||||
|
if (room.isLiuJu()) {
|
||||||
|
room.endGameByLiuJu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ITObject config = room.config;
|
||||||
|
|
||||||
|
boolean hz_hu = config.getBoolean(Config.ROOM_CONFIG_HZ_HU);
|
||||||
|
int laizi = room.config.getInt(Config.ROOM_CONFIG_LAIZI);
|
||||||
|
|
||||||
|
if(owner.seat == room.adminSeat) {
|
||||||
|
double rand = Math.random() % 100;
|
||||||
|
if (room.while_list && !owner.is_white && rand > room.white_value)
|
||||||
|
{
|
||||||
|
ArrayList<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
int count = 0;
|
||||||
|
do {
|
||||||
|
int drawCard = owner.drawCard = room.card.popsub();
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
WinCard win = new WinCard(owner.cardInhand, drawCard, room.card.laiziCard, room.card.laiziCard2, laizi > 0 ? true : false, true, true);
|
||||||
|
if(!(hz_hu && win.laizi_count >0)) {
|
||||||
|
if (win.checkWin(map, owner, room, true)) {
|
||||||
|
if (room.card.cardList.size() != 0 && count++ <= 5) {
|
||||||
|
tempCardList.add(drawCard);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
owner.drawCard = drawCard;
|
||||||
|
break;
|
||||||
|
} while(true);
|
||||||
|
|
||||||
|
room.card.cardList.addAll(tempCardList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
owner.drawCard = room.card.popsub();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
double rand = Math.random() % 100 * 100;
|
||||||
|
if (room.while_list && !owner.is_white && rand > room.white_value)
|
||||||
|
{
|
||||||
|
ArrayList<Integer> tempCardList = new ArrayList<Integer>();
|
||||||
|
int count = 0;
|
||||||
|
do {
|
||||||
|
int drawCard = room.card.pop();
|
||||||
|
HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
|
||||||
|
WinCard win = new WinCard(owner.cardInhand, drawCard, room.card.laiziCard, room.card.laiziCard2, laizi > 0 ? true : false, true, true);
|
||||||
|
if(!(hz_hu && win.laizi_count >0)) {
|
||||||
|
if (win.checkWin(map, owner, room, true)) {
|
||||||
|
if (room.card.cardList.size() != 0 && count++ <= 5) {
|
||||||
|
tempCardList.add(drawCard);
|
||||||
|
Global.logger.info("no white to hu:" + drawCard);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
owner.drawCard = drawCard;
|
||||||
|
break;
|
||||||
|
} while(true);
|
||||||
|
room.card.cardList.addAll(tempCardList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
owner.drawCard = room.card.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int leftCount = room.card.getCount();
|
||||||
|
((EXGameController)Global.gameCtr).getCard(owner, leftCount);
|
||||||
|
|
||||||
|
EXMainServer.playerRuleMgr.condition(PlayerRuleManager.KONG_DRAW_RULE, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
if (owner.is_gang)
|
||||||
|
{
|
||||||
|
timer(owner);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerDiscardState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void timer(EXPlayer owner) {
|
||||||
|
|
||||||
|
TPServer.me().getTimerPool().schedule(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
if (owner == null || owner.getRoom() == null) {
|
||||||
|
Global.logger.error("room is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (owner.getRoom().isDestroy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
owner.getRoom().enqueueRunnable(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXPlayerDiscardState.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 1000, TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
|
||||||
|
import extend.mj.EXActionEvent;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ȴ<EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayerKongWinState.java
|
||||||
|
*/
|
||||||
|
public class EXPlayerKongWinState extends EXPlayerTipState{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.enter(owner);
|
||||||
|
owner.getRoom().tipMap.put(owner.playerid, owner.tipMgr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.exit(owner);
|
||||||
|
owner.getRoom().tipMap.remove(owner.playerid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
if (cmd.equals(EXActionEvent.EVENT_ACTION)) {
|
||||||
|
ITObject netParam = (ITObject) param;
|
||||||
|
int id = netParam.getInt("id");
|
||||||
|
owner.tipMgr.choicAction(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import com.game.ActionEvent;
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import extend.mj.EXActionEvent;
|
||||||
|
import extend.mj.EXMainServer;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
public class EXPlayerPiaoNiaoTipState extends StateBase<EXPlayer>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
if(!owner.isEntrust()) {
|
||||||
|
EXMainServer.gameCtr.piaoTipEvent(owner,0);
|
||||||
|
}
|
||||||
|
owner.startActionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重连
|
||||||
|
* @param owner
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void reload(EXPlayer owner) {
|
||||||
|
EXMainServer.gameCtr.piaoTipEvent(owner,1);
|
||||||
|
owner.startActionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
owner.stopActionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _action(EXPlayer owner,int id,int gid) {
|
||||||
|
owner.piao = id;
|
||||||
|
owner.last_piao = id;
|
||||||
|
|
||||||
|
owner.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
owner.getRoom().piaoCount --;
|
||||||
|
EXMainServer.gameCtr.piaoEvent(owner);
|
||||||
|
owner.getRoom().stateMachine.execute(EXActionEvent.EVENT_PIAO, gid, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
super.execute(owner, cmd, gid, param);
|
||||||
|
if (cmd.equals(EXActionEvent.EVENT_PIAO)) {
|
||||||
|
ITObject netParam = (ITObject) param;
|
||||||
|
int id = netParam.getInt("id");
|
||||||
|
_action(owner, id, gid);
|
||||||
|
}else if(cmd.equals(ActionEvent.EVENT_TIMER_AUTO) || cmd.equals(ActionEvent.EVENT_ENTRUST)) {
|
||||||
|
_action(owner,0,gid);
|
||||||
|
}
|
||||||
|
else if(cmd.equals(ActionEvent.EVENT_OFFLINE)) {
|
||||||
|
owner.startActionTimer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import com.game.ActionEvent;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import extend.mj.Config;
|
||||||
|
import extend.mj.EXMainServer;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.RuleWeight;
|
||||||
|
import extend.mj.tip.Tip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayerTipState.java
|
||||||
|
*/
|
||||||
|
public abstract class EXPlayerTipState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXPlayer owner) {
|
||||||
|
if (owner.getRoom().config.getBoolean(Config.ROOM_CONFIG_ZI_DONG_HU))
|
||||||
|
{
|
||||||
|
Tip tip = owner.tipMgr.getTip(RuleWeight.TYPE_WIN);
|
||||||
|
if (tip != null)
|
||||||
|
{
|
||||||
|
owner.startActionTimer(1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!owner.isEntrust()) {
|
||||||
|
EXMainServer.gameCtr.tipEvent(owner);
|
||||||
|
}
|
||||||
|
owner.startActionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
owner.stateMachine.lastState.toNextState(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit(EXPlayer owner) {
|
||||||
|
owner.tipMgr.clean();
|
||||||
|
owner.stopActionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reload(EXPlayer owner) {
|
||||||
|
super.reload(owner);
|
||||||
|
this.enter(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
if(cmd.equals(ActionEvent.EVENT_ENTRUST)) {
|
||||||
|
owner.startActionTimer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD>ܺ<EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayerWaitKongWinState.java
|
||||||
|
*/
|
||||||
|
public class EXPlayerWaitKongWinState extends StateBase<EXPlayer>{
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXPlayer owner) {
|
||||||
|
owner.stateMachine.lastState.toNextState(owner);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package extend.mj.player.state;
|
||||||
|
|
||||||
|
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
|
||||||
|
import extend.mj.EXActionEvent;
|
||||||
|
import extend.mj.EXMainServer;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.PlayerRuleManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD>ҵȴ<EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXPlayerWaitState.java
|
||||||
|
*/
|
||||||
|
public class EXPlayerWaitState extends StateBase<EXPlayer> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(EXPlayer owner, String cmd, int gid, Object param) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
switch (cmd) {
|
||||||
|
case EXActionEvent.EVENT_OTHER_DISCARD:
|
||||||
|
EXMainServer.playerRuleMgr.condition( PlayerRuleManager.OTHER_DISCARD_RULE , owner);
|
||||||
|
break;
|
||||||
|
case EXActionEvent.EVENT_KONG_WIN:
|
||||||
|
owner.forceCheckWin = true;
|
||||||
|
EXMainServer.playerRuleMgr.condition( PlayerRuleManager.KONG_HU_RULE , owner);
|
||||||
|
owner.forceCheckWin = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
package extend.mj.room.state;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
|
||||||
|
import com.taurus.permanent.TPServer;
|
||||||
|
import extend.mj.*;
|
||||||
|
import extend.mj.player.state.EXPlayerPiaoNiaoTipState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>䷢<EFBFBD><EFBFBD>״̬
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXRoomDealState.java
|
||||||
|
*/
|
||||||
|
public class EXRoomDealState extends StateBase<EXRoom> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXRoom owner) {
|
||||||
|
boolean donghua = false;
|
||||||
|
for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
if (player.xi_pai)
|
||||||
|
{
|
||||||
|
donghua = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (donghua)
|
||||||
|
{
|
||||||
|
owner.notifyXiPai();
|
||||||
|
//启动定时器
|
||||||
|
timer(owner);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.toNextState(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void timer(EXRoom owner) {
|
||||||
|
|
||||||
|
TPServer.me().getTimerPool().schedule(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
if (owner == null) {
|
||||||
|
Global.logger.error("room is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (owner.isDestroy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
owner.enqueueRunnable(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
owner.stateMachine.toNextState();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 4000, TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXRoom owner) {
|
||||||
|
owner.card.init();
|
||||||
|
if (owner.bankerSeat == 0) {
|
||||||
|
owner.bankerSeat = 1;
|
||||||
|
ArrayList<Integer> randPlayer = new ArrayList<>();
|
||||||
|
for (Entry<Integer, Player> entry : owner.playerMapBySeat.entrySet()) {
|
||||||
|
Integer seat = entry.getKey();
|
||||||
|
randPlayer.add(seat);
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.shuffle(randPlayer);
|
||||||
|
if (randPlayer.size() > 0)
|
||||||
|
{
|
||||||
|
owner.bankerSeat = randPlayer.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (owner.config.getInt(Config.ROOM_CONFIG_XUAN_ZHUANG) == 0)
|
||||||
|
{
|
||||||
|
owner.bankerSeat = (owner.bankerSeat)%owner.maxPlayers+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ITObject param = new TObject();
|
||||||
|
param.putInt("bank_seat", owner.bankerSeat);
|
||||||
|
EXMainServer.gameCtr.dealCard(owner);
|
||||||
|
owner.playBackData = new EXPlayBack(owner);
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXRoomSetpState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package extend.mj.room.state;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
import extend.mj.EXActionEvent;
|
||||||
|
import extend.mj.EXRoom;
|
||||||
|
import extend.mj.player.state.EXPlayerPiaoNiaoTipState;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
public class EXRoomPiaoState extends StateBase<EXRoom>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXRoom owner) {
|
||||||
|
owner.piaoCount = owner.maxPlayers;
|
||||||
|
for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
|
||||||
|
Player player = entry.getValue();
|
||||||
|
player.stateMachine.changeState(Global.getState(EXPlayerPiaoNiaoTipState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(EXRoom owner, String cmd, int gid, Object param) {
|
||||||
|
if(cmd.equals(EXActionEvent.EVENT_PIAO)) {
|
||||||
|
if(owner.piaoCount==0) {
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXRoomDealState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package extend.mj.room.state;
|
||||||
|
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
|
||||||
|
import extend.mj.EXMainServer;
|
||||||
|
import extend.mj.EXRoom;
|
||||||
|
import extend.mj.player.state.EXPlayerDrawState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* EXRoomSetpState.java
|
||||||
|
*/
|
||||||
|
public class EXRoomSetpState extends StateBase<EXRoom> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXRoom owner) {
|
||||||
|
Player player;
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
if (owner.activeSeat == 0) {
|
||||||
|
player = owner.playerMapBySeat.get(owner.bankerSeat);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
player = owner.playerMapBySeat.get(owner.activeSeat);
|
||||||
|
int nextSeat = player.nextSeat;
|
||||||
|
player = owner.playerMapBySeat.get(nextSeat);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EXMainServer.gameCtr.changeActiveSeat(owner,player.seat);
|
||||||
|
|
||||||
|
player.stateMachine.changeState(Global.getState(EXPlayerDrawState.class));
|
||||||
|
|
||||||
|
this.toNextState(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package extend.mj.room.state;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.data.Player;
|
||||||
|
import com.game.state.StateBase;
|
||||||
|
|
||||||
|
import extend.mj.Config;
|
||||||
|
import extend.mj.EXMainServer;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.EXRoom;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD>俪ʼ״̬
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class EXRoomStartGameState extends StateBase<EXRoom> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(EXRoom owner) {
|
||||||
|
// owner.readyCount = 0;
|
||||||
|
// for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
|
||||||
|
// Player player = entry.getValue();
|
||||||
|
// player.ready = false;
|
||||||
|
// player.clear();
|
||||||
|
// player.initSeat();
|
||||||
|
// }
|
||||||
|
owner.startGame();
|
||||||
|
|
||||||
|
this.toNextState(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNextState(EXRoom owner) {
|
||||||
|
if(owner.config.containsKey(Config.ROOM_CONFIG_PIAO) && owner.config.getInt(Config.ROOM_CONFIG_PIAO) != 0) {
|
||||||
|
if (owner.config.getInt(Config.ROOM_CONFIG_PIAO) == 3)
|
||||||
|
{
|
||||||
|
int piaofen = owner.config.getInt(Config.ROOM_CONFIG_PIAO_FEN);
|
||||||
|
|
||||||
|
for (Map.Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
|
||||||
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
player.piao = piaofen;
|
||||||
|
player.last_piao = piaofen;
|
||||||
|
EXMainServer.gameCtr.piaoEvent(player);
|
||||||
|
}
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXRoomDealState.class));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXRoomPiaoState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
owner.stateMachine.changeState(Global.getState(EXRoomDealState.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package extend.mj.tip;
|
||||||
|
|
||||||
|
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
|
||||||
|
*/
|
||||||
|
public class Action {
|
||||||
|
|
||||||
|
public Tip tip;
|
||||||
|
public EXPlayer player;
|
||||||
|
|
||||||
|
public Action(Tip tip, EXPlayer player) {
|
||||||
|
this.tip = tip;
|
||||||
|
this.player = player;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
this.player.initOpCard(tip.opcard);
|
||||||
|
this.tip.rule.action(this.player,this.tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package extend.mj.tip;
|
||||||
|
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>
|
||||||
|
* RuleBase.java
|
||||||
|
*/
|
||||||
|
public interface IRuleBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
* @param player
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public abstract boolean condition(EXPlayer player );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ִ<EFBFBD>иù<EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
|
public abstract void action(EXPlayer player ,Tip tip);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package extend.mj.tip;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
import extend.mj.WinCardType;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tip<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>30<EFBFBD><EFBFBD> Tip.java
|
||||||
|
*/
|
||||||
|
public class Tip {
|
||||||
|
public int id;
|
||||||
|
public IRuleBase rule;
|
||||||
|
public int weight;
|
||||||
|
public int card;
|
||||||
|
public ITArray opcard;
|
||||||
|
public int winType;
|
||||||
|
public int type;
|
||||||
|
public boolean self;
|
||||||
|
public Map<Integer, WinCardType> winMap;
|
||||||
|
|
||||||
|
public Tip(int card, ITArray opcard, int weight, IRuleBase rule, int type) {
|
||||||
|
this.rule = rule;
|
||||||
|
this.weight = weight;
|
||||||
|
this.opcard = opcard;
|
||||||
|
this.card = card;
|
||||||
|
this.type = type;
|
||||||
|
this.self = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITObject toMP() {
|
||||||
|
ITObject tipMp = new TObject();
|
||||||
|
tipMp.putInt("id", id);
|
||||||
|
tipMp.putInt("weight", weight);
|
||||||
|
tipMp.putInt("type", type);
|
||||||
|
tipMp.putInt("card", card);
|
||||||
|
tipMp.putTArray("opcard", opcard);
|
||||||
|
return tipMp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
package extend.mj.tip;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.game.Global;
|
||||||
|
import com.game.player.state.PlayerWaitState;
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
|
||||||
|
import extend.mj.Config;
|
||||||
|
import extend.mj.EXPlayer;
|
||||||
|
import extend.mj.RuleWeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 2017<EFBFBD><EFBFBD>9<EFBFBD><EFBFBD>18<EFBFBD><EFBFBD> TipManager.java
|
||||||
|
*/
|
||||||
|
public class TipManager {
|
||||||
|
|
||||||
|
private int id = 0;
|
||||||
|
|
||||||
|
public Map<Integer, Tip> tipMap = null;
|
||||||
|
public Tip actionTip;
|
||||||
|
public int weight = 0;
|
||||||
|
public EXPlayer owner = null;
|
||||||
|
|
||||||
|
public TipManager(EXPlayer owner) {
|
||||||
|
this.tipMap = new HashMap<Integer, Tip>();
|
||||||
|
this.owner = owner;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTip(Tip tip) {
|
||||||
|
int id = this.getId();
|
||||||
|
this.weight = this.weight | tip.weight;
|
||||||
|
tip.id = id;
|
||||||
|
this.tipMap.put(id, tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tip getTip(int type)
|
||||||
|
{
|
||||||
|
for (Entry<Integer, Tip> entry : this.tipMap.entrySet())
|
||||||
|
{
|
||||||
|
Tip tip = entry.getValue();
|
||||||
|
if (tip.type == type)
|
||||||
|
{
|
||||||
|
return tip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkLouhu() {
|
||||||
|
if (owner.getRoom().config.getBoolean(Config.ROOM_CONFIG_LOUHU))
|
||||||
|
{
|
||||||
|
for (Entry<Integer, Tip> entry : this.tipMap.entrySet()) {
|
||||||
|
Tip tip = entry.getValue();
|
||||||
|
if(tip.type == RuleWeight.TYPE_WIN) {
|
||||||
|
this.owner.louhu = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void choicAction(int id) {
|
||||||
|
if (id == 0) {
|
||||||
|
this.checkLouhu();
|
||||||
|
this.owner.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
this.owner.getRoom().checkAction();
|
||||||
|
} else if (this.tipMap.containsKey(id)) {
|
||||||
|
Tip tip = this.tipMap.get(id);
|
||||||
|
owner.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||||
|
owner.getRoom().addAction(new Action(tip, owner));
|
||||||
|
} else {
|
||||||
|
throw new Error("tip map has no id" + id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void doAction(int id) {
|
||||||
|
if (id == 0) {
|
||||||
|
this.checkLouhu();
|
||||||
|
this.owner.stateMachine.lastState.toNextState(owner);
|
||||||
|
} else if (this.tipMap.containsKey(id)) {
|
||||||
|
Tip tip = this.tipMap.get(id);
|
||||||
|
owner.initOpCard(tip.opcard);
|
||||||
|
tip.rule.action(owner,tip);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new Error("tip map has no id" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITObject toMP() {
|
||||||
|
ITObject mp = new TObject();
|
||||||
|
mp.putInt("weight", this.weight);
|
||||||
|
ITArray tipList = new TArray();
|
||||||
|
for (Entry<Integer, Tip> entry : this.tipMap.entrySet()) {
|
||||||
|
Tip tip = entry.getValue();
|
||||||
|
ITObject tipMp = tip.toMP();
|
||||||
|
tipList.addTObject(tipMp);
|
||||||
|
}
|
||||||
|
mp.putTArray("tip_list", tipList);
|
||||||
|
return mp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getId() {
|
||||||
|
this.id += 1;
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWeightest() {
|
||||||
|
int result = 0;
|
||||||
|
for (Entry<Integer, Tip> entry : this.tipMap.entrySet()) {
|
||||||
|
Tip tip = entry.getValue();
|
||||||
|
if (tip.weight > result) {
|
||||||
|
result = tip.weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cleanTip() {
|
||||||
|
this.weight = 0;
|
||||||
|
this.id = 0;
|
||||||
|
this.tipMap = new HashMap<Integer, Tip>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clean() {
|
||||||
|
this.cleanTip();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package extend.mj.uitl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
import extend.mj.OpCard;
|
||||||
|
import extend.mj.WinCardType;
|
||||||
|
|
||||||
|
public class CardUtil {
|
||||||
|
|
||||||
|
|
||||||
|
static public void removeGroup(List<int[]> group, int card) {
|
||||||
|
for (int i = 0; i < group.size(); i++) {
|
||||||
|
int[] cardArray = group.get(i);
|
||||||
|
if (cardArray[0] == card) {
|
||||||
|
group.remove(cardArray);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void removeOpcard(List<OpCard> opcards, OpCard param) {
|
||||||
|
for (int i = 0; i < opcards.size(); i++) {
|
||||||
|
if (param.card == opcards.get(i).card) {
|
||||||
|
opcards.remove(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static public ITArray toMPData_WinMap(Map<Integer, WinCardType> map) {
|
||||||
|
return toMPData_WinMap(map,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public ITArray toMPData_WinMap(Map<Integer, WinCardType> map,boolean is_opcard) {
|
||||||
|
if (map != null && map.size() > 0) {
|
||||||
|
ITArray array = TArray.newInstance();
|
||||||
|
for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
|
||||||
|
WinCardType wct = entry.getValue();
|
||||||
|
array.addTObject(wct.toTObject(is_opcard));
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,9 @@
|
||||||
|
package game_mj_fulushou;
|
||||||
|
|
||||||
|
import com.taurus.permanent.TPServer;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TPServer.me().start();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue