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

@@ -35,6 +35,40 @@ func (h Controller) UseSkill(data *fight.UseSkillInInfo, c *player.Player) (resu
return nil, 0
}
// UseSkillAt 组队/多战位技能包cmd=7505
// 目标关系0=对方 1=自己 2=队友。
func (h Controller) UseSkillAt(data *fight.UseSkillAtInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if err := h.checkFightStatus(c); err != 0 {
return nil, err
}
actorIndex := int(data.ActorIndex)
targetIndex := int(data.TargetIndex)
targetRelation := data.TargetRelation
// 前端未显式给 relation 时,按 AtkType 兜底3=自己1=己方,其他按对方。
if targetRelation > fight.SkillTargetAlly {
switch data.AtkType {
case 3:
targetRelation = fight.SkillTargetSelf
case 1:
targetRelation = fight.SkillTargetAlly
default:
targetRelation = fight.SkillTargetOpponent
}
}
switch targetRelation {
case fight.SkillTargetSelf:
targetIndex = actorIndex
go c.FightC.UseSkillAt(c, data.SkillId, actorIndex, fight.EncodeTargetIndex(targetIndex, false))
case fight.SkillTargetAlly:
go c.FightC.UseSkillAt(c, data.SkillId, actorIndex, fight.EncodeTargetIndex(targetIndex, false))
default:
go c.FightC.UseSkillAt(c, data.SkillId, actorIndex, fight.EncodeTargetIndex(targetIndex, true))
}
return nil, 0
}
// Escape 战斗逃跑
func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if err := h.checkFightStatus(c); err != 0 {