refactor: 重构战斗系统支持多单位多动作

This commit is contained in:
xinian
2026-04-04 05:44:02 +08:00
committed by cnb
parent b62b4af628
commit 28d92c1e18
23 changed files with 1652 additions and 311 deletions

View File

@@ -21,7 +21,7 @@ func NewFight(p1, p2 common.PlayerI, b1, b2 []model.PetInfo, fn func(model.Fight
f.OurPlayers = []common.PlayerI{p1}
f.OppPlayers = []common.PlayerI{p2}
f.Switch = make(map[uint32]*action.ActiveSwitchAction)
f.Switch = make(map[actionSlotKey]*action.ActiveSwitchAction)
f.callback = fn //战斗结束的回调
f.quit = make(chan struct{})
f.over = make(chan struct{})
@@ -58,7 +58,6 @@ func NewFight(p1, p2 common.PlayerI, b1, b2 []model.PetInfo, fn func(model.Fight
ff.SetOPP(f.GetInputByPlayer(ff.Player, true))
})
f.FightStartOutboundInfo = f.buildFightStartInfo()
if f.Info.Status == info.BattleMode.FIGHT_WITH_NPC {
f.Opp[0].Finished = true //PVE 默认boss数据直接加载完成
@@ -67,11 +66,10 @@ func NewFight(p1, p2 common.PlayerI, b1, b2 []model.PetInfo, fn func(model.Fight
if f.Opp[0].Player.(*player.AI_player).CanCapture > 0 {
f.Opp[0].CanCapture = f.Opp[0].Player.(*player.AI_player).CanCapture
f.FightStartOutboundInfo.Info2.Catchable = 1 //可以捕捉就置1
}
f.Opp[0].AttackValue.Prop = f.Opp[0].Player.(*player.AI_player).Prop
f.FightStartOutboundInfo.Info2.Prop = f.Opp[0].AttackValue.Prop
}
f.FightStartOutboundInfo = f.buildFightStartInfo()
f.Broadcast(func(ff *input.Input) {