Files
bl/logic/service/fight/effect/1016_1020.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

171 lines
4.0 KiB
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1016: 造成的伤害不足{0}则下{1}次攻击造成的伤害提高{2}%
type Effect1016 struct {
node.EffectNode
}
func (e *Effect1016) Skill_Use() bool {
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
1016,
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1016Sub struct {
node.EffectNode
remaining int
percent alpacadecimal.Decimal
}
func (e *Effect1016Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
if len(a) > 1 {
e.percent = alpacadecimal.NewFromInt(int64(a[1]))
}
}
func (e *Effect1016Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
bonus := zone.Damage.Mul(e.percent).Div(alpacadecimal.NewFromInt(100))
zone.Damage = zone.Damage.Add(bonus)
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1017: 消耗自身所有护盾值,造成等量固定伤害
type Effect1017 struct {
node.EffectNode
}
func (e *Effect1017) Skill_Use() bool {
shield := e.Ctx().Our.ConsumeAllShield()
if shield.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: shield,
})
return true
}
// Effect 1018: {0}回合内若受到的伤害低于{1}则免疫伤害并造成等同于伤害量的固定伤害
type Effect1018 struct {
RoundEffectArg0Base
}
func (e *Effect1018) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || zone.Damage.Cmp(e.Args()[1]) >= 0 {
return true
}
damage := zone.Damage
zone.Damage = alpacadecimal.Zero
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 1019: 造成的攻击伤害若高于{0}则令对手{1}回合内使用的属性技能无效
type Effect1019 struct {
node.EffectNode
}
func (e *Effect1019) Skill_Use() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1019, int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1019Sub struct {
RoundEffectArg0Base
}
func (e *Effect1019Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
return true
}
// Effect 1020: 全属性+{0},对手不处于能力提升状态时强化效果翻倍
type Effect1020 struct {
node.EffectNode
}
func (e *Effect1020) OnSkill() bool {
boostValue := int8(e.Args()[0].IntPart())
if !e.Ctx().Opp.HasPropADD() {
boostValue *= 2
}
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boostValue)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1016, &Effect1016{})
input.InitEffect(input.EffectType.Sub, 1016, &Effect1016Sub{})
input.InitEffect(input.EffectType.Skill, 1017, &Effect1017{})
input.InitEffect(input.EffectType.Skill, 1018, &Effect1018{})
input.InitEffect(input.EffectType.Skill, 1019, &Effect1019{})
input.InitEffect(input.EffectType.Sub, 1019, &Effect1019Sub{})
input.InitEffect(input.EffectType.Skill, 1020, &Effect1020{})
}