chore: update fight logic and effect implementations
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user