All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(fight): 添加旧组队协议支持并优化战斗系统 - 实现了旧组队协议相关功能,包括GroupReadyFightFinish、GroupUseSkill、 GroupUseItem、GroupChangePet和GroupEscape方法 - 新增组队战斗相关的入站信息结构体定义 - 实现了组队BOSS战斗逻辑,添加groupBossSlotLimit常量 - 重构宠物技能设置逻辑,调整金币消耗时机 - 优化战斗循环逻辑,添加对无行动槽位的处理 - 改进AI行动逻辑,增加多位置目标选择机制 - 完善捕获系统上下文处理,修复空指针问题 - 添加战斗状态更新和数据同步机制 fix(pet-skill): 修复宠物技能设置中的金币扣除逻辑错误 - 将金币扣除逻辑移到验证之后 - 修正宠物技能数量限制检查的顺序 - 防止重复添加已有技能的情况 refactor(fight): 重构战斗系统代码结构 - 分离新旧组队协议的战斗创建逻辑 - 优化战斗输入验证和处理流程 - 改进战斗循环中的错误处理机制 ```
83 lines
2.4 KiB
Go
83 lines
2.4 KiB
Go
package controller
|
|
|
|
import (
|
|
"blazing/common/socket/errorcode"
|
|
"blazing/logic/service/nono"
|
|
"blazing/logic/service/player"
|
|
)
|
|
|
|
const (
|
|
nonoFuncValue = 255
|
|
nonoDefaultNum = 1
|
|
nonoDefaultPower = 0
|
|
nonoDefaultLevel = 12
|
|
nonoPetCureCost int64 = 50
|
|
)
|
|
|
|
// NonoFollowOrHome 处理控制器请求。
|
|
func (h Controller) NonoFollowOrHome(data *NonoFollowOrHomeInInfo, c *player.Player) (result *nono.NonoFollowOutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
|
c.Info.NONO.Flag = data.Flag
|
|
result = &nono.NonoFollowOutInfo{
|
|
UserID: data.Head.UserID,
|
|
SuperStage: data.Flag,
|
|
Flag: data.Flag,
|
|
Nick: "",
|
|
Color: c.Info.NONO.NonoColor,
|
|
Power: nonoDefaultPower,
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// GetNonoInfo 获取nono信息
|
|
func (h *Controller) GetNonoInfo(data *NonoInboundInfo, c *player.Player) (result *nono.NonoOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
|
_ = data
|
|
|
|
result = &nono.NonoOutboundInfo{
|
|
UserID: c.Info.UserID,
|
|
Nick: c.Info.NONO.Nick,
|
|
SuperNono: nonoDefaultNum,
|
|
Color: c.Info.NONO.NonoColor,
|
|
Num: nonoDefaultNum,
|
|
SuperLevel: nonoDefaultLevel,
|
|
SuperStage: c.Info.NONO.Flag,
|
|
Power: nonoDefaultPower,
|
|
SuperEnergy: nonoDefaultPower,
|
|
}
|
|
for i := range result.Func {
|
|
result.Func[i] = nonoFuncValue
|
|
}
|
|
return
|
|
}
|
|
|
|
// SwitchFlying 处理控制器请求。
|
|
func (h *Controller) SwitchFlying(data *SwitchFlyingInboundInfo, c *player.Player) (result *nono.SwitchFlyingOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
|
result = &nono.SwitchFlyingOutboundInfo{
|
|
UserId: data.Head.UserID,
|
|
Type: data.Type,
|
|
}
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
return
|
|
}
|
|
|
|
// PlayerPetCure 处理控制器请求。
|
|
func (h *Controller) PlayerPetCure(data *PetCureInboundInfo, c *player.Player) (result *nono.PetCureOutboundEmpty, err errorcode.ErrorCode) { //这个时候player应该是空的
|
|
_ = data
|
|
result = &nono.PetCureOutboundEmpty{}
|
|
if c.IsArenaHealLocked() {
|
|
return result, errorcode.ErrorCodes.ErrChampionCannotHeal
|
|
}
|
|
if !c.GetCoins(nonoPetCureCost) {
|
|
return result, errorcode.ErrorCodes.ErrSunDouInsufficient10016
|
|
}
|
|
for i := range c.Info.PetList {
|
|
c.Info.PetList[i].Cure()
|
|
}
|
|
for i := range c.Info.BackupPetList {
|
|
c.Info.BackupPetList[i].Cure()
|
|
}
|
|
c.Info.Coins -= nonoPetCureCost
|
|
return
|
|
}
|