122 lines
2.9 KiB
Go
122 lines
2.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 673: 对手不处于{0}状态时附加对手已损失体力{1}%的百分比伤害
|
|
type Effect673 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect673) OnSkill() bool {
|
|
status := info.EnumPetStatus(int(e.Args()[0].IntPart()))
|
|
if e.Ctx().Opp.StatEffect_Exist(status) {
|
|
return true
|
|
}
|
|
|
|
lostHP := e.Ctx().Opp.CurrentPet.GetMaxHP().Sub(e.Ctx().Opp.CurrentPet.GetHP())
|
|
if lostHP.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := lostHP.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 674: 攻击结束时恢复{0}点体力
|
|
type Effect674 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect674) Action_end() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
|
|
return true
|
|
}
|
|
|
|
// Effect 675: 下{0}回合致命一击对自身miss
|
|
type Effect675 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect675) DamageLockEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Crit == 0 {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = alpacadecimal.Zero
|
|
return true
|
|
}
|
|
|
|
// Effect 676: 下{0}回合每回合使用攻击技能附加自身防御、特防值总和{1}%的百分比伤害
|
|
type Effect676 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect676) OnSkill() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
totalDefense := e.Ctx().Our.GetProp(1).Add(e.Ctx().Our.GetProp(3))
|
|
damage := totalDefense.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 677: {0}回合内每回合使用技能吸取对手能力提升状态
|
|
type Effect677 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect677) OnSkill() bool {
|
|
if e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 673, &Effect673{})
|
|
input.InitEffect(input.EffectType.Skill, 674, &Effect674{})
|
|
input.InitEffect(input.EffectType.Skill, 675, &Effect675{})
|
|
input.InitEffect(input.EffectType.Skill, 676, &Effect676{})
|
|
input.InitEffect(input.EffectType.Skill, 677, &Effect677{})
|
|
}
|