Files
bl/logic/service/fight/effect/back.go1
昔念 ce279cd992
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
根据提供的code differences信息,我无法看到具体的代码变更内容。由于code differences部分为空白,我将提供一个通用的示例格式:
```
docs(readme): 更新文档说明

- 添加了项目使用说明
- 补充了配置项解释
- 修正了错误的示例代码
```

注意:由于没有具体的代码差异信息,无法生成准确的commit
2026-03-09 22:36:30 +08:00

175 lines
4.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/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 407 - 下回合起每回合XX等级+n持续m回合
type Effect407 struct {
node.EffectNode
}
func (e *Effect407) OnSkill() bool {
// 创建一个延迟生效的效果,在下一回合开始生效
go func() {
effectType := int(e.Args()[0].IntPart()) // XX类型
effectValue := int(e.Args()[1].IntPart()) // 等级+n
duration := int(e.Args()[2].IntPart()) // 持续m回合
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
statusEffect.SetArgs(e.Ctx().Our, effectValue)
statusEffect.Duration(duration)
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
}
}()
return true
}
// 523 - 若当回合未击败对手则自身1 1 1 1 1 1能力+1
type Effect523 struct {
node.EffectNode
}
func (e *Effect523) Action_end_ex() bool {
// 检查对手是否还活着
if e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
// 提升自身的全部能力等级
stats := []int{
int(info.PetStatus.AtkUp),
int(info.PetStatus.DefUp),
int(info.PetStatus.SpAtkUp),
int(info.PetStatus.SpDefUp),
int(info.PetStatus.SpeedUp),
int(info.PetStatus.AccuracyUp),
}
for _, stat := range stats {
statEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, stat)
if statEffect != nil {
statEffect.SetArgs(e.Ctx().Our, 1) // 提升1级
e.Ctx().Our.AddEffect(e.Ctx().Our, statEffect)
}
}
}
return true
}
// 440 - n回合内对手使用技能消耗的PP值变为m倍
type Effect440 struct {
node.EffectNode
}
func (e *Effect440) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(a[0]) // 持续n回合
}
// 457 - 复制对手释放的技能(组队对战时无效)
type Effect457 struct {
node.EffectNode
}
func (e *Effect457) Skill_Use_ex() bool {
// 这里需要检查是否在组队对战中
if !e.Ctx().IsTeamBattle { // 不是组队对战
if e.Ctx().SkillEntity != nil {
// 复制对手释放的技能
e.Ctx().Our.CopySkill(e.Ctx().SkillEntity)
}
}
return true
}
// 138 - 先出手时n回合自己不会受到对手攻击性技能伤害并反弹对手1/n造成的伤害
type Effect138 struct {
node.EffectNode
}
func (e *Effect138) Skill_Use_ex() bool {
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
// 本次受到的攻击伤害无效
e.Ctx().Our.CancelDamage()
// 反弹1/n造成的伤害
damageToBounce := e.Ctx().Opp.SumDamage.Div(e.Args()[1]) // 1/n
damageZone := &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damageToBounce,
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
}
}
return true
}
func (e *Effect138) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(a[0]) // 持续n回合
}
// 197 - n回合内若被对方击败则对手所有能力加强状态消失
type Effect197 struct {
node.EffectNode
}
func (e *Effect197) Skill_Use() bool {
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败
// 清除对手的所有能力加强状态
e.Ctx().Opp.RemoveAllPositiveBuffs()
}
return true
}
func (e *Effect197) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(a[0]) // 持续n回合
}
// 412 - 若自身体力小于1/n则每次攻击不消耗PP值
type Effect412 struct {
node.EffectNode
}
func (e *Effect412) SkillHit() bool {
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
currentHp := e.Ctx().Our.CurrentPet.GetHP()
threshold := maxHp.Div(e.Args()[0]) // 1/n
if currentHp.Cmp(threshold) < 0 {
// 本次攻击不消耗PP
e.Ctx().Our.SkipPpConsumption = true
}
return true
}
// 199 - 下次被击败后下一个出场的精灵xx等级+k
type Effect199 struct {
node.EffectNode
}
func (e *Effect199) Skill_Use() bool {
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败
// 设置下一个出场精灵的增益效果
effectType := int(e.Args()[0].IntPart()) // xx类型
effectValue := int(e.Args()[1].IntPart()) // 等级+k
buffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
if buffEffect != nil {
buffEffect.SetArgs(e.Ctx().Our, effectValue)
e.Ctx().Our.SetNextPetBuff(buffEffect)
}
}
return true
}