Files
bl/logic/service/fight/effect/1568_1572.go

246 lines
6.3 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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 1568: 无视对手护盾效果
type Effect1568 struct{ node.EffectNode }
func (e *Effect1568) Skill_Use() bool {
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) 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}次攻击伤害翻倍,未触发则自身{3}且免疫下{4}次攻击
type Effect1569 struct{ node.EffectNode }
func (e *Effect1569) Skill_Use() bool {
if len(e.Args()) < 5 {
return true
}
if e.Ctx().Opp == nil || e.Ctx().Our == nil {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if ok {
addStatusEffect(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
}
addStatusEffect(e.Ctx().Our, e.Ctx().Our, int(e.Args()[3].IntPart()))
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1569, int(e.Args()[4].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1569Sub struct {
node.EffectNode
remaining int
fail bool
}
func (e *Effect1569Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1569Sub) Damage_Mul(zone *info.DamageZone) bool {
if e.remaining <= 0 || zone == nil || zone.Type != info.DamageType.Red || e.fail {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func (e *Effect1569Sub) DamageLockEx(zone *info.DamageZone) bool {
if !e.fail || e.remaining <= 0 || zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity != nil {
e.Ctx().SkillEntity.SetMiss()
}
zone.Damage = alpacadecimal.Zero
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().Opp == nil {
return true
}
if e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp.CurrentPet == nil {
return true
}
var chance int
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) > 0 {
chance = int(e.Args()[0].IntPart())
} else {
chance = 0
}
if chance > 0 {
ok, _, _ := e.Input.Player.Roll(chance, 100)
if ok {
addStatusEffect(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.CurrentPet.GetMaxHP().Div(e.Args()[2])
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 e.Ctx().Our == nil {
return true
}
hasHoly := e.Ctx().Our.StatEffect_Exist(int(petStatus2077Holy))
hasEvil := e.Ctx().Our.StatEffect_Exist(int(petStatus2077Evil))
target := int(petStatus2077Holy)
if hasHoly {
target = int(petStatus2077Evil)
} else if hasEvil {
target = int(petStatus2077Holy)
} else if grand.Intn(2) == 1 {
target = int(petStatus2077Evil)
}
removeStatusEffect(e.Ctx().Our, int(petStatus2077Holy))
removeStatusEffect(e.Ctx().Our, int(petStatus2077Evil))
addStatusEffect(e.Ctx().Our, e.Ctx().Our, target)
return true
}
func removeStatusEffect(target *input.Input, statusID int) {
if target == nil {
return
}
if eff := target.GetEffect(input.EffectType.Status, statusID); eff != nil {
eff.Alive(false)
}
}
// Effect 1572: 3回合内每回合闪避对手攻击自身状态调整持续与命中率
type Effect1572 struct{ node.EffectNode }
func (e *Effect1572) Skill_Use() bool {
if e.Ctx().Opp == nil || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
return true
}
duration := 3
chance := 80
if e.Ctx().Our.StatEffect_Exist(int(petStatus2077Holy)) {
duration++
}
if e.Ctx().Our.StatEffect_Exist(int(petStatus2077Evil)) {
chance = 100
}
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1572, chance)
if sub != nil {
sub.Duration(duration)
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1572Sub struct {
RoundEffectArg0Base
chance int
}
func (e *Effect1572Sub) SetArgs(t *input.Input, a ...int) {
e.RoundEffectArg0Base.SetArgs(t, a...)
if len(a) > 0 {
e.chance = a[0]
}
}
func (e *Effect1572Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.chance >= 100 {
return true
}
ok, _, _ := e.Input.Player.Roll(e.chance, 100)
if ok {
return true
}
if e.Ctx().SkillEntity.AttackTime == 1 {
e.Ctx().SkillEntity.SetMiss()
e.Ctx().SkillEntity.AttackTime = 0
}
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{})
}