Merge pull request #2 from MarcinSc/master

Bringing fork up to date
This commit is contained in:
PhallenCassidy
2018-12-05 15:36:34 -05:00
committed by GitHub
38 changed files with 194 additions and 106 deletions

View File

@@ -74,7 +74,7 @@ public class LotroHttpRequestHandler extends SimpleChannelUpstreamHandler {
}
public void printLog(int statusCode, long finishedTime) {
_accesslog.debug(remoteIp+","+statusCode+","+uri+","+(finishedTime-requestTime));
_accesslog.debug(remoteIp + "," + statusCode + "," + uri + "," + (finishedTime - requestTime));
}
}
@@ -138,8 +138,9 @@ public class LotroHttpRequestHandler extends SimpleChannelUpstreamHandler {
try {
String ipAddress = ((InetSocketAddress) e.getRemoteAddress()).getAddress().getHostAddress();
if (isBanned(ipAddress))
throw new HttpProcessingException(404);
_uriRequestHandler.handleRequest(uri, request, _objects, responseWriter, e);
responseWriter.writeError(404);
else
_uriRequestHandler.handleRequest(uri, request, _objects, responseWriter, e);
} catch (HttpProcessingException exp) {
responseWriter.writeError(exp.getStatus());
} catch (Exception exp) {

View File

@@ -97,7 +97,7 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
} else if (uri.equals("/findMultipleAccounts") && request.getMethod() == HttpMethod.POST) {
findMultipleAccounts(request, responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -44,7 +44,7 @@ public class ChatRequestHandler extends LotroServerRequestHandler implements Uri
} else if (uri.startsWith("/") && request.getMethod() == HttpMethod.POST) {
postMessages(request, URLDecoder.decode(uri.substring(1)), responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -65,7 +65,7 @@ public class CollectionRequestHandler extends LotroServerRequestHandler implemen
} else if (uri.startsWith("/") && request.getMethod() == HttpMethod.GET) {
getCollection(request, uri.substring(1), responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -56,7 +56,7 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
} else if (uri.equals("/stats") && request.getMethod() == HttpMethod.POST) {
getDeckStats(request, responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -29,7 +29,7 @@ public class DeliveryRequestHandler extends LotroServerRequestHandler implements
if (uri.equals("") && request.getMethod() == HttpMethod.GET) {
getDelivery(request, responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -81,7 +81,7 @@ public class GameHistoryRequestHandler extends LotroServerRequestHandler impleme
responseWriter.writeXmlResponse(doc);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
}

View File

@@ -60,7 +60,7 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri
} else if (uri.startsWith("/") && request.getMethod() == HttpMethod.POST) {
updateGameState(request, uri.substring(1), responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
@@ -90,11 +90,11 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri
GameUpdateLongPollingResource pollingResource = new GameUpdateLongPollingResource(pollableResource, channelNumber, gameMediator, resourceOwner, responseWriter);
_longPollingSystem.processLongPollingResource(pollingResource, pollableResource);
} catch (SubscriptionConflictException exp) {
responseWriter.writeError(409);
throw new HttpProcessingException(409);
} catch (PrivateInformationException e) {
responseWriter.writeError(403);
throw new HttpProcessingException(403);
} catch (SubscriptionExpiredException e) {
responseWriter.writeError(410);
throw new HttpProcessingException(410);
}
}

View File

@@ -54,7 +54,7 @@ public class LeagueRequestHandler extends LotroServerRequestHandler implements U
} else if (uri.startsWith("/") && request.getMethod() == HttpMethod.POST) {
joinLeague(request, uri.substring(1), responseWriter, e);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
@@ -94,13 +94,15 @@ public class LeagueRequestHandler extends LotroServerRequestHandler implements U
final List<LeagueSerieData> series = leagueData.getSeries();
int end = series.get(series.size() - 1).getEnd();
int start = series.get(0).getStart();
int currentDate = DateUtils.getCurrentDate();
Element leagueElem = doc.createElement("league");
boolean inLeague = _leagueService.isPlayerInLeague(league, resourceOwner);
leagueElem.setAttribute("member", String.valueOf(inLeague));
leagueElem.setAttribute("joinable", String.valueOf(!inLeague && end >= DateUtils.getCurrentDate()));
leagueElem.setAttribute("draftable", String.valueOf(inLeague && leagueData.isSoloDraftLeague()));
leagueElem.setAttribute("joinable", String.valueOf(!inLeague && end >= currentDate));
leagueElem.setAttribute("draftable", String.valueOf(inLeague && leagueData.isSoloDraftLeague() && start >= currentDate));
leagueElem.setAttribute("type", league.getType());
leagueElem.setAttribute("name", league.getName());
leagueElem.setAttribute("cost", String.valueOf(league.getCost()));

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.lotro.game.Player;
import org.jboss.netty.channel.MessageEvent;
@@ -28,18 +29,17 @@ public class LoginRequestHandler extends LotroServerRequestHandler implements Ur
if (player.getType().contains("u")) {
final Date bannedUntil = player.getBannedUntil();
if (bannedUntil != null && bannedUntil.after(new Date()))
responseWriter.writeError(409);
throw new HttpProcessingException(409);
else
responseWriter.writeXmlResponse(null, logUserReturningHeaders(e, login));
} else {
responseWriter.writeError(403);
throw new HttpProcessingException(403);
}
} else {
responseWriter.writeError(401);
throw new HttpProcessingException(401);
}
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.lotro.cards.CardSets;
import com.gempukku.lotro.cards.packs.SetDefinition;
@@ -55,7 +56,7 @@ public class MerchantRequestHandler extends LotroServerRequestHandler implements
} else if (uri.equals("/tradeFoil") && request.getMethod() == HttpMethod.POST) {
tradeInFoil(request, responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.mtg.MtgCardServer;
import com.gempukku.mtg.ProviderNotFoundException;
@@ -44,16 +45,13 @@ public class MtgCardsRequestHandler implements UriRequestHandler {
responseWriter.writeByteResponse(dataProvidersResponse, headers);
}
private void processCardListRequest(ResponseWriter responseWriter, String provider, String updateMarker) {
private void processCardListRequest(ResponseWriter responseWriter, String provider, String updateMarker) throws Exception {
try {
MtgCardServer.CardDatabaseHolder cardDatabaseHolder = _mtgCardServer.getCardDatabaseHolder(provider);
if (cardDatabaseHolder == null) {
responseWriter.writeError(204);
return;
} else if (updateMarker != null && updateMarker.equals(String.valueOf(cardDatabaseHolder.getUpdateDate()))) {
responseWriter.writeError(304);
return;
}
if (cardDatabaseHolder == null)
throw new HttpProcessingException(204);
else if (updateMarker != null && updateMarker.equals(String.valueOf(cardDatabaseHolder.getUpdateDate())))
throw new HttpProcessingException(304);
Map<String, String> headers = new HashMap<String, String>();
headers.put(CONTENT_TYPE, "application/json; charset=UTF-8");
@@ -61,7 +59,7 @@ public class MtgCardsRequestHandler implements UriRequestHandler {
responseWriter.writeByteResponse(cardDatabaseHolder.getBytes(), headers);
} catch (ProviderNotFoundException exp) {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.lotro.db.PlayerStatistic;
import com.gempukku.lotro.game.GameHistoryService;
@@ -56,7 +57,7 @@ public class PlayerStatsRequestHandler extends LotroServerRequestHandler impleme
responseWriter.writeXmlResponse(doc);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -34,7 +34,7 @@ public class RegisterRequestHandler extends LotroServerRequestHandler implements
}
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
}

View File

@@ -57,7 +57,7 @@ public class ReplayRequestHandler extends LotroServerRequestHandler implements U
responseWriter.writeByteResponse(baos.toByteArray(), headers);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.lotro.common.ApplicationConfiguration;
import org.jboss.netty.channel.MessageEvent;
@@ -101,7 +102,7 @@ public class RootUriRequestHandler implements UriRequestHandler {
} else if (uri.equals(_serverContextPath)) {
_statusRequestHandler.handleRequest(uri.substring(_serverContextPath.length()), request, context, responseWriter, e);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
}

View File

@@ -86,7 +86,7 @@ public class ServerStatsRequestHandler extends LotroServerRequestHandler impleme
throw new HttpProcessingException(400);
}
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
}

View File

@@ -1,5 +1,7 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.DateUtils;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.lotro.cards.CardSets;
import com.gempukku.lotro.collection.CollectionsManager;
@@ -48,7 +50,7 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
} else if (uri.startsWith("/") && request.getMethod() == HttpMethod.GET) {
getAvailablePicks(request, uri.substring(1), responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
@@ -59,11 +61,13 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
League league = findLeagueByType(leagueType);
if (league == null)
responseWriter.writeError(404);
throw new HttpProcessingException(404);
LeagueData leagueData = league.getLeagueData(_cardSets, _soloDraftDefinitions);
if (!leagueData.isSoloDraftLeague())
responseWriter.writeError(404);
int leagueStart = leagueData.getSeries().get(0).getStart();
if (!leagueData.isSoloDraftLeague() || DateUtils.getCurrentDate() < leagueStart)
throw new HttpProcessingException(404);
SoloDraftLeagueData soloDraftLeagueData = (SoloDraftLeagueData) leagueData;
CollectionType collectionType = soloDraftLeagueData.getCollectionType();
@@ -113,11 +117,13 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
League league = findLeagueByType(leagueType);
if (league == null)
responseWriter.writeError(404);
throw new HttpProcessingException(404);
LeagueData leagueData = league.getLeagueData(_cardSets, _soloDraftDefinitions);
if (!leagueData.isSoloDraftLeague())
responseWriter.writeError(404);
int leagueStart = leagueData.getSeries().get(0).getStart();
if (!leagueData.isSoloDraftLeague() || DateUtils.getCurrentDate() < leagueStart)
throw new HttpProcessingException(404);
SoloDraftLeagueData soloDraftLeagueData = (SoloDraftLeagueData) leagueData;
CollectionType collectionType = soloDraftLeagueData.getCollectionType();
@@ -127,7 +133,7 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
CardCollection collection = _collectionsManager.getPlayerCollection(resourceOwner, collectionType.getCode());
boolean finished = (Boolean) collection.getExtraInformation().get("finished");
if (finished)
responseWriter.writeError(404);
throw new HttpProcessingException(404);
int stage = ((Number) collection.getExtraInformation().get("stage")).intValue();
long playerSeed = ((Number) collection.getExtraInformation().get("seed")).longValue();
@@ -137,12 +143,12 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
SoloDraft.DraftChoice draftChoice = getSelectedDraftChoice(selectedChoiceId, possibleChoices);
if (draftChoice == null)
responseWriter.writeError(400);
throw new HttpProcessingException(400);
CardCollection selectedCards = soloDraft.getCardsForChoiceId(selectedChoiceId, playerSeed, stage);
Map<String, Object> extraInformationChanges = new HashMap<String, Object>();
boolean hasNextStage = soloDraft.hasNextStage(playerSeed, stage);
extraInformationChanges.put("stage", stage+1);
extraInformationChanges.put("stage", stage + 1);
if (!hasNextStage)
extraInformationChanges.put("finished", true);
@@ -164,7 +170,7 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
}
if (hasNextStage) {
Iterable<SoloDraft.DraftChoice> availableChoices = soloDraft.getAvailableChoices(playerSeed, stage+1);
Iterable<SoloDraft.DraftChoice> availableChoices = soloDraft.getAvailableChoices(playerSeed, stage + 1);
appendAvailablePics(doc, pickResultElem, availableChoices);
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import com.gempukku.lotro.chat.ChatServer;
import com.gempukku.lotro.game.GameHistoryService;
@@ -36,7 +37,7 @@ public class StatusRequestHandler extends LotroServerRequestHandler implements U
responseWriter.writeHtmlResponse(sb.toString());
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}
}

View File

@@ -52,7 +52,7 @@ public class TournamentRequestHandler extends LotroServerRequestHandler implemen
} else if (uri.startsWith("/") && request.getMethod() == HttpMethod.GET) {
getTournamentInfo(request, uri.substring(1), responseWriter);
} else {
responseWriter.writeError(404);
throw new HttpProcessingException(404);
}
}

View File

@@ -1,9 +1,12 @@
package com.gempukku.lotro.async.handler;
import com.gempukku.lotro.async.HttpProcessingException;
import com.gempukku.lotro.async.ResponseWriter;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.codec.http.HttpHeaders;
import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.IF_NONE_MATCH;
import org.jboss.netty.handler.codec.http.HttpRequest;
import java.io.File;
@@ -22,10 +25,8 @@ public class WebRequestHandler implements UriRequestHandler {
@Override
public void handleRequest(String uri, HttpRequest request, Map<Type, Object> context, ResponseWriter responseWriter, MessageEvent e) throws Exception {
if (clientHasCurrentVersion(request)) {
responseWriter.writeError(304);
return;
}
if (clientHasCurrentVersion(request))
throw new HttpProcessingException(304);
if (uri.equals(""))
uri = "index.html";
@@ -34,16 +35,14 @@ public class WebRequestHandler implements UriRequestHandler {
if ((uri.contains(".."))
|| uri.contains(File.separator + ".")
|| uri.startsWith(".") || uri.endsWith(".")) {
responseWriter.writeError(403);
} else {
File file = new File(_root + uri);
if (!file.getCanonicalPath().startsWith(_root))
responseWriter.writeError(403);
else {
responseWriter.writeFile(file, Collections.singletonMap(HttpHeaders.Names.ETAG, _uniqueEtag));
}
}
|| uri.startsWith(".") || uri.endsWith("."))
throw new HttpProcessingException(403);
File file = new File(_root + uri);
if (!file.getCanonicalPath().startsWith(_root))
throw new HttpProcessingException(403);
responseWriter.writeFile(file, Collections.singletonMap(HttpHeaders.Names.ETAG, _uniqueEtag));
}
private boolean clientHasCurrentVersion(HttpRequest request) {

View File

@@ -1,5 +1,17 @@
<pre style="font-size:80%">
<b>Most recent update</b>
- "Drawn to Its Power" can no longer adds burden if The Ring-Bearer was killed
- "The Witch-king, Deathless Lord" can now wound an ally twice if all Free Peoples characters are exhausted
- "Nine-fingered Frodo and the Ring of Doom" can now remove one threat if there is one threat and no burdens
- "Saved from the Fire" can no longer target the Ring-Bearer
- "Tower Troll" now has the correct prevention pop-up text
- "Uruk Guard" and "Uruk-hai Guard" now announce the selected companion in chat
- "Shelob, Her Ladyship" now announces the seclected companion in chat
- "Safe Passage" now announces the selected keyword in chat
- "Saruman, Of Many Colours" now announces the selected culture in chat
- The Hobbit Draft League should no longer disappear from users' collections each server day
<b>21 June 2018</b>
- Added Draft for Fellowship block, The Two Towers block, and The Hobbit
- Added prize support for Draft games
- Users can now select what kind of foiling they want to see under the "Settings" tab in-game

View File

@@ -8,6 +8,7 @@ import com.gempukku.lotro.cards.modifiers.CantBeAssignedAgainstModifier;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
@@ -47,6 +48,7 @@ public class Card1_147 extends AbstractMinion {
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new CantBeAssignedAgainstModifier(self, Side.FREE_PEOPLE, Filters.sameCard(companion), self)));
game.getGameState().sendMessage(self.getOwner() +" has chosen "+ companion.getBlueprint().getName());
}
});
return Collections.singletonList(action);

View File

@@ -4,6 +4,7 @@ import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
@@ -28,7 +29,7 @@ public class Card1_211 extends AbstractPermanent {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.forEachKilledInASkirmish(game, effectResult, Race.NAZGUL, CardType.COMPANION)) {
if (TriggerConditions.forEachKilledInASkirmish(game, effectResult, Race.NAZGUL, CardType.COMPANION, Filters.not(Filters.ringBearer))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new AddBurdenEffect(self.getOwner(), self, 1));

View File

@@ -10,6 +10,7 @@ import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Race;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
@@ -50,6 +51,7 @@ public class Card10_023 extends AbstractMinion {
action.appendEffect(
new AddUntilEndOfTurnModifierEffect(
new CantBeAssignedToSkirmishModifier(self, card)));
game.getGameState().sendMessage(self.getOwner() +" has chosen "+ card.getBlueprint().getName());
}
});
return Collections.singletonList(action);

View File

@@ -47,13 +47,18 @@ public class Card10_112 extends AbstractEvent {
List<Effect> possibleEffects = new LinkedList<Effect>();
possibleEffects.add(
new RemoveBurdenEffect(playerId, self));
possibleEffects.add(
new RemoveThreatsEffect(self, 2) {
@Override
public String getText(LotroGame game) {
return "Remove 2 threats";
}
});
if (game.getGameState().getThreats() > 1) {
possibleEffects.add(
new RemoveThreatsEffect(self, 2) {
@Override
public String getText(LotroGame game) {
return "Remove 2 threats";
}
});
} else if (game.getGameState().getBurdens() == 0) {
possibleEffects.add(
new RemoveThreatsEffect(self, 1));
}
action.appendEffect(
new ChoiceEffect(action, playerId, possibleEffects));
return action;

View File

@@ -8,6 +8,7 @@ import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
@@ -33,7 +34,7 @@ public class Card11_050 extends AbstractPermanent {
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, final PhysicalCard self) {
public List<RequiredTriggerAction> getRequiredAfterTriggers(final LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.played(game, effectResult, self)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
@@ -49,6 +50,8 @@ public class Card11_050 extends AbstractPermanent {
self.setWhileInZoneData(Keyword.PLAINS);
else
self.setWhileInZoneData(Keyword.RIVER);
game.getGameState().sendMessage(self.getOwner() +" has chosen "+ result);
}
}));
return Collections.singletonList(action);

View File

@@ -63,7 +63,7 @@ public class Card12_054 extends AbstractMinion {
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, final PhysicalCard self) {
public List<RequiredTriggerAction> getRequiredAfterTriggers(final LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.played(game, effectResult, self)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
@@ -78,6 +78,7 @@ public class Card12_054 extends AbstractMinion {
@Override
protected void validDecisionMade(int index, String result) {
self.setWhileInZoneData(Culture.findCultureByHumanReadable(result));
game.getGameState().sendMessage(self.getOwner() +" has chosen "+ result);
}
}));
return Collections.singletonList(action);

View File

@@ -7,6 +7,7 @@ import com.gempukku.lotro.cards.effects.SelfExertEffect;
import com.gempukku.lotro.cards.modifiers.CantBeAssignedAgainstModifier;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
@@ -48,6 +49,7 @@ public class Card12_156 extends AbstractMinion {
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new CantBeAssignedAgainstModifier(self, Side.FREE_PEOPLE, card, self)));
game.getGameState().sendMessage(self.getOwner() +" has chosen "+ card.getBlueprint().getName());
}
});
return Collections.singletonList(action);

View File

@@ -56,23 +56,28 @@ public class Card15_117 extends AbstractMinion {
new SelfExertEffect(action, self));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose companion", CardType.COMPANION, Filters.not(Filters.ringBearer), Filters.assignableToSkirmishAgainst(Side.SHADOW, self)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard companion) {
if (PlayConditions.canSpot(game, 6, CardType.COMPANION))
action.appendEffect(
new AssignmentEffect(playerId, companion, self));
else
action.appendEffect(
new PreventableEffect(action,
new AssignmentEffect(playerId, companion, self), game.getGameState().getCurrentPlayerId(),
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.COMPANION);
}
}));
}
});
@Override
protected void cardSelected(LotroGame game, PhysicalCard companion) {
if (PlayConditions.canSpot(game, 6, CardType.COMPANION))
action.appendEffect(
new AssignmentEffect(playerId, companion, self));
else
action.appendEffect(
new PreventableEffect(action,
new AssignmentEffect(playerId, companion, self), game.getGameState().getCurrentPlayerId(),
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.COMPANION) {
@Override
public String getText(LotroGame game) {
return "Exert a companion";
}
};
}
}));
}
});
return Collections.singletonList(action);
}
return null;

View File

@@ -5,13 +5,17 @@ import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -35,17 +39,30 @@ public class Card6_122 extends AbstractMinion {
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.forEachKilledInASkirmish(game, effectResult, Race.NAZGUL, CardType.COMPANION)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
final RequiredTriggerAction action = new RequiredTriggerAction(self);
List<Effect> possibleEffects = new LinkedList<Effect>();
possibleEffects.add(
new ChooseAndWoundCharactersEffect(action, self.getOwner(), 1, 1, 2, CardType.ALLY) {
@Override
public String getText(LotroGame game) {
return "Wound an ally twice";
}
});
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(),
CardType.ALLY, Filters.canTakeWounds(self, 2))) {
possibleEffects.add(
new ChooseAndWoundCharactersEffect(action, self.getOwner(), 1, 1, 2, CardType.ALLY) {
@Override
public String getText(LotroGame game) {
return "Wound an ally twice";
}
});
} else if (!Filters.canSpot(game.getGameState(), game.getModifiersQuerying(),
CardType.COMPANION, Filters.canExert(self))) {
possibleEffects.add(
new ChooseAndWoundCharactersEffect(action, self.getOwner(), 1, 1, 1, CardType.ALLY) {
@Override
protected void woundedCardsCallback(Collection<PhysicalCard> cards) {
for (PhysicalCard card : cards)
action.appendEffect(new WoundCharactersEffect(self, card));
}
});
}
possibleEffects.add(
new ChooseAndExertCharactersEffect(action, self.getOwner(), 1, 1, CardType.COMPANION) {
@Override

View File

@@ -39,7 +39,7 @@ public class Card8_020 extends AbstractEvent {
public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseActiveCardEffect(self, playerId, "Choose a companion", CardType.COMPANION) {
new ChooseActiveCardEffect(self, playerId, "Choose a companion", CardType.COMPANION, Filters.not(Filters.ringBearer)) {
@Override
protected void cardSelected(LotroGame game, final PhysicalCard card) {
action.insertCost(

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.CardSets;
import com.gempukku.lotro.collection.CollectionsManager;
import com.gempukku.lotro.competitive.PlayerStanding;
import com.gempukku.lotro.db.vo.CollectionType;
import com.gempukku.lotro.draft2.SoloDraft;
import com.gempukku.lotro.draft2.SoloDraftDefinitions;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.Player;
@@ -47,6 +48,11 @@ public class ConstructedLeagueData implements LeagueData {
return false;
}
@Override
public SoloDraft getSoloDraft() {
return null;
}
@Override
public List<LeagueSerieData> getSeries() {
return _series;

View File

@@ -2,17 +2,20 @@ package com.gempukku.lotro.league;
import com.gempukku.lotro.collection.CollectionsManager;
import com.gempukku.lotro.competitive.PlayerStanding;
import com.gempukku.lotro.draft2.SoloDraft;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.Player;
import java.util.List;
public interface LeagueData {
public boolean isSoloDraftLeague();
boolean isSoloDraftLeague();
public List<LeagueSerieData> getSeries();
List<LeagueSerieData> getSeries();
public CardCollection joinLeague(CollectionsManager collecionsManager, Player player, int currentTime);
SoloDraft getSoloDraft();
public int process(CollectionsManager collectionsManager, List<PlayerStanding> leagueStandings, int oldStatus, int currentTime);
CardCollection joinLeague(CollectionsManager collecionsManager, Player player, int currentTime);
int process(CollectionsManager collectionsManager, List<PlayerStanding> leagueStandings, int oldStatus, int currentTime);
}

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.CardSets;
import com.gempukku.lotro.collection.CollectionsManager;
import com.gempukku.lotro.competitive.PlayerStanding;
import com.gempukku.lotro.db.vo.CollectionType;
import com.gempukku.lotro.draft2.SoloDraft;
import com.gempukku.lotro.draft2.SoloDraftDefinitions;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.Player;
@@ -50,6 +51,11 @@ public class NewConstructedLeagueData implements LeagueData {
return false;
}
@Override
public SoloDraft getSoloDraft() {
return null;
}
@Override
public List<LeagueSerieData> getSeries() {
return Collections.unmodifiableList(_series);

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.CardSets;
import com.gempukku.lotro.collection.CollectionsManager;
import com.gempukku.lotro.competitive.PlayerStanding;
import com.gempukku.lotro.db.vo.CollectionType;
import com.gempukku.lotro.draft2.SoloDraft;
import com.gempukku.lotro.draft2.SoloDraftDefinitions;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.DefaultCardCollection;
@@ -51,6 +52,11 @@ public class NewSealedLeagueData implements LeagueData {
return false;
}
@Override
public SoloDraft getSoloDraft() {
return null;
}
@Override
public List<LeagueSerieData> getSeries() {
return Collections.unmodifiableList(_series);

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.CardSets;
import com.gempukku.lotro.collection.CollectionsManager;
import com.gempukku.lotro.competitive.PlayerStanding;
import com.gempukku.lotro.db.vo.CollectionType;
import com.gempukku.lotro.draft2.SoloDraft;
import com.gempukku.lotro.draft2.SoloDraftDefinitions;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.DefaultCardCollection;
@@ -51,6 +52,11 @@ public class SealedLeagueData implements LeagueData {
return false;
}
@Override
public SoloDraft getSoloDraft() {
return null;
}
@Override
public List<LeagueSerieData> getSeries() {
return Collections.unmodifiableList(_series);

View File

@@ -42,6 +42,7 @@ public class SoloDraftLeagueData implements LeagueData {
return _collectionType;
}
@Override
public SoloDraft getSoloDraft() {
return _draft;
}
@@ -87,10 +88,10 @@ public class SoloDraftLeagueData implements LeagueData {
public int process(CollectionsManager collectionsManager, List<PlayerStanding> leagueStandings, int oldStatus, int currentTime) {
int status = oldStatus;
int maxGamesTotal = _serie.getMaxMatches();
if (status == 0) {
if (currentTime > DateUtils.offsetDate(_serie.getEnd(), 1)) {
int maxGamesTotal = _serie.getMaxMatches();
for (PlayerStanding leagueStanding : leagueStandings) {
CardCollection leaguePrize = _leaguePrizes.getPrizeForLeague(leagueStanding.getStanding(), leagueStandings.size(), leagueStanding.getGamesPlayed(), maxGamesTotal, _collectionType);
if (leaguePrize != null)