Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
fix(fight): 修复技能实体属性访问问题 - 修改所有技能实体的ID、Power、CritRate、MustHit、Priority等属性访问方式 从直接访问改为通过XML字段访问,确保数据一致性 - 更新多个boss技能效果处理逻辑中的属性引用路径 - 移除已废弃的effect/486文件 - 在New
122 lines
3.0 KiB
Go
122 lines
3.0 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
)
|
|
|
|
// ---- 全局函数表自动管理 ----
|
|
var statusFuncRegistry = newStatusFuncRegistry()
|
|
|
|
type statusFuncRegistryType struct {
|
|
funcs map[int]func(*input.Input, *input.Input) bool
|
|
}
|
|
|
|
func newStatusFuncRegistry() *statusFuncRegistryType {
|
|
return &statusFuncRegistryType{funcs: make(map[int]func(*input.Input, *input.Input) bool)}
|
|
}
|
|
|
|
func (r *statusFuncRegistryType) Register(id int, f func(*input.Input, *input.Input) bool) {
|
|
r.funcs[id] = f
|
|
}
|
|
|
|
func (r *statusFuncRegistryType) Get(id int) func(*input.Input, *input.Input) bool {
|
|
return r.funcs[id]
|
|
}
|
|
|
|
// ---- Effect96 ----
|
|
type Effect96 struct {
|
|
node.EffectNode
|
|
StatusID int
|
|
}
|
|
|
|
func (e *Effect96) SkillHit() bool {
|
|
if f := statusFuncRegistry.Get(e.StatusID); f != nil && f(e.Ctx().Our, e.Ctx().Opp) {
|
|
e.Ctx().SkillEntity.XML.Power *= 2
|
|
}
|
|
return true
|
|
}
|
|
|
|
// ---- 注册所有效果 ----
|
|
func init() {
|
|
registerStatusFunc(2, func(i, o *input.Input) bool {
|
|
return o.CurrentPet.Info.Hp < (o.CurrentPet.Info.MaxHp / 2)
|
|
})
|
|
registerStatusFunc(30, func(i, o *input.Input) bool {
|
|
return !i.FightC.IsFirst(i.Player)
|
|
})
|
|
registerStatusFunc(40, func(i, o *input.Input) bool {
|
|
return i.FightC.IsFirst(i.Player)
|
|
})
|
|
registerStatusFunc(64, func(i, o *input.Input) bool {
|
|
if i.StatEffect_Exist(info.PetStatus.Burned) {
|
|
return true
|
|
}
|
|
if i.StatEffect_Exist(info.PetStatus.Frozen) {
|
|
return true
|
|
}
|
|
if i.StatEffect_Exist(info.PetStatus.Poisoned) {
|
|
return true
|
|
}
|
|
return false
|
|
})
|
|
registerStatusFunc(96, func(i, o *input.Input) bool {
|
|
return o.StatEffect_Exist(info.PetStatus.Burned)
|
|
})
|
|
registerStatusFunc(97, func(i, o *input.Input) bool {
|
|
return o.StatEffect_Exist(info.PetStatus.Frozen)
|
|
})
|
|
registerStatusFunc(102, func(i, o *input.Input) bool {
|
|
return o.StatEffect_Exist(info.PetStatus.Paralysis)
|
|
})
|
|
initskill(129, &Effect129{})
|
|
|
|
registerStatusFunc(132, func(i, o *input.Input) bool {
|
|
return i.CurrentPet.Info.Hp < o.CurrentPet.Info.Hp
|
|
})
|
|
registerStatusFunc(168, func(i, o *input.Input) bool {
|
|
return o.StatEffect_Exist(info.PetStatus.Sleep)
|
|
})
|
|
registerStatusFunc(401, func(i, o *input.Input) bool {
|
|
return i.CurrentPet.PetInfo.Type == o.CurrentPet.PetInfo.Type
|
|
})
|
|
registerStatusFunc(431, func(i, o *input.Input) bool {
|
|
|
|
return o.HasPropSub()
|
|
})
|
|
initskill(609, &Effect609{})
|
|
}
|
|
|
|
type Effect129 struct {
|
|
node.EffectNode
|
|
StatusID int
|
|
}
|
|
|
|
func (e *Effect129) SkillHit() bool {
|
|
if e.Ctx().Opp.CurrentPet.Info.Gender != e.SideEffectArgs[0] {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.XML.Power *= 2
|
|
return true
|
|
}
|
|
|
|
// 小助手函数,让注册看起来更自然
|
|
func registerStatusFunc(id int, fn func(*input.Input, *input.Input) bool) {
|
|
statusFuncRegistry.Register(id, fn)
|
|
input.InitEffect(input.EffectType.Skill, id, &Effect96{StatusID: id})
|
|
}
|
|
|
|
type Effect609 struct {
|
|
node.EffectNode
|
|
StatusID int
|
|
}
|
|
|
|
func (e *Effect609) SkillHit() bool {
|
|
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.SideEffectArgs[0])) {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.XML.Power *= 2
|
|
return true
|
|
}
|