Files
bl/logic/service/fight/effect/1213_1217.go
xinian 87fdccaddf
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat: 实现大量技能效果及战斗逻辑修复
2026-03-30 00:51:18 +08:00

174 lines
3.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/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1213: {0}回合内每回合使用技能附加对手最大体力1/{1}的百分比伤害
type Effect1213 struct {
RoundEffectArg0Base
}
func (e *Effect1213) OnSkill() bool {
if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1214: 对手处于异常状态则吸取对手{0}点体力
type Effect1214 struct {
node.EffectNode
}
func (e *Effect1214) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if !e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
drain := e.Args()[0]
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
return true
}
// Effect 1215: 消除对手所有护盾效果,消除成功则使对手全属性-{0},自身体力低于对手时弱化效果翻倍
type Effect1215 struct {
node.EffectNode
}
func (e *Effect1215) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
if e.Ctx().Opp.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.ConsumeAllShield()
debuffLevel := int(e.Args()[0].IntPart())
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) < 0 {
debuffLevel *= 2
}
if debuffLevel <= 0 {
return true
}
if debuffLevel > 6 {
debuffLevel = 6
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(debuffLevel))
return true
}
// Effect 1216: 反转对手能力提升状态反转成功则恢复自身所有体力和PP值
type Effect1216 struct {
node.EffectNode
}
func (e *Effect1216) Skill_Use() bool {
reversed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
reversed = true
}
}
if !reversed {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
e.Ctx().Our.HealPP(-1)
return true
}
// Effect 1217: 消除对手能力提升状态,消除成功则对手下{0}次攻击技能无效
type Effect1217 struct {
node.EffectNode
}
func (e *Effect1217) Skill_Use() bool {
cleared := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1217, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1217Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1217Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1217Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1213, &Effect1213{})
input.InitEffect(input.EffectType.Skill, 1214, &Effect1214{})
input.InitEffect(input.EffectType.Skill, 1215, &Effect1215{})
input.InitEffect(input.EffectType.Skill, 1216, &Effect1216{})
input.InitEffect(input.EffectType.Skill, 1217, &Effect1217{})
input.InitEffect(input.EffectType.Sub, 1217, &Effect1217Sub{})
}