Files
bl/logic/service/fight/effect/effect_91.go
昔念 415315c288
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
1
2026-04-25 15:55:08 +08:00

84 lines
1.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/input"
)
/**
* n回合内对手的状态变化会同时作用在自己身上
*/
func init() {
t := &Effect91{}
input.InitEffect(input.EffectType.Skill, 91, t)
input.InitEffect(input.EffectType.Sub, 91, &Effect91Sub{})
}
// Effect 91: {0}回合内对手的状态变化会同时作用在自己身上
type Effect91 struct {
RoundEffectSideArg0Base
}
func (e *Effect91) Skill_Use() bool {
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 91, e.SideEffectArgs...)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect91Sub struct {
RoundEffectSideArg0Base
}
func (e *Effect91Sub) PropBefer(_ *input.Input, prop int8, level int8) bool {
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
return true
}
// 当前效果挂在“对手”身上:当对手能力变化时,将实际变化量同步给来源方。
target := e.Ctx().Our
current := target.Prop[prop]
actualDelta := calcPropActualDelta(current, level)
if actualDelta == 0 {
return true
}
owner := e.SourceInput()
if owner == nil || owner == target {
return true
}
owner.SetProp(owner, prop, actualDelta)
return true
}
func calcPropActualDelta(current, change int8) int8 {
switch {
case change < 0:
if current <= -6 {
return 0
}
next := current + change
if next < -6 {
next = -6
}
return next - current
case change > 0:
if current >= 6 {
return 0
}
next := current + change
if next > 6 {
next = 6
}
return next - current
default:
if current == 0 {
return 0
}
return -current
}
}