85 lines
2.0 KiB
Go
85 lines
2.0 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// 504. 乱舞:群体攻击提升{0}%的攻击伤害并增加一个攻击目标
|
|
// 说明:
|
|
// 1) 作为 NewSel(魂印/特性)实现,避免影响技能侧的 Effect504 旧逻辑。
|
|
// 2) 目前战斗主链仍是单目标红伤,额外目标以“追加一次同等红伤”方式落地。
|
|
type NewSel504 struct {
|
|
NewSel0
|
|
}
|
|
|
|
func (e *NewSel504) isOwnerActive() bool {
|
|
our := e.Ctx().Our
|
|
if our == nil || our.CurrentPet() == nil {
|
|
return false
|
|
}
|
|
return e.ID().GetCatchTime() == our.CurrentPet().Info.CatchTime
|
|
}
|
|
|
|
func (e *NewSel504) Damage_Mul(zone *info.DamageZone) bool {
|
|
if !e.isOwnerActive() || zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
percent := e.Args()[0]
|
|
if percent.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100).Add(percent)).Div(alpacadecimal.NewFromInt(100))
|
|
return true
|
|
}
|
|
|
|
func (e *NewSel504) Action_end() bool {
|
|
if !e.isOwnerActive() {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
return true
|
|
}
|
|
|
|
our := e.Ctx().Our
|
|
if our == nil || our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
currentTarget := e.OpponentInput()
|
|
var extraTarget *input.Input
|
|
e.ForEachOpponentSlot(func(target *input.Input) bool {
|
|
if target == nil || target == currentTarget {
|
|
return true
|
|
}
|
|
pet := target.CurrentPet()
|
|
if pet == nil || !pet.Alive() {
|
|
return true
|
|
}
|
|
extraTarget = target
|
|
return false
|
|
})
|
|
if extraTarget == nil {
|
|
return true
|
|
}
|
|
|
|
extraTarget.Damage(our, &info.DamageZone{
|
|
Type: info.DamageType.Red,
|
|
Damage: our.SumDamage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.NewSel, 504, &NewSel504{})
|
|
}
|