Files
bl/logic/service/fight/effect/effect_42.go
昔念 b6ec530c68
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
feat(fight): 添加闪亮怪物判断条件并修复物品添加参数格式

- 在战斗逻辑中增加对闪亮怪物的判断,只有闪亮怪物击败后才能获得玄铁
- 修复物品添加时uint32类型转换的参数格式问题
- 添加effect_42技能效果的参数设置方法
- 引入随机数库用于效果持续
2026-02-27 23:29:16 +08:00

51 lines
1.1 KiB
Go

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"
"github.com/gogf/gf/v2/util/grand"
)
// n回合提示m翻倍
// ---- Effect42 ----
type Effect42 struct {
node.EffectNode
StatusID int
}
func (e *Effect42) Damage_Mul(t *info.DamageZone) bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Type != int(element.ElementTypeElectric) {
return true
}
//fmt.Println("Effect42_o", t.Damage)
if t.Type == info.DamageType.Red {
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(2))
}
//fmt.Println("Effect42_n", t.Damage)
return true
}
func (e *Effect42) SetArgs(t *input.Input, a ...int) {
//e.CanStack(-1)//后续的不会顶掉这个效果
e.EffectNode.SetArgs(t, a...)
e.Duration(grand.N(int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))) //次数类,无限回合
}
// ---- 注册所有效果 ----
func init() {
input.InitEffect(input.EffectType.Skill, 42, &Effect42{})
}