203 lines
4.8 KiB
Go
203 lines
4.8 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 1203: 造成的伤害低于{0}则自身下{1}次技能先制+{2}
|
|
type Effect1203 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1203) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1203, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1203Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
priority int
|
|
}
|
|
|
|
func (e *Effect1203Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
if len(a) > 1 {
|
|
e.priority = a[1]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1203Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
current.SkillEntity.XML.Priority += e.priority
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1204: 自身下{0}次攻击必定致命一击
|
|
type Effect1204 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1204) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1204, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1204Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1204Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1204Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1205: 后出手时自身全属性+{0}
|
|
type Effect1205 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1205) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.IsFirst() {
|
|
return true
|
|
}
|
|
|
|
applyAllPropUp(e.Ctx().Our, int8(e.Args()[0].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 1206: 附加自身最大体力{0}%的百分比伤害,每次使用增加{1}%,最高{2}%
|
|
type Effect1206 struct {
|
|
node.EffectNode
|
|
bonus int
|
|
}
|
|
|
|
func (e *Effect1206) OnSkill() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
percent := int(e.Args()[0].IntPart()) + e.bonus
|
|
maxPercent := int(e.Args()[2].IntPart())
|
|
if percent > maxPercent {
|
|
percent = maxPercent
|
|
}
|
|
if percent <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(alpacadecimal.NewFromInt(int64(percent))).Div(hundred)
|
|
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: damage,
|
|
})
|
|
}
|
|
e.bonus += int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 1207: 双倍吸取对手能力提升状态,吸取成功则使对手下{0}回合先制-{1}
|
|
type Effect1207 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1207) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
absorbed := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
continue
|
|
}
|
|
absorbed = true
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v*2)
|
|
}
|
|
if !absorbed {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1207, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1207Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1207Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
current.SkillEntity.XML.Priority -= int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1203, &Effect1203{})
|
|
input.InitEffect(input.EffectType.Sub, 1203, &Effect1203Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1204, &Effect1204{})
|
|
input.InitEffect(input.EffectType.Sub, 1204, &Effect1204Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1205, &Effect1205{})
|
|
input.InitEffect(input.EffectType.Skill, 1206, &Effect1206{})
|
|
input.InitEffect(input.EffectType.Skill, 1207, &Effect1207{})
|
|
input.InitEffect(input.EffectType.Sub, 1207, &Effect1207Sub{})
|
|
}
|