30 lines
698 B
Go
30 lines
698 B
Go
package info
|
|
|
|
import "context"
|
|
|
|
type BattleInputSourceEntity struct {
|
|
FightUserInfo
|
|
ctx context.Context //输入源的上下文
|
|
}
|
|
|
|
// 新建一个宠物
|
|
func (u *BattleInputSourceEntity) NewBattlePetEntity(ctx context.Context) {
|
|
|
|
ret := BattlePetEntity{}
|
|
|
|
ret.UnitAttributes = make(map[EnumAttrType]*Attribute)
|
|
//todo 待实现精灵特性+加成的封装
|
|
ctx = context.WithValue(ctx, "player", &ret) //添加用户到上下文
|
|
ret.ctx = ctx
|
|
|
|
}
|
|
func (u *BattleInputSourceEntity) NewBattleAction(ctx context.Context, actiontype EnumPlayerOperation) {
|
|
|
|
ret := BattleAction{
|
|
Priority: actiontype,
|
|
}
|
|
ctx = context.WithValue(ctx, "player", &ret) //添加用户到上下文
|
|
ret.ctx = ctx
|
|
|
|
}
|