Files
bl/logic/service/fight/effect/effect_117.go
xinian 875ad668aa
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现战斗效果逻辑和接口重构
2026-03-28 21:57:22 +08:00

47 lines
892 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/gogf/gf/v2/util/grand"
)
/**
* n回合若自己先手则m%几率让对手害怕1到3回合
*/
func init() {
t := &Effect117{}
input.InitEffect(input.EffectType.Skill, 117, t)
}
// Effect 117: 5回合内如果先出手50%概率对手害怕1到3回合
type Effect117 struct {
RoundEffectSideArg0Base
}
// 默认添加回合
func (e *Effect117) OnSkill() bool {
if e.Input.FightC.IsFirst(e.Input.Player) {
// 概率判定
ok, _, _ := e.Input.Player.Roll(e.EffectNode.SideEffectArgs[1], 100)
if !ok {
return true
}
// 获取状态效果
eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
if eff == nil {
return true
}
eff.Duration(grand.Intn(3))
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
}
return true
}