Files
bl/logic/controller/nono.go
xinian 218e23ff81
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
refactor: 重构战斗系统动作提交和竞技场锁定逻辑
2026-04-02 23:05:18 +08:00

76 lines
2.1 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
)
func (h Controller) NonoFollowOrHome(data *nono.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 *nono.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
}
func (h *Controller) SwitchFlying(data *nono.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
}
func (h *Controller) PlayerPetCure(data *nono.PetCureInboundInfo, c *player.Player) (result *nono.PetCureOutboundEmpty, err errorcode.ErrorCode) { //这个时候player应该是空的
_ = data
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()
}
c.Info.Coins -= nonoPetCureCost
return
}