Files
bl/logic/service/fight/effect/936_940.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.9 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"
)
// Effect 936: {0}%令对手{1},未触发则令对手{2}回合内使用的属性技能无效
type Effect936 struct {
node.EffectNode
}
func (e *Effect936) OnSkill() bool {
if len(e.Args()) < 3 {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 936, int(e.Args()[2].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect936Sub struct {
RoundEffectArg0Base
}
func (e *Effect936Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetNoSide()
e.Ctx().SkillEntity.AttackTime = 0
return true
}
// Effect 937: 命中后{0}%使对手{1},未触发则对手下{2}回合先制-{3}
type Effect937 struct {
node.EffectNode
}
func (e *Effect937) SkillHit() bool {
if len(e.Args()) < 4 {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 937, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect937Sub struct {
RoundEffectArg0Base
}
func (e *Effect937Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if len(e.Args()) < 2 {
return true
}
priorityDown := int(e.Args()[1].IntPart())
if fattack != nil && fattack.PlayerID == e.Ctx().Opp.UserID && fattack.SkillEntity != nil {
fattack.SkillEntity.XML.Priority -= priorityDown
}
if sattack != nil && sattack.PlayerID == e.Ctx().Opp.UserID && sattack.SkillEntity != nil {
sattack.SkillEntity.XML.Priority -= priorityDown
}
return true
}
// Effect 938: 使对手全属性-{0},先出手时效果翻倍
type Effect938 struct {
node.EffectNode
}
func (e *Effect938) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
level := int8(e.Args()[0].IntPart())
if level <= 0 {
return true
}
if e.IsFirst() {
level *= 2
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, level)
return true
}
// Effect 939: 若后出手则附加自身最大体力1/{0}的百分比伤害并恢复等量体力
type Effect939 struct {
node.EffectNode
}
func (e *Effect939) OnSkill() bool {
if len(e.Args()) == 0 || e.IsFirst() || e.Args()[0].IntPart() <= 0 {
return true
}
damage := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
// Effect 940: 全属性+{0},若对手处于封印属性技能状态则攻击额外+{1}
type Effect940 struct {
node.EffectNode
}
func (e *Effect940) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
baseUp := int8(e.Args()[0].IntPart())
if baseUp > 0 {
applyAllPropUp(e.Ctx().Our, baseUp)
}
if e.Ctx().Opp.StatEffect_Exist_all() {
extraAtkUp := int8(e.Args()[1].IntPart())
if extraAtkUp > 0 {
e.Ctx().Our.SetProp(e.Ctx().Our, 0, extraAtkUp)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 936, &Effect936{})
input.InitEffect(input.EffectType.Sub, 936, &Effect936Sub{})
input.InitEffect(input.EffectType.Skill, 937, &Effect937{})
input.InitEffect(input.EffectType.Sub, 937, &Effect937Sub{})
input.InitEffect(input.EffectType.Skill, 938, &Effect938{})
input.InitEffect(input.EffectType.Skill, 939, &Effect939{})
input.InitEffect(input.EffectType.Skill, 940, &Effect940{})
}