176 lines
4.1 KiB
Go
176 lines
4.1 KiB
Go
package effect
|
|
|
|
import (
|
|
"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 1333: 自身处于能力提升状态时{0}%使对手进入{1}状态
|
|
type Effect1333 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1333) OnSkill() bool {
|
|
if len(e.Args()) < 2 || !e.Ctx().Our.HasPropADD() {
|
|
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
|
|
}
|
|
|
|
// Effect 1334: 造成的伤害低于{0}则使{1}%对手进入{2}状态,未触发则下{3}次自身技能{4}%使对手进入{5}状态
|
|
type Effect1334 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1334) Skill_Use() bool {
|
|
if len(e.Args()) < 6 {
|
|
return true
|
|
}
|
|
|
|
triggered := false
|
|
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) < 0 {
|
|
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if ok {
|
|
triggered = addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
|
}
|
|
}
|
|
if triggered {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(
|
|
input.EffectType.Sub,
|
|
1334,
|
|
int(e.Args()[3].IntPart()),
|
|
int(e.Args()[4].IntPart()),
|
|
int(e.Args()[5].IntPart()),
|
|
)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1334Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1334Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1334Sub) Skill_Use() bool {
|
|
if e.Ctx().SkillEntity == nil || e.remaining <= 0 || len(e.Args()) < 3 {
|
|
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()))
|
|
}
|
|
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1335: {0}%令对手{1},未触发则随机吸取对手{2}项属性-{3},并将该属性附加给自己
|
|
type Effect1335 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1335) Skill_Use() bool {
|
|
if len(e.Args()) < 4 {
|
|
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
|
|
}
|
|
|
|
count := int(e.Args()[2].IntPart())
|
|
level := int8(e.Args()[3].IntPart())
|
|
if count <= 0 || level <= 0 {
|
|
return true
|
|
}
|
|
|
|
if count > 6 {
|
|
count = 6
|
|
}
|
|
applied := 0
|
|
for _, idx := range grand.Perm(6) {
|
|
prop := int8(idx)
|
|
if !e.Ctx().Opp.SetProp(e.Ctx().Our, prop, -level) {
|
|
continue
|
|
}
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, prop, level)
|
|
applied++
|
|
if applied >= count {
|
|
break
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1336: {0}回合内每回合使用技能附加自身最大体力值与攻击值总和{1}%的百分比伤害
|
|
type Effect1336 struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1336) OnSkill() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
base := e.Ctx().Our.CurrentPet.GetMaxHP().Add(e.Ctx().Our.GetProp(0))
|
|
damage := base.Mul(e.Args()[1]).Div(hundred)
|
|
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 1337: 自身体力高于对手则{0}%令对手{1},未触发{2}则消除对手回合类效果
|
|
type Effect1337 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1337) Skill_Use() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) > 0 {
|
|
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
|
|
}
|
|
}
|
|
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1333, &Effect1333{})
|
|
input.InitEffect(input.EffectType.Skill, 1334, &Effect1334{})
|
|
input.InitEffect(input.EffectType.Sub, 1334, &Effect1334Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1335, &Effect1335{})
|
|
input.InitEffect(input.EffectType.Skill, 1336, &Effect1336{})
|
|
input.InitEffect(input.EffectType.Skill, 1337, &Effect1337{})
|
|
}
|