118 lines
3.4 KiB
Go
118 lines
3.4 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 1323: 造成伤害的{0}%恢复自身体力,若打出致命一击则附加恢复体力值等量的百分比伤害
|
||
type Effect1323 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1323) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
heal := e.Ctx().Our.SumDamage.Mul(e.Args()[0]).Div(hundred)
|
||
if heal.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit != 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: heal})
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1324: 消耗自身全部体力,使对手受到等同于自身最大体力1/1的百分比伤害且3回合内对手无法通过技能恢复自身体力
|
||
type Effect1324 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1324) Skill_Use() bool {
|
||
if e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp.CurrentPet == nil {
|
||
return true
|
||
}
|
||
|
||
selfHP := e.Ctx().Our.CurrentPet.GetHP()
|
||
if selfHP.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: selfHP})
|
||
}
|
||
|
||
damage := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
||
}
|
||
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 679, 3)
|
||
if effect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1325: 对手不处于能力下降状态则必定打出致命一击
|
||
type Effect1325 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1325) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp.HasPropSub() {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||
return true
|
||
}
|
||
|
||
// Effect 1326: 全属性+{0},自身处于护盾状态时强化效果翻倍
|
||
type Effect1326 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1326) OnSkill() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
boost := int8(e.Args()[0].IntPart())
|
||
if e.Ctx().Our.HasShield() {
|
||
boost *= 2
|
||
}
|
||
for i := range e.Ctx().Our.Prop[:] {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1327: 造成的伤害低于{0}则吸取对手最大体力的1/{1}并为自身附加等量的护盾
|
||
type Effect1327 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1327) Skill_Use() bool {
|
||
if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
|
||
return true
|
||
}
|
||
|
||
drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||
if drain.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: drain})
|
||
e.Ctx().Our.AddShield(drain)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1323, &Effect1323{})
|
||
input.InitEffect(input.EffectType.Skill, 1324, &Effect1324{})
|
||
input.InitEffect(input.EffectType.Skill, 1325, &Effect1325{})
|
||
input.InitEffect(input.EffectType.Skill, 1326, &Effect1326{})
|
||
input.InitEffect(input.EffectType.Skill, 1327, &Effect1327{})
|
||
}
|