Files
bl/logic/controller/fight.go
昔念 5ba81e2f90 refactor(fight): 重构战斗相关代码
- 移除未使用的战斗模式枚举和相关代码
- 更新 BurnEffect 结构,增加生命周期管理
- 删除多余的 Skill 结构和 Effect 相关代码
- 调整 NoteReadyToFightInfo 结构的位置
2025-08-25 04:23:32 +08:00

70 lines
1.8 KiB
Go

package controller
import (
"blazing/common/data/entity"
"blazing/common/socket/errorcode"
"blazing/common/socket/handler"
"blazing/logic/service/fight"
"blazing/logic/service/fight/info"
"blazing/modules/blazing/model"
)
func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundInfo, c *entity.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
c.IsFighting = true
t1 := handler.NewTomeeHeader(2503, c.UserID)
ttt := info.NoteReadyToFightInfo{
FightId: 3,
}
ttt.OurInfo = info.FightUserInfo{UserID: c.UserID}
ttt.OurPetList = []info.ReadyFightPetInfo{{ID: 300,
Level: 100,
MaxHp: 100,
Hp: 100,
SkillListLen: 4,
}}
for i := 0; i < 4; i++ {
ttt.OurPetList[0].SkillList[i] = model.SkillInfo{ID: 10001, Pp: 1}
}
ttt.OpponentInfo = info.FightUserInfo{UserID: 0}
ttt.OpponentPetList = []info.ReadyFightPetInfo{{ID: 1,
Level: 100,
MaxHp: 100,
SkillListLen: 4,
Hp: 100}}
for i := 0; i < 4; i++ {
ttt.OpponentPetList[0].SkillList[i] = model.SkillInfo{ID: 10001, Pp: 1}
}
c.SendPack(t1.Pack(&ttt))
return nil, -1
}
func (h Controller) OnReadyToFight(data *fight.ReadyToFightInboundInfo, c *entity.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
t1 := handler.NewTomeeHeader(2504, c.UserID)
rett := fight.FightStartOutboundInfo{
IsCanAuto: 0,
Info1: fight.FightPetInfo{PetID: 300,
UserID: c.UserID,
Hp: 1000,
MaxHp: 1000,
Level: 1,
CatchTime: 0,
Catchable: 1,
BattleLV: [6]byte{1, 1, 1, 1, 1, 1},
},
Info2: fight.FightPetInfo{
UserID: 0,
PetID: 1,
Hp: 1000,
MaxHp: 1000,
Level: 1,
CatchTime: 0,
Catchable: 1,
BattleLV: [6]byte{1, 1, 1, 1, 1, 1}},
}
c.SendPack(t1.Pack(&rett))
return nil, -1
}