Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
refactor(fight): 移除能力操作类型枚举并简化属性设置方法 移除了 info.EnumAbilityOpType 枚举类型及其相关常量定义, 重构了 SetProp 方法调用,不再传递操作类型参数, 通过检查等级正负值来判断是增加还是减少属性, 减少了代码复杂度并统一了属性变更的处理逻辑。 ```
34 lines
766 B
Go
34 lines
766 B
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
)
|
||
|
||
// 403 - 技能使用成功时,n%令自身特攻和速度等级+m。若和对手属性相同,则技能效果翻倍
|
||
type Effect403 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect403) OnSkill() bool {
|
||
chance := e.Args()[0].IntPart()
|
||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||
|
||
if success {
|
||
boostValue := int8(e.Args()[1].IntPart())
|
||
// 检查属性是否相同
|
||
if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type {
|
||
boostValue *= 2
|
||
}
|
||
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, boostValue)
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, boostValue)
|
||
}
|
||
|
||
return true
|
||
}
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 403, &Effect403{})
|
||
|
||
}
|