Files
bl/logic/service/fight/effect/785_789.go

145 lines
3.6 KiB
Go

package effect
import (
element "blazing/common/data/Element"
"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 785: 若自身攻击对手时克制关系为微弱则先制+2
type Effect785 struct {
node.EffectNode
}
func (e *Effect785) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || e.Ctx().Opp.CurrentPet == nil {
return true
}
if current.SkillEntity.Category() == info.Category.STATUS {
return true
}
mul, _ := element.Calculator.GetOffensiveMultiplier(current.SkillEntity.GetType().ID, e.Ctx().Opp.CurrentPet.GetType().ID)
if mul > 0 && mul < 1 {
current.SkillEntity.XML.Priority += 2
}
return true
}
// Effect 786: 令对手随机进入{0}种异常状态
type Effect786 struct {
node.EffectNode
}
func (e *Effect786) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
applyRandomStatusToOpp(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
// Effect 787: {0}回合内使用技能后若对手处于能力提升状态则附加对手最大体力1/{1}的百分比伤害
type Effect787 struct {
node.EffectNode
}
func (e *Effect787) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 787, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect787Sub struct {
RoundEffectArg0Base
}
func (e *Effect787Sub) Skill_Use() bool {
if len(e.Args()) < 2 || !e.Ctx().Opp.HasPropADD() || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.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 788: 消除对手能力提升,消除成功{0}回合内免疫异常状态
type Effect788 struct {
node.EffectNode
}
func (e *Effect788) Skill_Use() bool {
if len(e.Args()) == 0 || !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect48{}, -1)
return true
}
// Effect 789: 消除对手回合类效果,消除成功对手下{0}回合受到的伤害翻倍
type Effect789 struct {
node.EffectNode
}
func (e *Effect789) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 789, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect789Sub struct {
RoundEffectArg0Base
}
func (e *Effect789Sub) DamageDivEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 785, &Effect785{})
input.InitEffect(input.EffectType.Skill, 786, &Effect786{})
input.InitEffect(input.EffectType.Skill, 787, &Effect787{})
input.InitEffect(input.EffectType.Sub, 787, &Effect787Sub{})
input.InitEffect(input.EffectType.Skill, 788, &Effect788{})
input.InitEffect(input.EffectType.Skill, 789, &Effect789{})
input.InitEffect(input.EffectType.Sub, 789, &Effect789Sub{})
}