pro 属性转换处理
This commit is contained in:
parent
eed78135bf
commit
358c7cc6ba
@ -811,37 +811,70 @@ func (this *modelBattleComp) createBattleRole(hero *pb.DBHero, vlv int32, tid, p
|
||||
hero = this.module.ModuleHero.GetVirtualHero(hero, vlv)
|
||||
role.Lv = hero.Lv
|
||||
}
|
||||
|
||||
for k, v := range hero.Property {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
for k, v := range hero.Property {
|
||||
|
||||
role.Property[k] += v
|
||||
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
||||
|
||||
role.Currhp += v
|
||||
}
|
||||
}
|
||||
for k, v := range hero.AddProperty {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.AddProperty {
|
||||
//arrt := AttributesTransExt(k)
|
||||
|
||||
role.Property[k] += v
|
||||
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
||||
role.Currhp += v
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.JuexProperty {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.JuexProperty {
|
||||
|
||||
role.Property[k] += v
|
||||
@ -849,6 +882,23 @@ func (this *modelBattleComp) createBattleRole(hero *pb.DBHero, vlv int32, tid, p
|
||||
role.Currhp += v
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.HoroscopeProperty {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
for k, v := range hero.HoroscopeProperty {
|
||||
|
||||
role.Property[k] += v
|
||||
|
@ -172,17 +172,19 @@ func Test_Main(t *testing.T) {
|
||||
// 1<<2
|
||||
var star1, star2, star3 int32
|
||||
var rst int32
|
||||
rst = 1
|
||||
rst = 6 // 101
|
||||
rst |= 2 //010
|
||||
//fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
|
||||
for i := 0; i < 3; i++ {
|
||||
star1 = 1 << i
|
||||
if rst&star1 == star1 {
|
||||
star3++
|
||||
}
|
||||
}
|
||||
star1 = 1 << 0
|
||||
//star2 = 1 << 1
|
||||
//star1 = 1 << 0
|
||||
star2 = 1 << 1
|
||||
star3 = 1 << 2 // 101
|
||||
rst |= star1
|
||||
//rst |= star1
|
||||
rst |= star2
|
||||
rst |= star3
|
||||
//rst = star1 ^ star2 ^ star3 // 三星
|
||||
|
@ -23,10 +23,6 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
|
||||
}
|
||||
return
|
||||
}
|
||||
// if list.Complete { // 这个版本不给赛季塔信息
|
||||
// list, _ = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||
// }
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||
return
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
||||
}
|
||||
}
|
||||
|
||||
list.Data[conf.Floors].Star = req.Star
|
||||
list.Data[conf.Floors].Star |= req.Star
|
||||
list.Battlecount += 1
|
||||
mapData["data"] = list.Data
|
||||
mapData["battlecount"] = list.Battlecount
|
||||
@ -101,6 +101,7 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
||||
if list.Data[conf.Floors].Consttime > costTime { // 小于之前的时间 入榜
|
||||
this.module.modelRacePagoda.SetRacePagodaRankList(score, session.GetUserId())
|
||||
}
|
||||
award = append(award, conf.KeyReward...) // 首通奖励
|
||||
}
|
||||
|
||||
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), mapData); err != nil {
|
||||
|
@ -39,16 +39,6 @@ func (this *apiComp) RaceReward(session comm.IUserSession, req *pb.PagodaRaceRew
|
||||
return
|
||||
}
|
||||
|
||||
szConf = this.module.configure.GetSixDirectionsConf(req.Groud)
|
||||
if len(szConf) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: fmt.Sprintf("conf not fount:%d", req.Groud),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
floors = this.module.configure.GetSixDirectionsGroudConf(req.Groud)
|
||||
if len(floors) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -58,6 +48,18 @@ func (this *apiComp) RaceReward(session comm.IUserSession, req *pb.PagodaRaceRew
|
||||
}
|
||||
return
|
||||
} // 1 2 3
|
||||
if c, err := this.module.configure.GetSixPagodaConf(floors[0]); err == nil {
|
||||
szConf = this.module.configure.GetSixDirectionsConf(c.Groudreward)
|
||||
}
|
||||
|
||||
if len(szConf) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: fmt.Sprintf("conf not fount:%d", req.Groud),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range floors {
|
||||
if d, ok := list.Data[v]; ok {
|
||||
curStr = 0
|
||||
@ -90,10 +92,11 @@ func (this *apiComp) RaceReward(session comm.IUserSession, req *pb.PagodaRaceRew
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["reward"] = list.Reward
|
||||
errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
||||
this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), mapData)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "racereward", &pb.PagodaRaceRewardResp{
|
||||
Data: list,
|
||||
Data: list,
|
||||
Reward: atno,
|
||||
})
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "PagodaRaceRewardReq", atno)
|
||||
|
Loading…
Reference in New Issue
Block a user