1
This commit is contained in:
@@ -30,6 +30,146 @@ public class BotConfig
|
||||
|
||||
[Header("aggressive 状态参数")]
|
||||
public BotBehaviorConfig aggressiveBehavior = new BotBehaviorConfig();
|
||||
|
||||
[Header("倍数策略")]
|
||||
public BotMultiplierConfig multiplier = new BotMultiplierConfig();
|
||||
|
||||
[Header("Boss策略")]
|
||||
public BotBossStrategyConfig bossStrategy = new BotBossStrategyConfig();
|
||||
|
||||
[Header("退出条件")]
|
||||
public BotExitConfig exitCondition = new BotExitConfig();
|
||||
}
|
||||
|
||||
/// <summary>机器人倍数(炮台档位)策略配置</summary>
|
||||
[Serializable]
|
||||
public class BotMultiplierConfig
|
||||
{
|
||||
[Tooltip("进场初始炮台档位索引(对应 paoBeiList 的下标, 0=最低档)")]
|
||||
public int initialLevelIndex = 0;
|
||||
|
||||
[Tooltip("低于此倍数(当前金币/进场金币) → 降档")]
|
||||
public float decreaseThreshold = 0.5f;
|
||||
|
||||
[Tooltip("高于此倍数(当前金币/进场金币) → 升档")]
|
||||
public float increaseThreshold = 1.5f;
|
||||
|
||||
[Tooltip("每次调整的档位数")]
|
||||
public int step = 1;
|
||||
|
||||
[Tooltip("倍数检查间隔(秒)")]
|
||||
public float checkInterval = 3f;
|
||||
|
||||
[Tooltip("最低保持档位索引(不会降到低于此值)")]
|
||||
public int minLevelIndex = 0;
|
||||
|
||||
[Tooltip("最高保持档位索引(不会升到高于此值), -1=不限制")]
|
||||
public int maxLevelIndex = -1;
|
||||
}
|
||||
|
||||
/// <summary>机器人Boss策略配置</summary>
|
||||
[Serializable]
|
||||
public class BotBossStrategyConfig
|
||||
{
|
||||
[Tooltip("视为Boss的鱼类型 (按 FishTypeEnum 的int值)")]
|
||||
public int[] bossFishTypes = { 2, 5 }; // Boss鱼=2, 特殊Boss=5
|
||||
|
||||
[Tooltip("无Boss时启用散射乱射模式")]
|
||||
public bool scatterWhenNoBoss = true;
|
||||
|
||||
[Tooltip("无Boss时定点三发概率(0~1), 否则单射")]
|
||||
[Range(0f, 1f)] public float tripleShotProb = 0.5f;
|
||||
|
||||
[Tooltip("有Boss时优先锁定最大倍率(赔率)的Boss")]
|
||||
public bool preferMaxMultiplierBoss = true;
|
||||
|
||||
[Tooltip("Boss数量超过此值 → 开启散射模式")]
|
||||
public int scatterModeThreshold = 3;
|
||||
|
||||
[Tooltip("Boss数量<=此值时随机狂暴技能概率(0~1)")]
|
||||
[Range(0f, 1f)] public float frenzyProb = 0.6f;
|
||||
|
||||
[Tooltip("狂暴持续时间下限(秒)")]
|
||||
public float frenzyMinTime = 3f;
|
||||
|
||||
[Tooltip("狂暴持续时间上限(秒)")]
|
||||
public float frenzyMaxTime = 8f;
|
||||
}
|
||||
|
||||
/// <summary>机器人退出条件配置</summary>
|
||||
[Serializable]
|
||||
public class BotExitConfig
|
||||
{
|
||||
[Tooltip("金币超过此值时退出(盈利离场), 0=不检测")]
|
||||
public long exitWhenGoldAbove = 0;
|
||||
|
||||
[Tooltip("金币低于此值时退出(输完离场)")]
|
||||
public long exitWhenGoldBelow = 100;
|
||||
|
||||
[Tooltip("退出检查间隔(秒)")]
|
||||
public float checkInterval = 5f;
|
||||
|
||||
[Tooltip("退出时是否发送离房网络消息")]
|
||||
public bool sendLeaveRoom = true;
|
||||
|
||||
[Tooltip("退出后座位是否显示等待状态(等待下一个机器人)")]
|
||||
public bool showWaitingAfterExit = true;
|
||||
}
|
||||
|
||||
/// <summary>机器人当前行为模式</summary>
|
||||
public enum BotBehaviorMode
|
||||
{
|
||||
Idle, // 待机(未开始)
|
||||
ScatterRandom, // 散射乱射(无Boss): 随机定点三发或单射
|
||||
LockBoss, // 锁定Boss
|
||||
ScatterMode, // 散射模式(Boss数量>3)
|
||||
RandomFrenzy, // 随机狂暴(Boss数量<=3)
|
||||
Exited // 已退出
|
||||
}
|
||||
|
||||
/// <summary>每个 bot 座位的运行时状态(进场金币/倍数/模式/退出)</summary>
|
||||
public class BotRuntimeState
|
||||
{
|
||||
// ===== 进场 =====
|
||||
[Tooltip("进场时的金币(基准)")]
|
||||
public long entryGold;
|
||||
|
||||
[Tooltip("进场时间")]
|
||||
public float entryTime;
|
||||
|
||||
// ===== 倍数 =====
|
||||
[Tooltip("当前炮台档位索引")]
|
||||
public int currentLevelIndex;
|
||||
|
||||
[Tooltip("下次倍数检查时间")]
|
||||
public float nextMultiplierCheckTime;
|
||||
|
||||
// ===== 行为模式 =====
|
||||
[Tooltip("当前行为模式")]
|
||||
public BotBehaviorMode currentMode = BotBehaviorMode.Idle;
|
||||
|
||||
[Tooltip("上次Boss检测时间")]
|
||||
public float lastBossCheckTime;
|
||||
|
||||
// ===== 狂暴(Boss<=3时随机) =====
|
||||
[Tooltip("狂暴是否激活")]
|
||||
public bool frenzyActive;
|
||||
|
||||
[Tooltip("狂暴结束时间")]
|
||||
public float frenzyEndTime;
|
||||
|
||||
// ===== 退出 =====
|
||||
[Tooltip("下次退出检查时间")]
|
||||
public float nextExitCheckTime;
|
||||
|
||||
[Tooltip("是否已退出")]
|
||||
public bool hasExited;
|
||||
|
||||
/// <summary>当前金币相对进场金币的倍数</summary>
|
||||
public float GetGoldRatio(long currentGold)
|
||||
{
|
||||
return entryGold > 0 ? (float)currentGold / entryGold : 0f;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -76,13 +76,63 @@ namespace Assets.MyGame.Scripts.Net.WebResponses.ChineseChess
|
||||
public string createUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 1 未开始 2 进行中 3 已结束
|
||||
/// 状态 0 空房间 1 未开始 2 进行中 3 已结束
|
||||
/// </summary>
|
||||
public int state { get; set; } = 1;
|
||||
/// <summary>
|
||||
/// 金币数量
|
||||
/// </summary>
|
||||
public long gold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 机器人数量(房间内 AI 玩家数,计入总人数)
|
||||
/// </summary>
|
||||
public int robotCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束游戏请求记录(前端不用,仅占位反序列化)
|
||||
/// </summary>
|
||||
public object endGameRequests { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后活跃时间(Unix 秒)
|
||||
/// </summary>
|
||||
public long lastActiveTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 超时秒数
|
||||
/// </summary>
|
||||
public int timeoutSeconds { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// 超时输方用户ID
|
||||
/// </summary>
|
||||
public string timeoutLoserUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 待定赢方用户ID(可能为 null)
|
||||
/// </summary>
|
||||
public string pendingWinUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 游戏是否已结束
|
||||
/// </summary>
|
||||
public bool isGameEnded { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房间唯一 GUID(与 roomId 不同,roomId 是业务编号)
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已删除
|
||||
/// </summary>
|
||||
public bool isDelete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建信息(前端不用,仅占位反序列化)
|
||||
/// </summary>
|
||||
public object createInfo { get; set; }
|
||||
}
|
||||
[Serializable]
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user