feat: 新增多个战斗效果并修复逻辑问题
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-07 14:51:32 +08:00
committed by cnb
parent 02629b6f6c
commit de8ce9fc81
8 changed files with 210 additions and 1 deletions

View File

@@ -27,6 +27,17 @@ func (e *NewSel404) DamageDivEx(t *info.DamageZone) bool {
return true
}
type NewSel127 struct {
NewSel404
}
func (e *NewSel127) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[1])
}
func init() {
input.InitEffect(input.EffectType.NewSel, 404, &NewSel404{})
input.InitEffect(input.EffectType.NewSel, 127, &NewSel127{})
}

View File

@@ -0,0 +1,27 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/node"
)
type Effect154 struct {
node.EffectNode
}
func init() {
initskill(154, &Effect154{})
}
// 命中之后
func (e *Effect154) OnSkill() bool {
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
e.Input.Heal(
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(e.Args()[1]),
)
}
return true
}

View File

@@ -0,0 +1,35 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
/**
* 182
*/
func init() {
input.InitEffect(input.EffectType.Skill, 182, &Effect182{})
}
type Effect182 struct {
node.EffectNode
}
func (e *Effect182) OnSkill() bool {
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100)
if !success {
return true
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), int8(e.Args()[3].IntPart()), info.AbilityOpType.ADD)
}
return true
}

View File

@@ -0,0 +1,38 @@
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, 408, &Effect408{})
input.InitEffect(input.EffectType.Skill, 463, &Effect408{})
}
type Effect408 struct {
node.EffectNode
}
func (e *Effect408) DamageSubEx(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])
} else {
t.Damage = alpacadecimal.Zero
}
return true
}
func (e *Effect408) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}

View File

@@ -0,0 +1,42 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
type Effect448 struct {
node.EffectNode
rev bool
}
func (e *Effect448) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect448) OnSkill() bool {
for i, v := range e.SideEffectArgs[1:] {
if e.rev {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v), info.AbilityOpType.SUB)
} else {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v), info.AbilityOpType.ADD)
}
}
return true
}
// -----------------------------------------------------------
// 初始化
// -----------------------------------------------------------
func init() {
input.InitEffect(input.EffectType.Skill, 448, &Effect448{
rev: true,
})
input.InitEffect(input.EffectType.Skill, 433, &Effect448{
rev: false,
})
}

View File

@@ -22,7 +22,7 @@ type Effect467 struct {
func (e *Effect467) OnSkill() bool {
if e.Ctx().Our.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],

View File

@@ -0,0 +1,50 @@
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, 508, &Effect508{})
}
type Effect508 struct {
node.EffectNode
Can bool
}
func (e *Effect508) OnSkill() bool {
e.Can = true
return true
}
func (e *Effect508) DamageSubEx(t *info.DamageZone) bool {
if !e.Can {
return true
}
if t.Type != info.DamageType.Red {
return true
}
if t.Damage.Cmp(e.Args()[1]) > 0 {
t.Damage = t.Damage.Sub(e.Args()[1])
} else {
t.Damage = alpacadecimal.Zero
}
return true
}
func (e *Effect508) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}

View File

@@ -23,6 +23,9 @@ func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAb
switch t {
case info.AbilityOpType.ADD:
// 属性提升上限为6
if l < 0 {
l = -l
}
newValue = utils.Min(target.AttackValue.Prop[p]+l, 6)
if newValue > target.AttackValue.Prop[p] {
//fmt.Println("属性值会增加")
@@ -32,6 +35,9 @@ func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAb
return false
case info.AbilityOpType.SUB:
if l > 0 {
l = -l
}
// 属性降低,下限为-6
newValue = utils.Max(target.AttackValue.Prop[p]+l, -6)
if newValue < target.AttackValue.Prop[p] {