diff --git a/logic/service/fight/battle/node/node.go b/logic/service/fight/battle/node/node.go index b38eccda..18d31b19 100644 --- a/logic/service/fight/battle/node/node.go +++ b/logic/service/fight/battle/node/node.go @@ -28,16 +28,14 @@ func (this *EffectNode) ID() int { return 0 } +func (this *EffectNode) GetOwner() bool { -// 传出作用对象,默认0是自身,1是作用于对面 -func (this *EffectNode) Target() bool { - - return this.target + return this.Owner } -func (this *EffectNode) SetTarget(t bool) { +func (this *EffectNode) SetOwner(b bool) { - this.target = t + this.Owner = b } func (this *EffectNode) Stack(t int) int { diff --git a/logic/service/fight/info/nodemanger.go b/logic/service/fight/info/nodemanger.go index 9c62db61..5d90005e 100644 --- a/logic/service/fight/info/nodemanger.go +++ b/logic/service/fight/info/nodemanger.go @@ -27,9 +27,9 @@ type Effect interface { OnHit() bool // 技能命中时触发 OnMiss() bool // 技能未命中时触发 AfterAttacked() bool // 被攻击后触发(受击判定) - Target() bool // 技能效果类型 - SetTarget(bool) // 技能效果类型 - OnDefeat() bool // 精灵被击败时触发 + GetOwner() bool // 技能属主,比如寄生和镇魂歌,属主是对方) + SetOwner(bool) + OnDefeat() bool // 精灵被击败时触发 TurnEnd() bool // 回合结束 @@ -149,7 +149,7 @@ func (c *NodeManager) CancelTurn(efftype bool) { var remain []Effect for _, eff := range c.Effects { - if eff.Duration(0) <= 0 && eff.Target() == efftype { //false是自身,true是对方,反转后为真就是自己的 + if eff.Duration(0) <= 0 && eff.GetOwner() == efftype { //false是自身,true是对方,反转后为真就是自己的 remain = append(remain, eff) } } diff --git a/logic/service/fightc.go b/logic/service/fightc.go index b9bcc8ec..382d1081 100644 --- a/logic/service/fightc.go +++ b/logic/service/fightc.go @@ -117,6 +117,11 @@ func (f *FightC) ChangePet(c PlayerI, id int32) { // 玩家使用技能 func (f *FightC) UseSkill(c PlayerI, id int32) { + + if id == 0 { + f.actionChan <- &info.SystemGiveUpAction{PlayerID: c.ID()} + return + } ret := &info.SelectSkillAction{ PlayerID: c.ID(), } @@ -300,6 +305,7 @@ func (f *FightC) battleLoop() { } // 双方动作齐了,取出来结算 + //todo 如果一方没有选择,实际上就是后端判断PP是否还有,前端是直接发的 p1Action := actions[f.Our.Player.ID()] p2Action := actions[f.Opp.Player.ID()] fmt.Println("开始结算回合") @@ -389,7 +395,7 @@ func (f *FightC) parseskill(id *info.SelectSkillAction) { //如果不是是房主方,说明施加的对象是反的,比如本来是false,实际上是给邀请方施加的 //所以这里要对target取反 if id.GetPlayerID() != f.OwnerID { - t.SetTarget(!t.Target()) + t.SetOwner(!t.GetOwner()) } temparg = temparg[args:] f.EffectS.AddEffect(deepcopy.Copy(t).(info.Effect))