refactor: 重构战斗系统动作提交和竞技场锁定逻辑
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-02 23:05:18 +08:00
committed by cnb
parent f221b299cd
commit 218e23ff81
13 changed files with 194 additions and 77 deletions

View File

@@ -13,7 +13,7 @@ import (
// 接收战斗或者取消战斗的包
func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if c.GetSpace().Owner.UserID == c.Info.UserID {
if c.IsArenaPVPLocked() {
return nil, errorcode.ErrorCodes.ErrSystemError
}
if c.GetSpace().Owner.UserID == data.UserID {
@@ -79,7 +79,7 @@ func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInbou
// 邀请其他人进行战斗
func (h Controller) OnPlayerInviteOtherFight(data *fight.InviteToFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if c.GetSpace().Owner.UserID == c.Info.UserID {
if c.IsArenaPVPLocked() {
return nil, errorcode.ErrorCodes.ErrSystemError
}
if c.GetSpace().Owner.ChallengerID == c.Info.UserID {

View File

@@ -47,7 +47,7 @@ func (h Controller) ArenaFightOwner(data1 *fight.ARENA_FIGHT_OWENR, c *player.Pl
return nil, r
}
if c.Info.UserID == c.GetSpace().Owner.UserID {
if c.IsArenaHost() {
return nil, errorcode.ErrorCodes.ErrNoEligiblePokemon
}

View File

@@ -61,7 +61,7 @@ func (h *Controller) SwitchFlying(data *nono.SwitchFlyingInboundInfo, c *player.
func (h *Controller) PlayerPetCure(data *nono.PetCureInboundInfo, c *player.Player) (result *nono.PetCureOutboundEmpty, err errorcode.ErrorCode) { //这个时候player应该是空的
_ = data
if c.GetSpace().Owner.UserID == c.Info.UserID {
if c.IsArenaHealLocked() {
return result, errorcode.ErrorCodes.ErrChampionCannotHeal
}
if !c.GetCoins(nonoPetCureCost) {

View File

@@ -306,7 +306,7 @@ func (h Controller) TogglePetBagWarehouse(
result = &pet.PetReleaseOutboundInfo{}
result.Flag = uint32(data.Flag)
if player.GetSpace().Owner.UserID == player.Info.UserID {
if player.IsArenaSwitchLocked() {
return result, errorcode.ErrorCodes.ErrChampionCannotSwitch
}
@@ -380,7 +380,7 @@ func (h Controller) TogglePetBagWarehouseLegacy(
result = &pet.PetReleaseOutboundInfo{}
result.Flag = uint32(data.Flag)
//擂台住不能换精灵
if player.GetSpace().Owner.UserID == player.Info.UserID {
if player.IsArenaSwitchLocked() {
return result, errorcode.ErrorCodes.ErrChampionCannotSwitch
}
switch data.Flag {
@@ -464,7 +464,7 @@ func (h Controller) PlayerShowPet(
// PetOneCure 单体治疗
func (h Controller) PetOneCure(
data *pet.PetOneCureInboundInfo, player *player.Player) (result *pet.PetOneCureOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
if player.GetSpace().Owner.UserID == player.Info.UserID {
if player.IsArenaHealLocked() {
return result, errorcode.ErrorCodes.ErrChampionCannotHeal
}
@@ -484,7 +484,7 @@ func (h Controller) PetOneCure(
func (h Controller) PetFirst(
data *pet.PetDefaultInboundInfo, player *player.Player) (result *pet.PetDefaultOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
//擂台住不能换精灵
if player.GetSpace().Owner.UserID == player.Info.UserID {
if player.IsArenaSwitchLocked() {
return result, errorcode.ErrorCodes.ErrChampionCannotSwitch
}