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

216 lines
5.2 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/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 734: 若对手不处于能力提升或下降状态时则恢复{0}点体力
type Effect734 struct {
node.EffectNode
}
func (e *Effect734) OnSkill() bool {
if len(e.Args()) == 0 || e.Ctx().Opp.HasPropADD() || e.Ctx().Opp.HasPropSub() {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
return true
}
// Effect 735: 若对手处于能力提升状态则下{0}回合先制+{1}
type Effect735 struct {
node.EffectNode
}
func (e *Effect735) Skill_Use() bool {
if len(e.Args()) < 2 || !e.Ctx().Opp.HasPropADD() {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 735, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect735Sub struct {
RoundEffectArg0Base
}
func (e *Effect735Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if len(e.Args()) < 2 {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
return true
}
// Effect 736: 消除对手能力提升状态,消除成功则{0}回合内令对手使用的属性技能无效
type Effect736 struct {
node.EffectNode
}
func (e *Effect736) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
cleared := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 736, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect736Sub struct {
RoundEffectArg0Base
}
func (e *Effect736Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetNoSide()
return true
}
// Effect 737: {0}%使对手{1}若没有触发则回合结束时减少对手1/{2}最大体力
type Effect737 struct {
node.EffectNode
}
func (e *Effect737) OnSkill() bool {
if len(e.Args()) < 3 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
statusType := int(e.Args()[1].IntPart())
statusEff := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
if statusEff != nil {
statusEff.SetArgs(e.Ctx().Our, 2)
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
}
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 737, int(e.Args()[2].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect737Sub struct {
FixedDuration1Base
}
func (e *Effect737Sub) TurnEnd() {
if len(e.Args()) == 0 || e.Args()[0].IntPart() <= 0 {
e.Alive(false)
return
}
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[0])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Alive(false)
}
// Effect 738: {0}回合内若对手使用属性技能,则使用属性技能后的下{1}回合攻击技能无法造成伤害且命中效果失效
type Effect738 struct {
node.EffectNode
}
func (e *Effect738) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 738, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect738Sub struct {
RoundEffectArg0Base
}
func (e *Effect738Sub) Skill_Use_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
lock := e.Ctx().Our.InitEffect(input.EffectType.Sub, 7381, int(e.Args()[1].IntPart()))
if lock != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, lock)
}
return true
}
type Effect738Lock struct {
RoundEffectArg0Base
}
func (e *Effect738Lock) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetNoSide()
return true
}
func (e *Effect738Lock) 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
}
zone.Damage = alpacadecimal.Zero
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 734, &Effect734{})
input.InitEffect(input.EffectType.Skill, 735, &Effect735{})
input.InitEffect(input.EffectType.Sub, 735, &Effect735Sub{})
input.InitEffect(input.EffectType.Skill, 736, &Effect736{})
input.InitEffect(input.EffectType.Sub, 736, &Effect736Sub{})
input.InitEffect(input.EffectType.Skill, 737, &Effect737{})
input.InitEffect(input.EffectType.Sub, 737, &Effect737Sub{})
input.InitEffect(input.EffectType.Skill, 738, &Effect738{})
input.InitEffect(input.EffectType.Sub, 738, &Effect738Sub{})
input.InitEffect(input.EffectType.Sub, 7381, &Effect738Lock{})
}