```
feat(fight): 修复战斗中先手判断逻辑 在战斗回合开始时,当先手方被控制无法行动时, 正确设置真正的先手方为当前回合的先手, 确保战斗逻辑的准确性。 ```
This commit is contained in:
@@ -202,11 +202,17 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
|||||||
})
|
})
|
||||||
|
|
||||||
canUse := canUseSkill && action.CanUse(currentSkill) && attacker.CurrentPet.Info.Hp > 0
|
canUse := canUseSkill && action.CanUse(currentSkill) && attacker.CurrentPet.Info.Hp > 0
|
||||||
|
if i == 0 { //先手方被控,这时候应该算做未出手状态
|
||||||
|
if canUse {
|
||||||
|
f.TrueFirst = attacker
|
||||||
|
|
||||||
if !canUse {
|
} else {
|
||||||
if i == 0 { //增加我方放弃出手时变成后手放判断
|
f.TrueFirst = defender
|
||||||
f.Second, f.First = f.First, f.Second
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if !canUse {
|
||||||
|
|
||||||
attacker.RecoverEffect()
|
attacker.RecoverEffect()
|
||||||
currentSkill = nil
|
currentSkill = nil
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ type FightC struct {
|
|||||||
quit chan struct{}
|
quit chan struct{}
|
||||||
over chan struct{}
|
over chan struct{}
|
||||||
First *input.Input
|
First *input.Input
|
||||||
|
TrueFirst *input.Input
|
||||||
Second *input.Input
|
Second *input.Input
|
||||||
closefight bool
|
closefight bool
|
||||||
overl sync.Once
|
overl sync.Once
|
||||||
@@ -103,7 +104,7 @@ func (f *FightC) GetRand() *rand.Rand {
|
|||||||
// 获取随机数
|
// 获取随机数
|
||||||
func (f *FightC) IsFirst(play common.PlayerI) bool {
|
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) {
|
func (f *FightC) Chat(c common.PlayerI, msg string) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user