diff --git a/src/engine/gameManager/SimulationManager.java b/src/engine/gameManager/SimulationManager.java index db96ac3e..29c1a4fa 100644 --- a/src/engine/gameManager/SimulationManager.java +++ b/src/engine/gameManager/SimulationManager.java @@ -233,10 +233,15 @@ public enum SimulationManager { } private void pulseMines(){ for(Mine mine : Mine.getMines()) { - if (LocalDateTime.now().getHour() == 1) { - mine.wasClaimed = false; - mine.hasProduced = false; - } + + Building mineTower = BuildingManager.getBuilding(mine.getBuildingID()); + + if(mineTower == null) + continue; + ///if (LocalDateTime.now().getHour() == 1) { + // mine.wasClaimed = false; + // mine.hasProduced = false; + //} int minute = 0; if (mine.firstThirty == false) @@ -245,28 +250,25 @@ public enum SimulationManager { LocalDateTime openTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(minute).withSecond(0); LocalDateTime closeTime = openTime.plusMinutes(30); + //current time is after start time and before close time, open mine window if (!mine.isActive && LocalDateTime.now().isAfter(openTime) && LocalDateTime.now().isBefore(closeTime)) { mine.setActive(true); - ChatManager.chatSystemChannel(mine.getZoneName() + "'s Mine is now Active!"); - Logger.info(mine.getZoneName() + "'s Mine is now Active!"); + ChatManager.chatSystemChannel(mine.getParentZone().getName() + "'s Mine is now Active!"); + Logger.info(mine.getParentZone().getName() + "'s Mine is now Active!"); continue; } - //if (mine.lastClaimer == null && (LocalDateTime.now().isAfter(closeTime) || LocalDateTime.now().isBefore(openTime))) { - //mineWindowClose(mine); - //if(mine.firstThirty) { - // mine.firstThirty = false; - //}else { - // mine.liveTime += 1; - // if(mine.liveTime == 24) - // mine.liveTime = 1; - // mine.firstThirty = true; - // continue; - //} - //} - if (mine.isActive && mine.lastClaimer != null && (LocalDateTime.now().isAfter(closeTime) || LocalDateTime.now().isBefore(openTime))) { - mineWindowClose(mine); + if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() == 0 && mine.lastClaimer == null) + closeTime = closeTime.plusMinutes(30); // mine was knocked down and has no claimer, roll over + + if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() > 0) { + mineWindowClose(mine); //mine was never knocked down, close window + continue; } + + if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() == 0 && mine.lastClaimer != null) + mineWindowClose(mine); //mine was knocked down and was claimed, close window + } _minePulseTime = System.currentTimeMillis() + CITY_PULSE; }