209 lines
4.8 KiB
Go
209 lines
4.8 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
func countAliveStatusKinds(target *input.Input) int {
|
|
if target == nil {
|
|
return 0
|
|
}
|
|
|
|
seen := make(map[uint16]struct{})
|
|
for _, eff := range target.Effects {
|
|
if eff == nil || !eff.Alive() {
|
|
continue
|
|
}
|
|
effID := eff.ID()
|
|
if effID.GetEffectType() != input.EffectType.Status {
|
|
continue
|
|
}
|
|
seen[effID.Suffix()] = struct{}{}
|
|
}
|
|
return len(seen)
|
|
}
|
|
|
|
// Effect 764: {0}回合内若对手使用攻击技能降低对手最大体力的1/{1}
|
|
type Effect764 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect764) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 764, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect764Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect764Sub) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[1])
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 765: {0}回合对手无法使自身能力出现提升状态
|
|
type Effect765 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect765) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 765, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect765Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect765Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
|
|
if source != e.Ctx().Our {
|
|
return true
|
|
}
|
|
if level <= 0 {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Effect 766: 消除对手能力提升状态,消除成功则{0}回合内对手造成的攻击伤害不超过{1}点
|
|
type Effect766 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect766) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 766, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect766Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect766Sub) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(e.Args()[1]) <= 0 {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = e.Args()[1]
|
|
return true
|
|
}
|
|
|
|
// Effect 767: {0}回合内每回合使用技能且出手流程结束后若对手处于能力下降状态则附加给对手{1}点固定伤害
|
|
type Effect767 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect767) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 767, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect767Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect767Sub) Action_end() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || !e.Ctx().Opp.HasPropSub() {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Args()[1],
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 768: 对手每处于一种异常状态则附加{0}点固定伤害
|
|
type Effect768 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect768) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
count := countAliveStatusKinds(e.Ctx().Opp)
|
|
if count <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Args()[0].Mul(alpacadecimal.NewFromInt(int64(count)))
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 764, &Effect764{})
|
|
input.InitEffect(input.EffectType.Sub, 764, &Effect764Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 765, &Effect765{})
|
|
input.InitEffect(input.EffectType.Sub, 765, &Effect765Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 766, &Effect766{})
|
|
input.InitEffect(input.EffectType.Sub, 766, &Effect766Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 767, &Effect767{})
|
|
input.InitEffect(input.EffectType.Sub, 767, &Effect767Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 768, &Effect768{})
|
|
}
|