169 lines
4.2 KiB
Go
169 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"
|
|
)
|
|
|
|
// Effect 1163: 附加自身特攻值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%
|
|
type Effect1163 struct {
|
|
node.EffectNode
|
|
bonus int
|
|
}
|
|
|
|
func (e *Effect1163) 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
|
|
}
|
|
|
|
base := e.Ctx().Our.GetProp(2).Add(e.Ctx().Our.GetProp(4))
|
|
damage := base.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 1164: 反转对手能力提升状态,若该效果未满足条件或反转失败则消除对手能力提升状态和回合类效果
|
|
type Effect1164 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1164) Skill_Use() bool {
|
|
reversed := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
|
reversed = true
|
|
}
|
|
}
|
|
if reversed {
|
|
return true
|
|
}
|
|
|
|
clearPositiveProps(e.Ctx().Opp, e.Ctx().Our)
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
return true
|
|
}
|
|
|
|
// Effect 1165: {0}回合内若对手使用攻击技能,则使用攻击技能后的下{1}回合属性技能命中效果失效
|
|
type Effect1165 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1165) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1165, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1165Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1165Sub) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 11651, int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1165StatusLockSub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1165StatusLockSub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.SetNoSide()
|
|
e.Ctx().SkillEntity.AttackTime = 0
|
|
return true
|
|
}
|
|
|
|
// Effect 1166: 解除自身能力下降效果,解除成功则下{0}回合先制+{1}
|
|
type Effect1166 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1166) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
cleared := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if !cleared {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1312, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1167: 解除自身能力下降状态,解除成功则恢复自身所有体力
|
|
type Effect1167 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1167) Skill_Use() bool {
|
|
cleared := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if !cleared {
|
|
return true
|
|
}
|
|
|
|
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP())
|
|
if heal.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1163, &Effect1163{})
|
|
input.InitEffect(input.EffectType.Skill, 1164, &Effect1164{})
|
|
input.InitEffect(input.EffectType.Skill, 1165, &Effect1165{})
|
|
input.InitEffect(input.EffectType.Sub, 1165, &Effect1165Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 11651, &Effect1165StatusLockSub{})
|
|
input.InitEffect(input.EffectType.Skill, 1166, &Effect1166{})
|
|
input.InitEffect(input.EffectType.Skill, 1167, &Effect1167{})
|
|
}
|