183 lines
4.3 KiB
Go
183 lines
4.3 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 714: 使用技能时若对手处于能力提升状态,则先制+{0},同时消除对手能力提升状态
|
||
type Effect714 struct {
|
||
node.EffectNode
|
||
armed bool
|
||
}
|
||
|
||
func (e *Effect714) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if !e.Ctx().Opp.HasPropADD() {
|
||
return true
|
||
}
|
||
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current == nil || current.SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
current.SkillEntity.XML.Priority += int(e.Args()[0].IntPart())
|
||
e.armed = true
|
||
return true
|
||
}
|
||
|
||
func (e *Effect714) OnSkill() bool {
|
||
if !e.armed {
|
||
return true
|
||
}
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v > 0 {
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 715: 若下回合受到攻击,则对手随机{0}项能力值-{1}
|
||
type Effect715 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect715) OnSkill() bool {
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 715, e.SideEffectArgs...)
|
||
if effect != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect715Sub struct {
|
||
FixedDuration1Base
|
||
triggered bool
|
||
}
|
||
|
||
func (e *Effect715Sub) Skill_Use_ex() bool {
|
||
if e.triggered {
|
||
return true
|
||
}
|
||
skill := e.Ctx().SkillEntity
|
||
if skill == nil || skill.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
count := int(e.Args()[0].IntPart())
|
||
level := int8(e.Args()[1].IntPart())
|
||
if count <= 0 || level <= 0 {
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
indexes := grand.Perm(len(e.Ctx().Opp.Prop))
|
||
if count > len(indexes) {
|
||
count = len(indexes)
|
||
}
|
||
for _, idx := range indexes[:count] {
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(idx), -level)
|
||
}
|
||
e.triggered = true
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
// Effect 716: {0}回合内对手使用攻击技能,则使对手随机{1}个技能的PP值归零
|
||
type Effect716 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect716) OnSkill() bool {
|
||
addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect716Sub{}, -1)
|
||
return true
|
||
}
|
||
|
||
type Effect716Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect716Sub) Skill_Use() bool {
|
||
skill := e.Ctx().SkillEntity
|
||
if skill == nil || skill.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
zeroRandomSkillPP(e.Ctx().Our, int(e.Args()[1].IntPart()))
|
||
return true
|
||
}
|
||
|
||
// Effect 717: {0}回合内每回合使用技能吸取对手最大体力的1/{1},恢复体力时若自身体力低于最大体力的1/{2}则恢复效果翻倍
|
||
type Effect717 struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect717) Skill_Use() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||
if drain.IntPart() <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: drain,
|
||
})
|
||
|
||
heal := drain
|
||
if e.Args()[2].IntPart() > 0 {
|
||
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[2])
|
||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
|
||
heal = heal.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
return true
|
||
}
|
||
|
||
// Effect 718: {0}回合内对手使用属性技能,则自身下{1}回合必定暴击
|
||
type Effect718 struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect718) SkillHit_ex() bool {
|
||
skill := e.Ctx().SkillEntity
|
||
if skill == nil || skill.Category() != info.Category.STATUS {
|
||
return true
|
||
}
|
||
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect718Sub{}, -1)
|
||
return true
|
||
}
|
||
|
||
type Effect718Sub struct {
|
||
RoundEffectArg1Base
|
||
}
|
||
|
||
func (e *Effect718Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 714, &Effect714{})
|
||
input.InitEffect(input.EffectType.Skill, 715, &Effect715{})
|
||
input.InitEffect(input.EffectType.Sub, 715, &Effect715Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 716, &Effect716{})
|
||
input.InitEffect(input.EffectType.Skill, 717, &Effect717{})
|
||
input.InitEffect(input.EffectType.Skill, 718, &Effect718{})
|
||
}
|