``` refactor(fight): 重构状态效果初始化逻辑,统一使用InitEffect方法并内置随机持续回合
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
"github.com/brunoga/deep"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
"github.com/tnnmigga/enum"
|
||||
)
|
||||
|
||||
@@ -72,6 +73,7 @@ func Geteffect[T int | byte | uint16](etype EnumEffectType, id T) Effect {
|
||||
|
||||
if etype == EffectType.Status {
|
||||
eff.CanStack(true) //状态类不能被覆盖,只能无限叠加
|
||||
eff.Duration(grand.N(1, 2))
|
||||
|
||||
}
|
||||
|
||||
@@ -80,6 +82,12 @@ func Geteffect[T int | byte | uint16](etype EnumEffectType, id T) Effect {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (our *Input) InitEffect(etype EnumEffectType, id int) Effect {
|
||||
ret := Geteffect(etype, id)
|
||||
ret.SetArgs(our) //输入参数是对方
|
||||
return ret
|
||||
|
||||
}
|
||||
|
||||
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
|
||||
// 是否需要真实提升
|
||||
|
||||
Reference in New Issue
Block a user