111 lines
2.7 KiB
Go
111 lines
2.7 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 1188: {0}回合内自身受到攻击则使对手{1},未触发则吸取对手最大体力的1/{2}
|
||
type Effect1188 struct {
|
||
RoundEffectArg0Base
|
||
triggered bool
|
||
}
|
||
|
||
func (e *Effect1188) DamageSubEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || e.triggered {
|
||
return true
|
||
}
|
||
|
||
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
e.triggered = true
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1188) TurnEnd() {
|
||
if !e.triggered && e.Duration() == 1 && len(e.Args()) >= 3 && e.Args()[2].Cmp(alpacadecimal.Zero) > 0 {
|
||
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[2])
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
||
}
|
||
}
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
// Effect 1189: 后出手时吸取对手{0}点体力
|
||
type Effect1189 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1189) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.IsFirst() {
|
||
return true
|
||
}
|
||
|
||
damage := e.Args()[0]
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
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 1191: 100%令自身全属性-{0}
|
||
type Effect1191 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1191) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
level := int8(e.Args()[0].IntPart())
|
||
for i := range e.Ctx().Our.Prop[:] {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -level)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1192: 将自身能力下降状态反馈给对手,反馈失败则解除自身能力下降状态
|
||
type Effect1192 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1192) Skill_Use() bool {
|
||
copied := false
|
||
for i, v := range e.Ctx().Our.Prop[:] {
|
||
if v >= 0 {
|
||
continue
|
||
}
|
||
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), v) {
|
||
copied = true
|
||
}
|
||
}
|
||
if copied {
|
||
return true
|
||
}
|
||
|
||
for i, v := range e.Ctx().Our.Prop[:] {
|
||
if v < 0 {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1188, &Effect1188{})
|
||
input.InitEffect(input.EffectType.Skill, 1189, &Effect1189{})
|
||
input.InitEffect(input.EffectType.Skill, 1191, &Effect1191{})
|
||
input.InitEffect(input.EffectType.Skill, 1192, &Effect1192{})
|
||
}
|