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