Files
bl/logic/service/fight/effect/effect_status.go
昔念 e75ecd413d feat(fight): 重构战斗系统技能逻辑与精灵切换功能
- 优化技能执行流程,统一使用 SelectSkillAction 作为技能载体
- 移除冗余的技能 ID 字段,简化数据结构
- 调整命中判断和技能效果触发机制,提升准确性
- 修改精灵切换与捕获相关方法参数格式
- 更新技能列表结构为动态数组以支持灵活长度
- 完善睡眠等异常状态的处理逻辑
- 修复战斗中技能 PP 扣减及副本还原问题
- 清理无用代码,如多余的 FindWithIndex 函数定义
- 强化验证码缓存键命名规则,增强安全性
2025-10-26 20:56:03 +08:00

91 lines
2.0 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"
"github.com/shopspring/decimal"
)
// 施加一个基类effect
type EffectStatus struct {
node.EffectNode
Status info.EnumBattleStatus
}
type StatusNotSkill struct {
EffectStatus
}
// 不能出手
func (e *StatusNotSkill) Skill_Hit_Pre(ctx input.Ctx) bool {
if e.EffectStatus.Status == info.PetStatus.Sleep {
ctx.AddEffect(&input.EffectID{ //对对方添加出手解除效果
ID: -1,
Effect: &StatusSleep{},
})
}
return false
}
type StatusSleep struct { //睡眠不能出手
node.EffectNode
}
func (e *StatusSleep) Skill_Useed(input.Ctx) bool {
return true
}
// 扣血类
type DrainHP struct {
EffectStatus
}
func (e *DrainHP) Skill_Hit_Pre(input input.Ctx) bool {
input.DamageZone = &info.DamageZone{
Type: info.DamageType.True, //状态类扣除无法被减伤
Damage: decimal.NewFromUint64(uint64(e.Input.CurrentPet.Info.MaxHp)).
Div(decimal.NewFromInt(8)),
}
e.Input.Damage(input)
return true
}
// 被寄生种子 扣血类
type StatusDrainedHP struct {
DrainHP
}
func (e *StatusDrainedHP) Skill_Hit_Pre(input input.Ctx) bool {
e.DrainHP.Skill_Hit_Pre(input) //先调用父类扣血
//TODO 寄生种子 给对面回血待实现回血buff
// input.CurrentPet.Info.Hp = -e.Input.CurrentPet.Info.MaxHp / 8
return true
}
func init() {
//麻痹,疲惫,害怕,石化,都是无法行动
tt := func(t info.EnumBattleStatus, f *StatusNotSkill) {
f.Status = t
input.InitEffect(input.EffectType.Status, int(t), f)
}
input.InitEffect(input.EffectType.Status, int(info.PetStatus.DrainHP), &EffectStatus{}) //寄生种子
tt(info.PetStatus.Paralysis, &StatusNotSkill{}) //麻痹
tt(info.PetStatus.Tired, &StatusNotSkill{}) //疲惫
tt(info.PetStatus.Fear, &StatusNotSkill{}) //害怕
tt(info.PetStatus.Petrified, &StatusNotSkill{}) //石化
input.InitEffect(input.EffectType.Status, 8, &StatusSleep{}) //睡眠
}