Files
bl/logic/service/fight/effect/2315_2324.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

214 lines
5.3 KiB
Go

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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 2315: 吸取对方当前PP损失最多的精灵体力
type Effect2315 struct {
node.EffectNode
}
func (e *Effect2315) OnSkill() bool {
if len(e.Args()) < 3 || e.Ctx().Opp.CurPet[0] == nil {
return true
}
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[0])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
// Effect 2316: 任一方能力下降时自身免疫攻击
type Effect2316 struct {
node.EffectNode
}
func (e *Effect2316) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().Our.HasPropSub() || e.Ctx().Opp.HasPropSub() {
e.Ctx().SkillEntity.SetNoSide()
}
return true
}
// Effect 2317: 双方每有1组能力上下提升状态吸血
type Effect2317 struct {
node.EffectNode
}
func (e *Effect2317) OnSkill() bool {
if len(e.Args()) < 1 {
return true
}
if e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil {
return true
}
count := 0
for _, v := range e.Ctx().Our.Prop[:] {
if v > 0 {
count++
}
}
for _, v := range e.Ctx().Opp.Prop[:] {
if v > 0 {
count++
}
}
if count == 0 {
return true
}
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Mul(e.Args()[0]).Div(hundred)
damage = damage.Mul(alpacadecimal.NewFromInt(int64(count)))
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
}
return true
}
// Effect 2318: 消耗全部护盾
type Effect2318 struct {
node.EffectNode
}
func (e *Effect2318) Skill_Use() bool {
if e.Ctx().Our.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
return true
}
shield := e.Ctx().Our.CurrentShield()
e.Ctx().Our.AddShield(alpacadecimal.NewFromInt(-1).Mul(shield))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: shield})
return true
}
// Effect 2319: 附加双防之和的百分比伤害
type Effect2319 struct {
node.EffectNode
}
func (e *Effect2319) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
if e.Ctx().Opp.CurPet[0] == nil {
return true
}
dmg := e.Ctx().Our.CurPet[0].GetMaxHP().Mul(e.Args()[0]).Div(hundred)
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: dmg})
return true
}
// Effect 2320: 连续使用技能令对手下若干回合攻击无效
type Effect2320 struct {
node.EffectNode
}
func (e *Effect2320) Skill_Use() bool {
if len(e.Args()) < 8 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2320, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect2320Sub struct {
node.EffectNode
}
func (e *Effect2320Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
return true
}
// Effect 2321: 低伤害时令对手2回合内属性技能无效
type Effect2321 struct {
node.EffectNode
}
func (e *Effect2321) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
if zone.Damage.Cmp(alpacadecimal.NewFromInt(100)) < 0 {
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart()))
}
return true
}
// Effect 2322: 使用时解除异常
type Effect2322 struct {
node.EffectNode
}
func (e *Effect2322) Skill_Use() bool {
clearOwnDownProps(e.Ctx().Our)
return true
}
// Effect 2323: 获得光辉之翼
type Effect2323 struct {
node.EffectNode
}
func (e *Effect2323) Skill_Use() bool {
if e.Ctx().Our.CurPet[0] != nil {
e.Ctx().Our.CurPet[0].PetInfo.Type = 2
}
return true
}
// Effect 2324: 消除对手护盾/护罩并提升效果
type Effect2324 struct {
node.EffectNode
}
func (e *Effect2324) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
cleared := false
if e.Ctx().Opp.HasShield() {
e.Ctx().Opp.AddShield(alpacadecimal.NewFromInt(-1).Mul(e.Ctx().Opp.CurrentShield()))
cleared = true
}
if cleared && e.Ctx().Opp.CurPet[0] != nil {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: e.Ctx().Opp.CurPet[0].GetMaxHP().Mul(e.Args()[0]).Div(hundred),
})
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 2315, &Effect2315{})
input.InitEffect(input.EffectType.Skill, 2316, &Effect2316{})
input.InitEffect(input.EffectType.Skill, 2317, &Effect2317{})
input.InitEffect(input.EffectType.Skill, 2318, &Effect2318{})
input.InitEffect(input.EffectType.Skill, 2319, &Effect2319{})
input.InitEffect(input.EffectType.Skill, 2320, &Effect2320{})
input.InitEffect(input.EffectType.Sub, 2320, &Effect2320Sub{})
input.InitEffect(input.EffectType.Skill, 2321, &Effect2321{})
input.InitEffect(input.EffectType.Skill, 2322, &Effect2322{})
input.InitEffect(input.EffectType.Skill, 2323, &Effect2323{})
input.InitEffect(input.EffectType.Skill, 2324, &Effect2324{})
_ = grand.Intn(1)
}