Files
bl/logic/service/fight/effect/addlevel.go
昔念 69350bb79e
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
fix(fight): 修复战斗效果类型初始化错误

- 将EffectType.NewSel更改为EffectType.Skill以修正技能效果类型
- 移除effect_415中的多余变量声明,直接使用参数值进行治疗计算

feat(admin): 添加用户金币增加功能

- 新增UserGoldAddReq结构体用于处理金币添加请求
- 实现GoldAdd方法支持管理员为指定用户增加金币

feat(pet):
2026-03-10 20:51:48 +08:00

193 lines
4.6 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"
)
/**
* 连续使用每次威力增加n最高威力m
*/
type AddLvelEffect struct {
node.EffectNode
Skillid int //记录使用的技能 如果技能变了就删除effect
UseSkillCount int64 //技能使用了多少次切换后置0
}
// 使用技能
func (e *AddLvelEffect) SkillHit() bool {
if (e.Skillid != 0 && e.Ctx().SkillEntity.XML.ID != e.Skillid) || e.Ctx().SkillEntity.AttackTime == 0 {
e.Alive(false)
e.UseSkillCount = 0
return true
}
e.Duration(-1) //次数类无限回合
e.CanStack(true) //后续的不会顶掉这个效果
e.Skillid = e.Ctx().SkillEntity.XML.ID
e.UseSkillCount++
return true
}
func (e *AddLvelEffect) GetADD(base, add, max alpacadecimal.Decimal) alpacadecimal.Decimal {
return alpacadecimal.Min(add.Mul(alpacadecimal.NewFromInt(e.UseSkillCount)), max)
}
func init() {
input.InitEffect(input.EffectType.Skill, 9, &Effect9{})
}
type Effect9 struct {
AddLvelEffect
}
func (e *Effect9) SkillHit() bool {
e.Ctx().SkillEntity.XML.Power += int(e.GetADD(alpacadecimal.Zero, e.Args()[0], e.Args()[1]).IntPart())
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 484, &Effect484{})
}
// 484 - 连击n次每次命中后连击数+m最高连击p次
type Effect484 struct {
AddLvelEffect
}
func (e *Effect484) Damage_Mul(t *info.DamageZone) bool {
if t.Type != info.DamageType.Red {
return true
}
t.Damage = t.Damage.Mul(e.GetADD(e.Args()[0], e.Args()[1], e.Args()[2]))
return true
}
// 411 - 附加对手当前体力值n%的百分比伤害连续使用每次增加m%最高k%
type Effect411 struct {
AddLvelEffect
}
func init() {
input.InitEffect(input.EffectType.Skill, 411, &Effect411{})
}
func (e *Effect411) Skill_Use() bool {
// 附加百分比伤害
damageZone := &info.DamageZone{
Type: info.DamageType.Percent,
Damage: e.Ctx().Opp.CurrentPet.GetHP().Mul(e.GetADD(e.Args()[0], e.Args()[1], e.Args()[2]).Mul(alpacadecimal.NewFromInt(100))),
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 497, &Effect429{
ispower: true,
})
input.InitEffect(input.EffectType.Skill, 497, &Effect429{})
}
// 497 - 附加m点固定伤害每次使用额外附加n点最高k点遇到天敌时效果翻倍
// 429 - 附加m点固定伤害连续使用每次增加n点固定伤害最高附加k点固定伤害
type Effect429 struct {
AddLvelEffect
ispower bool
}
func (e *Effect429) Skill_Use() bool {
// 附加固定伤害
damageZone := &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.GetADD(e.Args()[0], e.Args()[1], e.Args()[2]),
}
if e.ISNaturalEnemy() && e.ispower {
damageZone.Damage.Mul(alpacadecimal.NewFromInt(2))
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 181, &Effect181{})
}
// 181 - n%几率令对手XX连续攻击每次提高m%几率最高提高k%
type Effect181 struct {
AddLvelEffect
}
func (e *Effect181) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.GetADD(e.Args()[0], e.Args()[2], e.Args()[3]).IntPart()), 100)
if success {
// 添加异常状态
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) // 以麻痹为例
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
}
return true
}
// 441 - 每次攻击提升n%的致命几率最高提升m%
type Effect441 struct {
AddLvelEffect
}
func (e *Effect441) ActionStart(a, b *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
//fmt.Println(e.Ctx().SkillEntity)
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate += int(e.GetADD(alpacadecimal.Zero, e.Args()[2], e.Args()[3]).IntPart())
return true
}
// 465 - m%令对手疲惫n回合每次使用几率提升x%最高y%
type Effect465 struct {
AddLvelEffect
}
func (e *Effect465) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.GetADD(e.Args()[0], e.Args()[2], e.Args()[3]).IntPart()), 100)
if success {
// 添加异常状态
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired)) // 以麻痹为例
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
}
return true
}