异妖属性加成

back_recharge
wangyuan 2019-03-18 11:40:33 +08:00
parent f62eda7bda
commit b2e560c8bc
1 changed files with 32 additions and 1 deletions

View File

@ -615,6 +615,20 @@ public class HeroLogic {
Map<Integer, Integer> heroAllAttribute = calHeroAllAttribute(hero);
Collection<String> values = hero.getEquipByPositionMap().values();
EquipManager equipManager = user.getEquipManager();
PokemonManager pokemonManager = user.getPokemonManager();
Map<Integer, Pokemon> pokemonMap = pokemonManager.getPokemonMap();
for(Map.Entry<Integer,Pokemon> item : pokemonMap.entrySet()){
Pokemon pokemon = item.getValue();
Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap();
for(Map.Entry<Integer, Integer> comonpentsLevelItem : comonpentsLevelMap.entrySet()){
Integer comonpentId = comonpentsLevelItem.getKey();
Integer comonpentLevel = comonpentsLevelItem.getValue();
Map<Integer, SDifferDemonsComonpentsConfig> sDifferDemonsComonpentsConfigMap = SDifferDemonsComonpentsConfig.getsDifferDemonsComonpentsConfigMap(comonpentId);
SDifferDemonsComonpentsConfig sDifferDemonsComonpentsConfig = sDifferDemonsComonpentsConfigMap.get(comonpentLevel);
combinedAttribute(sDifferDemonsComonpentsConfig.getBaseAttribute(),heroAllAttribute);
}
}
for(String equipId:values){
Equip equip = equipManager.getEquipMap().get(equipId);
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
@ -650,6 +664,16 @@ public class HeroLogic {
heroAttributeMap.put(propertyId,propertyValue);
}
}
private void combinedAttribute(int[][] otherAttriMap,Map<Integer,Integer> heroAttributeMap){
for(int[] item : otherAttriMap){
int propertyId = item[0];
int propertyValue = item[0];
if(heroAttributeMap.containsKey(propertyId)){
propertyValue += heroAttributeMap.get(propertyId);
}
heroAttributeMap.put(propertyId,propertyValue);
}
}
@ -679,7 +703,7 @@ public class HeroLogic {
hero.updateEquipPositionMap(position,equipId);
LOGGER.info("the heroTid={},the force={}",calHeoForce(user,hero));
LOGGER.info("the heroTid={},the force={}",hero.getTemplateId(),calHeoForce(user,hero));
//发送成功消息
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE_VALUE,null,true);
@ -823,10 +847,17 @@ public class HeroLogic {
break;
}
}
int[][] cost = sDifferDemonsStageConfig.getCost();
if(!isEnough){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.POKEMON_ADVANCED_RESPONSE_VALUE,"not match");
return;
}
isEnough = ItemUtil.itemCost(user,cost);
if(!isEnough){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.POKEMON_ADVANCED_RESPONSE_VALUE,"道具不足");
return;
}
pokemon.setAllStage(pokemon.getAllStage()+1);