Files
bl/logic/service/ai.go
昔念 4ab4f04a97 feat(fight): 优化战斗系统命中率计算和捕捉逻辑
- 新增 AI_player 结构体的 CanCapture 字段,用于判断是否可捕捉
- 优化 BattlePetEntity 的 Accuracy 方法,增加对负强化等级的处理
- 修改 BattleSkillEntity 的 AttackTime 方法,增加必中判断
- 更新 FightC 中的捕捉逻辑,支持 AI 玩家的捕捉判断
- 重构战斗流程中的技能攻击逻辑,优化命中率计算和效果执行
2025-09-12 00:27:49 +08:00

77 lines
1.7 KiB
Go

package service
import (
"blazing/logic/service/fight/info"
"blazing/modules/blazing/model"
"fmt"
)
type AI_player struct {
FightC *FightC //绑定战斗标识 替代本身的是否战斗标记 //IsFighting bool
petinfo []model.PetInfo //精灵信息
CanCapture bool
}
func NewAI_player(m model.PetInfo) *AI_player {
ret := &AI_player{}
ret.petinfo = make([]model.PetInfo, 0)
ret.petinfo = append(ret.petinfo, m)
return ret
}
func (f *AI_player) SetFightC(ff *FightC) {
f.FightC = ff
}
func (f *AI_player) ID() uint32 {
return 0
}
func (f *AI_player) MapID() uint32 {
panic("not implemented") // TODO: Implement
}
// func (f *AI_player) GetInfo() model.PlayerInfo {
// return f.FightC.Opp.
// }
func (f *AI_player) SendPack(b []byte) error {
panic("not implemented") // TODO: Implement
}
func (f *AI_player) SendReadyToFightInfo(gg info.FightStartOutboundInfo) {
fmt.Println(gg)
// f.FightC.UseSkill(f, f.fightinfo.OpponentPetList[0].SkillList[0].ID) //使用1#技能,实际上要按照四个技能权重去使用
//这时候给个出招
}
func (f *AI_player) SendNoteReadyToFightInfo(fs info.NoteReadyToFightInfo) {
fmt.Println(fs)
}
func (f *AI_player) SendFightEndInfo(_ info.FightOverInfo) {
//fmt.Println("战斗结束")
}
func (f *AI_player) GetAction() {
f.FightC.UseSkill(f, int32(f.FightC.Opp.CurrentPet.Skills[0].ID)) //使用1#技能,实际上要按照四个技能权重去使用
}
func (p *AI_player) End() {
p.FightC = nil
return
}
func (p *AI_player) GetPetInfo() []model.PetInfo {
return p.petinfo
}
func (p *AI_player) SendAttackValue(info.AttackValueS) {
}
func (p *AI_player) SendChangePet(info.ChangePetInfo) {
}