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

160 lines
3.7 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"
"math"
"github.com/alpacahq/alpacadecimal"
)
// Effect 663: {0}回合内若对手使用攻击技能则{1}%使对手{2}
type Effect663 struct {
RoundEffectArg0Base
}
func (e *Effect663) Skill_Use_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 664: 若先出手则当回合对手无法造成攻击伤害
type Effect664 struct {
node.EffectNode
}
func (e *Effect664) DamageLockEx(zone *info.DamageZone) bool {
if !e.IsFirst() || zone == nil || zone.Type != info.DamageType.Red {
return true
}
zone.Damage = alpacadecimal.Zero
return true
}
// Effect 665: 造成的伤害低于{0}则{1}回合内自身受到的伤害减少{2}
type Effect665 struct {
node.EffectNode
}
func (e *Effect665) Skill_Use() bool {
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
reductionEffect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
665,
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
)
if reductionEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, reductionEffect)
}
return true
}
type Effect665Sub struct {
node.EffectNode
}
func (e *Effect665Sub) SetArgs(t *input.Input, a ...int) {
setArgsWithDuration0(&e.EffectNode, t, a...)
}
func (e *Effect665Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
if zone.Damage.Cmp(e.Args()[1]) > 0 {
zone.Damage = zone.Damage.Sub(e.Args()[1])
} else {
zone.Damage = alpacadecimal.Zero
}
return true
}
// Effect 666: 使自身下回合攻击必定先手、必定暴击
type Effect666 struct {
FixedDuration1Base
active bool
}
func (e *Effect666) Skill_Use() bool {
e.active = true
return true
}
func (e *Effect666) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.active {
return true
}
if sattack == nil || sattack.PlayerID != e.Ctx().Our.UserID || sattack.SkillEntity == nil {
return true
}
if sattack.SkillEntity.Category() == info.Category.STATUS {
return true
}
if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID {
return true
}
sattack.SkillEntity.XML.Priority = math.MaxInt
return true
}
func (e *Effect666) ActionStart(a, b *action.SelectSkillAction) bool {
if !e.active || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 667: 自身为满体力时{0}{1}
type Effect667 struct {
node.EffectNode
}
func (e *Effect667) Skill_Use() bool {
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) != 0 {
return true
}
for i := 0; i < len(e.SideEffectArgs) && i < 6; i++ {
if e.SideEffectArgs[i] == 0 {
continue
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(e.SideEffectArgs[i]))
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 663, &Effect663{})
input.InitEffect(input.EffectType.Skill, 664, &Effect664{})
input.InitEffect(input.EffectType.Skill, 665, &Effect665{})
input.InitEffect(input.EffectType.Sub, 665, &Effect665Sub{})
input.InitEffect(input.EffectType.Skill, 666, &Effect666{})
input.InitEffect(input.EffectType.Skill, 667, &Effect667{})
}