- 移除 Effect0 基类效果 - 调整 Input 结构,删除未使用的属性 - 优化 Effect 接口,增加 GetMaxStack 方法 - 重构效果初始化逻辑,支持不同类型效果的初始化 - 优化效果的添加和移除操作 - 调整宠物效果信息结构,合并参数
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package input
|
|
|
|
import (
|
|
"blazing/logic/service/common"
|
|
"blazing/logic/service/fight/info"
|
|
|
|
"github.com/jinzhu/copier"
|
|
"github.com/mohae/deepcopy"
|
|
"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
|
|
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
|
Damage decimal.Decimal //造成伤害
|
|
First bool //是否先手
|
|
}
|
|
|
|
func NewInput(c common.FightI, p common.PlayerI) *Input {
|
|
ret := &Input{FightC: c, Player: p}
|
|
t := NodeM[1000000]
|
|
ret.AddEffect(deepcopy.Copy(t).(Effect)) //添加默认基类,实现继承
|
|
p.SetFightC(c) //给玩家设置战斗容器
|
|
return ret
|
|
|
|
}
|
|
func (i *Input) GetPetInfo() *info.BattlePetEntity {
|
|
|
|
return i.CurrentPet
|
|
|
|
}
|
|
|
|
// 这个每回合都会调用
|
|
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
|
|
|
|
}
|