```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

refactor(common/data/xmlres): 注释掉未使用的MonsterMap配置变量

- 将MonsterMap配置变量注释掉,因为当前不再使用该配置
- 相应地注释掉了初始化代码中的MonsterMap赋值逻辑

feat(logic/controller): 统一CanFight方法返回值为ErrorCode

- 修改PlayerFightBoss等战斗控制器中的Can
This commit is contained in:
昔念
2026-02-25 16:18:10 +08:00
parent 5e9ac0bef5
commit 7c1540ff6d
20 changed files with 284 additions and 272 deletions

View File

@@ -36,6 +36,7 @@ type OgrePetInfo struct {
Lv uint32 `struc:"skip"` //等级
Item []int64 `struc:"skip"` //奖励,如果有的话
Ext uint32 `struc:"skip"` //是否变尼尔尼奥
IsCapture int `struc:"skip"`
}
func (o *OgrePetInfo) FixSHiny() {
@@ -146,26 +147,26 @@ func (p *Player) GetSpace() *space.Space {
// CanFight 检查玩家是否可以进行战斗
// 0无战斗1PVP2,BOOS,3PVE
func (p *Player) CanFight() bool {
func (p *Player) CanFight() errorcode.ErrorCode {
if len(p.Info.PetList) == 0 {
atomic.StoreUint32(&p.Fightinfo.Mode, 0)
return false
return errorcode.ErrorCodes.ErrBattleCancelled
}
if p.FightC != nil {
atomic.StoreUint32(&p.Fightinfo.Mode, 0)
return false
return errorcode.ErrorCodes.ErrBattleEnded
}
for _, pet := range p.Info.PetList {
if pet.Hp > 0 { // 只要找到一个血量大于0的宠物就可以战斗
return true
return 0
}
}
// 遍历完所有宠物都没有血量大于0的才不能战斗
atomic.StoreUint32(&p.Fightinfo.Mode, 0)
return false
return errorcode.ErrorCodes.ErrPokemonNoStamina
}
func (p *Player) SendPack(b []byte) error {