Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
cc955cc160
@ -89,12 +89,14 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else { // 加属性
|
} else { // 加属性
|
||||||
property := make(map[string]int32, 0)
|
|
||||||
|
// property := make(map[string]int32, 0)
|
||||||
value, err := strconv.Atoi(awakenData.Phasebonus[1])
|
value, err := strconv.Atoi(awakenData.Phasebonus[1])
|
||||||
if err == nil {
|
if err == nil {
|
||||||
property[awakenData.Phasebonus[0]] += int32(value)
|
this.module.modelHero.setJuexingProperty(_hero, awakenData.Phasebonus[0], int32(value))
|
||||||
|
//property[awakenData.Phasebonus[0]] += int32(value)
|
||||||
}
|
}
|
||||||
this.module.modelHero.mergeMainProperty(session.GetUserId(), _hero, property)
|
// this.module.modelHero.mergeMainProperty(session.GetUserId(), _hero, property)
|
||||||
_hero.JuexingLv += 1
|
_hero.JuexingLv += 1
|
||||||
_heroMap := map[string]interface{}{
|
_heroMap := map[string]interface{}{
|
||||||
"juexingLv": _hero.JuexingLv,
|
"juexingLv": _hero.JuexingLv,
|
||||||
|
@ -60,11 +60,7 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, req *pb.HeroReson
|
|||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
property := make(map[string]int32, 0)
|
_hero.EnergyProperty = nil
|
||||||
property[comm.HpPro] -= _hero.AddProperty[comm.HpPro]
|
|
||||||
property[comm.AtkPro] -= _hero.AddProperty[comm.AtkPro]
|
|
||||||
property[comm.DefPro] -= _hero.AddProperty[comm.DefPro]
|
|
||||||
this.module.modelHero.mergeMainProperty(session.GetUserId(), _hero, property)
|
|
||||||
for k := range _hero.Energy { // 清除玩家选择的共鸣属性
|
for k := range _hero.Energy { // 清除玩家选择的共鸣属性
|
||||||
delete(_hero.Energy, k)
|
delete(_hero.Energy, k)
|
||||||
}
|
}
|
||||||
@ -73,6 +69,7 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, req *pb.HeroReson
|
|||||||
"distributionResonate": _hero.DistributionResonate,
|
"distributionResonate": _hero.DistributionResonate,
|
||||||
"energy": _hero.Energy,
|
"energy": _hero.Energy,
|
||||||
"isOverlying": false,
|
"isOverlying": false,
|
||||||
|
"energyProperty": _hero.EnergyProperty,
|
||||||
}
|
}
|
||||||
|
|
||||||
err1 = this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
err1 = this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||||
@ -82,7 +79,7 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, req *pb.HeroReson
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 计算属性
|
// 计算属性
|
||||||
this.module.modelHero.setEnergyProperty(_hero)
|
//this.module.modelHero.setEnergyProperty(_hero)
|
||||||
//session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: []*pb.DBHero{_hero}})
|
//session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: []*pb.DBHero{_hero}})
|
||||||
session.SendMsg(string(this.module.GetType()), ResonanceReset, &pb.HeroResonanceResetResp{Hero: _hero, Energy: _hero.ResonateNum})
|
session.SendMsg(string(this.module.GetType()), ResonanceReset, &pb.HeroResonanceResetResp{Hero: _hero, Energy: _hero.ResonateNum})
|
||||||
return
|
return
|
||||||
|
@ -261,6 +261,43 @@ func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
|
|||||||
return heroes
|
return heroes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 觉醒
|
||||||
|
func (this *ModelHero) setJuexingProperty(hero *pb.DBHero, key string, value int32) {
|
||||||
|
if hero.JuexProperty == nil {
|
||||||
|
hero.JuexProperty = make(map[string]int32)
|
||||||
|
}
|
||||||
|
JuexingProperty := make(map[string]int32) //副属性
|
||||||
|
switch key {
|
||||||
|
case comm.Hp:
|
||||||
|
hero.JuexProperty[comm.Hp] += value
|
||||||
|
case comm.Def:
|
||||||
|
hero.JuexProperty[comm.Def] += value
|
||||||
|
case comm.Atk:
|
||||||
|
hero.JuexProperty[comm.Atk] += value
|
||||||
|
case comm.Speed:
|
||||||
|
hero.JuexProperty[comm.Speed] += value
|
||||||
|
case comm.ResonanceHpPro:
|
||||||
|
hero.JuexProperty[comm.Hp] += int32(math.Floor((1.0 + float64(value)/1000) * float64(hero.Property[comm.Hp])))
|
||||||
|
case comm.ResonanceAtkPro:
|
||||||
|
hero.JuexProperty[comm.Atk] += int32(math.Floor((1.0 + float64(value)/1000) * float64(hero.Property[comm.Atk])))
|
||||||
|
case comm.ResonanceDefPro:
|
||||||
|
hero.JuexProperty[comm.Def] += int32(math.Floor((1.0 + float64(value)/1000) * float64(hero.Property[comm.Def])))
|
||||||
|
}
|
||||||
|
for k, v := range hero.JuexProperty {
|
||||||
|
JuexingProperty[k] = v
|
||||||
|
}
|
||||||
|
this.mergeJuexingProperty(hero.Uid, hero, JuexingProperty)
|
||||||
|
}
|
||||||
|
func (this *ModelHero) mergeJuexingProperty(uid string, hero *pb.DBHero, data map[string]int32) {
|
||||||
|
hero.EnergyProperty = data
|
||||||
|
|
||||||
|
if err := this.ChangeList(uid, hero.Id, map[string]interface{}{
|
||||||
|
"juexProperty": data,
|
||||||
|
}); err != nil {
|
||||||
|
this.moduleHero.Errorf("mergeAddProperty err %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 设置共鸣能量点数属性
|
// 设置共鸣能量点数属性
|
||||||
func (this *ModelHero) setEnergyProperty(hero *pb.DBHero) {
|
func (this *ModelHero) setEnergyProperty(hero *pb.DBHero) {
|
||||||
resonConfig := this.moduleHero.configure.GetHeroResonanceConfig(hero.HeroID, hero.Star)
|
resonConfig := this.moduleHero.configure.GetHeroResonanceConfig(hero.HeroID, hero.Star)
|
||||||
|
Loading…
Reference in New Issue
Block a user