Files
bl/logic/service/fight/effect/1428_1432.go
2026-04-02 16:24:16 +08:00

257 lines
6.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"
)
// Effect 1428: {0}%使对手全属性-1{1}回合内每回合对手{2}
type Effect1428 struct{ node.EffectNode }
func (e *Effect1428) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().Opp == nil {
return true
}
chance := int(e.Args()[0].IntPart())
duration := int(e.Args()[1].IntPart())
statusID := int(e.Args()[2].IntPart())
trigger := chance <= 0
if chance > 0 {
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
trigger = true
}
}
if trigger {
for idx := range e.Ctx().Opp.Prop {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(idx), -1)
}
}
if duration > 0 && statusID > 0 {
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1428, duration, statusID)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
}
return true
}
type Effect1428Sub struct{ RoundEffectArg0Base }
func (e *Effect1428Sub) TurnEnd() bool {
if len(e.Args()) < 2 {
return true
}
statusID := int(e.Args()[1].IntPart())
if statusID <= 0 {
return true
}
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
return true
}
// Effect 1429: 50%的概率打出致命一击,未触发则{0}%令对手{1}
type Effect1429 struct{ node.EffectNode }
func (e *Effect1429) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if ok, _, _ := e.Input.Player.Roll(50, 100); ok {
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
if len(e.Args()) < 2 {
return true
}
chance := int(e.Args()[0].IntPart())
statusID := int(e.Args()[1].IntPart())
if chance <= 0 || statusID <= 0 {
return true
}
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
}
return true
}
// Effect 1430: 造成的伤害低于{0}则{1}%令对手{2},未触发则下{3}回合攻击技能{4}%令对手{5}
type Effect1430 struct{ node.EffectNode }
func (e *Effect1430) Skill_Use() bool {
if len(e.Args()) < 6 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
threshold := e.Args()[0]
chance := int(e.Args()[1].IntPart())
statusID := int(e.Args()[2].IntPart())
rollRounds := int(e.Args()[3].IntPart())
brChance := int(e.Args()[4].IntPart())
brStatus := int(e.Args()[5].IntPart())
if e.Ctx().Our.SumDamage.Cmp(threshold) < 0 && chance > 0 && statusID > 0 {
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
return true
}
}
if rollRounds <= 0 || brChance <= 0 || brStatus <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1430, rollRounds, brChance, brStatus)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1430Sub struct{ RoundEffectArg0Base }
func (e *Effect1430Sub) SkillHit() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
chance := int(e.Args()[1].IntPart())
statusID := int(e.Args()[2].IntPart())
if chance <= 0 || statusID <= 0 {
return true
}
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
}
return true
}
// Effect 1431: “辛”死亡后额外先制+1且25%打出致命一击
type Effect1431 struct{ node.EffectNode }
func (e *Effect1431) SwitchOut(in *input.Input) bool {
if in != e.Ctx().Our {
return true
}
ownerPet := effectOwnerPetByCatchTime(e.Ctx().Our, e.ID().GetCatchTime())
if ownerPet == nil || ownerPet.Alive() {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1431)
if sub != nil {
sub.Duration(1)
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
e.Alive(false)
return true
}
type Effect1431Sub struct {
node.EffectNode
applied bool
}
func (e *Effect1431Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.applied || e.Ctx().SkillEntity == nil {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += 1
e.applied = true
return true
}
func (e *Effect1431Sub) SkillHit() bool {
if !e.applied || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if ok, _, _ := e.Input.Player.Roll(25, 100); ok {
e.Ctx().SkillEntity.XML.CritRate = 16
}
e.Alive(false)
return true
}
// Effect 1432: “辛”存活时50%的概率令自身2回合内回合类效果无法被消除后出手则延续至下2回合“辛”死亡后概率翻倍
type Effect1432 struct{ node.EffectNode }
func (e *Effect1432) Skill_Use() bool {
if e.Ctx().Our == nil {
return true
}
chance := 50
if !effectOwnerAliveByCatchTime(e.Ctx().Our, e.ID().GetCatchTime()) {
chance = 100
}
if ok, _, _ := e.Input.Player.Roll(chance, 100); !ok {
return true
}
rounds := 2
if !e.IsFirst() {
rounds += 2
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1432, rounds)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1432Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1432Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1432Sub) Skill_Use_ex() bool {
for _, eff := range e.Ctx().Our.Effects {
if eff == nil || eff == e {
continue
}
if eff.ID().GetEffectType() == input.EffectType.Status || eff.Duration() <= 0 {
continue
}
eff.Alive(true)
}
return true
}
func (e *Effect1432Sub) TurnEnd() {
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
}
func init() {
input.InitEffect(input.EffectType.Skill, 1428, &Effect1428{})
input.InitEffect(input.EffectType.Sub, 1428, &Effect1428Sub{})
input.InitEffect(input.EffectType.Skill, 1429, &Effect1429{})
input.InitEffect(input.EffectType.Skill, 1430, &Effect1430{})
input.InitEffect(input.EffectType.Sub, 1430, &Effect1430Sub{})
input.InitEffect(input.EffectType.Skill, 1431, &Effect1431{})
input.InitEffect(input.EffectType.Sub, 1431, &Effect1431Sub{})
input.InitEffect(input.EffectType.Skill, 1432, &Effect1432{})
input.InitEffect(input.EffectType.Sub, 1432, &Effect1432Sub{})
}