221 lines
5.1 KiB
Go
221 lines
5.1 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 1036: 消除对手回合类效果,消除成功则下{0}次攻击附加{1}点固定伤害
|
|||
|
|
type Effect1036 struct {
|
|||
|
|
node.EffectNode
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1036) Skill_Use() bool {
|
|||
|
|
if len(e.Args()) < 2 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
before := activeTurnEffectCount(e.Ctx().Opp)
|
|||
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|||
|
|
if before <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1036, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|||
|
|
if sub != nil {
|
|||
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Effect1036Sub struct {
|
|||
|
|
node.EffectNode
|
|||
|
|
remaining int
|
|||
|
|
damage alpacadecimal.Decimal
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1036Sub) 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.damage = alpacadecimal.NewFromInt(int64(a[1]))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1036Sub) OnSkill() bool {
|
|||
|
|
if e.remaining <= 0 {
|
|||
|
|
e.Alive(false)
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
if e.damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|||
|
|
Type: info.DamageType.Fixed,
|
|||
|
|
Damage: e.damage,
|
|||
|
|
})
|
|||
|
|
e.remaining--
|
|||
|
|
if e.remaining <= 0 {
|
|||
|
|
e.Alive(false)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1037: 消除对手能力提升状态,消除成功则自身下{0}次攻击技能造成伤害额外提升{1}%
|
|||
|
|
type Effect1037 struct {
|
|||
|
|
node.EffectNode
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1037) Skill_Use() bool {
|
|||
|
|
if len(e.Args()) < 2 {
|
|||
|
|
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
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1037, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|||
|
|
if sub != nil {
|
|||
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Effect1037Sub struct {
|
|||
|
|
node.EffectNode
|
|||
|
|
remaining int
|
|||
|
|
percent alpacadecimal.Decimal
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1037Sub) 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.percent = alpacadecimal.NewFromInt(int64(a[1]))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1037Sub) Damage_Mul(zone *info.DamageZone) bool {
|
|||
|
|
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.percent)).Div(hundred)
|
|||
|
|
e.remaining--
|
|||
|
|
if e.remaining <= 0 {
|
|||
|
|
e.Alive(false)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1038: 双倍反转自身能力下降状态,反转成功则获得{0}点护盾
|
|||
|
|
type Effect1038 struct {
|
|||
|
|
node.EffectNode
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1038) Skill_Use() bool {
|
|||
|
|
if len(e.Args()) == 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
reversed := false
|
|||
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|||
|
|
if v >= 0 {
|
|||
|
|
continue
|
|||
|
|
}
|
|||
|
|
reversed = true
|
|||
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -v*2)
|
|||
|
|
}
|
|||
|
|
if !reversed {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
shield := e.Args()[0]
|
|||
|
|
if shield.Cmp(alpacadecimal.Zero) > 0 {
|
|||
|
|
e.Ctx().Our.AddShield(shield)
|
|||
|
|
}
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1039: {0}回合内每回合使用技能恢复自身最大体力的1/{1},低于1/{2}时直接回满
|
|||
|
|
type Effect1039 struct {
|
|||
|
|
RoundEffectArg0Base
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1039) OnSkill() bool {
|
|||
|
|
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
if e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 || e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
|
|||
|
|
currentHP := e.Ctx().Our.CurrentPet.GetHP()
|
|||
|
|
heal := maxHP.Div(e.Args()[1])
|
|||
|
|
if currentHP.Cmp(maxHP.Div(e.Args()[2])) < 0 {
|
|||
|
|
heal = maxHP.Sub(currentHP)
|
|||
|
|
}
|
|||
|
|
if heal.Cmp(alpacadecimal.Zero) <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Effect 1040: 当回合若未击败对手则{0}%使对手{1},未触发则自身全属性+{2}
|
|||
|
|
type Effect1040 struct {
|
|||
|
|
node.EffectNode
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (e *Effect1040) Skill_Use() bool {
|
|||
|
|
if len(e.Args()) < 3 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|||
|
|
if success {
|
|||
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
applyAllPropUp(e.Ctx().Our, int8(e.Args()[2].IntPart()))
|
|||
|
|
return true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func init() {
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1036, &Effect1036{})
|
|||
|
|
input.InitEffect(input.EffectType.Sub, 1036, &Effect1036Sub{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1037, &Effect1037{})
|
|||
|
|
input.InitEffect(input.EffectType.Sub, 1037, &Effect1037Sub{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1038, &Effect1038{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1039, &Effect1039{})
|
|||
|
|
input.InitEffect(input.EffectType.Skill, 1040, &Effect1040{})
|
|||
|
|
}
|