Files
bl/logic/service/fight/effect/1533_1537.go
2026-04-04 01:04:58 +08:00

162 lines
4.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"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 transferPositiveProps(owner, source, target *input.Input) bool {
if owner == nil || source == nil || target == nil {
return false
}
transferred := false
for idx, level := range source.Prop[:] {
if level <= 0 {
continue
}
if source.SetProp(owner, int8(idx), 0) {
target.SetProp(owner, int8(idx), level)
transferred = true
}
}
return transferred
}
func reducePetSkillPP(pet *info.BattlePetEntity, value int) bool {
if pet == nil || value <= 0 {
return false
}
changed := false
for idx := range pet.Info.SkillList {
if pet.Info.SkillList[idx].PP <= 0 {
continue
}
if pet.Info.SkillList[idx].PP <= uint32(value) {
pet.Info.SkillList[idx].PP = 0
} else {
pet.Info.SkillList[idx].PP -= uint32(value)
}
changed = true
}
return changed
}
func divineMarkLayers(target *input.Input) int {
if target == nil {
return 0
}
return target.CurrentDivineEnergy()
}
func pickBanishedPet(target *input.Input) *info.BattlePetEntity {
if target == nil {
return nil
}
// The current codebase has no explicit "banished" pet state yet.
// Keep the fallback path intact until a dedicated representation exists.
return nil
}
// Effect 1533: 造成的攻击伤害低于{0}时附加大量真实伤害
type Effect1533 struct{ node.EffectNode }
func (e *Effect1533) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
dealTrueDamage(e.Ctx().Our, e.Ctx().Opp, e.Args()[0])
return true
}
// Effect 1534: 100%令对手随机1个被放逐的精灵所有技能PP值-1若对手不存在被放逐的精灵则令对手当前精灵所有技能PP值-1
type Effect1534 struct{ node.EffectNode }
func (e *Effect1534) Skill_Use() bool {
if e.Ctx().Opp == nil {
return true
}
if pet := pickBanishedPet(e.Ctx().Opp); pet != nil && reducePetSkillPP(pet, 1) {
return true
}
reducePetSkillPP(e.Ctx().Opp.CurrentPet, 1)
return true
}
// Effect 1535: 对手存在神印则当回合自身先制+1
type Effect1535 struct{ node.EffectNode }
func (e *Effect1535) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if divineMarkLayers(e.Ctx().Opp) <= 0 {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority++
return true
}
// Effect 1536: 全属性+{0},对手存在神印时强化效果翻倍
type Effect1536 struct{ node.EffectNode }
func (e *Effect1536) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
boost := int8(e.Args()[0].IntPart())
if divineMarkLayers(e.Ctx().Opp) > 0 {
boost *= 2
}
applyAllPropUp(e.Ctx().Our, boost)
return true
}
// Effect 1537: 消耗自身所有护罩并造成等量固定伤害,若当前护罩值低于{0}则造成的固定伤害翻倍
type Effect1537 struct{ node.EffectNode }
func (e *Effect1537) Skill_Use() bool {
if e.Ctx().Our == nil || e.Ctx().Opp == nil {
return true
}
shield := e.Ctx().Our.CurrentShield()
if shield.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Our.ConsumeAllShield()
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if len(e.Args()) > 0 && shield.Cmp(e.Args()[0]) < 0 {
damage = damage.Mul(alpacadecimal.NewFromInt(2))
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1533, &Effect1533{})
input.InitEffect(input.EffectType.Skill, 1534, &Effect1534{})
input.InitEffect(input.EffectType.Skill, 1535, &Effect1535{})
input.InitEffect(input.EffectType.Skill, 1536, &Effect1536{})
input.InitEffect(input.EffectType.Skill, 1537, &Effect1537{})
}