From c7ef7294ff507f4d86e6abf12f31a6e4d382423d Mon Sep 17 00:00:00 2001 From: wangyuan Date: Tue, 2 Jul 2019 22:49:27 +0800 Subject: [PATCH] food buffer --- .../com/ljsd/jieling/globals/BIReason.java | 3 ++ .../ljsd/jieling/handler/map/EventType.java | 1 + .../ljsd/jieling/handler/map/MapLogic.java | 6 ++-- .../map/behavior/ThirtySevenBehavior.java | 28 +++++++++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtySevenBehavior.java diff --git a/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java b/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java index 712ef3c5a..ff002c964 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java @@ -91,4 +91,7 @@ public interface BIReason { int CHALLENGE_INVASIONBOSS_CONSUME = 1024; + + int MAP_CONSUME = 1025; + } \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/EventType.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/EventType.java index ee961fe9c..07dac874a 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/EventType.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/EventType.java @@ -97,6 +97,7 @@ public class EventType { public static final int thirtyFour = 34; public static final int thirtyFive = 35; public static final int thirtySix = 36; + public static final int thirtySeven = 37; public static final int thirtyEight = 38; public static final int thirtyNine = 39; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java index 2ea95feb6..bbbf1db2b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java @@ -179,7 +179,7 @@ public class MapLogic { MapInfoProto.MapEnterResponse.Builder mapEnterResponse = MapInfoProto.MapEnterResponse.newBuilder(); mapEnterResponse.setLeftTime(getLeftTime(user, true)); for (Map.Entry buffEntry : mapManager.getFoodBufferMap().entrySet()) { - if (buffEntry.getValue() <= 0) { + if (buffEntry.getValue()!=-1 && buffEntry.getValue() <= 0) { continue; } CommonProto.FoodBuffer foodBuffer = CBean2Proto.getFoodBuffer(buffEntry.getKey(), buffEntry.getValue()); @@ -2110,13 +2110,11 @@ public class MapLogic { type = MathUtils.randomFromWeight(bossType); if(mapManager.getTower()<=3){ - type = 2; + type = 3; } // }else if(mapManager.getTower()==2){ // type = 3; - - type = 3; int[][][] pointId = config.getRandomMapPointId(); int mapId = config.getMapId(); SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtySevenBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtySevenBehavior.java new file mode 100644 index 000000000..913f8b6b1 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtySevenBehavior.java @@ -0,0 +1,28 @@ +package com.ljsd.jieling.handler.map.behavior; + +import com.ljsd.jieling.globals.BIReason; +import com.ljsd.jieling.handler.map.EventType; +import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.logic.fight.CombatLogic; +import com.ljsd.jieling.protocols.MapInfoProto; +import com.ljsd.jieling.util.ItemUtil; +import org.springframework.stereotype.Component; + +@Component +public class ThirtySevenBehavior extends BaseBehavior{ + @Override + public int getBehaviorType() { + return EventType.thirtySeven; + } + + @Override + public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { + int[][] cost = new int[1][2]; + cost[0][0] = behaviorTypeValues[0][0]; + cost[0][1] = behaviorTypeValues[0][1]; + ItemUtil.itemCost(user,cost, BIReason.MAP_CONSUME,user.getMapManager().getCurMapId()); + CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user.getMapManager(), behaviorTypeValues[0][2]); + return true; + } + +}