Files
bl/logic/service/fight/effect/effect_680_690.go
xinian 78a68148ce
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
chore: update fight logic and effect implementations
2026-04-05 02:25:44 +08:00

298 lines
7.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"
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 680: 先出手时{0}%使对手{1}{2}回合
type Effect680 struct {
node.EffectNode
}
func (e *Effect680) Skill_Use() bool {
source := e.SourceInput()
target := e.TargetInput()
if source == nil || target == nil {
return true
}
if !e.IsFirst() {
return true
}
chance := int(e.Args()[0].IntPart())
success, _, _ := source.Player.Roll(chance, 100)
if success {
statusID := int(e.Args()[1].IntPart())
duration := int(e.Args()[2].IntPart())
statusEffect := source.InitEffect(input.EffectType.Status, statusID)
if statusEffect != nil {
statusEffect.Duration(duration)
target.AddEffect(source, statusEffect)
}
}
return true
}
// Effect 681: 下{0}回合自身攻击技能必定致命、必定命中
type Effect681 struct {
RoundEffectSideArg0Base
}
func (e *Effect681) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
e.Ctx().SkillEntity.XML.MustHit = 1
return true
}
// Effect 682: 受到的伤害超过{0},自身{1}
type Effect682 struct {
FixedDurationNeg1Base
can bool
}
func (e *Effect682) DamageLockEx(t *info.DamageZone) bool {
source := e.SourceInput()
if t.Type != info.DamageType.Red {
return true
}
if source != nil && source.SumDamage.Cmp(e.Args()[0]) > 0 && !e.can {
e.can = true
triggerEffectID := int(e.Args()[1].IntPart())
effect := source.InitEffect(input.EffectType.Skill, triggerEffectID, e.SideEffectArgs[2:]...)
if effect != nil {
effect.Duration(int(e.Args()[2].IntPart()))
source.AddEffect(source, effect)
}
}
return true
}
// Effect 683: 随机附加{0}~{1}点固定伤害
type Effect683 struct {
node.EffectNode
}
func (e *Effect683) Skill_Use() bool {
source := e.SourceInput()
target := e.TargetInput()
if source == nil || target == nil {
return true
}
min := e.Args()[0].IntPart()
max := e.Args()[1].IntPart()
damage := alpacadecimal.NewFromInt(int64(min) + int64(grand.N(0, int(max-min))))
target.Damage(source, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 684: 双方任意一方处于能力下降状态均会附加{0}点固定伤害,同时解除自身能力下降状态
type Effect684 struct {
node.EffectNode
}
func (e *Effect684) Skill_Use() bool {
source := e.SourceInput()
target := e.TargetInput()
if source == nil || target == nil {
return true
}
if source.HasPropSub() || target.HasPropSub() {
target.Damage(source, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
// 解除自身能力下降状态
for i, v := range source.Prop[:] {
if v < 0 {
source.SetProp(source, int8(i), 0)
}
}
}
return true
}
// Effect 685: 若自身处于能力提升状态,附加{0}点固定伤害
type Effect685 struct {
node.EffectNode
}
func (e *Effect685) Skill_Use() bool {
source := e.SourceInput()
target := e.TargetInput()
if source == nil || target == nil {
return true
}
if source.HasPropADD() {
target.Damage(source, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
}
return true
}
// Effect 686: 若对手{0}则使对手下{1}回合攻击必定MISS
type Effect686 struct {
node.EffectNode
}
func (e *Effect686) Skill_Use() bool {
source := e.SourceInput()
target := e.TargetInput()
if source == nil || target == nil {
return true
}
statusID := int(e.Args()[0].IntPart())
duration := int(e.Args()[1].IntPart())
if target.StatEffect_Exist(info.EnumPetStatus(statusID)) {
effect := source.InitEffect(input.EffectType.Sub, 686, duration)
if effect != nil {
target.AddEffect(source, effect)
}
}
return true
}
// 686 sub - 使对手攻击技能MISS
type SubEffect686 struct {
node.EffectNode
}
func (e *SubEffect686) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() != info.Category.STATUS {
e.Ctx().SkillEntity.SetMiss()
}
return true
}
// Effect 687: 若对手{0},则对对方造成伤害的{1}%恢复自身体力
type Effect687 struct {
node.EffectNode
}
func (e *Effect687) Skill_Use() bool {
source := e.SourceInput()
target := e.TargetInput()
if source == nil || target == nil {
return true
}
statusID := int(e.Args()[0].IntPart())
percent := e.Args()[1]
if target.StatEffect_Exist(info.EnumPetStatus(statusID)) {
healAmount := source.SumDamage.Mul(percent).Div(alpacadecimal.NewFromInt(100))
source.Heal(source, &action.SelectSkillAction{}, healAmount)
}
return true
}
// Effect 688: {0}回合内抵挡受到的攻击
type Effect688 struct {
FixedDurationNeg1Base
conut int
}
func (e *Effect688) Damage_Shield(t *info.DamageZone) bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if t.Type == info.DamageType.Red {
e.conut++
t.Damage = alpacadecimal.Zero
}
if e.Args()[0].IntPart() == int64(e.conut) {
e.Alive(false)
}
return true
}
// Effect 689: 若造成的伤害高于{0}则恢复自身1/{1}最大体力
type Effect689 struct {
node.EffectNode
}
func (e *Effect689) Skill_Use() bool {
source := e.SourceInput()
if source == nil {
return true
}
if source.SumDamage.Cmp(e.Args()[0]) > 0 {
maxHp := source.CurPet[0].GetMaxHP()
healAmount := maxHp.Div(e.Args()[1])
source.Heal(source, &action.SelectSkillAction{}, healAmount)
}
return true
}
// Effect 690: 下{0}回合,能力提升状态消失则对手使用属性技能失效
type Effect690 struct {
RoundEffectSideArg0Base
}
func (e *Effect690) PropBefer(in *input.Input, prop int8, level int8) bool {
source := e.SourceInput()
target := e.OpponentInput()
if source == nil || target == nil {
return true
}
if in == source && level < 0 {
// 能力下降被应用时(自身能力提升被消除),让对手属性技能失效
effect := source.InitEffect(input.EffectType.Sub, 690)
if effect != nil {
effect.Duration(e.Duration())
target.AddEffect(source, effect)
}
}
return true
}
// 690 sub - 令对手属性技能失效
type SubEffect690 struct {
node.EffectNode
}
func (e *SubEffect690) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
e.Ctx().SkillEntity.SetMiss()
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 680, &Effect680{})
input.InitEffect(input.EffectType.Skill, 681, &Effect681{})
input.InitEffect(input.EffectType.Skill, 682, &Effect682{})
input.InitEffect(input.EffectType.Skill, 683, &Effect683{})
input.InitEffect(input.EffectType.Skill, 684, &Effect684{})
input.InitEffect(input.EffectType.Skill, 685, &Effect685{})
input.InitEffect(input.EffectType.Skill, 686, &Effect686{})
input.InitEffect(input.EffectType.Sub, 686, &SubEffect686{})
input.InitEffect(input.EffectType.Skill, 687, &Effect687{})
input.InitEffect(input.EffectType.Skill, 688, &Effect688{})
input.InitEffect(input.EffectType.Skill, 689, &Effect689{})
input.InitEffect(input.EffectType.Skill, 690, &Effect690{})
input.InitEffect(input.EffectType.Sub, 690, &SubEffect690{})
}