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

167 lines
3.9 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 1021: 对手不处于能力提升状态时造成的伤害提高{0}%
type Effect1021 struct {
node.EffectNode
}
func (e *Effect1021) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().Opp.HasPropADD() {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
return true
}
// Effect 1022: 吸取对手能力提升状态,吸取成功则吸取对手{0}点体力
type Effect1022 struct {
node.EffectNode
}
func (e *Effect1022) OnSkill() bool {
canSteal := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
canSteal = true
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
}
}
if !canSteal {
return true
}
drain := e.Args()[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
}
// Effect 1023: {0}回合内{1}%闪避对手攻击若对手MISS则恢复自身最大体力的1/{2}
type Effect1023 struct {
RoundEffectArg0Base
}
func (e *Effect1023) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.AttackTime == 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
if !e.Ctx().SkillEntity.SetMiss() {
return true
}
e.Ctx().Our.Heal(
e.Ctx().Our,
&action.SelectSkillAction{},
e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[2]),
)
return true
}
// Effect 1024: {0}回合内{1}%的概率免疫对手攻击伤害,未触发则回合结束时附加{2}%伤害量的百分比伤害
type Effect1024 struct {
RoundEffectArg0Base
pendingDamage alpacadecimal.Decimal
immuneTriggeredRound bool
}
func (e *Effect1024) DamageLockEx(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
}
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
zone.Damage = alpacadecimal.Zero
e.immuneTriggeredRound = true
return true
}
e.pendingDamage = e.pendingDamage.Add(zone.Damage)
return true
}
func (e *Effect1024) TurnEnd() {
if !e.immuneTriggeredRound && e.pendingDamage.Cmp(alpacadecimal.Zero) > 0 {
damage := e.pendingDamage.Mul(e.Args()[2]).Div(alpacadecimal.NewFromInt(100))
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
}
e.pendingDamage = alpacadecimal.Zero
e.immuneTriggeredRound = false
e.EffectNode.TurnEnd()
}
// Effect 1025: 吸取对手能力提升状态吸取成功则恢复自身最大体力的1/{0}
type Effect1025 struct {
node.EffectNode
}
func (e *Effect1025) OnSkill() bool {
canSteal := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
canSteal = true
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
}
}
if !canSteal {
return true
}
e.Ctx().Our.Heal(
e.Ctx().Our,
&action.SelectSkillAction{},
e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]),
)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1021, &Effect1021{})
input.InitEffect(input.EffectType.Skill, 1022, &Effect1022{})
input.InitEffect(input.EffectType.Skill, 1023, &Effect1023{})
input.InitEffect(input.EffectType.Skill, 1024, &Effect1024{})
input.InitEffect(input.EffectType.Skill, 1025, &Effect1025{})
}