149 lines
3.9 KiB
Go
149 lines
3.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 1423: 消除对手回合类效果,消除成功则{0}%令对手{1},未触发则恢复自身最大体力的1/{2}
|
||
type Effect1423 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1423) Skill_Use() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().Our.CurrentPet == nil || e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
before := activeTurnEffectCount(e.Ctx().Opp)
|
||
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
||
if before <= 0 {
|
||
return true
|
||
}
|
||
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok && addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) {
|
||
return true
|
||
}
|
||
|
||
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[2])
|
||
if heal.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1424: {0}%令对手{1},自身处于能力提升状态时概率翻倍
|
||
type Effect1424 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1424) OnSkill() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
chance := int(e.Args()[0].IntPart())
|
||
if e.Ctx().Our.HasPropADD() {
|
||
chance *= 2
|
||
if chance > 100 {
|
||
chance = 100
|
||
}
|
||
}
|
||
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1425: 造成的伤害低于{0}则自身{1}
|
||
type Effect1425 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1425) Skill_Use() bool {
|
||
if len(e.Args()) < 7 {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
|
||
return true
|
||
}
|
||
|
||
for idx := range e.Ctx().Our.Prop {
|
||
argIndex := idx + 1
|
||
if argIndex >= len(e.Args()) {
|
||
break
|
||
}
|
||
delta := int8(e.Args()[argIndex].IntPart())
|
||
if delta == 0 {
|
||
continue
|
||
}
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(idx), delta)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1426: 若对手不处于异常状态则{0}%令对手{1}
|
||
type Effect1426 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1426) OnSkill() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().Opp.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1427: {0}回合内每回合{1}%闪避对手攻击,未触发则受到的伤害减少{2}%
|
||
type Effect1427 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1427) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1427, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1427Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect1427Sub) SkillHit_ex() bool {
|
||
skill := e.Ctx().SkillEntity
|
||
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
if skill.AttackTime != 2 {
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok && skill.SetMiss() {
|
||
return true
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1427Sub) DamageDivEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
reduce := hundred.Sub(e.Args()[2])
|
||
if reduce.Cmp(alpacadecimal.Zero) < 0 {
|
||
reduce = alpacadecimal.Zero
|
||
}
|
||
zone.Damage = zone.Damage.Mul(reduce).Div(hundred)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1423, &Effect1423{})
|
||
input.InitEffect(input.EffectType.Skill, 1424, &Effect1424{})
|
||
input.InitEffect(input.EffectType.Skill, 1425, &Effect1425{})
|
||
input.InitEffect(input.EffectType.Skill, 1426, &Effect1426{})
|
||
input.InitEffect(input.EffectType.Skill, 1427, &Effect1427{})
|
||
input.InitEffect(input.EffectType.Sub, 1427, &Effect1427Sub{})
|
||
}
|