Files
bl/logic/service/fight/effect/637_641.go
xinian 66fdc3d189
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现技能效果 627-672 及 1011-1111
2026-03-29 19:00:08 +08:00

150 lines
3.3 KiB
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 637: 若对手处于异常状态,则对手{0}{1}
type Effect637 struct {
node.EffectNode
}
func (e *Effect637) OnSkill() bool {
if !e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
propID := int(e.Args()[0].IntPart())
if propID < 0 || propID >= 6 {
return true
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propID), int8(e.Args()[1].IntPart()))
return true
}
// Effect 638: 若对手{0},技能威力提升{1}%
type Effect638 struct {
node.EffectNode
}
func (e *Effect638) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if !e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
return true
}
bonus := alpacadecimal.NewFromInt(int64(e.Ctx().SkillEntity.XML.Power)).
Mul(e.Args()[1]).
Div(alpacadecimal.NewFromInt(100))
e.Ctx().SkillEntity.XML.Power += int(bonus.IntPart())
return true
}
// Effect 639: 造成伤害{0}{1},则下{2}回合所有技能附带{3}点固定伤害
type Effect639 struct {
node.EffectNode
}
func (e *Effect639) Skill_Use() bool {
if !effectCompareByMode(int(e.Args()[0].IntPart()), e.Ctx().Our.SumDamage, e.Args()[1]) {
return true
}
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
639,
int(e.Args()[0].IntPart()),
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
int(e.Args()[3].IntPart()),
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect639Sub struct {
node.EffectNode
}
func (e *Effect639Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if len(a) > 2 {
e.Duration(a[2])
}
}
func (e *Effect639Sub) OnSkill() bool {
if len(e.Args()) < 4 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[3],
})
return true
}
// Effect 640: 命中后{0}%使对手{1}{2}回合,遇到天敌概率翻倍
type Effect640 struct {
node.EffectNode
}
func (e *Effect640) Skill_Use() bool {
chance := int(e.Args()[0].IntPart())
if e.ISNaturalEnemy() {
chance *= 2
if chance > 100 {
chance = 100
}
}
success, _, _ := e.Input.Player.Roll(chance, 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
statusEffect.Duration(int(e.Args()[2].IntPart()))
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 641: 命中后{0}%使对手进入流血状态
type Effect641 struct {
node.EffectNode
}
func (e *Effect641) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Bleeding))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 637, &Effect637{})
input.InitEffect(input.EffectType.Skill, 638, &Effect638{})
input.InitEffect(input.EffectType.Skill, 639, &Effect639{})
input.InitEffect(input.EffectType.Sub, 639, &Effect639Sub{})
input.InitEffect(input.EffectType.Skill, 640, &Effect640{})
input.InitEffect(input.EffectType.Skill, 641, &Effect641{})
}