refactor(fight): 优化战斗胜利判断逻辑,移除冗余代码并修正日志格式

This commit is contained in:
1
2025-09-21 17:17:12 +00:00
parent 6238507ae5
commit 9ebe4173a5

View File

@@ -181,8 +181,6 @@ func (b *FightC) IsWin(c *input.Input, cache uint32) bool {
if c.Player.GetInfo().UserID == b.ownerID { //如果是房主
bbb = b.Opp.AllPet
} else {
bbb = b.Our.AllPet
}
for _, v := range bbb {
@@ -205,7 +203,6 @@ func (b *FightC) IsWin(c *input.Input, cache uint32) bool {
func (f *FightC) Broadcast(t func(ff *input.Input)) {
t(f.Our)
t(f.Opp)
}
@@ -275,7 +272,7 @@ func (f *FightC) battleLoop() {
}
actions[uint32(action.GetPlayerID())] = action
fmt.Println("玩家%d 执行动作", action.GetPlayerID())
fmt.Println("玩家%i 执行动作", action.GetPlayerID())
case <-timeout:
@@ -342,6 +339,8 @@ func (f *FightC) battleLoop() {
WinnerId: f.ownerID,
})
f.closefight = true
} else {
tt.CatchPetInfo(info.CatchMonsterOutboundInfo{})
}
} else { //说明不是可以捕捉的