共鸣属性分配BUG

This commit is contained in:
meixiongfeng 2022-08-12 10:43:49 +08:00
parent d61274b14f
commit 24fb25692f
4 changed files with 13 additions and 18 deletions

View File

@ -102,6 +102,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
_hero.JuexingLv += 1
_heroMap := map[string]interface{}{
"juexingLv": _hero.JuexingLv,
"sameCount": 1,
"isOverlying": false,
}
// 保存数据

View File

@ -75,10 +75,6 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR
}
}
// if int32(len(req.CostObjID)) != int32(len(szCostHero)) { // 总数消耗校验
// code = pb.ErrorCode_HeroNoEnough // 消耗数量不对应
// return
// }
for k, v := range szCostHero {
c := this.module.DelCard(session.GetUserId(), _costMaphero[k], v)
if c != pb.ErrorCode_Success {
@ -121,9 +117,7 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR
// 返还对应初始星级的卡
for _, v := range resonConfig.Prize {
if v.A == comm.HeroType {
for i := 0; i < int(v.N); i++ { // 有多少张加多少次
this.module.modelHero.createOneHero(session.GetUserId(), v.T)
}
this.module.modelHero.createHeroOverlying(session.GetUserId(), v.T, v.N)
}
}

View File

@ -68,10 +68,10 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, req *pb.HeroReson
for k := range _hero.Energy { // 清除玩家选择的共鸣属性
delete(_hero.Energy, k)
}
_hero.ResonateNum *= resonConfig.Energy
_hero.DistributionResonate = _hero.ResonateNum * resonConfig.Energy
_heroMap := map[string]interface{}{
"DistributionResonate": _hero.ResonateNum,
"Energy": _hero.Energy,
"distributionResonate": _hero.DistributionResonate,
"energy": _hero.Energy,
"isOverlying": false,
}

View File

@ -14,10 +14,11 @@ func (this *apiComp) ResonanceUseEnergyCheck(session comm.IUserSession, req *pb.
return
}
for _, v := range req.Energy {
if v.UseType != comm.ResonanceAtkPro && v.UseType != comm.ResonanceHpPro && v.UseType != comm.ResonanceDefPro {
if v.UseEnergy < 0 || (v.UseType != comm.ResonanceAtkPro && v.UseType != comm.ResonanceHpPro && v.UseType != comm.ResonanceDefPro) {
code = pb.ErrorCode_ReqParameterError
return
}
}
return
}
@ -25,10 +26,8 @@ func (this *apiComp) ResonanceUseEnergyCheck(session comm.IUserSession, req *pb.
func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, req *pb.HeroResonanceUseEnergyReq) (code pb.ErrorCode, data proto.Message) {
var (
_hero *pb.DBHero
energyMap map[string]int32
totalEnergy int32
)
energyMap = make(map[string]int32, 0)
code = this.ResonanceUseEnergyCheck(session, req) // check
if code != pb.ErrorCode_Success {
return
@ -39,7 +38,6 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, req *pb.HeroR
return
}
for _, v := range req.Energy {
energyMap[v.UseType] += v.UseEnergy
totalEnergy += v.UseEnergy
}
@ -48,12 +46,14 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, req *pb.HeroR
return
}
for _, v := range req.Energy {
_hero.Energy[v.UseType] += v.UseEnergy
if v.UseEnergy > 0 {
_hero.Energy[v.UseType] += v.UseEnergy
}
}
_hero.DistributionResonate -= totalEnergy
_heroMap := map[string]interface{}{
"DistributionResonate": _hero.DistributionResonate - totalEnergy, // 减没有分配的能量
"Energy": _hero.Energy,
"distributionResonate": _hero.DistributionResonate, // 减没有分配的能量
"energy": _hero.Energy,
"isOverlying": false,
}