Files
bl/logic/service/fight/effect/1665_1669.go
昔念 97b2588339
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
```
docs(effect): 移除未实现任务文档 task-320

移除 effects 2215-2219 的未实现任务文档,这些 effect 已经被重新评估
或通过其他方式处理,不再需要单独的任务跟踪文档。
```
2026-03-31 09:18:48 +08:00

227 lines
4.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/common/data/xmlres"
"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"
)
func applyAllPropsBoost(target *input.Input, boost int8) {
if target == nil {
return
}
for i := range target.Prop {
target.SetProp(target, int8(i), boost)
}
}
func countPets(target *input.Input, alive bool) int {
if target == nil {
return 0
}
count := 0
for _, pet := range target.AllPet {
if pet == nil {
continue
}
if pet == target.CurrentPet {
continue
}
if pet.Alive() == alive {
count++
}
}
return count
}
func lostSkillPP(pet *info.BattlePetEntity) int64 {
if pet == nil {
return 0
}
var total int64
for _, skill := range pet.Info.SkillList {
move, ok := xmlres.SkillMap[int(skill.ID)]
if !ok || move.MaxPP <= 0 {
continue
}
lost := int64(move.MaxPP) - int64(skill.PP)
if lost > 0 {
total += lost
}
}
return total
}
// Effect 1665: 全属性+{0}自身背包内每阵亡1只精灵则{1}%的概率强化效果翻倍
type Effect1665 struct {
node.EffectNode
}
func (e *Effect1665) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
boost := int8(e.Args()[0].IntPart())
dead := countPets(e.Ctx().Our, false)
if dead > 0 {
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart())*dead, 100); ok {
boost *= 2
}
}
applyAllPropsBoost(e.Ctx().Our, boost)
return true
}
// Effect 1666: 1回合做{0}-{1}次攻击,自身处于领域效果下连击上限为{2}
type Effect1666 struct {
node.EffectNode
}
func (e *Effect1666) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
minHits := int(e.Args()[0].IntPart())
maxHits := int(e.Args()[1].IntPart())
if minHits <= 0 {
minHits = 1
}
if maxHits < minHits {
maxHits = minHits
}
hits := minHits
if maxHits > minHits {
hits += grand.Intn(maxHits - minHits + 1)
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(hits)))
return true
}
// Effect 1667: 开启时空缉漓使用后必定令对手束缚且下2回合令对手无法主动切换精灵
type Effect1667 struct {
node.EffectNode
}
func (e *Effect1667) Skill_Use() bool {
if e.Ctx().Opp == nil {
return true
}
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1667)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
e.Ctx().Opp.CanChange = 1
}
return true
}
type Effect1667Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1667Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.CanStack(false)
e.Duration(-1)
e.remaining = 2
}
func (e *Effect1667Sub) TurnEnd() {
if e.remaining <= 0 {
e.Ctx().Our.CanChange = 0
e.Alive(false)
return
}
e.remaining--
if e.remaining <= 0 {
e.Ctx().Our.CanChange = 0
e.Alive(false)
return
}
if e.Ctx().Our != nil && e.Ctx().Our.CurrentPet != nil && e.Ctx().Our.CurrentPet.Info.Hp > 0 {
e.Ctx().Our.CanChange = 1
}
}
// Effect 1668: 附加对手当前已损失技能PP值总和×{0}的固定伤害,若对手未受到固定伤害则额外附加等量的真实伤害
type Effect1668 struct {
node.EffectNode
}
func (e *Effect1668) OnSkill() bool {
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
return true
}
totalLost := lostSkillPP(e.Ctx().Opp.CurrentPet)
if totalLost <= 0 {
return true
}
damage := alpacadecimal.NewFromInt(totalLost).Mul(e.Args()[0])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
before := e.Ctx().Opp.CurrentPet.GetHP()
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(before) == 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: damage,
})
}
return true
}
// Effect 1669: 全属性+{0}自身背包内每存活1只精灵则{1}%的概率强化效果翻倍
type Effect1669 struct {
node.EffectNode
}
func (e *Effect1669) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
boost := int8(e.Args()[0].IntPart())
live := countPets(e.Ctx().Our, true)
if live > 0 {
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart())*live, 100); ok {
boost *= 2
}
}
applyAllPropsBoost(e.Ctx().Our, boost)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1665, &Effect1665{})
input.InitEffect(input.EffectType.Skill, 1666, &Effect1666{})
input.InitEffect(input.EffectType.Skill, 1667, &Effect1667{})
input.InitEffect(input.EffectType.Sub, 1667, &Effect1667Sub{})
input.InitEffect(input.EffectType.Skill, 1668, &Effect1668{})
input.InitEffect(input.EffectType.Skill, 1669, &Effect1669{})
}