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

172 lines
4.3 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 916: 命中后{0}%使对手{1},若未触发则恢复自身全部体力
type Effect916 struct {
node.EffectNode
}
func (e *Effect916) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP())
return true
}
// Effect 917: 命中后{0}%使对手{1}未触发则附加自身最大体力值1/{2}的百分比伤害
type Effect917 struct {
node.EffectNode
}
func (e *Effect917) OnSkill() bool {
if len(e.Args()) < 3 || e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
damage := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[2])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 918: 造成的伤害不足{0}则自身下{1}次造成的伤害提升{2}%
type Effect918 struct {
node.EffectNode
}
func (e *Effect918) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 918, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect918Sub struct {
node.EffectNode
remaining int
}
func (e *Effect918Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect918Sub) SkillHit() bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[1])
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 919: 后出手时使对手下回合属性技能失效
type Effect919 struct {
node.EffectNode
}
func (e *Effect919) Skill_Use() bool {
if e.IsFirst() {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 919, 1)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect919Sub struct {
FixedDuration1Base
}
func (e *Effect919Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
return true
}
// Effect 920: 未击败对手则下回合造成的伤害提升{0}%
type Effect920 struct {
node.EffectNode
}
func (e *Effect920) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().Opp.CurPet[0].Info.Hp <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 920, 1, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect920Sub struct {
RoundEffectArg1Base
}
func (e *Effect920Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100).Add(e.Args()[1])).Div(alpacadecimal.NewFromInt(100))
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 916, &Effect916{})
input.InitEffect(input.EffectType.Skill, 917, &Effect917{})
input.InitEffect(input.EffectType.Skill, 918, &Effect918{})
input.InitEffect(input.EffectType.Sub, 918, &Effect918Sub{})
input.InitEffect(input.EffectType.Skill, 919, &Effect919{})
input.InitEffect(input.EffectType.Sub, 919, &Effect919Sub{})
input.InitEffect(input.EffectType.Skill, 920, &Effect920{})
input.InitEffect(input.EffectType.Sub, 920, &Effect920Sub{})
}