Files
bl/logic/service/fight/effect/effect_124_126.go
昔念 99ef152434
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
```
refactor(fight): 统一技能执行方法命名并修复战斗逻辑错误

- 将多个boss技能结构体中的OnSkill()方法重命名为Skill_Use()以保持一致性
- 修改fightc.go中的战斗回合逻辑,修复attacker和defender的执行顺序错误
- 将Effect126的TurnStart方法改为Skill_Use方法并返回bool值
- 为Effect499添加缺失的方法实现
- 移除effect_124_126.go中未
2026-03-09 17:42:52 +08:00

63 lines
1.7 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/input"
"blazing/logic/service/fight/node"
)
// -----------------------------------------------------------
// 效果124命中后{0}%概率随机对方一个属性{1}个等级
// -----------------------------------------------------------
type Effect124 struct {
node.EffectNode
}
func (e *Effect124) OnSkill() bool {
chance := int(e.Args()[0].IntPart())
changeAmount := int(e.Args()[1].IntPart())
ok, _, _ := e.Input.Player.Roll(chance, 100)
if !ok {
return true
}
// 随机选择一个属性0-5包含攻击、防御、特攻、特防、速度、命中
propIndex := int(e.Input.FightC.GetRand().Int31n(6))
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
return true
}
// -----------------------------------------------------------
// 效果126{0}回合内每回合自身攻击和速度提高{1}个等级
// -----------------------------------------------------------
type Effect126 struct {
node.EffectNode
}
func (e *Effect126) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect126) Skill_Use() bool {
changeAmount := int(e.Args()[1].IntPart())
// 攻击等级+1 (属性索引0)
e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount))
// 速度等级+1 (属性索引4)
e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount))
return true
}
// -----------------------------------------------------------
// 初始化
// -----------------------------------------------------------
func init() {
input.InitEffect(input.EffectType.Skill, 124, &Effect124{})
input.InitEffect(input.EffectType.Skill, 126, &Effect126{})
}