Files
bl/logic/service/fight/effect/1338_1342.go
2026-04-01 02:53:23 +08:00

182 lines
4.6 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 1338: 全属性+{0},对手处于能力下降状态时强化效果翻倍
type Effect1338 struct{ node.EffectNode }
func (e *Effect1338) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
boost := int8(e.Args()[0].IntPart())
if e.Ctx().Opp.HasPropSub() {
boost *= 2
}
for i := range e.Ctx().Our.Prop[:] {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
}
return true
}
// Effect 1339: 若对手不处于异常状态则下{0}回合攻击{1}%使对手进入{2}状态
type Effect1339 struct{ node.EffectNode }
func (e *Effect1339) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1339, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1339Sub struct{ RoundEffectArg0Base }
func (e *Effect1339Sub) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok {
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
}
return true
}
// Effect 1340: 命中后附加对手最大体力1/2的百分比伤害若未命中则自身死亡且己方下只出战精灵令对手下1次使用的攻击技能无效
type Effect1340 struct{ node.EffectNode }
func (e *Effect1340) Skill_Use() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.AttackTime == 0 {
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Our.CurrentPet.GetHP(),
})
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1340)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(2))
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
}
type Effect1340Sub struct{ node.EffectNode }
func (e *Effect1340Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.CanStack(false)
e.Duration(1)
}
func (e *Effect1340Sub) SwitchIn(in *input.Input) bool {
if in != e.Ctx().Our {
return true
}
lock := e.Ctx().Our.InitEffect(input.EffectType.Sub, 13401, 1)
if lock != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, lock)
}
e.Alive(false)
return true
}
type Effect1340LockSub struct {
node.EffectNode
remaining int
}
func (e *Effect1340LockSub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1340LockSub) 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
}
// Effect 1341: 造成的伤害高于{0}则恢复自身最大体力的1/{1}
type Effect1341 struct{ node.EffectNode }
func (e *Effect1341) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
return true
}
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
if heal.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
return true
}
// Effect 1342: 为自身附加{0}点护罩
type Effect1342 struct{ node.EffectNode }
func (e *Effect1342) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.AddShield(e.Args()[0])
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1338, &Effect1338{})
input.InitEffect(input.EffectType.Skill, 1339, &Effect1339{})
input.InitEffect(input.EffectType.Sub, 1339, &Effect1339Sub{})
input.InitEffect(input.EffectType.Skill, 1340, &Effect1340{})
input.InitEffect(input.EffectType.Sub, 1340, &Effect1340Sub{})
input.InitEffect(input.EffectType.Sub, 13401, &Effect1340LockSub{})
input.InitEffect(input.EffectType.Skill, 1341, &Effect1341{})
input.InitEffect(input.EffectType.Skill, 1342, &Effect1342{})
}