refactor: 提取效果493和497到独立文件
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
39
logic/service/fight/effect/493.go
Normal file
39
logic/service/fight/effect/493.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// 493 - m回合内若对手使用攻击技能则自身下n回合必定暴击
|
||||
type Effect493 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect493) Skill_Use_ex() bool {
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||||
e.can = true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func (e *Effect493) SkillHit() bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().SkillEntity.CritRate = 16
|
||||
|
||||
return true
|
||||
}
|
||||
func (e *Effect493) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 493, &Effect493{})
|
||||
|
||||
}
|
||||
49
logic/service/fight/effect/497.go
Normal file
49
logic/service/fight/effect/497.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// 497 - 附加m点固定伤害,每次使用额外附加n点,最高k点,遇到天敌时效果翻倍
|
||||
type Effect497 struct {
|
||||
node.EffectNode
|
||||
Skillid int //记录使用的技能 ,如果技能变了就删除effect
|
||||
UseSkillCount int //技能使用了多少次,切换后置0
|
||||
}
|
||||
|
||||
func (e *Effect497) OnSkill() bool {
|
||||
if e.Skillid != 0 && e.Ctx().SkillEntity.ID != e.Skillid {
|
||||
e.Alive(false)
|
||||
e.UseSkillCount = 0
|
||||
return true
|
||||
|
||||
}
|
||||
e.Skillid = e.Ctx().SkillEntity.ID
|
||||
add := e.EffectNode.SideEffectArgs[0] + e.EffectNode.SideEffectArgs[1]*e.UseSkillCount
|
||||
add = utils.Min(add, e.EffectNode.SideEffectArgs[2])
|
||||
// 附加固定伤害
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(add)),
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect497) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
}
|
||||
func init() {
|
||||
t := &Effect497{}
|
||||
t.Duration(-1) //次数类无限回合
|
||||
t.CanStack(true) //后续的不会顶掉这个效果
|
||||
input.InitEffect(input.EffectType.Skill, 497, t)
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
element "blazing/common/data/Element"
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
@@ -1060,56 +1059,6 @@ func (e *Effect521) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// 497 - 附加m点固定伤害,每次使用额外附加n点,最高k点,遇到天敌时效果翻倍
|
||||
type Effect497 struct {
|
||||
node.EffectNode
|
||||
stackedDamage int
|
||||
maxExtraDamage int
|
||||
}
|
||||
|
||||
func (e *Effect497) SkillHit_ex() bool {
|
||||
// 基础伤害
|
||||
baseDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
||||
|
||||
// 额外伤害
|
||||
extraDamage := alpacadecimal.NewFromInt(int64(e.stackedDamage))
|
||||
|
||||
// 总伤害
|
||||
totalDamage := baseDamage.Add(extraDamage)
|
||||
|
||||
// 检查是否遇到天敌
|
||||
if e.isDisadvantageousMatch() {
|
||||
// 遇到天敌,效果翻倍
|
||||
totalDamage = totalDamage.Mul(alpacadecimal.NewFromInt(2))
|
||||
}
|
||||
|
||||
// 附加固定伤害
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: totalDamage,
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
// 更新叠加伤害
|
||||
e.stackedDamage += int(e.Args()[1].IntPart())
|
||||
if e.stackedDamage > e.maxExtraDamage {
|
||||
e.stackedDamage = e.maxExtraDamage
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect497) isDisadvantageousMatch() bool {
|
||||
// 检查是否遇到天敌
|
||||
return e.Ctx().Our.CurrentPet.Type == element.ElementTypeFire &&
|
||||
e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater
|
||||
}
|
||||
|
||||
func (e *Effect497) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.maxExtraDamage = a[2] // 最高k点
|
||||
}
|
||||
|
||||
// 412 - 若自身体力小于1/n,则每次攻击不消耗PP值
|
||||
type Effect412 struct {
|
||||
node.EffectNode
|
||||
@@ -1212,28 +1161,3 @@ func (e *Effect506) OnSkill() bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 493 - m回合内若对手使用攻击技能则自身下n回合必定暴击
|
||||
type Effect493 struct {
|
||||
node.EffectNode
|
||||
critDuration int
|
||||
}
|
||||
|
||||
func (e *Effect493) Skill_Use_ex() bool {
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||||
// 对手使用了攻击技能,设置下n回合必定暴击
|
||||
critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit))
|
||||
if critEffect != nil {
|
||||
critEffect.Duration(e.critDuration) // n回合
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect493) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.critDuration = a[1] // n回合
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func NewEggService(id uint32) *EggService {
|
||||
}
|
||||
func (s *EggService) Get() (out *model.Egg) {
|
||||
|
||||
s.dbm_fix(s.Model).Scan(&out)
|
||||
s.dbm(s.Model).Scan(&out)
|
||||
if out != nil {
|
||||
BreedLeftTime := int64(out.Data.StartTime+out.CurEgg.EggID*uint32(time.Hour/1000000000)) - (time.Now().Unix())
|
||||
if cool.Config.ServerInfo.IsVip != 0 {
|
||||
|
||||
Reference in New Issue
Block a user