Files
bl/logic/service/fight/effect/1178_1182.go
2026-04-01 00:48:42 +08:00

263 lines
6.6 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"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1178: 自身不处于能力提升状态则造成的伤害翻倍
type Effect1178 struct{ node.EffectNode }
func (e *Effect1178) Damage_Mul(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 e.Ctx().Our.HasPropADD() {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
return true
}
// Effect 1179: 消除对手回合类效果,消除成功则自身下{0}次攻击技能造成的伤害额外提升{1}%
type Effect1179 struct{ node.EffectNode }
func (e *Effect1179) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1179, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1179Sub struct {
node.EffectNode
remaining int
percent alpacadecimal.Decimal
}
func (e *Effect1179Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
if len(a) > 1 {
e.percent = alpacadecimal.NewFromInt(int64(a[1]))
}
}
func (e *Effect1179Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(e.percent)).Div(hundred)
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1180: 吸取对手能力提升状态,吸取成功则自身下{0}回合必定致命一击
type Effect1180 struct{ node.EffectNode }
func (e *Effect1180) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
copied := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
copied = true
}
}
if !copied {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1180, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1180Sub struct{ RoundEffectArg0Base }
func (e *Effect1180Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 1181: {0}回合内每回合使用技能{1}%令对手{2},未触发则令对手全属性-{3}
type Effect1181 struct{ RoundEffectArg0Base }
func (e *Effect1181) OnSkill() bool {
if len(e.Args()) < 4 {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
return true
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[3].IntPart()))
return true
}
// Effect 1182: 牺牲自己进行自爆,将对手体力降为{0}点,令我方下一只出场精灵获得{1}次奇迹之力效果
type Effect1182 struct{ node.EffectNode }
func (e *Effect1182) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
return true
}
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Our.CurrentPet.GetHP(),
})
targetHP := e.Args()[0]
if targetHP.Cmp(alpacadecimal.Zero) < 0 {
targetHP = alpacadecimal.Zero
}
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(targetHP) > 0 {
e.Ctx().Opp.CurrentPet.Info.Hp = uint32(targetHP.IntPart())
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1182, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1182Sub struct {
node.EffectNode
remaining int
active bool
doubled bool
}
func (e *Effect1182Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
e.CanStack(false)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1182Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if e.remaining <= 0 {
e.Alive(false)
return true
}
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
return true
}
current.SkillEntity.XML.Priority += 1
e.active = true
e.doubled, _, _ = e.Input.Player.Roll(50, 100)
return true
}
func (e *Effect1182Sub) Damage_Mul(zone *info.DamageZone) bool {
if !e.active || !e.doubled || zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
return true
}
func (e *Effect1182Sub) OnSkill() bool {
if !e.active || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
damage := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(3))
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
}
return true
}
func (e *Effect1182Sub) Action_end() bool {
if e.active {
e.remaining--
e.active = false
e.doubled = false
if e.remaining <= 0 {
e.Alive(false)
}
}
return true
}
func (e *Effect1182Sub) Action_end_ex() bool {
if e.active {
e.remaining--
e.active = false
e.doubled = false
if e.remaining <= 0 {
e.Alive(false)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1178, &Effect1178{})
input.InitEffect(input.EffectType.Skill, 1179, &Effect1179{})
input.InitEffect(input.EffectType.Sub, 1179, &Effect1179Sub{})
input.InitEffect(input.EffectType.Skill, 1180, &Effect1180{})
input.InitEffect(input.EffectType.Sub, 1180, &Effect1180Sub{})
input.InitEffect(input.EffectType.Skill, 1181, &Effect1181{})
input.InitEffect(input.EffectType.Skill, 1182, &Effect1182{})
input.InitEffect(input.EffectType.Sub, 1182, &Effect1182Sub{})
}