Files
bl/logic/service/fight/effect/795_799.go
2026-03-31 08:19:53 +08:00

201 lines
5.0 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 795: 每次使用则当回合造成的攻击伤害额外提升{0}%,最高额外提升{1}%
type Effect795 struct {
node.EffectNode
useCount int64
}
func (e *Effect795) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.useCount++
return true
}
func (e *Effect795) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.useCount <= 0 {
return true
}
bonus := e.Args()[0].Mul(alpacadecimal.NewFromInt(e.useCount))
if bonus.Cmp(e.Args()[1]) > 0 {
bonus = e.Args()[1]
}
if bonus.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(bonus)).Div(hundred)
return true
}
// Effect 796: {0}回合内每回合吸取对手当前体力的1/{1}
type Effect796 struct {
node.EffectNode
}
func (e *Effect796) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 796, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect796Sub struct {
RoundEffectArg0Base
}
func (e *Effect796Sub) TurnEnd() {
if e.Ctx().Our.CurrentPet.Info.Hp > 0 && e.Ctx().Opp.CurrentPet.Info.Hp > 0 &&
len(e.Args()) >= 2 && e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
damage := e.Ctx().Opp.CurrentPet.GetHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) > 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)
}
}
e.EffectNode.TurnEnd()
}
// Effect 797: 消除对手回合类效果,消除成功{0}回合内对手无法通过自身技能恢复体力
type Effect797 struct {
node.EffectNode
}
func (e *Effect797) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 797, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect797Sub struct {
RoundEffectArg0Base
}
func (e *Effect797Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
if value == nil || *value <= 0 {
return true
}
if _, ok := ac.(*action.SelectSkillAction); !ok {
return true
}
*value = 0
return true
}
// Effect 798: 若对手处于能力提升状态,则对手{0}回合内造成的伤害不超过{1}
type Effect798 struct {
node.EffectNode
}
func (e *Effect798) Skill_Use() bool {
if len(e.Args()) < 2 || !e.Ctx().Opp.HasPropADD() {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 798, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect798Sub struct {
RoundEffectArg0Base
}
func (e *Effect798Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if zone.Damage.Cmp(e.Args()[1]) <= 0 {
return true
}
zone.Damage = e.Args()[1]
return true
}
// Effect 799: 恢复自身最大体力的1/{0}并给对手造成等量百分比伤害自身体力低于1/{1}时效果翻倍
type Effect799 struct {
node.EffectNode
}
func (e *Effect799) Skill_Use() bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
amount := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
amount = amount.Mul(alpacadecimal.NewFromInt(2))
}
}
if amount.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, amount)
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: amount,
})
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 795, &Effect795{})
input.InitEffect(input.EffectType.Skill, 796, &Effect796{})
input.InitEffect(input.EffectType.Sub, 796, &Effect796Sub{})
input.InitEffect(input.EffectType.Skill, 797, &Effect797{})
input.InitEffect(input.EffectType.Sub, 797, &Effect797Sub{})
input.InitEffect(input.EffectType.Skill, 798, &Effect798{})
input.InitEffect(input.EffectType.Sub, 798, &Effect798Sub{})
input.InitEffect(input.EffectType.Skill, 799, &Effect799{})
}