refactor(common/data/xmlres): 注释掉未使用的MonsterMap配置变量 - 将MonsterMap配置变量注释掉,因为当前不再使用该配置 - 相应地注释掉了初始化代码中的MonsterMap赋值逻辑 feat(logic/controller): 统一CanFight方法返回值为ErrorCode - 修改PlayerFightBoss等战斗控制器中的Can
This commit is contained in:
@@ -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无战斗,1PVP,2,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 {
|
||||
|
||||
Reference in New Issue
Block a user