diff --git a/luafight/Modules/Battle/Logic/Base/Effect.lua b/luafight/Modules/Battle/Logic/Base/Effect.lua index f61fd97b3..83cbf0b7f 100644 --- a/luafight/Modules/Battle/Logic/Base/Effect.lua +++ b/luafight/Modules/Battle/Logic/Base/Effect.lua @@ -31,6 +31,13 @@ local function buffRandomAction(random, caster, target, buffType, duration, ...) end end +local function casterBulletEffect(caster, target, interval) + caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) + if caster.camp == 0 and target.camp == 1 then + BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) + end +end + --效果表 local effectList = { --造成[a]%的[b]伤害 @@ -38,10 +45,7 @@ local effectList = { [1] = function(caster, target, args, interval) local f1 = args[1] local dt = args[2] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () BattleUtil.CalDamage(caster, target, dt, f1) end) @@ -171,10 +175,7 @@ local effectList = { local f1 = args[1] local dt = args[2] local f2 = args[3] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () local dmg = BattleUtil.CalDamage(caster, target, dt, f1) BattleUtil.CalTreat(caster, caster, floor(dmg * f2)) @@ -187,10 +188,7 @@ local effectList = { local dt = args[2] local i1 = args[3] local f2 = args[4] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () if target.professionId == i1 then f1 = f1 + f2 @@ -251,10 +249,7 @@ local effectList = { local f1 = args[1] local dt = args[2] local f2 = args[3] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1) if target.isDead then @@ -283,10 +278,7 @@ local effectList = { local dt = args[2] local i1 = args[3] local f2 = args[4] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge))) - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () local dmg = floor(caster:GetRoleData(propertyList[dt]) * f1) if target.professionId == i1 then @@ -306,10 +298,7 @@ local effectList = { local f1 = args[1] local dt = args[2] local f2 = args[3] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () local d, crit = BattleUtil.CalDamage(caster, target, dt, f1) if crit then @@ -354,10 +343,7 @@ local effectList = { local dt = args[2] local i1 = args[3] local f2 = args[4] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return i1 == 0 or buff.ctrlType == i1 end) then f1 = f1 + f2 @@ -402,10 +388,7 @@ local effectList = { local dt = args[2] local ht = args[3] local f2 = args[4] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () if BattleLogic.BuffMgr:HasBuff(target, BuffName.HOT, function (buff) return true end) then f1 = f1 + f2 @@ -476,10 +459,7 @@ local effectList = { local dt = args[2] local dot = args[3] local f2 = args[4] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then f1 = f1 + f2 @@ -521,10 +501,7 @@ local effectList = { local dt = args[2] local ct = args[3] local f2 = args[4] - caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target) - if caster.camp == 0 and target.camp == 1 then - BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) - end + casterBulletEffect(caster, target, interval) BattleLogic.WaitForTrigger(interval, function () if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then BattleUtil.CalDamage(caster, target, dt, f1, f2) @@ -681,6 +658,27 @@ local effectList = { end) end) end, + --造成[a]的伤害(真实伤害) + --a[int] + [38] = function(caster, target, args, interval) + local d = args[1] + casterBulletEffect(caster, target, interval) + BattleLogic.WaitForTrigger(interval, function () + if not target.isDead then + BattleUtil.ApplyDamage(caster, target, d) + end + end) + end, + --每秒造成[d]的伤害,持续[f]秒(真实伤害) + --d[float],f[int] + [39] = function(caster, target, args, interval) + local d1 = args[1] + local d2 = args[2] + casterBulletEffect(caster, target, interval) + BattleLogic.WaitForTrigger(interval, function () + target:AddBuff(Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1)) + end) + end, } return effectList \ No newline at end of file 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 3bdb2a1e3..f9e0c52c3 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 @@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.fight.CheckFight; import com.ljsd.jieling.logic.hero.HeroAttributeEnum; import com.ljsd.jieling.logic.hero.HeroLogic; import com.ljsd.jieling.logic.mission.GameEvent; +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; @@ -244,6 +245,10 @@ public class MapLogic { Map scMap = SCMap.sCMap.get(mapManager.getCurMapId()); Map newMap = new HashMap<>(); Random random = new Random(); + StoreManager storeManager = user.getStoreManager(); + Map storeInfoMap = storeManager.getStoreInfoMap(); + StoreLogic.checkStoreRefresh(storeManager,storeInfoMap); + boolean alreadHadYunShop = storeManager.getStoreInfoMap().containsKey(3); for (Map.Entry entry : scMap.entrySet()) { SCMap scMap1 = entry.getValue(); // 必出现的事件点 @@ -268,6 +273,13 @@ public class MapLogic { LOGGER.info("====initMap()====mapPointConfig == null======>{}", scMap1.getEvent()); continue; } + if(mapPointConfig.getStyle() == EventType.businessman){ + if(alreadHadYunShop){ + continue; + } + StoreLogic.initOneStore(user,3); + } + Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId()); newMap.put(xy, cellValue); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java index 7e168c552..f9a467ffc 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java @@ -8,14 +8,18 @@ import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.globals.Global; import com.ljsd.jieling.handler.map.Cell; +import com.ljsd.jieling.handler.map.EventType; import com.ljsd.jieling.handler.map.MapLogic; import com.ljsd.jieling.handler.map.MapManager; import com.ljsd.jieling.handler.mission.CheckMissionReturn; import com.ljsd.jieling.handler.mission.Mission; import com.ljsd.jieling.logic.dao.Hero; +import com.ljsd.jieling.logic.dao.StoreInfo; +import com.ljsd.jieling.logic.dao.StoreManager; import com.ljsd.jieling.logic.dao.TeamPosHeroInfo; import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.hero.HeroLogic; +import com.ljsd.jieling.logic.store.StoreLogic; import com.ljsd.jieling.protocols.CommonProto; import com.ljsd.jieling.protocols.FightInfoProto; import com.ljsd.jieling.protocols.MapInfoProto; @@ -58,9 +62,19 @@ public class BehaviorUtil { * @param y * @throws Exception */ - public static void addBehaviorInfo(int needDistoryPointId, MapManager mapManager, int mapId, int x, int y) throws Exception { + public static void addBehaviorInfo(User user,int needDistoryPointId, MapManager mapManager, int mapId, int x, int y) throws Exception { int xy = CellUtil.xy2Pos(x, y); MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(needDistoryPointId); + if(mapPointConfig.getStyle() == EventType.businessman){ + StoreManager storeManager = user.getStoreManager(); + Map storeInfoMap = storeManager.getStoreInfoMap(); + StoreLogic.checkStoreRefresh(storeManager,storeInfoMap); + boolean alreadHadYunShop = storeManager.getStoreInfoMap().containsKey(3); + if(alreadHadYunShop){ + return; + } + StoreLogic.initOneStore(user,3); + } Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId()); mapManager.addOrUpdateCell(xy, cellValue); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java index aa63f9336..b7aa1d9a8 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java @@ -20,7 +20,7 @@ public class MonitorMissionAndDestroyPointBehavior extends BaseBehavior { BehaviorUtil.destoryPoint(user, user.getMapManager().getCurMapId(), behaviorTypeValues[0][1]); // 开新事件 for (int j = 1; j < behaviorTypeValues.length; j++) { - BehaviorUtil.addBehaviorInfo(behaviorTypeValues[j][3], user.getMapManager(), behaviorTypeValues[j][0], behaviorTypeValues[j][1], behaviorTypeValues[j][2]); + BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[j][3], user.getMapManager(), behaviorTypeValues[j][0], behaviorTypeValues[j][1], behaviorTypeValues[j][2]); } return true; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java index ed1353abe..ae1f06bc7 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java @@ -17,7 +17,7 @@ public class OpenMissionBehavior extends BaseBehavior { BehaviorUtil.updateMission(user, eventUpdateResponse); // 开新事件 for (int i = 1; i < behaviorTypeValues.length; i++) { - BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); + BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); } return true; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java index 1003296d1..4f0537791 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java @@ -15,7 +15,7 @@ public class ThirtyBehavior extends BaseBehavior { @Override public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { for (int i = 0; i < behaviorTypeValues.length; i++) { - BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); + BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); } return true; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyFiveBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyFiveBehavior.java index 387a817a3..292403c65 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyFiveBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyFiveBehavior.java @@ -17,7 +17,7 @@ public class ThirtyFiveBehavior extends BaseBehavior { BehaviorUtil.updateMission(user, eventUpdateResponse); BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][0]); for (int i = 1; i < behaviorTypeValues.length; i++) { - BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); + BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); } return true; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java index 26dda6d65..f01f7350b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java @@ -25,7 +25,7 @@ public class ThirtyThreeBehavior extends BaseBehavior { public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception { BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][1]); for (int i = 1; i < behaviorTypeValues.length; i++) { - BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); + BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); } return true; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyTwoBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyTwoBehavior.java index efe6d7887..006e50172 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyTwoBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyTwoBehavior.java @@ -26,7 +26,7 @@ public class ThirtyTwoBehavior extends BaseBehavior { BehaviorUtil.updateMissionEndFight(user, fightEndResponse); BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][1]); for (int i = 1; i < behaviorTypeValues.length; i++) { - BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); + BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]); } return true; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java index 8b889a8a1..071df9702 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java @@ -626,6 +626,7 @@ public class CombatLogic { } } playerInfoManager.updateVipPrivilage(invasionBossPrivilege,i); + RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN,Integer.toString(uid),bossId,totalHurt); RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO,"",Integer.toString(uid),adventureBoss); RedisUtil.getInstence().incrementZsetScore(RedisKey.ADVENTRUEN_BOSS_RANK,"",Integer.toString(uid),totalHurt); FightInfoProto.AdventurenBossChallengeResponse build = builder.setHurtNums(totalHurt) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java index 66bf6aa28..8217db1a2 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java @@ -71,7 +71,7 @@ public class StoreLogic { } //检测商店刷新 - private static void checkStoreRefresh(StoreManager storeManager,Map storeInfoMap) { + public static void checkStoreRefresh(StoreManager storeManager,Map storeInfoMap) { long nowTime = System.currentTimeMillis(); for (Map.Entry entry:storeInfoMap.entrySet()){ StoreInfo storeInfo = entry.getValue(); @@ -84,6 +84,22 @@ public class StoreLogic { } } + public static void initOneStore(User user,int storeType) throws Exception { + StoreManager storeManager = user.getStoreManager(); + SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeType); + if(sStoreTypeConfig == null){ + return; + } + long now = TimeUtils.now(); + long startTime = now; + long endTime = 0; + if(sStoreTypeConfig.getStoreOpenRule() == 2 ){ + endTime =Integer.parseInt(sStoreTypeConfig.getEndTime())*60*1000 + now; + } + Map itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); + storeManager.newStoreInfo(sStoreTypeConfig.getId(),startTime,endTime,itemNumMap); + } + //初始化商店 private static void initStoreInfo(User user,StoreManager storeManager) throws Exception { Map sstoreTypeConfigMap = SStoreTypeConfig.getsStoreTypeConfigMap();