Files
bl/logic/service/fight/effect/1690_1694.go
xinian 87fdccaddf
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat: 实现大量技能效果及战斗逻辑修复
2026-03-30 00:51:18 +08:00

255 lines
6.2 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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 1690: 火之力量觉醒,使自身下{0}次攻击获得灼心之焰效果
type Effect1690 struct {
node.EffectNode
}
func (e *Effect1690) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1690, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1690Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1690Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1690Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || e.remaining <= 0 {
return true
}
if current.SkillEntity.Category() == info.Category.STATUS {
return true
}
current.SkillEntity.XML.Priority += 1
return true
}
func (e *Effect1690Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
func (e *Effect1690Sub) Skill_Use() bool {
if e.Ctx().SkillEntity == nil || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.AttackTime != 0 {
indexes := grand.Perm(6)
for _, idx := range indexes[:2] {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(idx), 1)
}
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1691: 终阶源盾下{0}次被激活或被消耗则回合结束时附加{1}点固定伤害
type Effect1691 struct {
node.EffectNode
}
func (e *Effect1691) Skill_Use() bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1691, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1691Sub struct {
node.EffectNode
remaining int
damage alpacadecimal.Decimal
triggeredTurn bool
}
func (e *Effect1691Sub) 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.damage = alpacadecimal.NewFromInt(int64(a[1]))
}
}
func (e *Effect1691Sub) ShieldChange(before, after alpacadecimal.Decimal) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if (before.Cmp(alpacadecimal.Zero) == 0 && after.Cmp(alpacadecimal.Zero) > 0) ||
(before.Cmp(alpacadecimal.Zero) > 0 && after.Cmp(alpacadecimal.Zero) == 0) {
e.triggeredTurn = true
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
}
return true
}
func (e *Effect1691Sub) TurnEnd() {
if e.triggeredTurn && e.damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.damage,
})
e.triggeredTurn = false
}
e.EffectNode.TurnEnd()
}
// Effect 1692: {0}%的概率造成伤害翻倍,终阶源盾处于激活状态时概率提升至{1}%
type Effect1692 struct {
node.EffectNode
}
func (e *Effect1692) 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 || len(e.Args()) < 2 {
return true
}
chance := int(e.Args()[0].IntPart())
if e.Ctx().Our.HasShield() {
chance = int(e.Args()[1].IntPart())
}
ok, _, _ := e.Input.Player.Roll(chance, 100)
if ok {
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
}
return true
}
// Effect 1693: {0}回合内每回合使用技能附加对手最大体力1/{1}的百分比伤害,对手免疫百分比伤害时额外附加{2}点真实伤害
type Effect1693 struct {
RoundEffectArg0Base
}
func (e *Effect1693) OnSkill() bool {
if len(e.Args()) < 3 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) > 0 {
beforeHP := e.Ctx().Opp.CurrentPet.Info.Hp
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
if e.Ctx().Opp.CurrentPet.Info.Hp < beforeHP {
return true
}
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: e.Args()[2],
})
return true
}
// Effect 1694: 随机吸取对手{0}-{1}点体力,若自身处于能力提升状态则效果转变为{2}-{3}点
type Effect1694 struct {
node.EffectNode
}
func (e *Effect1694) Skill_Use() bool {
if len(e.Args()) < 4 {
return true
}
minDrain := int(e.Args()[0].IntPart())
maxDrain := int(e.Args()[1].IntPart())
if e.Ctx().Our.HasPropADD() {
minDrain = int(e.Args()[2].IntPart())
maxDrain = int(e.Args()[3].IntPart())
}
if maxDrain < minDrain {
minDrain, maxDrain = maxDrain, minDrain
}
drain := minDrain
if maxDrain > minDrain {
drain = grand.N(minDrain, maxDrain)
}
if drain <= 0 {
return true
}
damage := alpacadecimal.NewFromInt(int64(drain))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1690, &Effect1690{})
input.InitEffect(input.EffectType.Sub, 1690, &Effect1690Sub{})
input.InitEffect(input.EffectType.Skill, 1691, &Effect1691{})
input.InitEffect(input.EffectType.Sub, 1691, &Effect1691Sub{})
input.InitEffect(input.EffectType.Skill, 1692, &Effect1692{})
input.InitEffect(input.EffectType.Skill, 1693, &Effect1693{})
input.InitEffect(input.EffectType.Skill, 1694, &Effect1694{})
}