Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
b3a7c9838f
|
@ -1,33 +1,33 @@
|
|||
Id Contiue Type Effect EffectValue
|
||||
int int int mut,int#int,1 mut,int#int,1
|
||||
9201 15 0 null null
|
||||
9202 15 0 null null
|
||||
9203 15 0 null null
|
||||
9204 15 0 null null
|
||||
9205 15 0 null null
|
||||
9206 15 0 null null
|
||||
9207 15 0 null null
|
||||
9208 15 0 null null
|
||||
9209 15 0 null null
|
||||
9210 15 0 null null
|
||||
9211 15 0 null null
|
||||
9212 15 0 null null
|
||||
9213 15 0 null null
|
||||
9214 15 0 null null
|
||||
9215 15 0 null null
|
||||
9216 15 0 null null
|
||||
9217 15 0 null null
|
||||
9218 15 0 null null
|
||||
9219 15 0 null null
|
||||
9220 15 0 null null
|
||||
9221 15 0 null null
|
||||
9222 15 0 null null
|
||||
9223 15 0 null null
|
||||
9224 15 0 null null
|
||||
9225 15 0 null null
|
||||
9226 15 0 null null
|
||||
9227 15 0 null null
|
||||
9228 15 0 null null
|
||||
9229 15 0 null null
|
||||
9230 15 0 null null
|
||||
9231 15 0 null null
|
||||
Id Contiue Type Target EffectPara
|
||||
int int int int mut,int#int,2
|
||||
9201 15 0 0 null
|
||||
9202 15 0 0 null
|
||||
9203 15 0 0 null
|
||||
9204 15 0 0 null
|
||||
9205 15 0 0 null
|
||||
9206 15 0 0 null
|
||||
9207 15 0 0 null
|
||||
9208 15 0 0 null
|
||||
9209 15 0 0 null
|
||||
9210 15 0 0 null
|
||||
9211 15 0 0 null
|
||||
9212 15 0 0 null
|
||||
9213 15 0 0 null
|
||||
9214 15 0 0 null
|
||||
9215 15 0 0 null
|
||||
9216 15 0 0 null
|
||||
9217 15 0 0 null
|
||||
9218 15 0 0 null
|
||||
9219 15 0 0 null
|
||||
9220 15 0 0 null
|
||||
9221 15 0 0 null
|
||||
9222 15 0 0 null
|
||||
9223 15 0 0 null
|
||||
9224 15 0 0 null
|
||||
9225 15 0 0 null
|
||||
9226 15 0 0 null
|
||||
9227 15 0 0 null
|
||||
9228 15 0 0 null
|
||||
9229 15 0 0 null
|
||||
9230 15 0 0 null
|
||||
9231 15 0 0 null
|
||||
|
|
|
@ -14,9 +14,9 @@ public class SFoodsConfig implements BaseConfig {
|
|||
|
||||
private int type;
|
||||
|
||||
private int[] effect;
|
||||
private int target;
|
||||
|
||||
private int[] effectValue;
|
||||
private int[][] effectPara;
|
||||
|
||||
|
||||
private static Map<Integer,SFoodsConfig> sFoodsConfigMap;
|
||||
|
@ -38,13 +38,15 @@ public class SFoodsConfig implements BaseConfig {
|
|||
return contiue;
|
||||
}
|
||||
|
||||
public int[] getEffect() {
|
||||
return effect;
|
||||
public int[][] getEffectPara() {
|
||||
return effectPara;
|
||||
}
|
||||
|
||||
public int[] getEffectValue() {
|
||||
return effectValue;
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public int getTarget() {
|
||||
return target;
|
||||
}
|
||||
}
|
|
@ -39,4 +39,20 @@ public interface GlobalsDef {
|
|||
//redis 过期时间
|
||||
int REDIS_OVER_TIME =-1;
|
||||
|
||||
//吃食物相关
|
||||
int FOOD_ADDITION_BATTLE_TYPE =1;
|
||||
int FOOD_ADDITION_EXPLORE_TYPE =2;
|
||||
|
||||
int FOOD_EAT_AFFECT_PERSON = 1;
|
||||
int FOOD_EAT_AFFECT_TEAM = 2;
|
||||
int FOOD_EAT_AFFECT_POKEMON = 3;
|
||||
|
||||
//探索类型
|
||||
int EXPLORE_MAP_SPEED_TYPE =1;
|
||||
int EXPLORE_MAP_VIEW_TYPE =2;
|
||||
int EXPLORE_MAP_SETTLE_TIMES_TYPE =3;
|
||||
int EXPLORE_MAP_DIGGLE_TYPE =4;
|
||||
int EXPLORE_MAP_ACTION_POWER_RORMULA_TYPE =5;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
public class FoodBuffer {
|
||||
|
||||
private int foodId;
|
||||
|
||||
private int remainStep;
|
||||
|
||||
public FoodBuffer() {
|
||||
}
|
||||
|
||||
public FoodBuffer(int foodId, int remainStep) {
|
||||
this.foodId = foodId;
|
||||
this.remainStep = remainStep;
|
||||
}
|
||||
|
||||
public int getFoodId() {
|
||||
return foodId;
|
||||
}
|
||||
|
||||
public int getRemainStep() {
|
||||
return remainStep;
|
||||
}
|
||||
|
||||
public void setFoodId(int foodId) {
|
||||
this.foodId = foodId;
|
||||
}
|
||||
|
||||
public void setRemainStep(int remainStep) {
|
||||
this.remainStep = remainStep;
|
||||
}
|
||||
}
|
|
@ -33,6 +33,8 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private Map<Integer, CrossMapCell> crossMapInfos = new ConcurrentHashMap<>();
|
||||
|
||||
private List<FoodBuffer> foodBuffers = new ArrayList();
|
||||
|
||||
public MapManager() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -155,4 +157,35 @@ public class MapManager extends MongoBase {
|
|||
updateString( "temporaryItems", temporaryItems);
|
||||
this.temporaryItems = temporaryItems;
|
||||
}
|
||||
|
||||
public List<FoodBuffer> getFoodBuffers() {
|
||||
return foodBuffers;
|
||||
}
|
||||
|
||||
public void eatFood(int foodId,int remainStep){
|
||||
this.foodBuffers.add(new FoodBuffer(foodId,remainStep));
|
||||
updateString( "foodBuffers", foodBuffers);
|
||||
}
|
||||
|
||||
public void setFoodBuffers(List<FoodBuffer> foodBuffers) {
|
||||
updateString( "foodBuffers", foodBuffers);
|
||||
this.foodBuffers = foodBuffers;
|
||||
}
|
||||
|
||||
public void updateFoodBufferByStep(int step){
|
||||
if(step>0 && !foodBuffers.isEmpty()){
|
||||
Iterator<FoodBuffer> iterator = foodBuffers.iterator();
|
||||
while (iterator.hasNext()){
|
||||
FoodBuffer foodBuffer = iterator.next();
|
||||
int remainStep = foodBuffer.getRemainStep() - step;
|
||||
if(foodBuffer.getRemainStep() - step <=0){
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
foodBuffer.setRemainStep(remainStep);
|
||||
}
|
||||
updateString( "foodBuffers", foodBuffers);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ package com.ljsd.jieling.logic.fight;
|
|||
import com.ljsd.jieling.config.SAdventureConfig;
|
||||
import com.ljsd.jieling.config.SAdventureSetting;
|
||||
import com.ljsd.jieling.config.SFoodsConfig;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.handler.map.FoodBuffer;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -176,7 +178,7 @@ public class CombatLogic {
|
|||
|
||||
|
||||
//在地图吃东西
|
||||
public void outMap(ISession session, int foodId) throws Exception {
|
||||
public void eatFood(ISession session, int foodId) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
@ -189,7 +191,49 @@ public class CombatLogic {
|
|||
return;
|
||||
}
|
||||
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodId);
|
||||
int contiue = sFoodsConfig.getContiue();
|
||||
if(contiue==0){
|
||||
int type = sFoodsConfig.getType();
|
||||
int target = sFoodsConfig.getTarget();
|
||||
int[][] effectParas = sFoodsConfig.getEffectPara();
|
||||
if(type == GlobalsDef.FOOD_ADDITION_EXPLORE_TYPE && target == GlobalsDef.FOOD_EAT_AFFECT_PERSON){
|
||||
for(int[] effectPara : effectParas){
|
||||
if(effectPara[0] == GlobalsDef.EXPLORE_MAP_ACTION_POWER_RORMULA_TYPE){
|
||||
mapManager.setTotalStep(mapManager.getTotalStep() + effectPara[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
mapManager.eatFood(foodId,sFoodsConfig.getContiue());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Map<Integer,Integer> attributeByEatFood( User user,int type,int target){
|
||||
Map<Integer,Integer> foddAddResult = new HashMap<>();
|
||||
MapManager mapManager = user.getMapManager();
|
||||
List<FoodBuffer> foodBuffers = mapManager.getFoodBuffers();
|
||||
for(FoodBuffer foodBuffer : foodBuffers){
|
||||
int foodId = foodBuffer.getFoodId();
|
||||
|
||||
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodId);
|
||||
int typeTmp = sFoodsConfig.getType();
|
||||
int targetTmp = sFoodsConfig.getTarget();
|
||||
if( typeTmp==type && targetTmp==target ){
|
||||
int[][] effectParas = sFoodsConfig.getEffectPara();
|
||||
for(int[] effectPara : effectParas){
|
||||
int effectId = effectPara[0];
|
||||
int effectValue = effectPara[1];
|
||||
if(!foddAddResult.containsKey(effectId)){
|
||||
foddAddResult.put(effectId,effectValue);
|
||||
continue;
|
||||
}
|
||||
foddAddResult.put( effectId,foddAddResult.get(effectId) + effectValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
return foddAddResult;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.ljsd.jieling.logic.STableManager;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
|
@ -708,6 +709,9 @@ public class HeroLogic {
|
|||
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
|
||||
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
||||
}
|
||||
//食物buffer加成
|
||||
Map<Integer, Integer> foodAddMap = CombatLogic.getInstance().attributeByEatFood(user,GlobalsDef.FOOD_ADDITION_EXPLORE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_TEAM);
|
||||
combinedAttribute(foodAddMap,heroAllAttribute);
|
||||
return heroAllAttribute;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue