Files
bl/logic/service/fight/effect/805_809.go
xinian b4a8048b85
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 添加战斗效果800-814及优化道具逻辑
2026-03-31 06:51:40 +08:00

146 lines
3.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"
)
// Effect 805: 消除对手能力提升状态,消除成功则令对手随机{0}项技能PP值归零
type Effect805 struct {
node.EffectNode
}
func (e *Effect805) Skill_Use() bool {
if len(e.Args()) == 0 || !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
// Effect 806: {0}回合内若对手使用攻击技能则使用后令自身全属性+{1}
type Effect806 struct {
node.EffectNode
}
func (e *Effect806) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 806, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect806Sub struct {
RoundEffectArg0Base
}
func (e *Effect806Sub) Skill_Use_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
applyAllPropUp(e.Ctx().Our, int8(e.Args()[1].IntPart()))
return true
}
// Effect 807: 附加对手上次造成伤害数值的固定伤害
type Effect807 struct {
node.EffectNode
}
func (e *Effect807) OnSkill() bool {
if e.Ctx().Opp.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Opp.SumDamage,
})
return true
}
// Effect 808: 自身每处于一种能力提升状态则附加{0}点固定伤害
type Effect808 struct {
node.EffectNode
}
func (e *Effect808) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
count := 0
for _, v := range e.Ctx().Our.Prop[:] {
if v > 0 {
count++
}
}
if count <= 0 {
return true
}
damage := e.Args()[0].Mul(alpacadecimal.NewFromInt(int64(count)))
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 809: 使对手下次使用的攻击技能失效
type Effect809 struct {
node.EffectNode
}
func (e *Effect809) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 809)
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect809Sub struct {
node.EffectNode
}
func (e *Effect809Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
}
func (e *Effect809Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
e.Alive(false)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 805, &Effect805{})
input.InitEffect(input.EffectType.Skill, 806, &Effect806{})
input.InitEffect(input.EffectType.Sub, 806, &Effect806Sub{})
input.InitEffect(input.EffectType.Skill, 807, &Effect807{})
input.InitEffect(input.EffectType.Skill, 808, &Effect808{})
input.InitEffect(input.EffectType.Skill, 809, &Effect809{})
input.InitEffect(input.EffectType.Sub, 809, &Effect809Sub{})
}