```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(boss): 新增技能优先级调整功能

新增ComparePre方法用于比较和调整技能释放优先级,
修复了Boss战斗中的技能执行顺序问题,
同时在login模块中启用战斗测试功能。
```
This commit is contained in:
昔念
2026-03-07 22:16:06 +08:00
parent a76a7e680e
commit b9ae17234d
8 changed files with 287 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 116. 自身的物理攻击有n%几率使对方处于异常状态a1: n, a2: 异常状态类型)
// TODO: 实现自身的物理攻击有n%几率使对方处于异常状态a1: n, a2: 异常状态类型)的核心逻辑
type NewSel116 struct {
NewSel0
}
func (e *NewSel116) OnSkill() bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
success, _, _ := e.Input.Player.Roll(50, 100)
if !success {
return true
}
eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired))
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 116, &NewSel116{})
}

View File

@@ -1,6 +1,7 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
)
@@ -10,6 +11,32 @@ type NewSel42 struct {
NewSel0
}
func (e *NewSel42) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if fattack == nil {
return true
}
//先手是自己
if fattack.PlayerID == e.Ctx().Our.UserID {
return true
}
if sattack == nil {
return true
}
if sattack == nil {
return true
}
if sattack.SkillEntity == nil {
return true
}
//对调
sattack.SkillEntity.Priority += int(e.Args()[0].IntPart())
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 42, &NewSel42{})
}

View File

@@ -0,0 +1,63 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// eid: 92
// icon_id: -1
// isHide: 隐藏特性
// tips:
// - 自身攻击会附加上一回合的伤害, 附加上回合受到伤害(红伤+粉伤等量的粉伤对应BuffId 2056
//
// args:
// - 0 0
//
// tips_help:
// - 自身攻击会附加上一回合的伤害, 附加上回合受到伤害(红伤+粉伤等量的粉伤对应BuffId 2056
//
// T92. 属性技能无效
type NewSel92 struct {
NewSel0
n1 alpacadecimal.Decimal
n2 alpacadecimal.Decimal
}
func init() {
input.InitEffect(input.EffectType.NewSel, 92, &NewSel92{})
}
func (e *NewSel92) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
e.n2, e.n1 = alpacadecimal.Zero, alpacadecimal.Zero
return
}
e.n1 = e.Ctx().Our.CurrentPet.GetHP()
return
}
func (e *NewSel92) TurnEnd() {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
e.n2, e.n1 = alpacadecimal.Zero, alpacadecimal.Zero
return
}
e.n2 = e.Ctx().Our.CurrentPet.GetHP()
return
}
func (e *NewSel92) DamageFloor(t *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
//不是技能
if e.Ctx().SkillEntity == nil {
return true
}
if e.n2.Cmp(e.n1) == 1 {
t.Damage.Add(e.n2.Sub(e.n1))
}
return true
}

View File

@@ -0,0 +1,39 @@
package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
func init() {
input.InitEffect(input.EffectType.Skill, 152, &Effect152{})
}
type Effect152 struct {
node.EffectNode
}
func (e *Effect152) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect152) Skill_Use_ex() bool {
if e.Ctx().SkillEntity == nil {
return true
}
ok, _, _ := e.Input.Player.Roll(e.SideEffectArgs[1], 100)
if !ok {
return true
}
eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if eff == nil {
return true
}
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
return true
}

View File

@@ -0,0 +1,55 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
* ID: 183
标签: [免伤]
描述: {0}回合内免疫并反弹{1}伤害。
关联技能: [21563, 21567, 23755]
关联精灵: 1288,1289,1290,1944,1945,2637
*/
func init() {
input.InitEffect(input.EffectType.Skill, 183, &Effect183{})
}
type Effect183 struct {
node.EffectNode
}
func (e *Effect183) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect183) DamageLockEx(t *info.DamageZone) bool {
if t.Type != info.DamageType.Red {
return true
}
if t.Damage.Cmp(e.Args()[1]) >= 0 {
t.Damage = t.Damage.Sub(e.Args()[1])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Damage: e.Args()[1],
Type: info.DamageType.Fixed,
})
} else {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Damage: t.Damage,
Type: info.DamageType.Fixed,
})
t.Damage = alpacadecimal.Zero
}
return true
}

View File

@@ -0,0 +1,29 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
func init() {
input.InitEffect(input.EffectType.Skill, 436, &Effect436{
EffectNode: node.EffectNode{},
})
}
type Effect436 struct {
node.EffectNode
}
func (e *Effect436) OnSkill() bool {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP()).Mul(e.Args()[0].Div(alpacadecimal.NewFromInt(100))),
})
return true
}

View File

@@ -0,0 +1,42 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// /
type Effect481 struct {
node.EffectNode
}
func (e *Effect481) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if fattack == nil {
return true
}
//先手是自己
if fattack.PlayerID == e.Ctx().Our.UserID {
return true
}
if sattack == nil {
return true
}
if sattack == nil {
return true
}
if sattack.SkillEntity == nil {
return true
}
//对调
sattack.SkillEntity.Priority += int(e.Args()[0].IntPart())
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 481, &Effect481{})
}