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

380 lines
9.8 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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 1092: 后出手时使对手{0}未触发则附加自身当前体力1/{1}的百分比伤害
type Effect1092 struct{ node.EffectNode }
func (e *Effect1092) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
if !e.IsFirst() {
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
if e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Our.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,
})
}
return true
}
// Effect 1093: 出手时若自身体力低于对手则恢复自身最大体力的1/{0}
type Effect1093 struct{ node.EffectNode }
func (e *Effect1093) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) >= 0 {
return true
}
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if heal.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
}
return true
}
// Effect 1094: 消除对手回合类效果消除成功则令对手随机2项技能PP值归零消除对手能力提升状态消除成功则令自身下2回合使用技能触发星皇之怒的概率提升20%
type Effect1094 struct {
node.EffectNode
furyChanceBonusUses int
starFuryActive bool
}
func (e *Effect1094) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if old := t.GetEffect(input.EffectType.Skill, 1094); old != nil {
if prev, ok := old.(*Effect1094); ok {
e.furyChanceBonusUses = prev.furyChanceBonusUses
}
}
}
func (e *Effect1094) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil {
return true
}
chance := 50
if e.furyChanceBonusUses > 0 {
chance += 20
e.furyChanceBonusUses--
}
beforeTurn := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if beforeTurn > 0 {
zeroRandomSkillPP(e.Ctx().Opp, 2)
}
if clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
e.furyChanceBonusUses = 2
}
if e.starFuryActive {
if !e.Ctx().Opp.HasPropADD() {
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(3))
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
}
return true
}
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
return true
}
ok, _, _ := e.Input.Player.Roll(chance, 100)
if !ok {
return true
}
furySkill := cloneSkillEntity(skill)
if furySkill == nil {
return true
}
if furySkill.Category() != info.Category.STATUS {
furySkill.XML.Power = halvePower(furySkill.XML.Power)
}
e.starFuryActive = true
executeExtraSkill(e.Ctx().Our, e.Ctx().Opp, furySkill)
e.starFuryActive = false
return true
}
// Effect 1095: 3回合内若对手使用属性技能则命中前令对手所有技能随机降低1-3点PP值3回合内若对手使用攻击技能则使用后受到对手最大体力1/3的百分比伤害己方免疫下2次受到的异常状态
type Effect1095 struct {
node.EffectNode
starFuryActive bool
}
func (e *Effect1095) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil {
return true
}
watch := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1095, 3)
if watch != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, watch)
}
immune := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1099, 2)
if immune != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, immune)
}
if e.starFuryActive {
rounds := 2
if !e.IsFirst() {
rounds++
}
protect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 821, rounds)
if protect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, protect)
}
priority := e.Ctx().Our.InitEffect(input.EffectType.Sub, 10951, 2, 2)
if priority != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, priority)
}
return true
}
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
return true
}
ok, _, _ := e.Input.Player.Roll(50, 100)
if !ok {
return true
}
furySkill := cloneSkillEntity(skill)
if furySkill == nil {
return true
}
if furySkill.Category() != info.Category.STATUS {
furySkill.XML.Power = halvePower(furySkill.XML.Power)
}
e.starFuryActive = true
executeExtraSkill(e.Ctx().Our, e.Ctx().Opp, furySkill)
e.starFuryActive = false
return true
}
type Effect1095Sub struct{ RoundEffectArg0Base }
func (e *Effect1095Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().Opp.DelPP(grand.Intn(3) + 1)
return true
}
func (e *Effect1095Sub) Skill_Use_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(3))
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
return true
}
type Effect1095PrioritySub struct{ RoundEffectArg0Base }
func (e *Effect1095PrioritySub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || len(e.Args()) < 2 {
return true
}
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
return true
}
// Effect 1096: 全属性+1自身当前体力低于最大体力的1/2时强化效果翻倍4回合内每回合使用技能吸取对手最大体力的1/3自身下2次使用技能触发星皇之怒的概率翻倍
type Effect1096 struct {
node.EffectNode
furyChanceDoubleUses int
starFuryActive bool
}
func (e *Effect1096) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if old := t.GetEffect(input.EffectType.Skill, 1096); old != nil {
if prev, ok := old.(*Effect1096); ok {
e.furyChanceDoubleUses = prev.furyChanceDoubleUses
}
}
}
func (e *Effect1096) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil {
return true
}
chance := 50
if e.furyChanceDoubleUses > 0 {
chance *= 2
if chance > 100 {
chance = 100
}
e.furyChanceDoubleUses--
}
boost := int8(1)
if e.Ctx().Our.CurrentPet.GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) < 0 {
boost = 2
}
applyAllPropUp(e.Ctx().Our, boost)
drain := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1096, 4)
if drain != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, drain)
}
e.furyChanceDoubleUses = 2
if e.starFuryActive {
damageBoost := e.Ctx().Our.InitEffect(input.EffectType.Sub, 10961, 2)
if damageBoost != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, damageBoost)
}
reduce := e.Ctx().Our.InitEffect(input.EffectType.Sub, 10962, 2)
if reduce != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, reduce)
}
return true
}
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
return true
}
ok, _, _ := e.Input.Player.Roll(chance, 100)
if !ok {
return true
}
furySkill := cloneSkillEntity(skill)
if furySkill == nil {
return true
}
if furySkill.Category() != info.Category.STATUS {
furySkill.XML.Power = halvePower(furySkill.XML.Power)
}
e.starFuryActive = true
executeExtraSkill(e.Ctx().Our, e.Ctx().Opp, furySkill)
e.starFuryActive = false
return true
}
type Effect1096DrainSub struct{ RoundEffectArg0Base }
func (e *Effect1096DrainSub) OnSkill() bool {
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(3))
if e.Ctx().Our.CurrentPet.GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) < 0 {
damage = damage.Mul(alpacadecimal.NewFromInt(2))
}
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
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)
return true
}
type Effect1096DamageBoostSub struct{ RoundEffectArg0Base }
func (e *Effect1096DamageBoostSub) 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
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
return true
}
type Effect1096DamageReduceSub struct {
node.EffectNode
remaining int
}
func (e *Effect1096DamageReduceSub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1096DamageReduceSub) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
return true
}
reduce := zone.Damage.Mul(alpacadecimal.NewFromInt(50)).Div(hundred)
if reduce.Cmp(zone.Damage) >= 0 {
zone.Damage = alpacadecimal.Zero
} else {
zone.Damage = zone.Damage.Sub(reduce)
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1092, &Effect1092{})
input.InitEffect(input.EffectType.Skill, 1093, &Effect1093{})
input.InitEffect(input.EffectType.Skill, 1094, &Effect1094{})
input.InitEffect(input.EffectType.Skill, 1095, &Effect1095{})
input.InitEffect(input.EffectType.Sub, 1095, &Effect1095Sub{})
input.InitEffect(input.EffectType.Sub, 10951, &Effect1095PrioritySub{})
input.InitEffect(input.EffectType.Skill, 1096, &Effect1096{})
input.InitEffect(input.EffectType.Sub, 1096, &Effect1096DrainSub{})
input.InitEffect(input.EffectType.Sub, 10961, &Effect1096DamageBoostSub{})
input.InitEffect(input.EffectType.Sub, 10962, &Effect1096DamageReduceSub{})
}