chore: update fight logic and effect implementations
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-05 02:25:44 +08:00
committed by cnb
parent f473c54880
commit 78a68148ce
80 changed files with 475 additions and 248 deletions

View File

@@ -151,25 +151,6 @@ func (f *FightC) bindInputFightContext(inputGroups ...[]*input.Input) {
}
}
// linkOppInputs 仅建立“默认对手回退”关系,不参与真实目标选择。
// 真实目标应由 action.targetIndex 决定;这里仅为旧 effect/无动作上下文链路提供默认 Opp。
func (f *FightC) linkOppInputs() {
defaultOpp := f.selectInput(f.Opp, 0)
for _, fighter := range f.Our {
if fighter == nil {
continue
}
fighter.SetOPP(defaultOpp)
}
defaultOur := f.selectInput(f.Our, 0)
for _, fighter := range f.Opp {
if fighter == nil {
continue
}
fighter.SetOPP(defaultOur)
}
}
// linkTeamViews 建立每个输入的同阵营/对阵营视图Team/OppTeam
func (f *FightC) linkTeamViews() {
for _, fighter := range f.Our {
@@ -263,7 +244,8 @@ func (f *FightC) setActionAttackValue(act action.BattleActionI) {
return
}
attacker.AttackValue.ActorIndex = uint32(act.GetActorIndex())
attacker.AttackValue.TargetIndex = uint32(act.GetTargetIndex())
targetIndex, _ := DecodeTargetIndex(act.GetTargetIndex())
attacker.AttackValue.TargetIndex = uint32(targetIndex)
}
func (f *FightC) Ownerid() uint32 {
@@ -311,10 +293,11 @@ func (f *FightC) GetInputByAction(c action.BattleActionI, isOpposite bool) *inpu
return f.primaryOur()
}
index := c.GetActorIndex()
if isOpposite {
index = c.GetTargetIndex()
if !isOpposite {
return f.getInputByUserID(c.GetPlayerID(), index, false)
}
return f.getInputByUserID(c.GetPlayerID(), index, isOpposite)
targetIndex, targetIsOpposite := DecodeTargetIndex(c.GetTargetIndex())
return f.getInputByUserID(c.GetPlayerID(), targetIndex, targetIsOpposite)
}
// 玩家使用技能