180 lines
4.4 KiB
Go
180 lines
4.4 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 1148: 随机吸取对手{0}-{1}点体力
|
||
type Effect1148 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1148) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
drain := randomInRange(int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if drain <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := alpacadecimal.NewFromInt(int64(drain))
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damage,
|
||
})
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
||
return true
|
||
}
|
||
|
||
// Effect 1149: 若先出手则将本回合受到的攻击伤害{0}%反馈给对手(双方同时死亡时对手残留1点体力)
|
||
type Effect1149 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1149) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || !e.IsFirst() {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1149, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1149Sub struct {
|
||
FixedDuration1Base
|
||
damage alpacadecimal.Decimal
|
||
}
|
||
|
||
func (e *Effect1149Sub) DamageSubEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity.Category() == info.Category.STATUS || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.damage = e.damage.Add(zone.Damage)
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1149Sub) TurnEnd() {
|
||
defer e.Alive(false)
|
||
|
||
if len(e.Args()) == 0 || e.damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return
|
||
}
|
||
if e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp == 0 {
|
||
return
|
||
}
|
||
|
||
reflectDamage := e.damage.Mul(e.Args()[0]).Div(hundred)
|
||
if reflectDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return
|
||
}
|
||
|
||
if e.Ctx().Our != nil && e.Ctx().Our.CurrentPet != nil && e.Ctx().Our.CurrentPet.Info.Hp == 0 {
|
||
cap := e.Ctx().Opp.CurrentPet.GetHP().Sub(oneDecimal)
|
||
if cap.Cmp(alpacadecimal.Zero) < 0 {
|
||
cap = alpacadecimal.Zero
|
||
}
|
||
if reflectDamage.Cmp(cap) > 0 {
|
||
reflectDamage = cap
|
||
}
|
||
}
|
||
if reflectDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: reflectDamage,
|
||
})
|
||
}
|
||
|
||
// Effect 1150: 消除对手能力上升状态,消除成功对手{0}
|
||
type Effect1150 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1150) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
||
return true
|
||
}
|
||
|
||
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
||
return true
|
||
}
|
||
|
||
// Effect 1151: {0}回合内若对手使用攻击技能则自身全属性+{1}
|
||
type Effect1151 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1151) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1151, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1151Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1151Sub) 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
|
||
}
|
||
|
||
applyAllPropUp(e.Ctx().Our, int8(e.Args()[1].IntPart()))
|
||
return true
|
||
}
|
||
|
||
// Effect 1152: 自身不处于能力提升状态则造成的伤害提升{0}%
|
||
type Effect1152 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1152) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.HasPropADD() {
|
||
return true
|
||
}
|
||
|
||
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1148, &Effect1148{})
|
||
input.InitEffect(input.EffectType.Skill, 1149, &Effect1149{})
|
||
input.InitEffect(input.EffectType.Sub, 1149, &Effect1149Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1150, &Effect1150{})
|
||
input.InitEffect(input.EffectType.Skill, 1151, &Effect1151{})
|
||
input.InitEffect(input.EffectType.Sub, 1151, &Effect1151Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1152, &Effect1152{})
|
||
}
|