132 lines
3.6 KiB
Go
132 lines
3.6 KiB
Go
|
|
package effect
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"blazing/logic/service/fight/info"
|
|||
|
|
"blazing/logic/service/fight/input"
|
|||
|
|
"blazing/logic/service/fight/node"
|
|||
|
|
|
|||
|
|
"github.com/alpacahq/alpacadecimal"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
func dealFixedDamage(target *input.Input, owner *input.Input, value alpacadecimal.Decimal) alpacadecimal.Decimal {
|
|||
|
|
if owner == nil || target == nil || value.Cmp(alpacadecimal.Zero) <= 0 {
|
|||
|
|
return alpacadecimal.Zero
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
before := target.CurrentPet.GetHP()
|
|||
|
|
target.Damage(owner, &info.DamageZone{Type: info.DamageType.Fixed, Damage: value})
|
|||
|
|
after := target.CurrentPet.GetHP()
|
|||
|
|
return before.Sub(after)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func dealTrueDamage(owner, target *input.Input, value alpacadecimal.Decimal) {
|
|||
|
|
if owner == nil || target == nil || value.Cmp(alpacadecimal.Zero) <= 0 {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
target.Damage(owner, &info.DamageZone{Type: info.DamageType.True, Damage: value})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1528: 附加{0}点真实伤害
|
|||
|
|
type Effect1528 struct{ node.EffectNode }
|
|||
|
|
|
|||
|
|
func (e *Effect1528) OnSkill() bool {
|
|||
|
|
if len(e.Args()) == 0 || e.Ctx().Opp == nil {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
dealTrueDamage(e.Ctx().Our, e.Ctx().Opp, e.Args()[0])
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1529: 消除对手能力提升状态,消除成功则附加{0}点真实伤害
|
|||
|
|
type Effect1529 struct{ node.EffectNode }
|
|||
|
|
|
|||
|
|
func (e *Effect1529) Skill_Use() bool {
|
|||
|
|
if len(e.Args()) == 0 || e.Ctx().Opp == nil {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
dealTrueDamage(e.Ctx().Our, e.Ctx().Opp, e.Args()[0])
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1530: 遇到天敌时附加{0}点真实伤害
|
|||
|
|
type Effect1530 struct{ node.EffectNode }
|
|||
|
|
|
|||
|
|
func (e *Effect1530) Skill_Use() bool {
|
|||
|
|
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().SkillEntity == nil {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
if !e.ISNaturalEnemy() {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
dealTrueDamage(e.Ctx().Our, e.Ctx().Opp, e.Args()[0])
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1531: {0}回合内每回合使用技能附加{1}点固定伤害,若对手未受到固定伤害则额外附加等量的真实伤害
|
|||
|
|
type Effect1531 struct{ node.EffectNode }
|
|||
|
|
|
|||
|
|
func (e *Effect1531) Skill_Use() bool {
|
|||
|
|
if len(e.Args()) < 2 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
duration := int(e.Args()[0].IntPart())
|
|||
|
|
if duration <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1531, duration, int(e.Args()[1].IntPart()))
|
|||
|
|
if sub != nil {
|
|||
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Effect1531Sub struct{ RoundEffectArg0Base }
|
|||
|
|
|
|||
|
|
func (e *Effect1531Sub) OnSkill() bool {
|
|||
|
|
if len(e.Args()) < 2 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
fixed := e.Args()[1]
|
|||
|
|
if fixed.Cmp(alpacadecimal.Zero) <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
if e.Ctx().Opp == nil {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
received := dealFixedDamage(e.Ctx().Opp, e.Ctx().Our, fixed)
|
|||
|
|
if received.Cmp(alpacadecimal.Zero) == 0 {
|
|||
|
|
dealTrueDamage(e.Ctx().Our, e.Ctx().Opp, fixed)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1532: 对手不存在神印则攻击必定打出致命一击,对手每存在1层神印则100%使对手随机1项技能PP值归零
|
|||
|
|
type Effect1532 struct{ node.EffectNode }
|
|||
|
|
|
|||
|
|
func (e *Effect1532) SkillHit() bool {
|
|||
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
energy := e.Ctx().Opp.CurrentDivineEnergy()
|
|||
|
|
if energy <= 0 {
|
|||
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
for i := 0; i < energy; i++ {
|
|||
|
|
zeroRandomSkillPP(e.Ctx().Opp, 1)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func init() {
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1528, &Effect1528{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1529, &Effect1529{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1530, &Effect1530{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1531, &Effect1531{})
|
|||
|
|
input.InitEffect(input.EffectType.Sub, 1531, &Effect1531Sub{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1532, &Effect1532{})
|
|||
|
|
}
|