2025-08-28 02:44:10 +00:00
|
|
|
package effect
|
|
|
|
|
|
|
|
|
|
import (
|
2025-09-24 18:53:54 +00:00
|
|
|
"blazing/logic/service/fight/info"
|
2025-09-14 03:36:26 +08:00
|
|
|
"blazing/logic/service/fight/input"
|
2025-09-14 01:35:16 +08:00
|
|
|
"blazing/logic/service/fight/node"
|
2025-08-28 02:44:10 +00:00
|
|
|
)
|
|
|
|
|
|
2025-11-03 03:59:59 +08:00
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
// 注册
|
|
|
|
|
// -----------------------------------------------------------
|
2025-08-28 02:44:10 +00:00
|
|
|
func init() {
|
2025-12-11 19:12:54 +00:00
|
|
|
initskill(4, newEffectStat(false))
|
|
|
|
|
initskill(5, newEffectStat(true))
|
|
|
|
|
|
2025-08-28 02:44:10 +00:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 03:59:59 +08:00
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
// 构造
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
func newEffectStat(targetOpponent bool) input.Effect {
|
|
|
|
|
e := &EffectStat{
|
|
|
|
|
Etype: targetOpponent,
|
2025-09-06 00:31:08 +08:00
|
|
|
}
|
2025-11-14 06:14:49 +08:00
|
|
|
//e.CanStack(-1) // 无限叠加
|
2025-11-03 03:59:59 +08:00
|
|
|
return e
|
2025-09-03 00:37:05 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 03:59:59 +08:00
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
// 主体结构
|
|
|
|
|
// -----------------------------------------------------------
|
2025-09-06 00:31:08 +08:00
|
|
|
type EffectStat struct {
|
|
|
|
|
node.EffectNode
|
2025-11-03 03:59:59 +08:00
|
|
|
Etype bool // false: 作用自身, true: 作用对方
|
2025-08-28 02:44:10 +00:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 03:59:59 +08:00
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
// 技能触发时调用
|
|
|
|
|
// -----------------------------------------------------------
|
2025-11-11 05:54:24 +00:00
|
|
|
func (e *EffectStat) OnSkill() bool {
|
2025-11-03 03:59:59 +08:00
|
|
|
|
|
|
|
|
// 参数解构 (防止 SideEffectArgs 长度不足)
|
|
|
|
|
var (
|
|
|
|
|
statIndex int // 哪个属性
|
|
|
|
|
chance int // 触发概率
|
|
|
|
|
level int // 增减值
|
|
|
|
|
)
|
|
|
|
|
if len(e.SideEffectArgs) > 0 {
|
|
|
|
|
statIndex = e.SideEffectArgs[0]
|
|
|
|
|
}
|
|
|
|
|
if len(e.SideEffectArgs) > 1 {
|
|
|
|
|
chance = e.SideEffectArgs[1]
|
|
|
|
|
}
|
|
|
|
|
if len(e.SideEffectArgs) > 2 {
|
|
|
|
|
level = e.SideEffectArgs[2]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 概率判定
|
|
|
|
|
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
|
|
|
|
if !ok {
|
2025-10-26 20:56:03 +08:00
|
|
|
return true
|
2025-09-25 17:15:06 +00:00
|
|
|
}
|
2025-11-03 03:59:59 +08:00
|
|
|
|
|
|
|
|
// 判断加减类型
|
|
|
|
|
opType := info.AbilityOpType.ADD
|
|
|
|
|
if level < 0 {
|
|
|
|
|
opType = info.AbilityOpType.SUB
|
2025-09-25 17:15:06 +00:00
|
|
|
}
|
2025-09-23 19:28:19 +00:00
|
|
|
|
2025-11-03 03:59:59 +08:00
|
|
|
// 执行属性变化
|
|
|
|
|
if e.Etype {
|
|
|
|
|
// 对方属性变化
|
2025-11-11 05:54:24 +00:00
|
|
|
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType)
|
2025-11-03 03:59:59 +08:00
|
|
|
} else {
|
|
|
|
|
// 自身属性变化
|
2025-11-11 05:54:24 +00:00
|
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType)
|
2025-09-06 00:31:08 +08:00
|
|
|
}
|
2025-11-03 03:59:59 +08:00
|
|
|
|
2025-10-26 20:56:03 +08:00
|
|
|
return true
|
2025-08-28 02:44:10 +00:00
|
|
|
}
|