43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/common/data/xmlres"
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"strings"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
"github.com/gogf/gf/v2/util/gconv"
|
||
"github.com/samber/lo"
|
||
)
|
||
|
||
// 15. 若遇到天敌, 则整个战斗中对天敌的伤害减少 n%;(a1: 0-100 百分比)
|
||
// TODO: 实现若遇到天敌, 则整个战斗中对天敌的伤害减少 n%;(a1: 0-100 百分比)的核心逻辑
|
||
type NewSel15 struct {
|
||
NewSel0
|
||
}
|
||
|
||
func (e *NewSel15) Damage_Mul(t *info.DamageZone) bool {
|
||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet[0].Info.CatchTime {
|
||
return true
|
||
}
|
||
evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(e.Ctx().Our.CurrentPet[0].ID)].NaturalEnemy, " "))
|
||
_, ok := lo.Find(evs, func(t uint32) bool {
|
||
return t == uint32(e.Ctx().Opp.CurrentPet[0].ID)
|
||
})
|
||
if !ok {
|
||
return true
|
||
}
|
||
|
||
if t.Type == info.DamageType.Red {
|
||
reduceRatio := alpacadecimal.NewFromInt(100).Sub(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
|
||
t.Damage = t.Damage.Mul(reduceRatio)
|
||
}
|
||
|
||
return true
|
||
}
|
||
func init() {
|
||
input.InitEffect(input.EffectType.NewSel, 15, &NewSel15{})
|
||
}
|