back_recharge
lvxinran 2019-11-13 16:05:02 +08:00
commit dd46d9e219
4 changed files with 49 additions and 32 deletions

View File

@ -27,6 +27,7 @@ import com.ljsd.jieling.logic.activity.event.StoryEvent;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CheckFight;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.fight.FightType;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
@ -358,6 +359,17 @@ public class MapLogic {
LOGGER.info("enterMap() uid=>{} team pos is wrong ", uid, teamId);
return "阵容有误";
}
if(2 == initType && teamId!=401){
Map<Integer, Integer> foodBufferMap = mapManager.getFoodBufferMap();
for(Map.Entry<Integer,Integer> item : foodBufferMap.entrySet()){
Integer value = item.getValue();
if(value<=-1){
SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(item.getKey());
CombatLogic.getInstance().updateHeroAttributJustOne(user,teamPosHeroInfos,sFoodsConfig,heroAllAttributeMap,true);
}
}
}
mapManager.setTeamId(teamId);
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
return "";
@ -534,6 +546,7 @@ public class MapLogic {
}
}
mapManager.setCurXY(curXY);
mapManager.updateFoodBufferByStep(cells.size());
}
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder()
.setLeftTime(getLeftTime(user, true))

View File

@ -28,6 +28,7 @@ import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.FightInfoProto;
import com.ljsd.jieling.protocols.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.*;
import config.*;
@ -62,7 +63,7 @@ public class CombatLogic {
public Map<Integer,Integer> bufferOneHeroAttrAfterEat(Map<Integer,Integer> value,int foodId){
SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(foodId);
if(value.get(HeroAttributeEnum.CurHP.getPropertyId()) == 0){
if(value.get(HeroAttributeEnum.CurHP.getPropertyId()) == 0 || sFoodsConfig.getContiue()!=0){
return value;
}
for(int[] effectPara : sFoodsConfig.getEffectPara()){
@ -76,15 +77,8 @@ public class CombatLogic {
}else{
if(sPropertyConfig.getTargetPropertyId()!=0){
effectId = sPropertyConfig.getTargetPropertyId();
effectValue = value.get(effectId) + effectValue/10000;
}else{
int baseValue = 0;
if(value.containsKey(effectId)){
baseValue = value.get(effectId);
}
effectValue = baseValue + effectValue/10000;
effectValue = value.get(effectId) * effectValue/10000;
}
}
}
@ -135,29 +129,34 @@ public class CombatLogic {
int contiue = sFoodsConfig.getContiue();
if(contiue==0){
contiue=-1;
int teamId = mapManager.getTeamId();
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(teamId);
Map<Integer,Integer> foodAddMap = new HashMap<>();
getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
continue;
}
Map<Integer, Integer> heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
if(heroAllAttribute == null || heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()) <= 0){
continue;
}
HeroLogic.getInstance().combinedAttribute(foodAddMap,heroAllAttribute);
HeroLogic.getInstance().calInteractAdd(heroAllAttribute);
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
}
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
}
mapManager.eatFood(foodIdOrEventId,contiue);
}
public void updateHeroAttributJustOne(User user,List<TeamPosHeroInfo> teamPosHeroInfoList,SFoodsConfig sFoodsConfig, Map<String, Map<Integer, Integer>> heroAllAttributeMap,boolean isRecory){
Map<Integer,Integer> foodAddMap = new HashMap<>();
getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
continue;
}
Map<Integer, Integer> heroAllAttribute = new HashMap<>();
if(isRecory){
heroAllAttribute =heroAllAttributeMap.get(hero.getId());
}else {
heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
if(heroAllAttribute == null || heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()) <= 0){
continue;
}
}
HeroLogic.getInstance().combinedAttribute(foodAddMap,heroAllAttribute);
HeroLogic.getInstance().calInteractAdd(heroAllAttribute);
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
}
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
}
public Map<Integer,Integer> attributeByEatFood( User user,int type,int target){
Map<Integer,Integer> foddAddResult = new HashMap<>();
MapManager mapManager = user.getMapManager();
@ -944,8 +943,8 @@ public class CombatLogic {
String randomReward = ItemUtil.getReward(randomItemMap, randomCardMap, randomEquipMap, randomRandomMap);
if(randomReward.length()!=0){
reward = reward + "|" + randomReward;
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,now, Global.MAIL_EFFECTIVE_TIME);
}
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,now, Global.MAIL_EFFECTIVE_TIME);
}
mainLevelManager.afterTakeStateReward(true,0);
myResult = true;

View File

@ -1313,9 +1313,10 @@ public class HeroLogic {
if(foodAddMap.isEmpty()){
return heroAllAttribute;
}
combinedAttribute(foodAddMap,heroAllAttribute);
calInteractAdd(heroAllAttribute);
return heroAllAttribute;
Map<Integer, Integer> heroAllAttributeCopy = new HashMap<>(heroAllAttribute);
combinedAttribute(foodAddMap,heroAllAttributeCopy);
calInteractAdd(heroAllAttributeCopy);
return heroAllAttributeCopy;
}

View File

@ -330,6 +330,10 @@ public class PlayerLogic {
}
if(hadNum<num){
Map<Integer,Integer> itemMap = new HashMap<>(1);
if(reson == BIReason.VIP_LEVEL_REWARD){
Map<Integer, Integer> privilegePreMap = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel - 1).getPrivilegeMap();
hadNum = privilegePreMap.get(dailyGift[1]);
}
itemMap.put(dailyGift[0],num-hadNum);
ItemUtil.addItem(user,itemMap,null, reson);
}