放炮罚机器人出牌时间
parent
60b2df3908
commit
9fd6ce91f6
|
|
@ -43,4 +43,17 @@ public class Config {
|
|||
/** 机器人HTTP服务路径 */
|
||||
public static final String HTTP_PATH_JOIN_ROOM = "/robot/joinRoom";
|
||||
|
||||
//==================== 机器人出牌延迟配置 ====================
|
||||
/** 出牌最小延迟 */
|
||||
public static final int DISCARD_DELAY_MIN_MS = 1000;
|
||||
|
||||
/** 出牌最大延迟 */
|
||||
public static final int DISCARD_DELAY_MAX_MS = 4000;
|
||||
|
||||
/** 吃碰胡动作最小延迟 */
|
||||
public static final int ACTION_DELAY_MIN_MS = 1500;
|
||||
|
||||
/** 吃碰胡动作最大延迟 */
|
||||
public static final int ACTION_DELAY_MAX_MS = 3500;
|
||||
|
||||
}
|
||||
|
|
@ -400,9 +400,11 @@ public class FangPaoFaHandler {
|
|||
private void delayedAction(TaurusClient client, ITObject params, String actionName) {
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
int delaySeconds = 1 + new Random().nextInt(2);
|
||||
log.info("执行{}动作,延迟{}秒", actionName, delaySeconds);
|
||||
Thread.sleep(delaySeconds * 1000);
|
||||
int minDelay = robot.zp.Config.ACTION_DELAY_MIN_MS;
|
||||
int maxDelay = robot.zp.Config.ACTION_DELAY_MAX_MS;
|
||||
int delayMs = minDelay + new Random().nextInt(maxDelay - minDelay);
|
||||
log.info("执行{}动作,延迟{}毫秒", actionName, delayMs);
|
||||
Thread.sleep(delayMs);
|
||||
|
||||
client.send("612", params, response -> {
|
||||
System.out.println("动作发送完成");
|
||||
|
|
@ -421,8 +423,11 @@ public class FangPaoFaHandler {
|
|||
private void delayedDiscard(TaurusClient client, ITObject params) {
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
int delay = new Random().nextInt(4);
|
||||
Thread.sleep(delay * 1000);
|
||||
int minDelay = robot.zp.Config.DISCARD_DELAY_MIN_MS;
|
||||
int maxDelay = robot.zp.Config.DISCARD_DELAY_MAX_MS;
|
||||
int delayMs = minDelay + new Random().nextInt(maxDelay - minDelay);
|
||||
log.info("出牌延迟{}毫秒", delayMs);
|
||||
Thread.sleep(delayMs);
|
||||
|
||||
client.send("611", params, response -> {
|
||||
log.debug("出牌发送完成");
|
||||
|
|
@ -647,9 +652,11 @@ public class FangPaoFaHandler {
|
|||
private void daniao(TaurusClient client, ITObject params, String actionName) {
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
int delaySeconds = 1 + new Random().nextInt(2);
|
||||
log.info("执行{}动作,延迟{}秒", actionName, delaySeconds);
|
||||
Thread.sleep(delaySeconds * 1000);
|
||||
int minDelay = robot.zp.Config.ACTION_DELAY_MIN_MS;
|
||||
int maxDelay = robot.zp.Config.ACTION_DELAY_MAX_MS;
|
||||
int delayMs = minDelay + new Random().nextInt(maxDelay - minDelay);
|
||||
log.info("执行{}动作,延迟{}毫秒", actionName, delayMs);
|
||||
Thread.sleep(delayMs);
|
||||
|
||||
client.send("831", params, response -> {
|
||||
System.out.println("动作发送完成");
|
||||
|
|
|
|||
Loading…
Reference in New Issue