Files
bl/logic/service/fight/effect/effect_status.go
昔念 a86782b1ea ```text
refactor(fight): 重构战斗准备逻辑并优化战斗启动流程

将 ReadyFight 方法拆分为多个职责清晰的子方法:
- buildFightStartInfo: 构建战斗初始信息
- checkBothPlayersReady: 检查PVP双方是否就绪
- handleNPCFightSpecial: 处理NPC战斗特殊逻辑(如可捕捉标记)
- startBattle: 统一启动战斗流程

同时修复部分逻辑顺序问题,增强代码可读性和扩展性。

feat(fight): 新增精灵王挑战协议支持

增加 StartPetWarInboundInfo 结构体用于接收精灵王挑战请求,
为后续实现相关功能提供基础。

fix(effect): 修正多个技能效果数值引用错误

- effect_37: 技能威力计算使用正确参数索引
- effect_50: 固定减伤比例调整为除以2
- effect_65: 正确比较技能分类类型
- effect_68: 致死保护改为锁定剩余1点生命值
- effect_77: 回复目标由敌方改为己方
- effect_93: 固定伤害值直接取参数

refactor(effect): 移除冗余效果类文件

删除 effect_133.go 和 effect_90.go 文件,其功能已被统一条件伤害和倍率系统取代;
移除 effect_74.go、effect_75.go 中重复的状态随机施加逻辑。

refactor(effect): 更新能力操作枚举命名一致性

重命名 AbilityOpType 枚举项名称,去除前缀,提升语义清晰度:
- AbilityOpStealStrengthen → StealStrengthen
- AbilityOpReverse → Reverse
- AbilityOpBounceWeaken → BounceWeaken

chore(fight): 完善 BattlePetEntity 属性初始化逻辑

在创建 BattlePetEntity 时即设置 PType,避免后续多次查询 PetMAP;
移除 Type() 方法中的冗余配置查找逻辑。

fix(skill): 确保必中技能不参与命中率计算

在 AttackTimeC 方法中添加 return 防止必中技能继续执行命中率公式计算。

refactor(fight): 调整战斗回合结束逻辑

进入新回合时允许玩家更换精灵,并提前跳出循环防止多余处理。

style(effect): 更正拼写及变量命名风格

修改 BaseSataus.Switch 方法签名中的参数命名;
更正 Effect58 中 can 字段首字母大写;
2025-11-14 23:09:16 +08:00

125 lines
3.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/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/gogf/gf/v2/util/gconv"
"github.com/shopspring/decimal"
)
type BaseSataus struct {
node.EffectNode
Status info.EnumPetStatus
}
// /重写切换事件
func (e *BaseSataus) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePetEntity) bool {
//状态如果是我方切换,那么就消除掉状态效果
if in == e.Ctx().Our {
//下场,执行消回合效果
// e.ctx.Our.CancelAll()
///我放下场
e.Alive(false)
}
return true
}
type StatusNotSkill struct {
BaseSataus
}
// 不能出手
func (e *StatusNotSkill) Skill_Hit_Pre(a, b *action.SelectSkillAction) bool {
return false
}
type StatusSleep struct { //睡眠不能出手 ,这个挂载到对面来实现对方攻击后解除睡眠效果
StatusNotSkill
can bool
}
func (e *StatusSleep) Skill_Hit_Pre(a, b *action.SelectSkillAction) bool {
e.can = true
return e.StatusNotSkill.Skill_Hit_Pre(a, b)
}
func (e *StatusSleep) Skill_Use_ex() bool {
if !e.can {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().Category() != info.Category.STATUS {
e.Alive(false)
}
return true
}
// 扣血类
type DrainHP struct {
BaseSataus
damage decimal.Decimal
}
func (e *DrainHP) Skill_Hit_Pre(a, b *action.SelectSkillAction) bool {
e.damage = decimal.NewFromUint64(uint64(e.Ctx().Our.CurrentPet.Info.MaxHp)).
Div(decimal.NewFromInt(8))
e.Ctx().Our.Damage(e.Input, &info.DamageZone{
Type: info.DamageType.True,
Damage: e.damage,
})
return true
}
// 被寄生种子 扣血类
type DrainedHP struct {
DrainHP
}
func (e *DrainedHP) Skill_Hit_Pre(a, b *action.SelectSkillAction) bool {
if gconv.Int(e.Ctx().Our.CurrentPet.Type) == 1 {
return true
}
e.DrainHP.Skill_Hit_Pre(a, b) //先调用父类扣血
//TODO 寄生种子 给对面回血待实现回血buff
//这个回血不属于任何类型,所以不会被阻止回血
e.Ctx().Opp.Heal(e.Ctx().Our, nil, e.damage)
// input.CurrentPet.Info.Hp = -e.Input.CurrentPet.Info.MaxHp / 8
return true
}
func init() {
//麻痹,疲惫,害怕,石化,都是无法行动
tt := func(t info.EnumPetStatus, f *StatusNotSkill) {
f.Status = t
input.InitEffect(input.EffectType.Status, int(t), f)
}
input.InitEffect(input.EffectType.Status, int(info.PetStatus.DrainedHP), &DrainedHP{}) //寄生种子
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Poisoned), &DrainHP{}) //中毒
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Frozen), &DrainHP{}) //冻伤
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Burned), &DrainHP{}) //烧伤
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{}) //睡眠
}