Files
bl/logic/service/fight/effect/effect_status.go
昔念 30ed47a30c ```
refactor(socket): 优化消息处理逻辑,避免顺序执行问题

将消息处理的循环从协程外部移入协程内部,确保每个消息在独立的 goroutine 中处理,
避免因并发导致的消息顺序错乱问题。同时移除了多余的空行,使代码更简洁。

fix(controller): 为低 ID 用户设置 VIP 标志

在 COMMEND_ONLINE 接口逻辑中,新增对 UserID 小于 10000 的用户设置 IsVip = 1,
用于标识测试或特殊用户身份。

ref
2025-11-03 03:59:59 +08:00

84 lines
1.9 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 {
return false
}
type StatusSleep struct { //睡眠不能出手 ,这个挂载到对面来实现对方攻击后解除睡眠效果
StatusNotSkill
}
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{}) //睡眠
}