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

127 lines
3.4 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"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1353: {0}回合内若自身先出手则{1}%令对手{2},未触发则消除对手回合类效果
type Effect1353 struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1353) OnSkill() bool {
if len(e.Args()) < 3 || !e.IsFirst() {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok && addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) {
e.triggered = true
}
return true
}
func (e *Effect1353) TurnEnd() {
if !e.triggered && e.Duration() == 1 {
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
}
e.EffectNode.TurnEnd()
}
// Effect 1354: 吸取对手能力提升状态,吸取成功则吸取对手{0}点体力,若对手不处于能力提升状态则令对手全属性-{1}
type Effect1354 struct{ node.EffectNode }
func (e *Effect1354) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
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) {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
absorbed = true
}
}
if absorbed {
drain := e.Args()[0]
if drain.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
}
return true
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[1].IntPart()))
return true
}
// Effect 1355: 若打出致命一击则自身免疫下{0}次受到的异常状态
type Effect1355 struct{ node.EffectNode }
func (e *Effect1355) SkillHit_ex() bool {
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.Crit == 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1099, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
// Effect 1356: 打出致命一击则附加对手最大体力1/{0}的百分比伤害
type Effect1356 struct{ node.EffectNode }
func (e *Effect1356) OnSkill() bool {
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Crit == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
return true
}
if e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[0])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1357: 后出手时造成的伤害提高{0}%
type Effect1357 struct{ node.EffectNode }
func (e *Effect1357) SkillHit() bool {
if len(e.Args()) == 0 || e.IsFirst() || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1353, &Effect1353{})
input.InitEffect(input.EffectType.Skill, 1354, &Effect1354{})
input.InitEffect(input.EffectType.Skill, 1355, &Effect1355{})
input.InitEffect(input.EffectType.Skill, 1356, &Effect1356{})
input.InitEffect(input.EffectType.Skill, 1357, &Effect1357{})
}