diff --git a/logic/service/fight/effect/173.go b/logic/service/fight/effect/173.go index e841c9d76..74a7fa033 100644 --- a/logic/service/fight/effect/173.go +++ b/logic/service/fight/effect/173.go @@ -12,7 +12,7 @@ type Effect173 struct { func (e *Effect173) OnSkill() bool { - if e.Input.FightC.IsFirst(e.Input.Player) { // 先出手 + if e.IsFirst() { // 先出手 chance := e.Args()[0].IntPart() success, _, _ := e.Input.Player.Roll(int(chance), 100) if success { diff --git a/logic/service/fight/effect/196.go b/logic/service/fight/effect/196.go index fd0252183..854017f46 100644 --- a/logic/service/fight/effect/196.go +++ b/logic/service/fight/effect/196.go @@ -11,7 +11,7 @@ type Effect196 struct { } func (e *Effect196) OnSkill() bool { - if e.Input.FightC.IsFirst(e.Input.Player) { // 先出手 + if e.IsFirst() { // 先出手 chance := e.Args()[4].IntPart() // j% effectValue := e.Args()[5].IntPart() // 等级-k success, _, _ := e.Input.Player.Roll(int(chance), 100) diff --git a/logic/service/fight/effect/458.go b/logic/service/fight/effect/458.go index 37d6ac835..6b38b7d8f 100644 --- a/logic/service/fight/effect/458.go +++ b/logic/service/fight/effect/458.go @@ -14,7 +14,7 @@ type Effect458 struct { } func (e *Effect458) SkillHit_ex() bool { - if e.Input.FightC.IsFirst(e.Input.Player) { // 先出手 + if e.IsFirst() { // 先出手 damageDone := e.Ctx().Our.SumDamage healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // n% healAmount := damageDone.Mul(healPercent) diff --git a/logic/service/fight/effect/471.go b/logic/service/fight/effect/471.go index a0a913e93..d027aa8f2 100644 --- a/logic/service/fight/effect/471.go +++ b/logic/service/fight/effect/471.go @@ -37,7 +37,7 @@ func (e *Effect471) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { return true } func (e *Effect471) OnSkill() bool { - if e.Input.FightC.IsFirst(e.Input.Player) { // 先出手 + if e.IsFirst() { // 先出手 e.can = true } diff --git a/logic/service/fight/effect/476.go b/logic/service/fight/effect/476.go index 7ebf38d86..3d39c7b30 100644 --- a/logic/service/fight/effect/476.go +++ b/logic/service/fight/effect/476.go @@ -14,7 +14,7 @@ type Effect476 struct { } func (e *Effect476) OnSkill() bool { - if !e.Input.FightC.IsFirst(e.Input.Player) { + if e.IsFirst() { return true } healAmount := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) diff --git a/logic/service/fight/effect/561.go b/logic/service/fight/effect/561.go index e310dc1ee..aa2a87ed8 100644 --- a/logic/service/fight/effect/561.go +++ b/logic/service/fight/effect/561.go @@ -11,8 +11,8 @@ type Effect561 struct { can bool } -func (e *Effect561) Action_end_ex() bool { - if e.Input.FightC.IsFirst(e.Input.Player) { +func (e *Effect561) Skill_Use_ex() bool { + if e.IsFirst() { if e.Ctx().Our.CurrentPet.GetHP().IntPart() == 0 { e.Ctx().Our.CurrentPet.Info.Hp = e.Ctx().Our.CurrentPet.Info.MaxHp } diff --git a/logic/service/fight/effect/effct_122.go b/logic/service/fight/effect/effct_122.go index e94c59829..745aa6e60 100644 --- a/logic/service/fight/effect/effct_122.go +++ b/logic/service/fight/effect/effct_122.go @@ -36,7 +36,7 @@ type Effect122 struct { func (e *Effect122) OnSkill() bool { - if e.Input.FightC.IsFirst(e.Input.Player) == e.isfrist { + if e.IsFirst() == e.isfrist { propIndex := int(e.Args()[0].IntPart()) chance := int(e.Args()[1].IntPart()) changeAmount := int(e.Args()[2].IntPart()) diff --git a/logic/service/fight/effect/effect_147_159.go b/logic/service/fight/effect/effect_147_159.go index c5f4396ae..ec644062d 100644 --- a/logic/service/fight/effect/effect_147_159.go +++ b/logic/service/fight/effect/effect_147_159.go @@ -15,7 +15,7 @@ type Effect147 struct { func (e *Effect147) OnSkill() bool { - if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) { + if e.IsFirst() { return true } chance := int(e.Args()[0].IntPart()) @@ -44,7 +44,7 @@ type Effect148 struct { func (e *Effect148) OnSkill() bool { - if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) { + if e.IsFirst() { return true } propIndex := int(e.Args()[0].IntPart()) diff --git a/logic/service/fight/effect/effect_172.go b/logic/service/fight/effect/effect_172.go index 23b3fc07a..aba665553 100644 --- a/logic/service/fight/effect/effect_172.go +++ b/logic/service/fight/effect/effect_172.go @@ -12,7 +12,7 @@ type Effect172 struct { } func (e *Effect172) OnSkill() bool { - if !e.Input.FightC.IsFirst(e.Input.Player) { + if e.IsFirst() { return true } damage := e.Ctx().Opp.SumDamage diff --git a/logic/service/fight/effect/effect_405_402.go b/logic/service/fight/effect/effect_405_402.go index 5b1039465..8adbc144e 100644 --- a/logic/service/fight/effect/effect_405_402.go +++ b/logic/service/fight/effect/effect_405_402.go @@ -25,7 +25,7 @@ type Effect405 struct { func (e *Effect405) OnSkill() bool { - if e.Input.FightC.IsFirst(e.Input.Player) == e.isfrist { + if e.IsFirst() == e.isfrist { e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: e.Ctx().Opp.CurrentPet.GetHP().Div(e.Args()[0]), diff --git a/logic/service/fight/effect/effect_499.go b/logic/service/fight/effect/effect_499.go index eed87c626..eeb94afd9 100644 --- a/logic/service/fight/effect/effect_499.go +++ b/logic/service/fight/effect/effect_499.go @@ -28,7 +28,7 @@ func (e *Effect499) ActionStartEx(fattack, sattack *action.SelectSkillAction) bo return true } func (e *Effect499) OnSkill() bool { - if e.Input.FightC.IsFirst(e.Input.Player) { + if e.IsFirst() { return true } e.can = true diff --git a/logic/service/fight/effect/effect_73.go b/logic/service/fight/effect/effect_73.go index 53291c918..468fb3f02 100644 --- a/logic/service/fight/effect/effect_73.go +++ b/logic/service/fight/effect/effect_73.go @@ -34,7 +34,7 @@ func (e *Effect73) SetArgs(t *input.Input, a ...int) { } func (e *Effect73) Action_end_ex() bool { - if !e.Input.FightC.IsFirst(e.Ctx().Our.Player) { + if !e.IsFirst() { return true } tt := &info.DamageZone{ diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index 315d8704f..c119e9d4f 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -220,17 +220,37 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) attacker.RecoverEffect() currentSkill = nil - if i == 0 { - //不能使用,所以这时候取消后手 - defender.ReactvieEffect() - firstAttack, secondAttack = secondAttack, firstAttack //互换先手权 - f.First, f.Second = f.Second, f.First - //反转先后手 - originalSkill = f.copySkill(firstAttack) + if i == 0 { //先手方被控,这时候应该算做未出手状态 + if canUse { + f.TrueFirst = attacker + + attacker.Exec(func(effect input.Effect) bool { + effect.IsFirst(true) + return true + }) + + } else { + + f.TrueFirst = defender + defender.Exec(func(effect input.Effect) bool { + effect.IsFirst(true) + return true + }) + } - currentSkill = originalSkill - attacker, defender = defender, attacker } + //先手权不一定出手 + // if i == 0 { + // //不能使用,所以这时候取消后手 + // defender.ReactvieEffect() + // firstAttack, secondAttack = secondAttack, firstAttack //互换先手权 + // f.First, f.Second = f.Second, f.First + // //反转先后手 + // originalSkill = f.copySkill(firstAttack) + + // currentSkill = originalSkill + // attacker, defender = defender, attacker + // } } else { f.processSkillAttack(attacker, defender, currentSkill) @@ -297,6 +317,10 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) }) ff.GenInfo() }) + if f.TrueFirst != f.First { + f.First, f.Second = f.Second, f.First + + } attackValueResult := info.AttackValueS{ FAttack: *f.First.AttackValue, diff --git a/logic/service/fight/input.go b/logic/service/fight/input.go index e24da367e..f52506190 100644 --- a/logic/service/fight/input.go +++ b/logic/service/fight/input.go @@ -37,10 +37,10 @@ type FightC struct { StartTime time.Time actionChan chan action.BattleActionI // 所有操作统一从这里进入 - quit chan struct{} - over chan struct{} - First *input.Input - //TrueFirst *input.Input + quit chan struct{} + over chan struct{} + First *input.Input + TrueFirst *input.Input Second *input.Input closefight bool overl sync.Once @@ -96,11 +96,11 @@ func (f *FightC) GetRand() *rand.Rand { } -// 获取随机数 +// // 获取随机数 func (f *FightC) IsFirst(play common.PlayerI) bool { - return f.First.Player == play -} + return f.TrueFirst.Player == play + } func (f *FightC) Chat(c common.PlayerI, msg string) { f.GetInputByPlayer(c, true).Player.SendPackCmd(50002, &user.ChatOutboundInfo{ diff --git a/logic/service/fight/input/interface.go b/logic/service/fight/input/interface.go index 4ea5d7d88..2ae42d6a9 100644 --- a/logic/service/fight/input/interface.go +++ b/logic/service/fight/input/interface.go @@ -66,6 +66,7 @@ type Effect interface { Duration(...int) int //Hit(...bool) bool Alive(...bool) bool + IsFirst(...bool) bool Stack(...int) int CanStack(...bool) bool diff --git a/logic/service/fight/node/node.go b/logic/service/fight/node/node.go index f357b2fef..67fc164f1 100644 --- a/logic/service/fight/node/node.go +++ b/logic/service/fight/node/node.go @@ -16,7 +16,8 @@ type EffectNode struct { Input *input.Input stacks int // 当前层数 id input.EffectIDCombiner - canStack bool // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层 + canStack bool // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层 + isFirst bool SideEffectArgs []int // 附加效果参数 // owner bool //是否作用自身 Success bool // 是否执行成功 成功XXX,失败XXX @@ -86,6 +87,14 @@ func (e *EffectNode) CanStack(t ...bool) bool { } return e.canStack +} +func (e *EffectNode) IsFirst(t ...bool) bool { + + if len(t) > 0 { + e.isFirst = t[0] + } + return e.isFirst + } // 回合类改成int.max,然后魂印类重写切换精灵替换