Files
bl/logic/service/fight/effect/effect_62.go
昔念 85f15a72aa ```
refactor(fight): 统一战斗系统方法命名规范并优化逻辑

- 将所有下划线命名的方法统一为驼峰命名,如 Turn_Start 改为 TurnStart,
  Action_end_ex 改为 ActionEndEx,Turn_End 改为 TurnEnd
- 新增 IsOwner() 方法用于判断当前精灵是否为场上的当前宠物
- 将硬编码的 CatchTime 比较逻辑替换为 IsOwner() 方法调用
- 在 NewSel408 中实现消除对手能力强化效果的具体逻辑
- 修复 effect_74 中衰弱状态的数值引用,使用枚举类型代替硬编码
- 优化 input/fight.go 中的技能选择逻辑,使用伤害值比较代替权重比较
- 移除 shiny.go 中未使用的 utils 导入和相关逻辑
- 修正 NewSel77 从 Turn_End 重命名为 TurnStart 的方法
- 在 input/fight.go 中添加 Damage 方法的注释说明
```
2026-01-05 22:54:41 +08:00

109 lines
2.6 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"
"fmt"
"math"
"github.com/alpacahq/alpacadecimal"
)
/**
* n回合内没有击败则对方死亡
*/
type Effect62 struct {
node.EffectNode
// Hide bool // 是否隐藏 正常是命中就可用,镇魂歌是回合数到才可用
// opp *input.Input
// e *Effect62_sub
//l sync.Once
}
type Effect62_sub struct {
node.EffectNode
duy int
//bindpet *info.BattlePetEntity
//bind *input.Input
// Hide bool // 是否隐藏 正常是命中就可用,镇魂歌是回合数到才可用
}
func (e *Effect62_sub) TurnEnd() {
e.duy--
}
// 这个实际上在对方回合执行的
func (e *Effect62_sub) OnSkill() bool {
fmt.Println("镇魂歌剩余回合", e.duy)
//defer e.Alive(false)
if e.duy <= 0 { //说明对方没有切换精灵
//直接扣除所有血量OnSkill
//相当于对方给自己的伤害
e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
})
e.Alive(false)
}
return true
}
func init() {
t := &Effect62{
EffectNode: node.EffectNode{},
}
input.InitEffect(input.EffectType.Skill, 62, t)
}
// func (e *Effect62) TurnStart() {
// //如果对面还是我方放技能时候的玩家
// // if ctx.Player != e.opp.Player {
// // return
// // }
// fmt.Println(e.Duration(), "镇魂歌剩余回合")
// if e.Duration() != 0 { //说明还没到生效节点
// e.Hide = true //隐藏效果
// } else {
// e.opp.AddEffect(e.e)
// }
// // if !e.Hide { //说明是自身回合//如果还在隐藏,就直接返回
// // //t.Duration(e.SideEffectArgs[0])
// // e.opp.AddEffect(e.e)
// // //defer e.EffectNode.NotALive() //失效
// // //应该是对方固定伤害等于自身血量
// // //e.Input.Death() //本只死亡
// // //否则触发秒杀 在对面使用技能后
// // //return true
// // }
// }
// 魂印开局添加,然后切精灵不消失
func (e *Effect62) OnSkill() bool {
//e.Duration(1) //必须保持到下一回合,这样才会被复制
// e.opp = ctx.Input
ee := &Effect62_sub{
// bindpet: ctx.CurrentPet,
// bind: ctx.Input,
}
ee.duy = e.EffectNode.SideEffectArgs[0]
ee.EffectNode.Duration(math.MaxInt) //给对方挂3回合子buff
tt := e.ID()
tt.SetEffectType(input.EffectType.Sub)
ee.ID(tt)
//e.e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
//给对方添加我方施加的buff
ee.SetArgs(e.Ctx().Our, e.SideEffectArgs...)
e.Ctx().Opp.AddEffect(e.Ctx().Our, ee)
return true
}