Files
bl/logic/service/fight/effect/effect_74.go
昔念 d52c6cbb79 ```
feat(fight): 更新概率判定函数注释并新增状态与属性操作类型

更新 PlayerCaptureContext.Roll 函数注释,明确返回值含义。
新增 PetStatus 枚举值 NULL,表示无效状态。
新增 AbilityOpType.COPY 操作类型,支持复制对手属性值。
```
2025-11-14 04:55:29 +08:00

59 lines
1.3 KiB
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"
"blazing/logic/service/fight/node"
)
/**
* 10%中毒、10%烧伤、10%冻伤剩下70%无效果)
*/
type Effect74 struct {
node.EffectNode
}
func init() {
ret := &Effect74{}
input.InitEffect(input.EffectType.Skill, 74, ret)
}
// 命中之后
func (e *Effect74) OnSkill() bool {
if !e.Hit() {
return true
}
Status := info.PetStatus.NULL
// 生成0-99的随机数共100种可能
switch t := e.Input.FightC.GetRand().Int31n(100); {
case t < 10: // 0-910个数占10%
Status = info.PetStatus.Poisoned
case t < 20: // 10-1910个数占10%
// 触发睡眠效果
Status = info.PetStatus.Burned
case t < 30: // 20-2910个数占10%
// 触发害怕效果
Status = info.PetStatus.Frozen
default: // 30-9970个数占70%
// 无效果
}
if Status == info.PetStatus.NULL {
return true
}
// 获取状态效果
eff := input.Geteffect(input.EffectType.Status, int(Status))
if eff == nil {
return true
}
duration := int(e.Input.FightC.GetRand().Int31n(2)) // 默认随机 2~3 回合
duration++
eff.Duration(duration)
eff.SetArgs(e.Ctx().Our) //输入参数是对方
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
return true
}