Files
bl/logic/service/fight/effect/1680_1684.go
xinian 87fdccaddf
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat: 实现大量技能效果及战斗逻辑修复
2026-03-30 00:51:18 +08:00

279 lines
6.3 KiB
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1680: 对手不处于异常状态时附加{0}点真实伤害
type Effect1680 struct {
node.EffectNode
}
func (e *Effect1680) OnSkill() bool {
if len(e.Args()) == 0 || e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: e.Args()[0],
})
return true
}
// Effect 1681: 吸取对手能力提升状态,吸取成功则下{0}次受到的攻击伤害减少{1}点
type Effect1681 struct {
node.EffectNode
}
func (e *Effect1681) Skill_Use() bool {
absorbed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
continue
}
absorbed = true
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
}
if !absorbed || len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1681, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1681Sub struct {
node.EffectNode
remaining int
reduce int
}
func (e *Effect1681Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
if len(a) > 1 {
e.reduce = a[1]
}
}
func (e *Effect1681Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 || e.reduce <= 0 {
return true
}
reduceDamage := alpacadecimal.NewFromInt(int64(e.reduce))
if zone.Damage.Cmp(reduceDamage) > 0 {
zone.Damage = zone.Damage.Sub(reduceDamage)
} else {
zone.Damage = alpacadecimal.Zero
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1682: {0}%的概率伤害为{1}倍,未触发则令敌我双方全属性-{2}且下次翻倍概率额外提升{3}%
type Effect1682 struct {
node.EffectNode
triggered bool
nextBonus int
}
func (e *Effect1682) SkillHit() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 4 {
return true
}
bonus := 0
if state := findEffect1682State(e.Ctx().Our, skill.XML.ID); state != nil {
bonus = state.bonusChance
}
chance := int(e.Args()[0].IntPart()) + bonus
if chance > 100 {
chance = 100
}
e.triggered, _, _ = e.Input.Player.Roll(chance, 100)
e.nextBonus = bonus + int(e.Args()[3].IntPart())
if e.triggered {
if state := findEffect1682State(e.Ctx().Our, skill.XML.ID); state != nil {
state.Alive(false)
}
}
return true
}
func (e *Effect1682) Damage_Mul(zone *info.DamageZone) bool {
if !e.triggered || zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Mul(int(e.Args()[1].IntPart()))
return true
}
func (e *Effect1682) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 4 || e.triggered {
return true
}
reduce := int8(e.Args()[2].IntPart())
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -reduce)
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -reduce)
}
if state := findEffect1682State(e.Ctx().Our, skill.XML.ID); state != nil {
state.bonusChance = e.nextBonus
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1682, skill.XML.ID, e.nextBonus)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1682Sub struct {
node.EffectNode
skillID int
bonusChance int
}
func (e *Effect1682Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.skillID = a[0]
}
if len(a) > 1 {
e.bonusChance = a[1]
}
}
func (e *Effect1682Sub) SwitchOut(in *input.Input) bool {
if in == e.Ctx().Our {
e.Alive(false)
}
return true
}
func findEffect1682State(in *input.Input, skillID int) *Effect1682Sub {
if in == nil {
return nil
}
for i := len(in.Effects) - 1; i >= 0; i-- {
effect, ok := in.Effects[i].(*Effect1682Sub)
if !ok || !effect.Alive() || effect.skillID != skillID {
continue
}
return effect
}
return nil
}
// Effect 1683: {0}回合内自身的能力提升状态无法被消除或吸取
type Effect1683 struct {
node.EffectNode
}
func (e *Effect1683) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1683, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1683Sub struct {
RoundEffectArg0Base
}
func (e *Effect1683Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
return true
}
if e.Ctx().Our.Prop[prop] <= 0 {
return true
}
if level == 0 {
return false
}
return true
}
// Effect 1684: {0}回合内对手的能力下降状态无法被解除或反转
type Effect1684 struct {
node.EffectNode
}
func (e *Effect1684) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1684, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1684Sub struct {
RoundEffectArg0Base
}
func (e *Effect1684Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
return true
}
if e.Ctx().Our.Prop[prop] >= 0 {
return true
}
if level >= 0 {
return false
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1680, &Effect1680{})
input.InitEffect(input.EffectType.Skill, 1681, &Effect1681{})
input.InitEffect(input.EffectType.Sub, 1681, &Effect1681Sub{})
input.InitEffect(input.EffectType.Skill, 1682, &Effect1682{})
input.InitEffect(input.EffectType.Sub, 1682, &Effect1682Sub{})
input.InitEffect(input.EffectType.Skill, 1683, &Effect1683{})
input.InitEffect(input.EffectType.Sub, 1683, &Effect1683Sub{})
input.InitEffect(input.EffectType.Skill, 1684, &Effect1684{})
input.InitEffect(input.EffectType.Sub, 1684, &Effect1684Sub{})
}