Files
bl/logic/service/fight/effect/effect_41.go
昔念 a95e6b8491 ```
feat(common): 升级 gf 框架版本至 v2.8.0 并优化模型时间字段

- 将 `github.com/gogf/gf/contrib/drivers/pgsql/v2` 和 redis 依赖从 v2.6.3 升级到 v2.8.0
- 使用 `*gtime.Time` 替代标准库 `time.Time` 以支持更灵活的时间处理
- 移除 Model 结构体中 CreateTime、UpdateTime 等字段的默认初始化逻辑
- 注释掉已弃用的 GDBM 函数,推荐使用 DBM
- 在 DBM 中添加 OnConflict("id") 配置以增强写入安全性
- 调整部分代码结构与调用方式以适配新版框架行为
```
2025-11-17 12:59:46 +08:00

60 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/shopspring/decimal"
)
/**
*m~n回合对本方的火系攻击伤害减半
*/
func init() {
input.InitEffect(input.EffectType.Skill, 41, &Effect41{})
}
type Effect41 struct {
node.EffectNode
}
func (e *Effect41) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
t1 := e.Input.FightC
t2 := t1.GetRand()
n := t2.Int31n(int32(e.Args()[1]-e.Args()[0]+1)) + int32(e.Args()[0])
e.EffectNode.Duration(int(n))
}
// 伤害落实前触发,限制最大伤害
func (e *Effect41) Damage_DIV_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.Type().Secondary != nil {
return true
}
if e.Ctx().SkillEntity.Type().Primary != element.ElementTypeFire {
return true
}
if t.Type == info.DamageType.Red {
t.Damage = t.Damage.Div(decimal.NewFromInt(2))
}
return true
}