Files
bl/logic/service/fight/effect/back.go1
昔念 1fa1ae848d
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
feat(fight): 实现技能PP消耗Hook机制并优化效果处理

- 在Effect475中添加子效果时通过Ctx().Our.AddEffect正确添加效果
- 删除已废弃的Effect407、Effect440和Effect412效果类型
- 在fightc.go中实现技能使用后的PP消耗Hook机制,支持效果修改PP消耗数量
- 添加HookPP接口方法用于处理技能使用的PP消耗逻辑
- 在SkillInfo中添加Use方法用于实际消耗PP值
```
2026-03-09 23:44:09 +08:00

95 lines
2.2 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"
)
// 523 - 若当回合未击败对手则自身1 1 1 1 1 1能力+1
type Effect523 struct {
node.EffectNode
}
func (e *Effect523) Action_end_ex() bool {
// 检查对手是否还活着
if e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
// 提升自身的全部能力等级
stats := []int{
int(info.PetStatus.AtkUp),
int(info.PetStatus.DefUp),
int(info.PetStatus.SpAtkUp),
int(info.PetStatus.SpDefUp),
int(info.PetStatus.SpeedUp),
int(info.PetStatus.AccuracyUp),
}
for _, stat := range stats {
statEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, stat)
if statEffect != nil {
statEffect.SetArgs(e.Ctx().Our, 1) // 提升1级
e.Ctx().Our.AddEffect(e.Ctx().Our, statEffect)
}
}
}
return true
}
// 457 - 复制对手释放的技能(组队对战时无效)
type Effect457 struct {
node.EffectNode
}
func (e *Effect457) Skill_Use_ex() bool {
// 这里需要检查是否在组队对战中
if !e.Ctx().IsTeamBattle { // 不是组队对战
if e.Ctx().SkillEntity != nil {
// 复制对手释放的技能
e.Ctx().Our.CopySkill(e.Ctx().SkillEntity)
}
}
return true
}
// 197 - n回合内若被对方击败则对手所有能力加强状态消失
type Effect197 struct {
node.EffectNode
}
func (e *Effect197) Skill_Use() bool {
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败
// 清除对手的所有能力加强状态
e.Ctx().Opp.RemoveAllPositiveBuffs()
}
return true
}
func (e *Effect197) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(a[0]) // 持续n回合
}
// 199 - 下次被击败后下一个出场的精灵xx等级+k
type Effect199 struct {
node.EffectNode
}
func (e *Effect199) Skill_Use() bool {
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败
// 设置下一个出场精灵的增益效果
effectType := int(e.Args()[0].IntPart()) // xx类型
effectValue := int(e.Args()[1].IntPart()) // 等级+k
buffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
if buffEffect != nil {
buffEffect.SetArgs(e.Ctx().Our, effectValue)
e.Ctx().Our.SetNextPetBuff(buffEffect)
}
}
return true
}