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

@@ -199,7 +199,6 @@ func (f *FightC) UseSkillAt(c common.PlayerI, id uint32, actorIndex, targetIndex
BaseAction: action.NewBaseAction(c.GetInfo().UserID),
}
ret.ActorIndex = actorIndex
ret.TargetIndex = targetIndex
self := f.getInputByUserID(c.GetInfo().UserID, actorIndex, false)
if self == nil {
@@ -225,9 +224,28 @@ func (f *FightC) UseSkillAt(c common.PlayerI, id uint32, actorIndex, targetIndex
}
}
ret.TargetIndex = normalizeSkillTargetIndex(actorIndex, targetIndex, ret.SkillEntity)
f.submitAction(ret)
}
func normalizeSkillTargetIndex(actorIndex, targetIndex int, skill *info.SkillEntity) int {
if skill == nil {
return targetIndex
}
// 约定:非负目标位表示敌方;负值 -(index+1) 表示同侧(自己/队友)
if _, targetIsOpposite := DecodeTargetIndex(targetIndex); !targetIsOpposite {
return targetIndex
}
// GBTL.AtkType: 0=所有人 1=仅己方 2=仅对方 3=仅自己默认2
switch skill.XML.AtkType {
case 1, 3:
// 旧协议未传目标时,己方类技能默认作用自己;新协议可通过负编码显式指定队友。
return EncodeTargetIndex(actorIndex, false)
default:
return targetIndex
}
}
// 玩家使用技能
func (f *FightC) Capture(c common.PlayerI, id uint32) {
if f.closefight {