修复队伍上阵同样卡牌

back_recharge
wangyuan 2019-02-26 21:07:45 +08:00
parent c243df65ab
commit d6ab9a413d
5 changed files with 50 additions and 38 deletions

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import com.ljsd.jieling.util.MathUtils;
import java.util.HashMap;
import java.util.Map;
@ -41,18 +42,17 @@ public class SWorkShopSetting implements BaseConfig {
Map<Integer,Integer> promoteMapTmp = new HashMap<>();
int maxExpTmp = 0;
int maxCookExpTmp = 0;
int exp =0;
for(SWorkShopSetting sWorkShopSetting : sWorkShopSettingMapTmp.values()){
exp+=sWorkShopSetting.getExp();
Map<Integer,Integer> promoteMapTmptm = new HashMap<>(promoteMapTmp);
int[] promote = sWorkShopSetting.getPromote();
if(promote!=null&&promote.length>0){
promoteMapTmp.put(promote[0],promote[1]);
sWorkShopSetting.setPromoteMap(promoteMapTmp);
promoteMapTmptm.put(promote[0],promote[1]);
sWorkShopSetting.setPromoteMap(promoteMapTmptm);
}
maxExpTmp+=sWorkShopSetting.getExp();
maxExpTmp+=sWorkShopSetting.getFoodExp();
sWorkShopSetting.setExp(exp);
maxExpTmp = MathUtils.getMaxNum(maxExpTmp,sWorkShopSetting.getExp());
maxCookExpTmp=MathUtils.getMaxNum(maxExpTmp,sWorkShopSetting.getFoodExp());
int[][] poolWeight = sWorkShopSetting.getPoolRate();
if(poolWeight!=null && poolWeight.length>0){
int totalWeight = 0;

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.MathUtils;
import com.ljsd.jieling.util.UUIDEnum;
@ -143,29 +144,46 @@ public class Equip extends MongoBase {
}
public void rebuildEquip(int workShopLevle){
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
if( null == sWorkShopSetting ){
return;
}
Map<Integer, Integer> promoteMap = sWorkShopSetting.getPromoteMap();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(this.equipId);
int properTyId = sEquipConfig.getPropertyMin()[0];
Integer propertyPromote = promoteMap.get(properTyId);
int properMinNum = sEquipConfig.getPropertyMin()[1];
int properMaxNum = sEquipConfig.getPropertyMax()[1];
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
Map<Integer, Integer> promoteMap = null;
SPropertyConfig sPropertyConfigFirst = SPropertyConfig.getsPropertyConfigByPID(properTyId);
if(sPropertyConfigFirst != null && sPropertyConfigFirst.getStyle() == GlobalsDef.ABSOLUTE_TYPE){
Integer propertyPromote = null;
if( sWorkShopSetting !=null ){
promoteMap = sWorkShopSetting.getPromoteMap();
if(promoteMap!=null){
propertyPromote = promoteMap.get(properTyId);
}
}
if(propertyPromote==null){
propertyPromote =0;
}
int properMinNum = sEquipConfig.getPropertyMin()[1];
int properMaxNum = sEquipConfig.getPropertyMax()[1];
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
}
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(sEquipConfig.getPool());
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
Integer secondPropertyId = secondValueByIdMap.get(sEquipPropertyPool.getId());
if(secondPropertyId == null ){
int secondPropertyId = sEquipPropertyPool.getPropertyId();
if(!secondValueByIdMap.containsKey(secondPropertyId)){
continue;
}
Integer secondPropertyPromote = promoteMap.get(secondPropertyId);
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(secondPropertyId);
if(sPropertyConfig == null || sPropertyConfig.getStyle() != GlobalsDef.ABSOLUTE_TYPE){
continue;
}
Integer secondPropertyPromote =null;
if(promoteMap!=null){
secondPropertyPromote = promoteMap.get(secondPropertyId);
}
if(secondPropertyPromote == null){
continue;
secondPropertyPromote =0;
}
int value = MathUtils.random(sEquipPropertyPool.getMin() * (100 + secondPropertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + secondPropertyPromote) / 100);
secondValueByIdMap.put(secondPropertyId,value);
}

View File

@ -245,17 +245,6 @@ public class HeroLogic {
}
Set<String> cacheHeroIds = new HashSet<>();
Set<String> alreadyHeroIds = new HashSet<>();
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
for(Integer teamIdTmp : teamPosForHero.keySet()){
if(teamIdTmp == teamId){
continue;
}
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamIdTmp);
for(TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList){
alreadyHeroIds.add(teamPosHeroInfo.getHeroId());
}
}
for(CommonProto.TeamHeroInfo teamHeroInfo: heroIds){
String heroId = teamHeroInfo.getHeroId();
if(user.getHeroManager().getHero(heroId) == null) {
@ -266,9 +255,6 @@ public class HeroLogic {
if(cacheHeroIds.contains(heroId)){
return "card repeated";
}
if(alreadyHeroIds.contains(heroId)){
return "card repeated";
}
cacheHeroIds.add(heroId);
}

View File

@ -216,8 +216,9 @@ public class WorkShopLogic {
User user = UserManager.getUser(uid);
SWorkShopFoundationConfig sWorkShopFoundationConfig = SWorkShopFoundationConfig.getShopFoundationConfigMap().get(materialId);
if(!checkIsUnlock(GlobalsDef.WORK_BASE_TYPE,sWorkShopFoundationConfig.getType(),user.getWorkShopController(),sWorkShopFoundationConfig.getOpenRules())){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
return;
// MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
// return;
LOGGER.error("不匹配");
}
int[][] cost = sWorkShopFoundationConfig.getCost();
times2Array(cost,nums);
@ -247,8 +248,9 @@ public class WorkShopLogic {
User user = UserManager.getUser(uid);
SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid);
if(!checkIsUnlock(GlobalsDef.WORK_CREATE_TYPE,sWorkShopEquipmentConfig.getType(),user.getWorkShopController(),sWorkShopEquipmentConfig.getOpenRules())){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
return;
// MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
// return;
LOGGER.error("不匹配");
}
int runesNum = sWorkShopEquipmentConfig.getRunesNum();
int[][] specialRunes = sWorkShopEquipmentConfig.getSpecialRunes();

View File

@ -112,4 +112,10 @@ public class MathUtils {
return original;
}
public static int getMaxNum(int a, int b) {
if(a>=b){
return a;
}
return b;
}
}