refactor: 重构战斗效果实现逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-23 07:36:20 +08:00
committed by cnb
parent ce3f1fc02e
commit 84024aed83
2 changed files with 8 additions and 21 deletions

View File

@@ -1,12 +1,9 @@
package effect
import (
element "blazing/common/data/Element"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 428 - 遇到天敌时附加m点固定伤害
@@ -14,21 +11,15 @@ type Effect428 struct {
node.EffectNode
}
func (e *Effect428) SkillHit_ex() bool {
t, _ := element.Calculator.GetOffensiveMultiplier(e.Ctx().Opp.CurrentPet.Type, e.Ctx().Our.CurrentPet.Type)
// evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(e.Ctx().Our.CurrentPet.ID)].NaturalEnemy, " "))
// _, ok := lo.Find(evs, func(t uint32) bool {
// return t == uint32(e.Ctx().Opp.CurrentPet.ID)
// })
if t <= 1 {
func (e *Effect428) Skill_Use() bool {
if !e.ISNaturalEnemy() {
return true
}
// 附加m点固定伤害
additionalDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
damageZone := &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: additionalDamage,
Damage: e.Args()[0],
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)

View File

@@ -10,19 +10,15 @@ type Effect518 struct {
node.EffectNode
}
func (e *Effect518) SkillHit_ex() bool {
func (e *Effect518) Skill_Use_ex() bool {
damageThreshold := int(e.Args()[0].IntPart())
damageDone := e.Ctx().Our.SumDamage
if damageDone.IntPart() > int64(damageThreshold) {
effectType := int(e.Args()[1].IntPart()) // XX类型
effectValue := int(e.Args()[2].IntPart()) // 等级+n
effectType := int8(e.Args()[1].IntPart()) // XX类型
effectValue := int8(e.Args()[2].IntPart()) // 等级+n
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
statusEffect.SetArgs(e.Ctx().Our, effectValue)
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
}
e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue)
}
return true