refactor(fight): 重构战斗流程实现并完善效果处理机制
This commit is contained in:
@@ -4,10 +4,13 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const Input_ctx = "player"
|
||||
|
||||
type BattleInputSourceEntity struct {
|
||||
FightUserInfo
|
||||
ctx context.Context //输入源的上下文
|
||||
effects NodeManager //挂载effect
|
||||
FightUserInfo //用户信息
|
||||
PetEntities []*BattlePetEntity //宠物信息
|
||||
ctx context.Context //输入源的上下文
|
||||
|
||||
}
|
||||
|
||||
// 新建一个宠物
|
||||
@@ -17,7 +20,7 @@ func (u *BattleInputSourceEntity) NewBattlePetEntity(ctx context.Context) {
|
||||
|
||||
ret.UnitAttributes = make(map[EnumAttrType]*Attribute)
|
||||
//todo 待实现精灵特性+加成的封装
|
||||
ctx = context.WithValue(ctx, "player", &ret) //添加用户到上下文
|
||||
ctx = context.WithValue(ctx, Input_ctx, &ret) //添加用户到上下文
|
||||
ret.ctx = ctx
|
||||
|
||||
}
|
||||
@@ -26,7 +29,7 @@ func (u *BattleInputSourceEntity) NewBattleAction(ctx context.Context, actiontyp
|
||||
ret := BattleAction{
|
||||
Priority: actiontype,
|
||||
}
|
||||
ctx = context.WithValue(ctx, "player", &ret) //添加用户到上下文
|
||||
ctx = context.WithValue(ctx, Input_ctx, &ret) //添加用户到上下文
|
||||
ret.ctx = ctx
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user