属性公式调整
This commit is contained in:
parent
d097f95d05
commit
39387fd874
@ -3,7 +3,6 @@ package hero
|
||||
import (
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
@ -15,7 +14,6 @@ import (
|
||||
"math/big"
|
||||
"reflect"
|
||||
|
||||
mengine "github.com/dengsgo/math-engine/engine"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
@ -413,65 +411,28 @@ func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[st
|
||||
//属性计算 基础属性
|
||||
//英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数
|
||||
func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
||||
|
||||
//英雄等级基础属性levelup
|
||||
heroLvCfg := this.moduleHero.configure.GetHeroLv(hero.Lv)
|
||||
if heroLvCfg == nil {
|
||||
return
|
||||
}
|
||||
|
||||
//英雄基础配置 newhero
|
||||
growCfg := this.moduleHero.configure.GetHeroLvgrow(hero.HeroID)
|
||||
heroCfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID)
|
||||
if heroCfg == nil {
|
||||
lvCfg := this.moduleHero.configure.GetHeroLv(hero.Lv)
|
||||
starCfg := this.moduleHero.configure.GetHeroStar(heroCfg.Star)
|
||||
starLvfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
||||
if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil {
|
||||
return
|
||||
}
|
||||
atk := (starLvfg.Atk*(1+(starCfg.StarupAtk/1000)) + lvCfg.Atk + float32(growCfg.Atk)) * (growCfg.Atkgrow / 1000)
|
||||
def := (starLvfg.Def*(1+(starCfg.StarupDef/1000)) + lvCfg.Def + float32(growCfg.Def)) * (growCfg.Defgrow / 1000)
|
||||
hp := (starLvfg.Hp*(1+(starCfg.StarupHp/1000)) + lvCfg.Hp + float32(growCfg.Hp)) * (growCfg.Hpgrow / 1000)
|
||||
speed := growCfg.Speed
|
||||
|
||||
//品质系数
|
||||
stargrowCfg := this.moduleHero.configure.GetHeroStar(heroCfg.Star)
|
||||
if stargrowCfg == nil {
|
||||
return
|
||||
}
|
||||
|
||||
//英雄星级对应等级属性
|
||||
heroStarCfg := this.moduleHero.configure.GetHeroLv(heroCfg.Star * comm.HeroStarLvRatio)
|
||||
if heroStarCfg == nil {
|
||||
return
|
||||
}
|
||||
|
||||
//成长系数
|
||||
lvGrow := this.moduleHero.configure.GetHeroLvgrow(hero.HeroID)
|
||||
if lvGrow == nil {
|
||||
return
|
||||
}
|
||||
|
||||
//血量
|
||||
exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v/1000",
|
||||
lvGrow.Hp, heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp)
|
||||
hp, _ := mengine.ParseAndExec(exprHp)
|
||||
|
||||
// 攻击
|
||||
exprAtk := fmt.Sprintf("%v +%v * %v/1000 + %v * %v/1000",
|
||||
lvGrow.Atk, heroLvCfg.Atk, lvGrow.Atkgrow, heroStarCfg.Atk, stargrowCfg.StarupAtk)
|
||||
atk, _ := mengine.ParseAndExec(exprAtk)
|
||||
|
||||
// 防御
|
||||
exprDef := fmt.Sprintf("%v +%v * %v/1000 + %v * %v/1000",
|
||||
lvGrow.Def, heroLvCfg.Def, lvGrow.Defgrow, heroStarCfg.Def, stargrowCfg.StarupDef)
|
||||
def, _ := mengine.ParseAndExec(exprDef)
|
||||
|
||||
// 速度
|
||||
exprSpeed := fmt.Sprintf("%v +%v * %v/1000 + %v * %v/1000",
|
||||
lvGrow.Speed, 0, 0, 0, stargrowCfg.StarupSpeed)
|
||||
speed, _ := mengine.ParseAndExec(exprSpeed)
|
||||
hero.Property = map[string]int32{
|
||||
comm.Hp: int32(math.Floor(hp)),
|
||||
comm.Atk: int32(math.Floor(atk)),
|
||||
comm.Def: int32(math.Floor(def)),
|
||||
comm.Speed: int32(math.Floor(speed)),
|
||||
comm.Cri: int32(lvGrow.Cri), //暴击
|
||||
comm.Effhit: int32(lvGrow.Effhit), //效果命中
|
||||
comm.Cridam: int32(lvGrow.Cridam), //暴击伤害
|
||||
comm.Effre: int32(lvGrow.Effre), //效果抵抗
|
||||
comm.Hp: int32(math.Floor(float64(hp))),
|
||||
comm.Atk: int32(math.Floor(float64(atk))),
|
||||
comm.Def: int32(math.Floor(float64(def))),
|
||||
comm.Speed: int32(math.Floor(float64(speed))),
|
||||
comm.Cri: int32(growCfg.Cri), //暴击
|
||||
comm.Effhit: int32(growCfg.Effhit), //效果命中
|
||||
comm.Cridam: int32(growCfg.Cridam), //暴击伤害
|
||||
comm.Effre: int32(growCfg.Effre), //效果抵抗
|
||||
}
|
||||
this.resetTalentProperty(hero)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user