mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
@@ -1347,6 +1347,11 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
// Ai won't understand that anyway
|
// Ai won't understand that anyway
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void revealUnsupported(Map<Player, List<PaperCard>> unsupported) {
|
||||||
|
// Ai won't understand that anyway
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<DeckSection, List<? extends PaperCard>> complainCardsCantPlayWell(Deck myDeck) {
|
public Map<DeckSection, List<? extends PaperCard>> complainCardsCantPlayWell(Deck myDeck) {
|
||||||
// TODO check if profile detection set to Auto
|
// TODO check if profile detection set to Auto
|
||||||
|
|||||||
@@ -115,6 +115,20 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
return parts.get(DeckSection.Main);
|
return parts.get(DeckSection.Main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Pair<Deck, List<PaperCard>> getValid() {
|
||||||
|
List<PaperCard> unsupported = new ArrayList<>();
|
||||||
|
for (Entry<DeckSection, CardPool> kv : parts.entrySet()) {
|
||||||
|
CardPool pool = kv.getValue();
|
||||||
|
for (Entry<PaperCard, Integer> pc : pool) {
|
||||||
|
if (pc.getKey().getRules() != null && pc.getKey().getRules().isUnsupported()) {
|
||||||
|
unsupported.add(pc.getKey());
|
||||||
|
pool.remove(pc.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Pair.of(this, unsupported);
|
||||||
|
}
|
||||||
|
|
||||||
public List<PaperCard> getCommanders() {
|
public List<PaperCard> getCommanders() {
|
||||||
List<PaperCard> result = Lists.newArrayList();
|
List<PaperCard> result = Lists.newArrayList();
|
||||||
final CardPool cp = get(DeckSection.Commander);
|
final CardPool cp = get(DeckSection.Commander);
|
||||||
|
|||||||
@@ -2222,6 +2222,13 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void revealUnsupported(Map<Player, List<PaperCard>> unsupported) {
|
||||||
|
// Notify players
|
||||||
|
for (Player p : game.getPlayers()) {
|
||||||
|
p.getController().revealUnsupported(unsupported);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Delivers a message to all players. (use reveal to show Cards) */
|
/** Delivers a message to all players. (use reveal to show Cards) */
|
||||||
public void notifyOfValue(SpellAbility saSource, GameObject relatedTarget, String value, Player playerExcept) {
|
public void notifyOfValue(SpellAbility saSource, GameObject relatedTarget, String value, Player playerExcept) {
|
||||||
if (saSource != null) {
|
if (saSource != null) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import forge.item.PaperCard;
|
|||||||
import forge.util.Localizer;
|
import forge.util.Localizer;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
import forge.util.collect.FCollectionView;
|
import forge.util.collect.FCollectionView;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -224,6 +225,7 @@ public class Match {
|
|||||||
// friendliness
|
// friendliness
|
||||||
Map<Player, Map<DeckSection, List<? extends PaperCard>>> rAICards = new HashMap<>();
|
Map<Player, Map<DeckSection, List<? extends PaperCard>>> rAICards = new HashMap<>();
|
||||||
Multimap<Player, PaperCard> removedAnteCards = ArrayListMultimap.create();
|
Multimap<Player, PaperCard> removedAnteCards = ArrayListMultimap.create();
|
||||||
|
Map<Player, List<PaperCard>> unsupported = new HashMap<>();
|
||||||
|
|
||||||
final FCollectionView<Player> players = game.getPlayers();
|
final FCollectionView<Player> players = game.getPlayers();
|
||||||
final List<RegisteredPlayer> playersConditions = game.getMatch().getPlayers();
|
final List<RegisteredPlayer> playersConditions = game.getMatch().getPlayers();
|
||||||
@@ -293,17 +295,17 @@ public class Match {
|
|||||||
|
|
||||||
Set<PaperCard> myRemovedAnteCards = null;
|
Set<PaperCard> myRemovedAnteCards = null;
|
||||||
if (!rules.useAnte()) {
|
if (!rules.useAnte()) {
|
||||||
myRemovedAnteCards = getRemovedAnteCards(myDeck);
|
myRemovedAnteCards = getRemovedAnteCards(myDeck.getLeft());
|
||||||
for (PaperCard cp: myRemovedAnteCards) {
|
for (PaperCard cp: myRemovedAnteCards) {
|
||||||
for (Entry<DeckSection, CardPool> ds : myDeck) {
|
for (Entry<DeckSection, CardPool> ds : myDeck.getLeft()) {
|
||||||
ds.getValue().removeAll(cp);
|
ds.getValue().removeAll(cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preparePlayerZone(player, ZoneType.Library, myDeck.getMain(), psc.useRandomFoil());
|
preparePlayerZone(player, ZoneType.Library, myDeck.getLeft().getMain(), psc.useRandomFoil());
|
||||||
if (myDeck.has(DeckSection.Sideboard)) {
|
if (myDeck.getLeft().has(DeckSection.Sideboard)) {
|
||||||
preparePlayerZone(player, ZoneType.Sideboard, myDeck.get(DeckSection.Sideboard), psc.useRandomFoil());
|
preparePlayerZone(player, ZoneType.Sideboard, myDeck.getLeft().get(DeckSection.Sideboard), psc.useRandomFoil());
|
||||||
|
|
||||||
// Assign Companion
|
// Assign Companion
|
||||||
Card companion = player.assignCompanion(game, person);
|
Card companion = player.assignCompanion(game, person);
|
||||||
@@ -322,7 +324,7 @@ public class Match {
|
|||||||
player.shuffle(null);
|
player.shuffle(null);
|
||||||
|
|
||||||
if (isFirstGame) {
|
if (isFirstGame) {
|
||||||
Map<DeckSection, List<? extends PaperCard>> cardsComplained = player.getController().complainCardsCantPlayWell(myDeck);
|
Map<DeckSection, List<? extends PaperCard>> cardsComplained = player.getController().complainCardsCantPlayWell(myDeck.getLeft());
|
||||||
if (cardsComplained != null && !cardsComplained.isEmpty()) {
|
if (cardsComplained != null && !cardsComplained.isEmpty()) {
|
||||||
rAICards.put(player, cardsComplained);
|
rAICards.put(player, cardsComplained);
|
||||||
}
|
}
|
||||||
@@ -337,6 +339,7 @@ public class Match {
|
|||||||
if (myRemovedAnteCards != null && !myRemovedAnteCards.isEmpty()) {
|
if (myRemovedAnteCards != null && !myRemovedAnteCards.isEmpty()) {
|
||||||
removedAnteCards.putAll(player, myRemovedAnteCards);
|
removedAnteCards.putAll(player, myRemovedAnteCards);
|
||||||
}
|
}
|
||||||
|
unsupported.put(player, myDeck.getRight());
|
||||||
}
|
}
|
||||||
|
|
||||||
final Localizer localizer = Localizer.getInstance();
|
final Localizer localizer = Localizer.getInstance();
|
||||||
@@ -347,6 +350,10 @@ public class Match {
|
|||||||
if (!removedAnteCards.isEmpty()) {
|
if (!removedAnteCards.isEmpty()) {
|
||||||
game.getAction().revealAnte(localizer.getMessage("lblAnteCardsRemoved"), removedAnteCards);
|
game.getAction().revealAnte(localizer.getMessage("lblAnteCardsRemoved"), removedAnteCards);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!unsupported.isEmpty()) {
|
||||||
|
game.getAction().revealUnsupported(unsupported);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeAnte(Game lastGame) {
|
private void executeAnte(Game lastGame) {
|
||||||
|
|||||||
@@ -287,6 +287,8 @@ public abstract class PlayerController {
|
|||||||
public abstract void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards);
|
public abstract void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards);
|
||||||
public abstract void revealAISkipCards(String message, Map<Player, Map<DeckSection, List<? extends PaperCard>>> deckCards);
|
public abstract void revealAISkipCards(String message, Map<Player, Map<DeckSection, List<? extends PaperCard>>> deckCards);
|
||||||
|
|
||||||
|
public abstract void revealUnsupported(Map<Player, List<PaperCard>> unsupported);
|
||||||
|
|
||||||
// These 2 are for AI
|
// These 2 are for AI
|
||||||
public CardCollectionView cheatShuffle(CardCollectionView list) { return list; }
|
public CardCollectionView cheatShuffle(CardCollectionView list) { return list; }
|
||||||
public Map<DeckSection, List<? extends PaperCard>> complainCardsCantPlayWell(Deck myDeck) { return null; }
|
public Map<DeckSection, List<? extends PaperCard>> complainCardsCantPlayWell(Deck myDeck) { return null; }
|
||||||
|
|||||||
@@ -664,6 +664,11 @@ public class PlayerControllerForTests extends PlayerController {
|
|||||||
// TODO test this!
|
// TODO test this!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void revealUnsupported(Map<Player, List<PaperCard>> unsupported) {
|
||||||
|
// test this!
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PaperCard> chooseCardsYouWonToAddToDeck(List<PaperCard> losses) {
|
public List<PaperCard> chooseCardsYouWonToAddToDeck(List<PaperCard> losses) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|||||||
@@ -2306,6 +2306,16 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void revealUnsupported(final Map<Player, List<PaperCard>> unsupported) {
|
||||||
|
for (final Player p : unsupported.keySet()) {
|
||||||
|
List<PaperCard> removed = unsupported.get(p);
|
||||||
|
if (removed == null || removed.isEmpty())
|
||||||
|
continue;
|
||||||
|
getGui().getChoices(localizer.getMessage("lblActionFromPlayerDeck", localizer.getMessage("lblRemoved"), Lang.getInstance().getPossessedObject(MessageUtil.mayBeYou(player, p), "")), -1, -1, ImmutableList.copyOf(removed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PaperCard> chooseCardsYouWonToAddToDeck(final List<PaperCard> losses) {
|
public List<PaperCard> chooseCardsYouWonToAddToDeck(final List<PaperCard> losses) {
|
||||||
return getGui().many(localizer.getMessage("lblSelectCardstoAddtoYourDeck"), localizer.getMessage("lblAddTheseToMyDeck"), 0, losses.size(), losses, null);
|
return getGui().many(localizer.getMessage("lblSelectCardstoAddtoYourDeck"), localizer.getMessage("lblAddTheseToMyDeck"), 0, losses.size(), losses, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user