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

201 lines
5.8 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/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1568: 无视对手护盾效果
type Effect1568 struct{ node.EffectNode }
func (e *Effect1568) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1568)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1568Sub struct{ node.EffectNode }
func (e *Effect1568Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(1)
e.CanStack(false)
}
func (e *Effect1568Sub) Damage_Shield(zone *info.DamageZone) bool {
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if e.Ctx().Our == nil || e.Ctx().Our.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.ConsumeAllShield()
e.Alive(false)
return true
}
func (e *Effect1568Sub) SwitchOut(in *input.Input) bool {
if in == e.Ctx().Our {
e.Alive(false)
}
return true
}
// Effect 1569: {0}%令对手{1},若触发则自身下{2}次攻击技能造成的伤害提升100%,若未触发则令自身{3}且免疫下{4}次受到的攻击
type Effect1569 struct{ node.EffectNode }
func (e *Effect1569) Skill_Use() bool {
if len(e.Args()) < 5 {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if ok && addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) {
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1569, int(e.Args()[2].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(e.Args()[3].IntPart()))
immune := e.Ctx().Our.InitEffect(input.EffectType.Skill, 570, int(e.Args()[4].IntPart()))
if immune != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, immune)
}
return true
}
type Effect1569Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1569Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
e.CanStack(false)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1569Sub) 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 || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1570: 出手时若自身体力高于对手则{0}%令对手{1}未触发则附加对手最大体力1/{2}的百分比伤害
type Effect1570 struct{ node.EffectNode }
func (e *Effect1570) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
return true
}
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) <= 0 {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if ok {
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[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
}
// Effect 1571: 使自身随机获得圣念状态或邪念状态,若已拥有则切换为另外一种状态
type Effect1571 struct{ node.EffectNode }
func (e *Effect1571) Skill_Use() bool {
if holy := e.Ctx().Our.GetEffect(input.EffectType.Status, int(petStatus2077Holy)); holy != nil && holy.Alive() {
holy.Alive(false)
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(petStatus2077Evil))
return true
}
if evil := e.Ctx().Our.GetEffect(input.EffectType.Status, int(petStatus2077Evil)); evil != nil && evil.Alive() {
evil.Alive(false)
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(petStatus2077Holy))
return true
}
if ok, _, _ := e.Input.Player.Roll(50, 100); ok {
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(petStatus2077Holy))
} else {
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(petStatus2077Evil))
}
return true
}
// Effect 1572: 3回合内每回合80%闪避对手攻击自身为圣念状态则回合数延长1回合自身为邪念状态则闪避率提升至100%
type Effect1572 struct{ node.EffectNode }
func (e *Effect1572) Skill_Use() bool {
duration := 3
chance := 80
if e.Ctx().Our.StatEffect_Exist(petStatus2077Holy) {
duration++
}
if e.Ctx().Our.StatEffect_Exist(petStatus2077Evil) {
chance = 100
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1572, duration, chance)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1572Sub struct{ RoundEffectArg0Base }
func (e *Effect1572Sub) SkillHit_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if e.Ctx().SkillEntity.AttackTime == 2 {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok {
e.Ctx().SkillEntity.SetMiss()
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1568, &Effect1568{})
input.InitEffect(input.EffectType.Sub, 1568, &Effect1568Sub{})
input.InitEffect(input.EffectType.Skill, 1569, &Effect1569{})
input.InitEffect(input.EffectType.Sub, 1569, &Effect1569Sub{})
input.InitEffect(input.EffectType.Skill, 1570, &Effect1570{})
input.InitEffect(input.EffectType.Skill, 1571, &Effect1571{})
input.InitEffect(input.EffectType.Skill, 1572, &Effect1572{})
input.InitEffect(input.EffectType.Sub, 1572, &Effect1572Sub{})
}