feat(effect): 实现effects 1770-1794战斗效果 - 实现Effect 1770: 开启战魂附体效果,免疫对手下1次攻击技能伤害, 若对手攻击技能PP值为满则额外免疫下1次固定伤害和百分比伤害 - 实现Effect 1771-1779相关战斗效果,包括能力状态反转、固定伤害计算等功能 - 实现Effect 1780-1794系列效果,包含伤害计算、护盾机制、切换限制等功能
760 lines
23 KiB
Go
760 lines
23 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/common/data/xmlres"
|
||
"blazing/logic/service/fight/action"
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
func healBench2121(owner *input.Input, amount alpacadecimal.Decimal) {
|
||
if owner == nil || amount.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return
|
||
}
|
||
for _, pet := range owner.AllPet {
|
||
if pet == nil || !pet.Alive() || pet == owner.CurrentPet {
|
||
continue
|
||
}
|
||
pet.Info.ModelHP(amount.IntPart())
|
||
}
|
||
}
|
||
|
||
func clearTargetEffects(owner, target *input.Input) bool {
|
||
if owner == nil || target == nil {
|
||
return false
|
||
}
|
||
cleared := false
|
||
for _, eff := range target.Effects {
|
||
if eff != nil && eff.Alive() {
|
||
eff.Alive(false)
|
||
cleared = true
|
||
}
|
||
}
|
||
return cleared
|
||
}
|
||
|
||
func addStatusEffect(owner, target *input.Input, statusID int) bool {
|
||
if owner == nil || target == nil {
|
||
return false
|
||
}
|
||
eff := owner.InitEffect(input.EffectType.Status, statusID)
|
||
if eff == nil {
|
||
return false
|
||
}
|
||
target.AddEffect(owner, eff)
|
||
return true
|
||
}
|
||
|
||
const (
|
||
status2135LossLife = 2135
|
||
status2136ReturnLife = 2136
|
||
status2138ShadowSeed = 2138
|
||
status2139ShadowRoot = 2139
|
||
)
|
||
|
||
var effect2137StatusRounds = []info.EnumPetStatus{
|
||
info.PetStatus.Paralysis,
|
||
info.PetStatus.Poisoned,
|
||
info.PetStatus.Burned,
|
||
info.PetStatus.DrainHP,
|
||
info.PetStatus.Frozen,
|
||
info.PetStatus.Fear,
|
||
info.PetStatus.Tired,
|
||
info.PetStatus.Sleep,
|
||
info.PetStatus.Petrified,
|
||
info.PetStatus.Confused,
|
||
info.PetStatus.Weakened,
|
||
info.PetStatus.Flammable,
|
||
info.PetStatus.Berserk,
|
||
info.PetStatus.IceBound,
|
||
info.PetStatus.Bleeding,
|
||
info.PetStatus.Paralyzed,
|
||
info.PetStatus.Blind,
|
||
}
|
||
|
||
type timedStatus struct {
|
||
BaseStatus
|
||
defaultDuration int
|
||
stackable bool
|
||
}
|
||
|
||
func (e *timedStatus) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t)
|
||
e.Duration(e.defaultDuration)
|
||
e.CanStack(e.stackable)
|
||
}
|
||
|
||
func getAliveStatusEffect(target *input.Input, statusID int) input.Effect {
|
||
if target == nil {
|
||
return nil
|
||
}
|
||
eff := target.GetEffect(input.EffectType.Status, statusID)
|
||
if eff == nil || !eff.Alive() {
|
||
return nil
|
||
}
|
||
return eff
|
||
}
|
||
|
||
func addTimedStatus(owner, target *input.Input, statusID, duration int) bool {
|
||
if owner == nil || target == nil {
|
||
return false
|
||
}
|
||
eff := owner.InitEffect(input.EffectType.Status, statusID, duration)
|
||
if eff == nil {
|
||
return false
|
||
}
|
||
if duration <= 0 {
|
||
duration = 1
|
||
}
|
||
eff.Duration(duration)
|
||
target.AddEffect(owner, eff)
|
||
return true
|
||
}
|
||
|
||
func transferTimedStatus(owner, source, target *input.Input, statusID int) bool {
|
||
eff := getAliveStatusEffect(source, statusID)
|
||
if eff == nil {
|
||
return false
|
||
}
|
||
|
||
duration := eff.Duration()
|
||
if duration <= 0 {
|
||
duration = 1
|
||
}
|
||
eff.Alive(false)
|
||
return addTimedStatus(owner, target, statusID, duration)
|
||
}
|
||
|
||
func countEffectRounds(target *input.Input, statusIDs []info.EnumPetStatus) int {
|
||
if target == nil {
|
||
return 0
|
||
}
|
||
total := 0
|
||
for _, statusID := range statusIDs {
|
||
eff := getAliveStatusEffect(target, int(statusID))
|
||
if eff == nil {
|
||
continue
|
||
}
|
||
if duration := eff.Duration(); duration > 0 {
|
||
total += duration
|
||
}
|
||
}
|
||
return total
|
||
}
|
||
|
||
func addShadowRoot(owner, target *input.Input) bool {
|
||
if owner == nil || target == nil {
|
||
return false
|
||
}
|
||
eff := owner.InitEffect(input.EffectType.Status, status2139ShadowRoot)
|
||
if eff == nil {
|
||
return false
|
||
}
|
||
eff.Stack(1)
|
||
target.AddEffect(owner, eff)
|
||
return true
|
||
}
|
||
|
||
func hasShadowSeed(target *input.Input) bool {
|
||
return getAliveStatusEffect(target, status2138ShadowSeed) != nil
|
||
}
|
||
|
||
// Effect 2120: 自身为对手天敌时n回合内受到攻击的伤害减少m%
|
||
type Effect2120 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2120) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2120, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2120) DamageDivEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || !e.ISNaturalEnemy() {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 - int64(e.Args()[1].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
return true
|
||
}
|
||
|
||
type Effect2120Sub struct{ RoundEffectArg0Base }
|
||
|
||
// Effect 2121: 未击败对手则己方场下精灵吸取对手最大体力的n%
|
||
type Effect2121 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2121) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2121, int(e.Args()[0].IntPart()))
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2121Sub struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect2121Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
}
|
||
|
||
func (e *Effect2121Sub) TurnEnd() {
|
||
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
||
return
|
||
}
|
||
heal := e.Ctx().Opp.CurrentPet.GetMaxHP().Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
|
||
if heal.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return
|
||
}
|
||
before := e.Ctx().Opp.CurrentPet.Info.Hp
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: heal})
|
||
healBench2121(e.Ctx().Our, heal)
|
||
if e.Ctx().Opp.CurrentPet.Info.Hp < before {
|
||
e.Alive(false)
|
||
}
|
||
}
|
||
|
||
// Effect 2122: 获得护罩,护罩消失时自身所有技能PP值+{1}
|
||
type Effect2122 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2122) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
e.Ctx().Our.AddShield(e.Args()[0])
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2122, int(e.Args()[1].IntPart()))
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2122Sub struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect2122Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
}
|
||
|
||
func (e *Effect2122Sub) ShieldChange(before, after alpacadecimal.Decimal) bool {
|
||
if before.Cmp(alpacadecimal.Zero) <= 0 || after.Cmp(alpacadecimal.Zero) > 0 || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
restore := uint32(e.Args()[0].IntPart())
|
||
if restore == 0 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
||
return true
|
||
}
|
||
for i := range e.Ctx().Our.CurrentPet.Info.SkillList {
|
||
skillInfo := &e.Ctx().Our.CurrentPet.Info.SkillList[i]
|
||
skill, ok := xmlres.SkillMap[int(skillInfo.ID)]
|
||
if !ok || skill.MaxPP <= 0 {
|
||
continue
|
||
}
|
||
next := skillInfo.PP + restore
|
||
if next > uint32(skill.MaxPP) {
|
||
next = uint32(skill.MaxPP)
|
||
}
|
||
skillInfo.PP = next
|
||
}
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
// Effect 2123: 消除对手回合类效果,消除成功令对手感染并附加中毒、睡眠、寄生中的前1种异常状态
|
||
type Effect2123 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2123) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
||
}
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Poisoned))
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Sleep))
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.DrainHP))
|
||
return true
|
||
}
|
||
|
||
// Effect 2124: 概率造成伤害翻倍,自身处于能力提升状态或对手处于能力下降状态时概率翻倍
|
||
type Effect2124 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2124) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
chance := int(e.Args()[0].IntPart())
|
||
if e.Ctx().Our.HasPropADD() || e.Ctx().Opp.HasPropSub() {
|
||
chance *= 2
|
||
}
|
||
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2125: 携带此技能时,专属特性中对手属性技能无效的概率提升至100%
|
||
type Effect2125 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2125) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.SetNoSide()
|
||
return true
|
||
}
|
||
|
||
// Effect 2126: 技能无效时,消除对手回合类效果、能力提升效果,并令对手烧伤
|
||
type Effect2126 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2126) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Burned))
|
||
return true
|
||
}
|
||
|
||
// Effect 2127: 技能无效时,消除对手回合类效果、能力提升效果,并令对手冻伤
|
||
type Effect2127 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2127) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Frozen))
|
||
return true
|
||
}
|
||
|
||
// Effect 2128: 对手不处于异常状态时对手n回合内体力恢复效果减少m%
|
||
type Effect2128 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2128) Skill_Use() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().Opp.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2128, e.SideEffectArgs...)
|
||
if eff != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2128Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2128Sub) Heal_Pre(_ action.BattleActionI, amount *int) bool {
|
||
if amount == nil || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
*amount = *amount * (100 - int(e.Args()[1].IntPart())) / 100
|
||
return true
|
||
}
|
||
|
||
// Effect 2129: 攻击后附加造成伤害n%,先出手时效果提升m%,附加后若对手体力未减少则额外附加等量的真实伤害
|
||
type Effect2129 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2129) OnSkill() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2129, e.SideEffectArgs...)
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2129Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2129Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[0].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
if e.IsFirst() {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[1].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2130: 对手持有失能时必定命中且无视攻击免疫效果
|
||
type Effect2130 struct {
|
||
node.EffectNode
|
||
disabled []input.Effect
|
||
}
|
||
|
||
func (e *Effect2130) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || !e.Ctx().Opp.HasPropSub() {
|
||
return true
|
||
}
|
||
|
||
e.disabled = e.disabled[:0]
|
||
for _, eff := range e.Ctx().Opp.Effects {
|
||
if eff == nil || !eff.Alive() {
|
||
continue
|
||
}
|
||
if _, ok := effect1508IgnoredImmunityIDs[int(eff.ID().Suffix())]; !ok {
|
||
continue
|
||
}
|
||
eff.Alive(false)
|
||
e.disabled = append(e.disabled, eff)
|
||
}
|
||
e.Ctx().SkillEntity.AttackTime = 2
|
||
e.Ctx().SkillEntity.Hit = true
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2130) Skill_Use() bool {
|
||
for _, eff := range e.disabled {
|
||
if eff != nil {
|
||
eff.Alive(true)
|
||
}
|
||
}
|
||
e.disabled = e.disabled[:0]
|
||
return true
|
||
}
|
||
|
||
// Effect 2131: 自身持有回体时先制+1且附加对手最大体力1/{0}的百分比伤害
|
||
type Effect2131 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2131) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current == nil || current.SkillEntity == nil || !e.Ctx().Our.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
||
return true
|
||
}
|
||
current.SkillEntity.XML.Priority++
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2131) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 || !e.Ctx().Our.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Add(e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]))
|
||
return true
|
||
}
|
||
|
||
// Effect 2132: 对手持有失体时造成伤害提升100%,否则为对手附加3回合的失体并令对手害怕
|
||
type Effect2132 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2132) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || !e.Ctx().Opp.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2132) OnSkill() bool {
|
||
if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
||
return true
|
||
}
|
||
addTimedStatus(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.DrainedHP), 3)
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Fear))
|
||
return true
|
||
}
|
||
|
||
// Effect 2133: 自身持有回体时先制+1,否则为自身附加3回合的回体并令对手疲惫
|
||
type Effect2133 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2133) Skill_Use() bool {
|
||
if e.Ctx().Our.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
||
return true
|
||
}
|
||
addTimedStatus(e.Ctx().Our, e.Ctx().Our, int(info.PetStatus.DrainedHP), 3)
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Tired))
|
||
return true
|
||
}
|
||
|
||
// Effect 2134: 反转对手能力提升状态,反转成功则恢复自身所有体力和PP值
|
||
type Effect2134 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2134) OnSkill() bool {
|
||
reversed := false
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v <= 0 {
|
||
continue
|
||
}
|
||
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
||
reversed = true
|
||
}
|
||
}
|
||
if !reversed {
|
||
return true
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
|
||
e.Ctx().Our.HealPP(-1)
|
||
return true
|
||
}
|
||
|
||
// Effect 2135: 自身未持有失命时为自身附加回合的失命,若自身持有失命则将失命转移给对手
|
||
type Effect2135 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2135) Skill_Use() bool {
|
||
if transferTimedStatus(e.Ctx().Our, e.Ctx().Our, e.Ctx().Opp, status2135LossLife) {
|
||
return true
|
||
}
|
||
addTimedStatus(e.Ctx().Our, e.Ctx().Our, status2135LossLife, 3)
|
||
return true
|
||
}
|
||
|
||
// Effect 2136: 对手未持有回命时为对手附加回合的回命,若对手持有回命且剩余回合数大于0则回合数-1
|
||
type Effect2136 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2136) Skill_Use() bool {
|
||
if eff := getAliveStatusEffect(e.Ctx().Opp, status2136ReturnLife); eff != nil {
|
||
if eff.Duration() > 1 {
|
||
eff.Duration(eff.Duration() - 1)
|
||
}
|
||
return true
|
||
}
|
||
addTimedStatus(e.Ctx().Our, e.Ctx().Opp, status2136ReturnLife, 3)
|
||
return true
|
||
}
|
||
|
||
// Effect 2137: 自身每有1回合异常状态造成伤害提升{0}%,最高{1}%
|
||
type Effect2137 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2137) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
rounds := countEffectRounds(e.Ctx().Our, effect2137StatusRounds)
|
||
if rounds <= 0 {
|
||
return true
|
||
}
|
||
percent := int(e.Args()[0].IntPart())
|
||
limit := int(e.Args()[1].IntPart())
|
||
bonus := rounds * percent
|
||
if bonus > limit {
|
||
bonus = limit
|
||
}
|
||
if bonus <= 0 {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(bonus))).Div(alpacadecimal.NewFromInt(100))
|
||
return true
|
||
}
|
||
|
||
// Effect 2138: 为对手种下悬暗之因,若对手悬暗之因已成熟则转化为自身1层悬暗之根
|
||
type Effect2138 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2138) Skill_Use() bool {
|
||
if seed := getAliveStatusEffect(e.Ctx().Opp, status2138ShadowSeed); seed != nil && seed.Duration() <= 1 {
|
||
seed.Alive(false)
|
||
addShadowRoot(e.Ctx().Our, e.Ctx().Our)
|
||
return true
|
||
}
|
||
addTimedStatus(e.Ctx().Our, e.Ctx().Opp, status2138ShadowSeed, 3)
|
||
return true
|
||
}
|
||
|
||
// Effect 2139: 100%令对手害怕,对手拥有悬暗之因时改为诅咒,自身拥有悬暗之根时每层伤害提升{0}%
|
||
type Effect2139 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2139) Skill_Use() bool {
|
||
if hasShadowSeed(e.Ctx().Opp) {
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(petStatusCurse))
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Fear))
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2139) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
eff := getAliveStatusEffect(e.Ctx().Our, status2139ShadowRoot)
|
||
if eff == nil || eff.Stack() <= 0 {
|
||
return true
|
||
}
|
||
bonus := eff.Stack() * int(e.Args()[0].IntPart())
|
||
if bonus <= 0 {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(bonus))).Div(alpacadecimal.NewFromInt(100))
|
||
return true
|
||
}
|
||
|
||
// Effect 2140: 吸取对手最大体力的{0}%,对手每有1层悬暗之因提升{1}%,吸取后若对手体力未减少则对手下{2}回合无法主动切换精灵
|
||
type Effect2140 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2140) 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
|
||
}
|
||
|
||
beforeHP := e.Ctx().Opp.CurrentPet.GetHP()
|
||
percent := e.Args()[0]
|
||
if seed := getAliveStatusEffect(e.Ctx().Opp, status2138ShadowSeed); seed != nil && seed.Stack() > 0 {
|
||
percent = percent.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(int64(seed.Stack()))))
|
||
}
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Mul(percent).Div(alpacadecimal.NewFromInt(100))
|
||
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)
|
||
}
|
||
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(beforeHP) >= 0 {
|
||
if eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2144, int(e.Args()[2].IntPart())); eff != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||
e.Ctx().Opp.CanChange = 1
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2141: 击败持有悬暗之因的对手时自身获得1层悬暗之根
|
||
type Effect2141 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2141) Skill_Use() bool {
|
||
if e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
||
return true
|
||
}
|
||
if !hasShadowSeed(e.Ctx().Opp) {
|
||
return true
|
||
}
|
||
addShadowRoot(e.Ctx().Our, e.Ctx().Our)
|
||
return true
|
||
}
|
||
|
||
// Effect 2142: 无视对手正先制等级
|
||
type Effect2142 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2142) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if current := actionByPlayer(fattack, sattack, e.Ctx().Opp.UserID); current != nil && current.SkillEntity != nil && current.SkillEntity.XML.Priority > 0 {
|
||
current.SkillEntity.XML.Priority = 0
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2143: 无视自身负先制等级
|
||
type Effect2143 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2143) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID); current != nil && current.SkillEntity != nil && current.SkillEntity.XML.Priority < 0 {
|
||
current.SkillEntity.XML.Priority = 0
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2144: 双方n回合无法主动切换精灵
|
||
type Effect2144 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2144) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2144, int(e.Args()[0].IntPart())); eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
e.Ctx().Our.CanChange = 1
|
||
}
|
||
if eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2144, int(e.Args()[0].IntPart())); eff != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||
e.Ctx().Opp.CanChange = 1
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2144Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2144Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2144Sub) SwitchOut(in *input.Input) bool {
|
||
if in != e.Ctx().Our {
|
||
return true
|
||
}
|
||
e.Ctx().Our.CanChange = 0
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2144Sub) TurnEnd() {
|
||
if e.remaining <= 0 {
|
||
e.Ctx().Our.CanChange = 0
|
||
e.Alive(false)
|
||
return
|
||
}
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Ctx().Our.CanChange = 0
|
||
e.Alive(false)
|
||
return
|
||
}
|
||
if e.Ctx().Our != nil && e.Ctx().Our.CurrentPet != nil && e.Ctx().Our.CurrentPet.Info.Hp > 0 {
|
||
e.Ctx().Our.CanChange = 1
|
||
}
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 2120, &Effect2120{})
|
||
input.InitEffect(input.EffectType.Sub, 2120, &Effect2120Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2121, &Effect2121{})
|
||
input.InitEffect(input.EffectType.Sub, 2121, &Effect2121Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2122, &Effect2122{})
|
||
input.InitEffect(input.EffectType.Sub, 2122, &Effect2122Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2123, &Effect2123{})
|
||
input.InitEffect(input.EffectType.Skill, 2124, &Effect2124{})
|
||
input.InitEffect(input.EffectType.Skill, 2125, &Effect2125{})
|
||
input.InitEffect(input.EffectType.Skill, 2126, &Effect2126{})
|
||
input.InitEffect(input.EffectType.Skill, 2127, &Effect2127{})
|
||
input.InitEffect(input.EffectType.Skill, 2128, &Effect2128{})
|
||
input.InitEffect(input.EffectType.Sub, 2128, &Effect2128Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2129, &Effect2129{})
|
||
input.InitEffect(input.EffectType.Sub, 2129, &Effect2129Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2130, &Effect2130{})
|
||
input.InitEffect(input.EffectType.Skill, 2131, &Effect2131{})
|
||
input.InitEffect(input.EffectType.Skill, 2132, &Effect2132{})
|
||
input.InitEffect(input.EffectType.Skill, 2133, &Effect2133{})
|
||
input.InitEffect(input.EffectType.Skill, 2134, &Effect2134{})
|
||
input.InitEffect(input.EffectType.Status, status2135LossLife, &timedStatus{defaultDuration: 3})
|
||
input.InitEffect(input.EffectType.Skill, 2135, &Effect2135{})
|
||
input.InitEffect(input.EffectType.Status, status2136ReturnLife, &timedStatus{defaultDuration: 3})
|
||
input.InitEffect(input.EffectType.Skill, 2136, &Effect2136{})
|
||
input.InitEffect(input.EffectType.Skill, 2137, &Effect2137{})
|
||
input.InitEffect(input.EffectType.Status, status2138ShadowSeed, &timedStatus{defaultDuration: 3})
|
||
input.InitEffect(input.EffectType.Skill, 2138, &Effect2138{})
|
||
input.InitEffect(input.EffectType.Status, status2139ShadowRoot, &timedStatus{defaultDuration: -1, stackable: true})
|
||
input.InitEffect(input.EffectType.Skill, 2139, &Effect2139{})
|
||
input.InitEffect(input.EffectType.Skill, 2140, &Effect2140{})
|
||
input.InitEffect(input.EffectType.Skill, 2141, &Effect2141{})
|
||
input.InitEffect(input.EffectType.Skill, 2142, &Effect2142{})
|
||
input.InitEffect(input.EffectType.Skill, 2143, &Effect2143{})
|
||
input.InitEffect(input.EffectType.Skill, 2144, &Effect2144{})
|
||
input.InitEffect(input.EffectType.Sub, 2144, &Effect2144Sub{})
|
||
}
|