181 lines
4.2 KiB
Go
181 lines
4.2 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"
|
|
"github.com/gogf/gf/v2/util/grand"
|
|
)
|
|
|
|
// Effect 1313: 命中后使对手受到{0}点固定伤害,未命中则自身死亡,同时使对手下次施放的技能无效(包括必中技能)
|
|
type Effect1313 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1313) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 {
|
|
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Ctx().Our.CurrentPet.GetHP(),
|
|
})
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1313, 1)
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Args()[0],
|
|
})
|
|
return true
|
|
}
|
|
|
|
type Effect1313Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1313Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1313Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1314: 令自身下{0}次受到的攻击伤害转化为体力
|
|
type Effect1314 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1314) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1314, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1314Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1314Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1314Sub) DamageLockEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := zone.Damage
|
|
zone.Damage = alpacadecimal.Zero
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1315: {0}%的概率打出致命一击
|
|
type Effect1315 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1315) SkillHit() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if ok {
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1316: 先出手时令自身随机{0}项属性+{1}
|
|
type Effect1316 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1316) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || !e.IsFirst() {
|
|
return true
|
|
}
|
|
|
|
count := int(e.Args()[0].IntPart())
|
|
if count <= 0 {
|
|
return true
|
|
}
|
|
level := int8(e.Args()[1].IntPart())
|
|
if level <= 0 {
|
|
return true
|
|
}
|
|
|
|
indexes := grand.Perm(6)
|
|
if count > len(indexes) {
|
|
count = len(indexes)
|
|
}
|
|
for _, idx := range indexes[:count] {
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(idx), level)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1317: 后出手时恢复自身最大体力的1/{0}
|
|
type Effect1317 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1317) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.IsFirst() || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
|
if heal.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1313, &Effect1313{})
|
|
input.InitEffect(input.EffectType.Sub, 1313, &Effect1313Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1314, &Effect1314{})
|
|
input.InitEffect(input.EffectType.Sub, 1314, &Effect1314Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1315, &Effect1315{})
|
|
input.InitEffect(input.EffectType.Skill, 1316, &Effect1316{})
|
|
input.InitEffect(input.EffectType.Skill, 1317, &Effect1317{})
|
|
}
|