fix: 修复空提交问题

This commit is contained in:
1
2025-11-23 23:42:16 +00:00
parent 240c349b8a
commit 2723b1871d
4 changed files with 8 additions and 11 deletions

View File

@@ -23,7 +23,7 @@ func (h Controller) UseSkill(data *fight.UseSkillInInfo, c *player.Player) (resu
if c.FightC == nil { if c.FightC == nil {
return nil, errorcode.ErrorCodes.ErrBattleEnded return nil, errorcode.ErrorCodes.ErrBattleEnded
} }
c.FightC.UseSkill(c, int32(data.SkillId)) c.FightC.UseSkill(c, (data.SkillId))
return nil, 0 return nil, 0
} }

View File

@@ -7,7 +7,7 @@ import (
type FightI interface { type FightI interface {
Over(c PlayerI, id info.EnumBattleOverReason) //逃跑 Over(c PlayerI, id info.EnumBattleOverReason) //逃跑
UseSkill(c PlayerI, id int32) //使用技能 UseSkill(c PlayerI, id uint32) //使用技能
GetCurrPET(c PlayerI) *info.BattlePetEntity //当前精灵 GetCurrPET(c PlayerI) *info.BattlePetEntity //当前精灵
Ownerid() uint32 Ownerid() uint32

View File

@@ -94,7 +94,7 @@ func (f *FightC) ChangePet(c common.PlayerI, id uint32) {
} }
// 玩家使用技能 // 玩家使用技能
func (f *FightC) UseSkill(c common.PlayerI, id int32) { func (f *FightC) UseSkill(c common.PlayerI, id uint32) {
if f.closefight { if f.closefight {
cool.Loger.Debug(context.Background(), " 战斗chan已关闭") cool.Loger.Debug(context.Background(), " 战斗chan已关闭")
return return
@@ -108,12 +108,9 @@ func (f *FightC) UseSkill(c common.PlayerI, id int32) {
if f.GetInputByPlayer(c, false).CurrentPet.Info.Hp <= 0 { if f.GetInputByPlayer(c, false).CurrentPet.Info.Hp <= 0 {
return return
} }
for _, v := range f.GetInputByPlayer(c, false).CurrentPet.Skills { t, ok := f.GetInputByPlayer(c, false).CurrentPet.Skills[id]
if ok {
if v != nil && v.ID == int(id) { ret.SkillEntity = t
ret.SkillEntity = v
break
}
} }
f.actionChan <- ret f.actionChan <- ret

View File

@@ -254,7 +254,7 @@ func (our *Input) GetAction(opp *Input) {
// bestKillSkill = ks.skill // bestKillSkill = ks.skill
// } // }
// } // }
our.FightC.UseSkill(our.Player, int32(bestKillSkill.ID)) our.FightC.UseSkill(our.Player, uint32(bestKillSkill.ID))
return return
} }
if len(allSkills) <= 0 { if len(allSkills) <= 0 {
@@ -265,7 +265,7 @@ func (our *Input) GetAction(opp *Input) {
randomIdx := grand.Intn(len(allSkills)) randomIdx := grand.Intn(len(allSkills))
for i, v := range skills { for i, v := range skills {
if randomIdx == int(i) { if randomIdx == int(i) {
our.FightC.UseSkill(our.Player, int32(v.ID)) our.FightC.UseSkill(our.Player, uint32(v.ID))
} }
} }