Bug fixes

- Fixed missing return value in deck stats causing a superfluous error in the log
- Fixed deck validation causing an error in PC-Movie if a Map was added before a RB or Ring
- Fixed leagues not permitting decks to be altered or tables to be created on the same day of a serie end
This commit is contained in:
Christian 'ketura' McCarty
2024-09-23 19:25:18 -05:00
parent 3d4fd507c8
commit 1d39bf2811
4 changed files with 18 additions and 4 deletions

View File

@@ -157,6 +157,7 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
if(format == null || targetFormat == null)
{
responseWriter.writeHtmlResponse("Invalid format: " + targetFormat);
return;
}
List<String> validation = format.validateDeck(deck);

View File

@@ -38,7 +38,14 @@ public class DateUtils {
public static boolean IsToday(ZonedDateTime date) { return DaysSince(date) == 0; }
public static boolean IsAtLeastDayAfter(ZonedDateTime a, ZonedDateTime b) { return DaysBetween(b, a) >= 1; }
public static boolean IsAfterStart(ZonedDateTime date, ZonedDateTime start) { return date.isEqual(start) || date.isAfter(start); }
public static boolean IsBeforeEnd(ZonedDateTime date, ZonedDateTime end) { return DaysBetween(end, date) < 0; }
public static boolean IsBeforeEnd(ZonedDateTime date, ZonedDateTime end) {
if(IsSameDay(date, end)) {
return date.isBefore(end.plusDays(1));
}
else {
return date.isBefore(end);
}
}
public static boolean IsSameDay(ZonedDateTime a, ZonedDateTime b) { return DaysBetween(a, b) == 0; }
public static long DaysBetween(ZonedDateTime a, ZonedDateTime b) { return Duration.between(a, b).toDays(); }
public static long DaysSince(ZonedDateTime date) { return DaysBetween(date, Now()); }

View File

@@ -4,6 +4,7 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.*;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.vo.LotroDeck;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
@@ -712,8 +713,13 @@ public class DefaultLotroFormat implements LotroFormat {
sites.add(new PhysicalCardImpl(0, bp, "", _library.getLotroCardBlueprint(bp)));
}
var rb = new PhysicalCardImpl(0, deck.getRingBearer(), "", _library.getLotroCardBlueprint(deck.getRingBearer()));
var ring = new PhysicalCardImpl(0, deck.getRing(), "", _library.getLotroCardBlueprint(deck.getRing()));
PhysicalCardImpl rb = null, ring = null;
if(!StringUtils.isEmpty(deck.getRingBearer())) {
rb = new PhysicalCardImpl(0, deck.getRingBearer(), "", _library.getLotroCardBlueprint(deck.getRingBearer()));
}
if(!StringUtils.isEmpty(deck.getRing())) {
ring = new PhysicalCardImpl(0, deck.getRing(), "", _library.getLotroCardBlueprint(deck.getRing()));
}
var result = map.validatePreGameDeckCheck(freeps, shadow, sites, rb, ring, new PhysicalCardImpl(0, mapBP, "", map));
if(!result.success())

View File

@@ -149,7 +149,7 @@ public class LeagueService {
var currentDate = DateUtils.Now();
for (LeagueSerieInfo leagueSerieInfo : league.getLeagueData(_productLibrary, _formatLibrary, _soloDraftDefinitions).getSeries()) {
if (currentDate.isAfter( leagueSerieInfo.getStart()) && currentDate.isBefore(leagueSerieInfo.getEnd()))
if (currentDate.isAfter( leagueSerieInfo.getStart()) && DateUtils.IsBeforeEnd(currentDate, leagueSerieInfo.getEnd()))
return leagueSerieInfo;
}