2025-09-14 01:35:16 +08:00
|
|
|
package input
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"blazing/logic/service/common"
|
|
|
|
|
"blazing/logic/service/fight/info"
|
|
|
|
|
|
|
|
|
|
"github.com/jinzhu/copier"
|
2025-09-14 04:48:38 +08:00
|
|
|
"github.com/mohae/deepcopy"
|
2025-09-14 01:35:16 +08:00
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Input struct {
|
|
|
|
|
CanChange bool //是否可以死亡切换CanChange
|
|
|
|
|
CurrentPet *info.BattlePetEntity //当前精灵
|
|
|
|
|
AllPet []*info.BattlePetEntity
|
|
|
|
|
Player common.PlayerI
|
|
|
|
|
Finished bool //是否加载完成
|
|
|
|
|
*info.AttackValue
|
|
|
|
|
FightC common.FightI
|
|
|
|
|
// info.BattleActionI
|
2025-09-16 22:51:22 +08:00
|
|
|
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
|
|
|
|
Damage decimal.Decimal //造成伤害
|
|
|
|
|
First bool //是否先手
|
2025-09-14 01:35:16 +08:00
|
|
|
}
|
|
|
|
|
|
2025-09-14 04:48:38 +08:00
|
|
|
func NewInput(c common.FightI, p common.PlayerI) *Input {
|
|
|
|
|
ret := &Input{FightC: c, Player: p}
|
2025-09-14 19:59:58 +08:00
|
|
|
t := NodeM[1000000]
|
2025-09-15 00:40:19 +08:00
|
|
|
ret.AddEffect(deepcopy.Copy(t).(Effect)) //添加默认基类,实现继承
|
|
|
|
|
p.SetFightC(c) //给玩家设置战斗容器
|
2025-09-14 04:48:38 +08:00
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
}
|
2025-09-14 01:35:16 +08:00
|
|
|
func (i *Input) GetPetInfo() *info.BattlePetEntity {
|
|
|
|
|
|
|
|
|
|
return i.CurrentPet
|
|
|
|
|
|
|
|
|
|
}
|
2025-09-14 04:48:38 +08:00
|
|
|
|
|
|
|
|
// 这个每回合都会调用
|
2025-09-14 01:35:16 +08:00
|
|
|
func (i *Input) InitAttackValue() {
|
|
|
|
|
i.AttackValue = info.NewAttackValue(i.Player.ID())
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
func (i *Input) GetPet(id uint32) (ii *info.BattlePetEntity, Reason info.ChangePetInfo) {
|
|
|
|
|
for _, v := range i.AllPet {
|
|
|
|
|
if v.Info.CatchTime == uint32(id) {
|
|
|
|
|
copier.Copy(&Reason, &v.Info)
|
|
|
|
|
Reason.UserId = i.Player.ID()
|
|
|
|
|
|
|
|
|
|
ii = v
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
}
|