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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user