Files
bl/logic/service/fight/effect/effect_status.go
昔念 5542718a2b feat(fight): 优化睡眠状态效果逻辑,确保对方攻击后解除睡眠
睡眠状态现在会正确挂载到对手身上,以实现在对方攻击后自动解除睡眠效果。

fix(fight): 修复技能PP减少逻辑,确保使用技能时正确扣减PP

在技能执行过程中,通过查找当前宠物的技能列表来正确地减少对应技能的PP值,避免了错误的PP扣减。

fix(fight): 修复回合开始时技能列表初始化问题

修正了战斗中角色和对手的技能列表初始化逻辑,确保双方技能数据正确加载。

feat(pet): 限制宠物技能数量为4个并修复技能学习逻辑

更新宠物技能学习逻辑,确保只保留最后四个技能,并在学习新技能时正确添加至技能列表。

fix(p
2025-10-27 01:11:31 +08:00

91 lines
2.1 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{}) //睡眠
}