fix(fight): 修复技能效果获取逻辑并调整伤害计算方式

-
This commit is contained in:
2025-09-24 19:46:42 +08:00
parent 9b078d7820
commit 805fe8ec8d
4 changed files with 38 additions and 25 deletions

View File

@@ -79,7 +79,7 @@ var NodeM = make(map[int]Effect, 0)
func InitSkillEffect(id int, t Effect) {
NodeM[id+1000000] = t
NodeM[id+1000000-1] = t
}
func Geteffect(id int) (Effect, bool) {
@@ -95,7 +95,7 @@ func Geteffect(id int) (Effect, bool) {
func InitPropEffect(id int, t Effect) {
NodeM[id+2000000] = t
NodeM[id+2000000-1] = t
}
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
@@ -125,11 +125,11 @@ func (c *Input) GetProp(id int, istue bool) int {
}
func InitDamageEffect(id int, t Effect) {
NodeM[id+4000000] = t
NodeM[id+4000000-1] = t
}
// 1为红伤
func (c *Input) GetDamageEffect(id int) *EffectID {
func GetDamageEffect(id int) *EffectID {
id1 := id + 4000000
ret, ok := Geteffect(id1)
if ok {
@@ -142,7 +142,17 @@ func (c *Input) GetDamageEffect(id int) *EffectID {
}
return &EffectID{}
}
func (c *Input) GetSkillEffect(id int) *EffectID {
func (c *Input) GetDamageEffect(id int) int {
id1 := id + 4000000
rer, ok := c.Effects.Load(id1)
if ok {
return rer.Stack()
}
return 0
}
func GetSkillEffect(id int) *EffectID {
id1 := id + 1000000
ret, ok := Geteffect(id1)
if ok {
@@ -161,7 +171,7 @@ type EffectID struct {
Effect Effect
}
func (c *Input) GetPropEffect(id int) Effect {
func GetPropEffect(id int) Effect {
ret, ok := Geteffect(id + 2000000)
if ok {
@@ -173,10 +183,10 @@ func (c *Input) GetPropEffect(id int) Effect {
}
func InitStatusEffect(id int, t Effect) {
NodeM[id+3000000] = t
NodeM[id+3000000-1] = t
}
func (c *Input) GetStatusEffect(id int) (Effect, bool) {
func GetStatusEffect(id int) (Effect, bool) {
ret, ok := Geteffect(id + 3000000)
if ok {
//todo 获取前GetEffect
@@ -186,6 +196,11 @@ func (c *Input) GetStatusEffect(id int) (Effect, bool) {
return nil, false
}
func (c *Input) GetStatusEffect(id int) (Effect, bool) {
rer, ok := c.Effects.Load(id + 3000000)
return rer, ok
}
func (c *Input) GetCurrAttr(id int) *model.PetInfo {
//todo 获取前GetEffect