199 lines
4.9 KiB
Go
199 lines
4.9 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 1318: {0}%的概率秒杀对手,未触发则令对手全属性-{1}
|
|
type Effect1318 struct {
|
|
node.EffectNode
|
|
success bool
|
|
}
|
|
|
|
func (e *Effect1318) DamageFloor(zone *info.DamageZone) bool {
|
|
e.success = false
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
return true
|
|
}
|
|
|
|
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if !ok {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = e.Ctx().Opp.CurrentPet.GetMaxHP()
|
|
e.success = true
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1318) Skill_Use() bool {
|
|
if e.success || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 1319: 自身下次被击败后下一只出场的精灵{0}
|
|
type Effect1319 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1319) Skill_Use() bool {
|
|
if len(e.Args()) < 6 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(
|
|
input.EffectType.Sub,
|
|
1319,
|
|
int(e.Args()[0].IntPart()),
|
|
int(e.Args()[1].IntPart()),
|
|
int(e.Args()[2].IntPart()),
|
|
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 Effect1319Sub struct {
|
|
node.EffectNode
|
|
pending bool
|
|
}
|
|
|
|
func (e *Effect1319Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect1319Sub) SwitchOut(in *input.Input) bool {
|
|
if in != e.Ctx().Our || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Our.CurrentPet.Alive() {
|
|
return true
|
|
}
|
|
e.pending = true
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1319Sub) SwitchIn(in *input.Input) bool {
|
|
if !e.pending || in != e.Ctx().Our || len(e.Args()) < 6 {
|
|
return true
|
|
}
|
|
|
|
changes := make([]int, 6)
|
|
for i := 0; i < 6; i++ {
|
|
changes[i] = int(e.Args()[i].IntPart())
|
|
}
|
|
applyEffectPropChanges(e.Ctx().Our, e.Ctx().Our, changes, false)
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 1320: {0}回合内若对手攻击MISS则回合结束时吸取对手最大体力的1/{1}
|
|
type Effect1320 struct {
|
|
RoundEffectArg0Base
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1320) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.AttackTime != 0 {
|
|
return true
|
|
}
|
|
e.triggered = true
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1320) TurnEnd() {
|
|
if e.triggered && len(e.Args()) >= 2 && e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
|
|
drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
|
if drain.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: drain,
|
|
})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
|
|
}
|
|
}
|
|
e.triggered = false
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
// Effect 1321: 解除自身能力下降状态并消除对手提升状态,消除任意一项成功则{0}%对手{1}
|
|
type Effect1321 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1321) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
changed := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
changed = true
|
|
}
|
|
}
|
|
if clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
|
changed = true
|
|
}
|
|
if !changed {
|
|
return true
|
|
}
|
|
|
|
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if ok {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1322: {0}回合内受到攻击则{1}%使对手进入{2},未触发则使对手全属性-{3}
|
|
type Effect1322 struct {
|
|
RoundEffectArg0Base
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1322) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 4 {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if ok {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
|
e.triggered = true
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1322) TurnEnd() {
|
|
if !e.triggered && e.Duration() == 1 && len(e.Args()) >= 4 {
|
|
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[3].IntPart()))
|
|
}
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1318, &Effect1318{})
|
|
input.InitEffect(input.EffectType.Skill, 1319, &Effect1319{})
|
|
input.InitEffect(input.EffectType.Sub, 1319, &Effect1319Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1320, &Effect1320{})
|
|
input.InitEffect(input.EffectType.Skill, 1321, &Effect1321{})
|
|
input.InitEffect(input.EffectType.Skill, 1322, &Effect1322{})
|
|
}
|