吃食物buffer一次性生效,做延缓处理
parent
371d8af39d
commit
1a40372803
|
@ -328,15 +328,18 @@ public class CombatLogic {
|
||||||
int contiue = sFoodsConfig.getContiue();
|
int contiue = sFoodsConfig.getContiue();
|
||||||
if(contiue==0){
|
if(contiue==0){
|
||||||
int type = sFoodsConfig.getType();
|
int type = sFoodsConfig.getType();
|
||||||
int target = sFoodsConfig.getTarget();
|
|
||||||
int[][] effectParas = sFoodsConfig.getEffectPara();
|
int[][] effectParas = sFoodsConfig.getEffectPara();
|
||||||
if(type == GlobalsDef.FOOD_ADDITION_EXPLORE_TYPE && target == GlobalsDef.FOOD_EAT_AFFECT_PERSON){
|
if(type == GlobalsDef.FOOD_ADDITION_EXPLORE_TYPE){
|
||||||
for(int[] effectPara : effectParas){
|
for(int[] effectPara : effectParas){
|
||||||
if(effectPara[0] == GlobalsDef.EXPLORE_MAP_ACTION_POWER_RORMULA_TYPE){
|
if(effectPara[0] == GlobalsDef.EXPLORE_MAP_ACTION_POWER_RORMULA_TYPE){
|
||||||
mapManager.setTotalStep(mapManager.getTotalStep() + effectPara[1]);
|
mapManager.setTotalStep(mapManager.getTotalStep() + effectPara[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(type == GlobalsDef.FOOD_ADDITION_BATTLE_TYPE){
|
||||||
|
mapManager.eatFood(foodIdOrEventId,sFoodsConfig.getContiue());
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
mapManager.eatFood(foodIdOrEventId,sFoodsConfig.getContiue());
|
mapManager.eatFood(foodIdOrEventId,sFoodsConfig.getContiue());
|
||||||
}
|
}
|
||||||
|
@ -345,9 +348,16 @@ public class CombatLogic {
|
||||||
public Map<Integer,Integer> attributeByEatFood( User user,int type,int target){
|
public Map<Integer,Integer> attributeByEatFood( User user,int type,int target){
|
||||||
Map<Integer,Integer> foddAddResult = new HashMap<>();
|
Map<Integer,Integer> foddAddResult = new HashMap<>();
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
|
Set<Integer> removeFoodBufferIds = new HashSet<>();
|
||||||
Map<Integer, Integer> foodBufferMap = mapManager.getFoodBufferMap();
|
Map<Integer, Integer> foodBufferMap = mapManager.getFoodBufferMap();
|
||||||
for(Map.Entry<Integer,Integer> foodBuffer : foodBufferMap.entrySet()){
|
for(Map.Entry<Integer,Integer> foodBuffer : foodBufferMap.entrySet()){
|
||||||
int foodId = foodBuffer.getKey();
|
int foodId = foodBuffer.getKey();
|
||||||
|
Integer step = foodBuffer.getValue();
|
||||||
|
int times =1;
|
||||||
|
if(step<0){
|
||||||
|
times = step*-1;
|
||||||
|
removeFoodBufferIds.add(foodId);
|
||||||
|
}
|
||||||
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodId);
|
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodId);
|
||||||
int typeTmp = sFoodsConfig.getType();
|
int typeTmp = sFoodsConfig.getType();
|
||||||
int targetTmp = sFoodsConfig.getTarget();
|
int targetTmp = sFoodsConfig.getTarget();
|
||||||
|
@ -355,7 +365,7 @@ public class CombatLogic {
|
||||||
int[][] effectParas = sFoodsConfig.getEffectPara();
|
int[][] effectParas = sFoodsConfig.getEffectPara();
|
||||||
for(int[] effectPara : effectParas){
|
for(int[] effectPara : effectParas){
|
||||||
int effectId = effectPara[0];
|
int effectId = effectPara[0];
|
||||||
int effectValue = effectPara[1];
|
int effectValue = effectPara[1] * times;
|
||||||
if(!foddAddResult.containsKey(effectId)){
|
if(!foddAddResult.containsKey(effectId)){
|
||||||
foddAddResult.put(effectId,effectValue);
|
foddAddResult.put(effectId,effectValue);
|
||||||
continue;
|
continue;
|
||||||
|
@ -364,6 +374,12 @@ public class CombatLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!removeFoodBufferIds.isEmpty()){
|
||||||
|
for(Integer removeFoodId : removeFoodBufferIds){
|
||||||
|
foodBufferMap.remove(removeFoodId);
|
||||||
|
}
|
||||||
|
mapManager.setFoodBufferMap(foodBufferMap);
|
||||||
|
}
|
||||||
return foddAddResult;
|
return foddAddResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue