```
fix(fight): 修复NPC战斗逻辑和玩家宠物初始化问题 修复了在与NPC战斗时AI玩家技能释放的逻辑错误,确保AI能够正确获取行动。 同时修正了玩家参战宠物的CatchTime生成方式,避免数据冲突。 此外,移除了大乱斗模式中不必要的延迟逻辑,并添加了战斗开始与结束的调试日志输出。 ```
This commit is contained in:
@@ -314,14 +314,16 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) {
|
||||
|
||||
f.closefight = true
|
||||
// break
|
||||
}
|
||||
if f.Info.Status == info.BattleMode.FIGHT_WITH_NPC {
|
||||
if _, ok := defender.Player.(*player.AI_player); ok {
|
||||
defender.GetAction(f.Our)
|
||||
//panic("AI自动技能")
|
||||
}
|
||||
} else {
|
||||
if f.Info.Status == info.BattleMode.FIGHT_WITH_NPC {
|
||||
if _, ok := defender.Player.(*player.AI_player); ok {
|
||||
defender.GetAction(f.Our)
|
||||
//panic("AI自动技能")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
attacker.CanChange = true
|
||||
break
|
||||
}
|
||||
|
||||
@@ -162,12 +162,13 @@ func (f *FightC) initplayer(c common.PlayerI) (*input.Input, errorcode.ErrorCode
|
||||
initmeetpet()
|
||||
}
|
||||
for i, v := range meetpet {
|
||||
v1 := v
|
||||
if len(in.AllPet) > 2 {
|
||||
break
|
||||
}
|
||||
|
||||
v.CatchTime = uint32(i)
|
||||
in.AllPet = append(in.AllPet, info.CreateBattlePetEntity(v, f.rand))
|
||||
v1.CatchTime = c.GetInfo().UserID + uint32(i)*1000000
|
||||
in.AllPet = append(in.AllPet, info.CreateBattlePetEntity(v1, f.rand))
|
||||
}
|
||||
|
||||
//in.AllPet = in.AllPet[:3]
|
||||
@@ -276,7 +277,7 @@ func NewFight(p1, p2 common.PlayerI, fn func(*info.FightOverInfo)) (*FightC, err
|
||||
}
|
||||
|
||||
f.Broadcast(func(ff *input.Input) {
|
||||
//ff.InitEFFect(&f.FightStartOutboundInfo)
|
||||
fmt.Println("战斗开始信息", ff.UserID)
|
||||
ff.Player.SendPackCmd(2503, &f.ReadyInfo)
|
||||
|
||||
})
|
||||
|
||||
@@ -67,10 +67,6 @@ func (f *FightC) battleLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//大乱斗,给个延迟
|
||||
<-time.After(500)
|
||||
}
|
||||
|
||||
})
|
||||
@@ -79,7 +75,11 @@ func (f *FightC) battleLoop() {
|
||||
f.callback(&f.FightOverInfo) //先执行回调,再执行返回信息,在回调内修改战斗判断
|
||||
|
||||
}
|
||||
//大乱斗,给个延迟
|
||||
//<-time.After(1000)
|
||||
f.Broadcast(func(ff *input.Input) {
|
||||
|
||||
fmt.Println("战斗结束信息", ff.UserID)
|
||||
ff.Player.SendPackCmd(2506, &f.FightOverInfo)
|
||||
|
||||
ff.Player.QuitFight()
|
||||
|
||||
Reference in New Issue
Block a user