Files
bl/logic/service/fight/effect/effect_8.go
昔念 294cb2e3fd feat(login): 重构登录逻辑并迁移每日重置功能到 Personself 方法
将原本在 Controller.Login 中处理的每日重置逻辑(如电池、任务等)迁移到
service.Info.Personself 方法中,并移除对 gtime.Now().Time 的旧引用。同时更新了
相关的时间判断函数 IsToday,使其支持 *gtime.Time 类型。

此外,清理无用导入包,优化日志打印方式,并修复部分结构体字段定义与使用问题。
2025-12-07 19:23:44 +08:00

53 lines
1002 B
Go

package effect
import (
"blazing/common/utils"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
* 伤害大于对方体力时会余下1体力
*/
func init() {
input.InitEffect(input.EffectType.Skill, 8, &Effect8{})
}
type Effect8 struct {
node.EffectNode
max alpacadecimal.Decimal
}
// DamageFloor 伤害落实前触发,限制最大伤害
func (e *Effect8) DamageFloor(t *info.DamageZone) bool {
if t.Type == info.DamageType.Red {
t.Damage = alpacadecimal.NewFromInt(utils.Min(t.Damage.IntPart(),
int64(e.Ctx().Opp.CurrentPet.Info.Hp)-1))
e.max = t.Damage
}
return true
}
func (e *Effect8) DamageLock(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
//fmt.Println("Effect7_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
if t.Damage.Cmp(e.max) == 1 {
t.Damage = e.max
}
}
// fmt.Println("Effect7_new", t.Damage.IntPart())
return true
}