feat(fight): 添加逃跑操作并优化速度比较逻辑

- 在玩家操作枚举中添加逃跑操作(Escape)
- 更新药剂使用操作(UsePotion)的注释,增加逃跑功能
- 修正速度比较逻辑,使用宠物信息中的速度值进行比较
This commit is contained in:
2025-09-03 02:11:47 +08:00
parent 5c6f35b1da
commit afdf015d62

View File

@@ -11,12 +11,13 @@ type EnumPlayerOperation int
// 定义读秒倒计时期间玩家可执行的操作枚举
var PlayerOperations = enum.New[struct {
SystemGiveUp EnumPlayerOperation `enum:"-1"` //`enum:"系统选择放弃出手"`比如没有PP
SystemGiveUp EnumPlayerOperation `enum:"-1"` //`enum:"系统选择放弃出手"`比如没有PP,
SelectSkill EnumPlayerOperation `enum:"0"` //`enum:"选择技能"`
ActiveSwitch EnumPlayerOperation `enum:"2"` //`enum:"主动切换(中切)"`
UsePotion EnumPlayerOperation `enum:"3"` //`enum:"使用药剂"` 捕捉
UsePotion EnumPlayerOperation `enum:"3"` //`enum:"使用药剂"` 捕捉 逃跑
Escape EnumPlayerOperation `enum:"4"` //`enum:"使用药剂"` 逃跑 等级最高
//DeathSwitch EnumPlayerOperation `enum:"4"` //`enum:"死亡切换"` 这两个本质上还是对action的比较
// ExpelledSwitch EnumPlayerOperation `enum:"5"` //`enum:"(被)驱逐切换"`
}]()
@@ -51,7 +52,7 @@ func (c *BattleAction) Compare(a *BattleAction) *BattleAction {
peto, _ := a.ctx.Value(Pet_O_Ctx).(*BattlePetEntity)
pett, _ := a.ctx.Value(Pet_O_Ctx).(*BattlePetEntity)
p2 = int(peto.Speed) - int(pett.Speed) // 假设 Use1v1SkillAction 有 SkillPriority() 方法
p2 = int(peto.info.Speed) - int(pett.info.Speed) // 假设 Use1v1SkillAction 有 SkillPriority() 方法
if p2 > 0 {
return a
} else if p2 < 0 {