对多个 boss 技能效果文件中的参数调用进行了统一调整,将原先直接使用 `e.Args()[index]` 的地方, 改为通过 `e.Args()[index].IntPart()` 或 `e.Args()[index]` 进行类型转换后再参与逻辑判断或数值计算。 同时修正了部分 HP 比较方式,由整型比较转为 decimal
52 lines
983 B
Go
52 lines
983 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))
|
|
|
|
}
|
|
|
|
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
|
|
}
|