127 lines
3.4 KiB
Go
127 lines
3.4 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// Effect 1553: 自身体力高于最大体力的1/{0}时攻击后附加造成伤害值{1}%的百分比伤害
|
|
type Effect1553 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1553) Skill_Use() bool {
|
|
skill := e.Ctx().SkillEntity
|
|
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
threshold := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0])
|
|
if e.Ctx().Our.CurPet[0].GetHP().Cmp(threshold) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Our.SumDamage.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 1554: 若自身当前体力低于最大体力的1/{0}则令自身{1}且免疫下{2}次受到的攻击
|
|
type Effect1554 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1554) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
threshold := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0])
|
|
if e.Ctx().Our.CurPet[0].GetHP().Cmp(threshold) >= 0 {
|
|
return true
|
|
}
|
|
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
|
|
if statusEffect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
|
|
immuneEffect := e.Ctx().Our.InitEffect(input.EffectType.Skill, 570, int(e.Args()[2].IntPart()))
|
|
if immuneEffect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, immuneEffect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1555: 对手不处于能力提升时令对手所有技能PP值-{0}
|
|
type Effect1555 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1555) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Opp.HasPropADD() {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.DelPP(int(e.Args()[0].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 1556: {0}回合内每回合{1}%闪避对手攻击,未触发则使对手全属性-{2}
|
|
type Effect1556 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1556) 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 {
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if success && skill.SetMiss() {
|
|
return true
|
|
}
|
|
}
|
|
|
|
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[2].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 1557: 本回合未打出致命一击则令对手随机{0}个技能PP值归零
|
|
type Effect1557 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1557) Skill_Use() bool {
|
|
skill := e.Ctx().SkillEntity
|
|
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit != 0 || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1553, &Effect1553{})
|
|
input.InitEffect(input.EffectType.Skill, 1554, &Effect1554{})
|
|
input.InitEffect(input.EffectType.Skill, 1555, &Effect1555{})
|
|
input.InitEffect(input.EffectType.Skill, 1556, &Effect1556{})
|
|
input.InitEffect(input.EffectType.Skill, 1557, &Effect1557{})
|
|
}
|