fix: 修复战斗模式下的技能和物品使用逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-14 20:02:04 +08:00
committed by cnb
parent 3a39abe9c6
commit 65d8468520
3 changed files with 14 additions and 8 deletions

View File

@@ -61,7 +61,8 @@ func (h Controller) Capture(data *fight.CatchMonsterInboundInfo, c *player.Playe
} }
if c.GetSpace().IsTime { if c.GetSpace().IsTime {
if data.CapsuleId < 300009 { if data.CapsuleId < 300009 {
return nil, errorcode.ErrorCodes.ErrCannotPerformAction go c.FightC.UseSkill(c, 0)
return nil, -1
} }
} }
go c.FightC.Capture(c, data.CapsuleId) go c.FightC.Capture(c, data.CapsuleId)
@@ -84,9 +85,10 @@ func (h Controller) UsePetItemInboundInfo(data *fight.UsePetItemInboundInfo, c *
} }
if c.GetSpace().IsTime { if c.GetSpace().IsTime {
if data.ItemId < 300009 { if data.ItemId < 300009 {
return nil, errorcode.ErrorCodes.ErrCannotPerformAction go c.FightC.UseSkill(c, 0)
} }
} }
go c.FightC.UseItem(c, data.CatchTime, data.ItemId) go c.FightC.UseItem(c, data.CatchTime, data.ItemId)
return nil, -1 return nil, -1
} }

View File

@@ -152,6 +152,10 @@ func (f *FightC) UseItem(c common.PlayerI, cacthid, itemid uint32) {
return return
} }
if f.Info.Mode== info.BattleMode.PET_MELEE {
go f.UseSkill(c, 0)
return
}
select { select {
case f.actionChan <- &action.UseItemAction{BaseAction: action.NewBaseAction(c.GetInfo().UserID), ItemID: itemid, CacthTime: cacthid}: case f.actionChan <- &action.UseItemAction{BaseAction: action.NewBaseAction(c.GetInfo().UserID), ItemID: itemid, CacthTime: cacthid}:
// 发送成功,可选记录日志 // 发送成功,可选记录日志

View File

@@ -330,12 +330,12 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
}) })
f.Switch = make(map[uint32]*action.ActiveSwitchAction) f.Switch = make(map[uint32]*action.ActiveSwitchAction)
if f.closefight && f.Info.Mode == info.BattleMode.PET_MELEE { if f.closefight && f.Info.Mode == info.BattleMode.PET_MELEE {
f.Broadcast(func(fighter *input.Input) { // f.Broadcast(func(fighter *input.Input) {
if fighter.UserID != f.WinnerId { // if fighter.UserID != f.WinnerId {
fighter.Player.SendPackCmd(2505, &attackValueResult) // fighter.Player.SendPackCmd(2505, &attackValueResult)
} // }
}) // })
return return
} }
f.Broadcast(func(fighter *input.Input) { f.Broadcast(func(fighter *input.Input) {