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中未
103 lines
2.6 KiB
Go
103 lines
2.6 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
)
|
||
|
||
// -----------------------------------------------------------
|
||
// 效果147:后出手时,{0}%概率使对方{1}
|
||
// -----------------------------------------------------------
|
||
type Effect147 struct {
|
||
node.EffectNode
|
||
can bool
|
||
}
|
||
|
||
func (e *Effect147) Skill_Use() bool {
|
||
|
||
if e.IsFirst() {
|
||
return true
|
||
}
|
||
chance := int(e.Args()[0].IntPart())
|
||
|
||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||
if ok {
|
||
// 使对方进入指定状态(Args[1]为状态类型)
|
||
statusType := int(e.Args()[1].IntPart())
|
||
statusEff := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
|
||
if statusEff != nil {
|
||
statusEff.SetArgs(e.Ctx().Our, 2)
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// -----------------------------------------------------------
|
||
// 效果148:后出手时,{1}%改变对方{0}等级{2}
|
||
// -----------------------------------------------------------
|
||
type Effect148 struct {
|
||
node.EffectNode
|
||
can bool
|
||
}
|
||
|
||
func (e *Effect148) Skill_Use() bool {
|
||
|
||
if e.IsFirst() {
|
||
return true
|
||
}
|
||
propIndex := int(e.Args()[0].IntPart())
|
||
chance := int(e.Args()[1].IntPart())
|
||
changeAmount := int(e.Args()[2].IntPart())
|
||
|
||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||
if ok {
|
||
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// -----------------------------------------------------------
|
||
// 效果159:自身体力小于最大值的1/{0}时,{1}%概率令对方{2}
|
||
// -----------------------------------------------------------
|
||
type Effect159 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect159) Skill_Use() bool {
|
||
|
||
// 检查自身体力是否小于最大值的1/{0}
|
||
maxHP := int64(e.Ctx().Our.CurrentPet.Info.MaxHp)
|
||
currentHP := int64(e.Ctx().Our.CurrentPet.Info.Hp)
|
||
|
||
// 比较 currentHP * {0} < maxHP
|
||
if currentHP*int64(e.Args()[0].IntPart()) < maxHP {
|
||
// 满足条件:{1}%概率令对方{2}
|
||
chance := int(e.Args()[1].IntPart())
|
||
|
||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||
if ok {
|
||
statusType := int(e.Args()[2].IntPart())
|
||
statusEff := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
|
||
if statusEff != nil {
|
||
statusEff.SetArgs(e.Ctx().Our, 2)
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
|
||
}
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// -----------------------------------------------------------
|
||
// 初始化
|
||
// -----------------------------------------------------------
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 147, &Effect147{})
|
||
input.InitEffect(input.EffectType.Skill, 148, &Effect148{})
|
||
|
||
input.InitEffect(input.EffectType.Skill, 159, &Effect159{})
|
||
}
|