云游商店

back_recharge
wangyuan 2019-05-29 17:55:32 +08:00
parent 3d2bcae72f
commit 7667d21b8f
11 changed files with 89 additions and 48 deletions

View File

@ -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

View File

@ -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<Integer, SCMap> scMap = SCMap.sCMap.get(mapManager.getCurMapId());
Map<Integer, Cell> newMap = new HashMap<>();
Random random = new Random();
StoreManager storeManager = user.getStoreManager();
Map<Integer, StoreInfo> storeInfoMap = storeManager.getStoreInfoMap();
StoreLogic.checkStoreRefresh(storeManager,storeInfoMap);
boolean alreadHadYunShop = storeManager.getStoreInfoMap().containsKey(3);
for (Map.Entry<Integer, SCMap> 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);
}

View File

@ -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<Integer, StoreInfo> 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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -71,7 +71,7 @@ public class StoreLogic {
}
//检测商店刷新
private static void checkStoreRefresh(StoreManager storeManager,Map<Integer, StoreInfo> storeInfoMap) {
public static void checkStoreRefresh(StoreManager storeManager,Map<Integer, StoreInfo> storeInfoMap) {
long nowTime = System.currentTimeMillis();
for (Map.Entry<Integer, StoreInfo> 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<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user);
storeManager.newStoreInfo(sStoreTypeConfig.getId(),startTime,endTime,itemNumMap);
}
//初始化商店
private static void initStoreInfo(User user,StoreManager storeManager) throws Exception {
Map<Integer, SStoreTypeConfig> sstoreTypeConfigMap = SStoreTypeConfig.getsStoreTypeConfigMap();