Files
bl/logic/service/fight/effect/1583_1587.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

203 lines
5.7 KiB
Go

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 1583: 后出手时附加当前战斗回合数×{0}的固定伤害
type Effect1583 struct{ node.EffectNode }
func (e *Effect1583) Skill_Use() bool {
if len(e.Args()) == 0 || e.IsFirst() || e.Ctx().Our == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Our.FightC == nil {
return true
}
round := int64(e.Ctx().Our.FightC.GetOverInfo().Round)
if round <= 0 {
round = 1
}
damage := alpacadecimal.NewFromInt(round).Mul(e.Args()[0])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
return true
}
// Effect 1584: 出手时若自身未满体力则下回合自身受到的攻击伤害减少{0}%
type Effect1584 struct{ node.EffectNode }
func (e *Effect1584) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil {
return true
}
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) >= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1584, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1584Sub struct{ node.EffectNode }
func (e *Effect1584Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(1)
e.CanStack(false)
}
func (e *Effect1584Sub) DamageDivEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Sub(e.Args()[0])).Div(hundred)
return true
}
// Effect 1585: {0}回合内若对手使用攻击技能则自身下{1}回合必定暴击
type Effect1585 struct{ node.EffectNode }
func (e *Effect1585) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Opp == nil {
return true
}
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1585, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
if wired, ok := sub.(*Effect1585Sub); ok {
wired.owner = e.Ctx().Our
}
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1585Sub struct {
RoundEffectArg0Base
owner *input.Input
buffDuration int
triggered bool
}
func (e *Effect1585Sub) SetArgs(t *input.Input, a ...int) {
e.RoundEffectArg0Base.SetArgs(t, a...)
e.CanStack(false)
if len(a) > 1 {
e.buffDuration = a[1]
}
}
func (e *Effect1585Sub) Action_end() bool {
if e.triggered || e.owner == nil || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
e.triggered = true
sub := e.owner.InitEffect(input.EffectType.Sub, 15851, e.buffDuration)
if sub != nil {
e.owner.AddEffect(e.owner, sub)
}
e.Alive(false)
return true
}
type Effect1585CritSub struct{ RoundEffectArg0Base }
func (e *Effect1585CritSub) SetArgs(t *input.Input, a ...int) {
e.RoundEffectArg0Base.SetArgs(t, a...)
e.CanStack(false)
}
func (e *Effect1585CritSub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 1586: {0}%令对手{1},若对手已处于{2}状态则将此状态刷新至{3}回合
type Effect1586 struct{ node.EffectNode }
func (e *Effect1586) Skill_Use() bool {
if len(e.Args()) < 4 || e.Ctx().Our == nil || e.Ctx().Opp == nil {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); !ok {
return true
}
refreshStatusID := int(e.Args()[2].IntPart())
if eff := getAliveStatusEffect(e.Ctx().Opp, refreshStatusID); eff != nil {
eff.Duration(int(e.Args()[3].IntPart()))
return true
}
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
// Effect 1587: 当回合击败对手则下回合自身攻击先制+{0}
type Effect1587 struct{ node.EffectNode }
func (e *Effect1587) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1587, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1587Sub struct {
node.EffectNode
remaining int
priority int
}
func (e *Effect1587Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
e.CanStack(false)
e.remaining = 1
if len(a) > 0 {
e.priority = a[0]
}
}
func (e *Effect1587Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
return true
}
current.SkillEntity.XML.Priority += e.priority
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1583, &Effect1583{})
input.InitEffect(input.EffectType.Skill, 1584, &Effect1584{})
input.InitEffect(input.EffectType.Sub, 1584, &Effect1584Sub{})
input.InitEffect(input.EffectType.Skill, 1585, &Effect1585{})
input.InitEffect(input.EffectType.Sub, 1585, &Effect1585Sub{})
input.InitEffect(input.EffectType.Sub, 15851, &Effect1585CritSub{})
input.InitEffect(input.EffectType.Skill, 1586, &Effect1586{})
input.InitEffect(input.EffectType.Skill, 1587, &Effect1587{})
input.InitEffect(input.EffectType.Sub, 1587, &Effect1587Sub{})
}