Files
bl/logic/service/fight/effect/1168_1172.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

156 lines
4.4 KiB
Go

package effect
import (
"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"
)
func clearAllStatusEffects1169(target *input.Input) {
if target == nil {
return
}
for _, eff := range target.Effects {
if eff == nil || !eff.Alive() || eff.ID().GetEffectType() != input.EffectType.Status {
continue
}
eff.Alive(false)
}
}
// Effect 1168: 全属性+{0},双方任意一方处于异常状态则强化效果翻倍
type Effect1168 struct{ node.EffectNode }
func (e *Effect1168) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
level := int8(e.Args()[0].IntPart())
if e.Ctx().Our.StatEffect_Exist_all() || e.Ctx().Opp.StatEffect_Exist_all() {
level *= 2
}
applyAllPropUp(e.Ctx().Our, level)
return true
}
// Effect 1169: 若自身处于异常状态则造成的攻击伤害额外提升{0}%且回合结束后解除自身所有异常状态
type Effect1169 struct{ node.EffectNode }
func (e *Effect1169) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 || !e.Ctx().Our.StatEffect_Exist_all() {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
return true
}
func (e *Effect1169) TurnEnd() {
if e.Ctx().Our.StatEffect_Exist_all() {
clearAllStatusEffects1169(e.Ctx().Our)
}
}
// Effect 1170: 消除对手能力提升状态,消除成功则附加{0}点固定伤害
type Effect1170 struct{ node.EffectNode }
func (e *Effect1170) OnSkill() bool {
if len(e.Args()) == 0 || !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Args()[0]})
return true
}
// Effect 1171: 未击败对手则使自身下{0}回合受到的伤害减少{1}点
type Effect1171 struct{ node.EffectNode }
func (e *Effect1171) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Opp.CurPet[0].Info.Hp <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1171, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1171Sub struct{ RoundEffectArg0Base }
func (e *Effect1171Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
reduce := e.Args()[1]
if zone.Damage.Cmp(reduce) <= 0 {
zone.Damage = alpacadecimal.Zero
return true
}
zone.Damage = zone.Damage.Sub(reduce)
return true
}
// Effect 1172: {0}回合做{1}~{2}次攻击,每次攻击都有{3}%的概率令自身{4}
// 当前战斗模型未逐段执行多段攻击,这里按随机连击次数折算为红伤倍率,并按命中段数独立判定附加状态。
type Effect1172 struct {
RoundEffectArg0Base
addStatus bool
}
func (e *Effect1172) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 5 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
minHits := int(e.Args()[1].IntPart())
maxHits := int(e.Args()[2].IntPart())
if minHits <= 0 {
minHits = 1
}
if maxHits < minHits {
maxHits = minHits
}
hits := minHits
if maxHits > minHits {
hits += grand.Intn(maxHits - minHits + 1)
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(hits)))
e.addStatus = false
for i := 0; i < hits; i++ {
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[3].IntPart()), 100); ok {
e.addStatus = true
break
}
}
return true
}
func (e *Effect1172) Skill_Use() bool {
if !e.addStatus || len(e.Args()) < 5 {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[4].IntPart()))
if statusEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
}
e.addStatus = false
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1168, &Effect1168{})
input.InitEffect(input.EffectType.Skill, 1169, &Effect1169{})
input.InitEffect(input.EffectType.Skill, 1170, &Effect1170{})
input.InitEffect(input.EffectType.Skill, 1171, &Effect1171{})
input.InitEffect(input.EffectType.Sub, 1171, &Effect1171Sub{})
input.InitEffect(input.EffectType.Skill, 1172, &Effect1172{})
}