Files
bl/logic/service/fight/effect/1026_1030.go
xinian 66fdc3d189
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现技能效果 627-672 及 1011-1111
2026-03-29 19:00:08 +08:00

185 lines
4.4 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 1026: 下{0}回合,每回合都使对手的先制-{1}
type Effect1026 struct {
node.EffectNode
}
func (e *Effect1026) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
1026,
int(e.Args()[0].IntPart()),
int(e.Args()[1].IntPart()),
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1026Sub struct {
RoundEffectArg0Base
}
func (e *Effect1026Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
priorityDown := int(e.Args()[1].IntPart())
if fattack != nil && fattack.PlayerID == e.Ctx().Opp.UserID && fattack.SkillEntity != nil {
fattack.SkillEntity.XML.Priority -= priorityDown
}
if sattack != nil && sattack.PlayerID == e.Ctx().Opp.UserID && sattack.SkillEntity != nil {
sattack.SkillEntity.XML.Priority -= priorityDown
}
return true
}
// Effect 1027: {0}回合内若自身不处于能力提升状态则附加{1}点固定伤害
type Effect1027 struct {
RoundEffectArg0Base
}
func (e *Effect1027) OnSkill() bool {
if e.Ctx().Our.HasPropADD() {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})
return true
}
// Effect 1028: 命中后{0}回合内每回合使对手{1}若未触发则减少对手最大体力的1/{7}
type Effect1028 struct {
node.EffectNode
}
func (e *Effect1028) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
1028,
e.SideEffectArgs...,
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1028Sub struct {
RoundEffectArg0Base
}
func (e *Effect1028Sub) TurnEnd() {
triggered := false
for i, v := range e.SideEffectArgs[1:7] {
if v == 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v)) {
triggered = true
}
}
if !triggered && len(e.SideEffectArgs) > 7 {
divisor := alpacadecimal.NewFromInt(int64(e.SideEffectArgs[7]))
if divisor.Cmp(alpacadecimal.Zero) > 0 {
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(divisor)
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
}
e.EffectNode.TurnEnd()
}
// Effect 1029: 造成的伤害低于{0}则下{1}回合自身先制+{2}
type Effect1029 struct {
node.EffectNode
}
func (e *Effect1029) Skill_Use() bool {
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
1029,
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1029Sub struct {
RoundEffectArg0Base
}
func (e *Effect1029Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if sattack != nil && sattack.PlayerID == e.Ctx().Our.UserID && sattack.SkillEntity != nil {
sattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
}
if fattack != nil && fattack.PlayerID == e.Ctx().Our.UserID && fattack.SkillEntity != nil {
fattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
}
return true
}
// Effect 1030: 将自身能力下降状态反馈给对手,反馈成功则对手{0}
type Effect1030 struct {
node.EffectNode
}
func (e *Effect1030) OnSkill() bool {
reflected := false
for i, v := range e.Ctx().Our.Prop[:] {
if v >= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), v) {
reflected = true
}
}
if !reflected {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1026, &Effect1026{})
input.InitEffect(input.EffectType.Sub, 1026, &Effect1026Sub{})
input.InitEffect(input.EffectType.Skill, 1027, &Effect1027{})
input.InitEffect(input.EffectType.Skill, 1028, &Effect1028{})
input.InitEffect(input.EffectType.Sub, 1028, &Effect1028Sub{})
input.InitEffect(input.EffectType.Skill, 1029, &Effect1029{})
input.InitEffect(input.EffectType.Sub, 1029, &Effect1029Sub{})
input.InitEffect(input.EffectType.Skill, 1030, &Effect1030{})
}