英雄优化
This commit is contained in:
parent
1f97b9f5be
commit
4335663fbc
@ -166,10 +166,22 @@ func (this *Hero) AddCardExp(uid string, heroId string, exp int32) (newhero *pb.
|
|||||||
data["def"] = int32(nowConfig.Def - preConfig.Def)
|
data["def"] = int32(nowConfig.Def - preConfig.Def)
|
||||||
this.modelHero.mergeMainProperty(uid, heroId, data)
|
this.modelHero.mergeMainProperty(uid, heroId, data)
|
||||||
}
|
}
|
||||||
_hero.SameCount -= 1
|
|
||||||
curCount := _hero.SameCount
|
curCount := _hero.SameCount - 1
|
||||||
if _hero.SameCount == 0 {
|
if curCount == 0 {
|
||||||
this.modelHero.consumeHeroCard(uid, _hero.Id, 1)
|
this.modelHero.consumeHeroCard(uid, _hero.Id, 1)
|
||||||
|
} else {
|
||||||
|
newhero, err1 = this.modelHero.createOneHero(uid, _hero.HeroID)
|
||||||
|
if err1 != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
}
|
||||||
|
update := map[string]interface{}{
|
||||||
|
"sameCount": curCount,
|
||||||
|
}
|
||||||
|
newhero.SameCount = curCount
|
||||||
|
if err := this.modelHero.modifyHeroData(uid, newhero.Id, update); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
}
|
||||||
}
|
}
|
||||||
update1 := map[string]interface{}{
|
update1 := map[string]interface{}{
|
||||||
"lv": curLv,
|
"lv": curLv,
|
||||||
@ -177,24 +189,16 @@ func (this *Hero) AddCardExp(uid string, heroId string, exp int32) (newhero *pb.
|
|||||||
"isOverlying": false,
|
"isOverlying": false,
|
||||||
"sameCount": 1,
|
"sameCount": 1,
|
||||||
}
|
}
|
||||||
newhero, err1 = this.modelHero.createOneHero(uid, _hero.HeroID)
|
|
||||||
if err1 != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
}
|
|
||||||
_hero.Lv = curLv
|
_hero.Lv = curLv
|
||||||
_hero.Exp = curExp
|
_hero.Exp = curExp
|
||||||
_hero.IsOverlying = false
|
_hero.IsOverlying = false
|
||||||
_hero.SameCount = 1
|
_hero.SameCount = 1
|
||||||
newhero.SameCount = curCount
|
|
||||||
update := map[string]interface{}{
|
|
||||||
"sameCount": curCount,
|
|
||||||
}
|
|
||||||
if err := this.modelHero.modifyHeroData(uid, _hero.Id, update1); err != nil {
|
if err := this.modelHero.modifyHeroData(uid, _hero.Id, update1); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
if err := this.modelHero.modifyHeroData(uid, newhero.Id, update); err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
}
|
|
||||||
oldhero = _hero
|
oldhero = _hero
|
||||||
} else {
|
} else {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
code = pb.ErrorCode_HeroNoExist
|
||||||
|
Loading…
Reference in New Issue
Block a user