Files
bl/logic/service/fight/effect/1107_1111.go
xinian 66fdc3d189
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现技能效果 627-672 及 1011-1111
2026-03-29 19:00:08 +08:00

233 lines
5.6 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/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1107: 未击败对手则{0}%自身全属性+{1}{2}%对手全属性-{3}
type Effect1107 struct {
node.EffectNode
}
func (e *Effect1107) Skill_Use() bool {
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
return true
}
selfChance := int(e.Args()[0].IntPart())
if ok, _, _ := e.Input.Player.Roll(selfChance, 100); ok {
boost := int8(e.Args()[1].IntPart())
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
}
}
oppChance := int(e.Args()[2].IntPart())
if ok, _, _ := e.Input.Player.Roll(oppChance, 100); ok {
reduce := int8(e.Args()[3].IntPart())
for i := 0; i < 6; i++ {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -reduce)
}
}
return true
}
// Effect 1108: 自身每处于一种能力提升状态则技能连击数+{0},对手每处于一种弱化状态则技能连击数+{1}
// 当前战斗模型未逐段执行多段攻击,这里按仓库现有连击效果统一折算为红伤倍率提升。
type Effect1108 struct {
node.EffectNode
}
func (e *Effect1108) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
baseHits := e.Ctx().SkillEntity.XML.AtkNum
if baseHits <= 0 {
baseHits = 1
}
extraHits := countPositivePropKinds(e.Ctx().Our)*int(e.Args()[0].IntPart()) +
countNegativePropKinds(e.Ctx().Opp)*int(e.Args()[1].IntPart())
totalHits := baseHits + extraHits
if totalHits <= 1 {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(totalHits)))
return true
}
// Effect 1109: {0}回合内若自身能力提升状态被消除则吸取对手最大体力的1/{1}
type Effect1109 struct {
RoundEffectArg0Base
}
func (e *Effect1109) PropBefer(source *input.Input, prop int8, level int8) bool {
if source != e.Ctx().Opp {
return true
}
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
return true
}
if level != 0 || e.Ctx().Our.Prop[prop] <= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, nil, damage)
return true
}
// Effect 1110: 反转对手能力提升状态,反转成功则令对手下{0}次属性技能失效,反转失败则消除对手能力提升状态
type Effect1110 struct {
node.EffectNode
}
func (e *Effect1110) Skill_Use() bool {
reversed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
reversed = true
}
}
if reversed {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1110, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
for i, v := range e.Ctx().Opp.Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
}
}
return true
}
type Effect1110Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1110Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1110Sub) SkillHit_ex() bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetNoSide()
e.Ctx().SkillEntity.AttackTime = 0
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1111: {0}%令对手{1},未触发则{2}回合内自身造成的攻击伤害额外提升{3}%
type Effect1111 struct {
node.EffectNode
}
func (e *Effect1111) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1111, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1111Sub struct {
node.EffectNode
percent alpacadecimal.Decimal
}
func (e *Effect1111Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if len(a) > 0 {
e.Duration(a[0])
}
if len(a) > 1 {
e.percent = alpacadecimal.NewFromInt(int64(a[1]))
}
}
func (e *Effect1111Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(e.percent)).Div(hundred)
return true
}
func countPositivePropKinds(target *input.Input) int {
count := 0
for _, v := range target.Prop[:] {
if v > 0 {
count++
}
}
return count
}
func countNegativePropKinds(target *input.Input) int {
count := 0
for _, v := range target.Prop[:] {
if v < 0 {
count++
}
}
return count
}
func init() {
input.InitEffect(input.EffectType.Skill, 1107, &Effect1107{})
input.InitEffect(input.EffectType.Skill, 1108, &Effect1108{})
input.InitEffect(input.EffectType.Skill, 1109, &Effect1109{})
input.InitEffect(input.EffectType.Skill, 1110, &Effect1110{})
input.InitEffect(input.EffectType.Sub, 1110, &Effect1110Sub{})
input.InitEffect(input.EffectType.Skill, 1111, &Effect1111{})
input.InitEffect(input.EffectType.Sub, 1111, &Effect1111Sub{})
}