Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
9c3c1ab798
@ -408,6 +408,35 @@ func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ModelHero) StarAtkAddition(star int32) (addValue float32) {
|
||||||
|
for i := 1; i <= int(star); i++ {
|
||||||
|
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
|
||||||
|
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
||||||
|
addValue += cfg.Atk * starCfg.StarupAtk / 1000.0
|
||||||
|
}
|
||||||
|
return addValue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ModelHero) StarDefAddition(star int32) (addValue float32) {
|
||||||
|
for i := 1; i <= int(star); i++ {
|
||||||
|
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
|
||||||
|
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
||||||
|
addValue += cfg.Def * starCfg.StarupDef / 1000.0
|
||||||
|
}
|
||||||
|
return addValue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ModelHero) StarHpAddition(star int32) (addValue float32) {
|
||||||
|
for i := 1; i <= int(star); i++ {
|
||||||
|
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
|
||||||
|
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
||||||
|
|
||||||
|
this.moduleHero.Debugf("cfg.Atk= %f,starCfg.StarupHp = %f,addValue= %f", cfg.Atk, starCfg.StarupHp, addValue)
|
||||||
|
addValue += cfg.Hp * starCfg.StarupHp / 1000.0
|
||||||
|
}
|
||||||
|
return addValue
|
||||||
|
}
|
||||||
|
|
||||||
//属性计算 基础属性
|
//属性计算 基础属性
|
||||||
//英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数
|
//英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数
|
||||||
func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
||||||
@ -419,11 +448,10 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
|||||||
if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil {
|
if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
atk := (starLvfg.Atk*(1+(starCfg.StarupAtk/1000)) + lvCfg.Atk + float32(growCfg.Atk)) * (growCfg.Atkgrow / 1000)
|
var atk = (this.StarAtkAddition(hero.Star) + lvCfg.Atk + float32(growCfg.Atk)) * (growCfg.Atkgrow / 1000.0) * 1.0
|
||||||
def := (starLvfg.Def*(1+(starCfg.StarupDef/1000)) + lvCfg.Def + float32(growCfg.Def)) * (growCfg.Defgrow / 1000)
|
var def = (this.StarDefAddition(hero.Star) + lvCfg.Def + float32(growCfg.Def)) * (growCfg.Defgrow / 1000.0) * 1.0
|
||||||
hp := (starLvfg.Hp*(1+(starCfg.StarupHp/1000)) + lvCfg.Hp + float32(growCfg.Hp)) * (growCfg.Hpgrow / 1000)
|
var hp = (this.StarHpAddition(hero.Star) + lvCfg.Hp + float32(growCfg.Hp)) * (growCfg.Hpgrow / 1000.0) * 1.0
|
||||||
speed := growCfg.Speed
|
speed := growCfg.Speed
|
||||||
|
|
||||||
hero.Property = map[string]int32{
|
hero.Property = map[string]int32{
|
||||||
comm.Hp: int32(math.Floor(float64(hp))),
|
comm.Hp: int32(math.Floor(float64(hp))),
|
||||||
comm.Atk: int32(math.Floor(float64(atk))),
|
comm.Atk: int32(math.Floor(float64(atk))),
|
||||||
|
@ -35,7 +35,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
||||||
aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
//aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||||
for k, v := range req.Items {
|
for k, v := range req.Items {
|
||||||
|
|
||||||
if v == 0 { // 过滤数量为0 的消息
|
if v == 0 { // 过滤数量为0 的消息
|
||||||
@ -49,7 +49,8 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
|||||||
if !bSell {
|
if !bSell {
|
||||||
bSell = true
|
bSell = true
|
||||||
trolltrain.SellCount += 1 // 交易次数+1
|
trolltrain.SellCount += 1 // 交易次数+1
|
||||||
if trolltrain.SellCount > aiMaxCount-dayMaxCount {
|
if trolltrain.AiCount+trolltrain.SellCount >= dayMaxCount {
|
||||||
|
//if trolltrain.SellCount > aiMaxCount-trolltrain.AiCount {
|
||||||
code = pb.ErrorCode_TrollMaxSellCount // 达到最大交易次数 直接返回
|
code = pb.ErrorCode_TrollMaxSellCount // 达到最大交易次数 直接返回
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
|
|||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount) // 8
|
||||||
aiCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
aiCount := this.configure.GetTrollRule(comm.TrollAIBuyCount) // 10
|
||||||
if trolltrain.AiCount <= aiCount-dayMaxCount { // 小于离线挂机次数可执行
|
if trolltrain.AiCount+trolltrain.SellCount < dayMaxCount {
|
||||||
this.module.TrollAI(session, trolltrain, aiCount)
|
this.module.TrollAI(session, trolltrain, aiCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,6 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
|
|||||||
sellPrice = make(map[int32]int32)
|
sellPrice = make(map[int32]int32)
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
trainNum := this.configure.GetTrollMaxTraintNum()
|
trainNum := this.configure.GetTrollMaxTraintNum()
|
||||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
|
||||||
maxCoefficient := this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
maxCoefficient := this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
||||||
if maxCoefficient == 0 {
|
if maxCoefficient == 0 {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
@ -122,8 +121,8 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
|
|||||||
this.SeTrollRankList(troll.TotalEarn, session.GetUserId()) // 设置排行数据
|
this.SeTrollRankList(troll.TotalEarn, session.GetUserId()) // 设置排行数据
|
||||||
|
|
||||||
troll.AiCount++
|
troll.AiCount++
|
||||||
|
aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||||
if troll.AiCount > aiCount-dayMaxCount { //达到最大交易次数
|
if troll.AiCount > aiMaxCount { //达到最大交易次数
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user