157 lines
3.6 KiB
Go
157 lines
3.6 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 866: 若打出致命一击则获得{0}层神耀能量, 否则获得{1}层
|
|
type Effect866 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect866) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
|
|
gain := int(e.Args()[1].IntPart())
|
|
if e.Ctx().SkillEntity.Crit != 0 {
|
|
gain = int(e.Args()[0].IntPart())
|
|
}
|
|
e.Ctx().Our.AddDivineEnergy(gain)
|
|
return true
|
|
}
|
|
|
|
// Effect 867: 消除对手回合类效果,消除成功使对手下回合先制-{0}
|
|
type Effect867 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect867) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
before := activeTurnEffectCount(e.Ctx().Opp)
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
if before <= 0 {
|
|
return true
|
|
}
|
|
|
|
addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect867Sub{}, -1)
|
|
return true
|
|
}
|
|
|
|
type Effect867Sub struct {
|
|
FixedDuration1Base
|
|
}
|
|
|
|
func (e *Effect867Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
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())
|
|
return true
|
|
}
|
|
|
|
// Effect 868: 消除对手能力提升状态,消除成功则令对手下回合所有技能先制-{0}
|
|
type Effect868 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect868) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
cleared := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if !cleared {
|
|
return true
|
|
}
|
|
|
|
addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect868Sub{}, -1)
|
|
return true
|
|
}
|
|
|
|
type Effect868Sub struct {
|
|
FixedDuration1Base
|
|
}
|
|
|
|
func (e *Effect868Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
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())
|
|
return true
|
|
}
|
|
|
|
// Effect 869: 附加自身速度{0}%的百分比伤害,每次触发增加{1}%,最高{2}%
|
|
type Effect869 struct {
|
|
AddLvelEffect
|
|
}
|
|
|
|
func (e *Effect869) Skill_Use() bool {
|
|
percent := e.Args()[0]
|
|
if e.UseSkillCount > 1 {
|
|
percent = percent.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(e.UseSkillCount - 1)))
|
|
}
|
|
if percent.Cmp(e.Args()[2]) > 0 {
|
|
percent = e.Args()[2]
|
|
}
|
|
|
|
damage := e.Ctx().Our.GetProp(4).Mul(percent).Div(alpacadecimal.NewFromInt(100))
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 870: 吸取对手{0}点体力
|
|
type Effect870 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect870) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
drain := e.Args()[0]
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: drain,
|
|
})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 866, &Effect866{})
|
|
input.InitEffect(input.EffectType.Skill, 867, &Effect867{})
|
|
input.InitEffect(input.EffectType.Skill, 868, &Effect868{})
|
|
input.InitEffect(input.EffectType.Skill, 869, &Effect869{})
|
|
input.InitEffect(input.EffectType.Skill, 870, &Effect870{})
|
|
}
|