mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Added Mindlock Orb and Shadow of Doubt
This commit is contained in:
@@ -1107,10 +1107,6 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
if (sa.hasParam("Origin")) {
|
||||
origin = ZoneType.listValueOf(sa.getParam("Origin"));
|
||||
}
|
||||
|
||||
if(origin.contains(ZoneType.Library) && !sa.hasParam("NoLooking")) {
|
||||
sa.getActivatingPlayer().incLibrarySearched();
|
||||
}
|
||||
|
||||
String type = sa.getParam("ChangeType");
|
||||
if (type == null) {
|
||||
@@ -1121,6 +1117,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
sa) : 1;
|
||||
|
||||
List<Card> fetchList;
|
||||
boolean shuffleMandatory = true;
|
||||
boolean searchedLibrary = false;
|
||||
if (defined) {
|
||||
fetchList = new ArrayList<Card>(AbilityUtils.getDefinedCards(card, sa.getParam("Defined"), sa));
|
||||
if (!sa.hasParam("ChangeNum")) {
|
||||
@@ -1132,15 +1130,30 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
fetchList = AbilityUtils.filterListByType(fetchList, type, sa);
|
||||
} else {
|
||||
fetchList = player.getCardsIn(origin);
|
||||
if (origin.contains(ZoneType.Library) && ai.hasKeyword("LimitSearchLibrary")
|
||||
&& !sa.hasParam("NoLooking")) {
|
||||
if (origin.contains(ZoneType.Library) && !sa.hasParam("NoLooking")) {
|
||||
searchedLibrary = true;
|
||||
if (ai.hasKeyword("LimitSearchLibrary")) {
|
||||
// Aven Mindcensor
|
||||
fetchList.removeAll(player.getCardsIn(ZoneType.Library));
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
fetchList.addAll(player.getCardsIn(ZoneType.Library, fetchNum));
|
||||
fetchList.removeAll(player.getCardsIn(ZoneType.Library));
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
fetchList.addAll(player.getCardsIn(ZoneType.Library, fetchNum));
|
||||
if (fetchNum == 0) {
|
||||
searchedLibrary = false;
|
||||
}
|
||||
}
|
||||
if (ai.hasKeyword("CantSearchLibrary")) {
|
||||
fetchList.removeAll(player.getCardsIn(ZoneType.Library));
|
||||
// "if you do/sb does, shuffle" is not mandatory, should has this param.
|
||||
// "then shuffle" is mandatory
|
||||
shuffleMandatory = !sa.hasParam("ShuffleNonMandatory");
|
||||
searchedLibrary = false;
|
||||
}
|
||||
}
|
||||
fetchList = AbilityUtils.filterListByType(fetchList, type, sa);
|
||||
}
|
||||
if (searchedLibrary && ai.equals(player)) {
|
||||
ai.incLibrarySearched();
|
||||
}
|
||||
|
||||
final ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination"));
|
||||
final List<Card> fetched = new ArrayList<Card>();
|
||||
@@ -1278,7 +1291,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
if (origin.contains(ZoneType.Library) && !defined && !"False".equals(sa.getParam("Shuffle"))) {
|
||||
if (origin.contains(ZoneType.Library) && !defined && !"False".equals(sa.getParam("Shuffle")) && shuffleMandatory) {
|
||||
player.shuffle();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ package forge.card.ability.ai;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.card.ability.SpellAbilityAi;
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.CardPredicates.Presets;
|
||||
|
||||
@@ -51,13 +51,19 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
|
||||
|
||||
if ((tgtPlayers == null) || tgtPlayers.isEmpty() || sa.hasParam("UseAllOriginZones")) {
|
||||
cards = game.getCardsIn(origin);
|
||||
} else if (sa.getActivatingPlayer().hasKeyword("LimitSearchLibrary")
|
||||
&& origin.contains(ZoneType.Library) && sa.hasParam("Search")) {
|
||||
for (final Player p : tgtPlayers) {
|
||||
cards.addAll(p.getCardsIn(origin));
|
||||
cards.removeAll(p.getCardsIn(ZoneType.Library));
|
||||
int fetchNum = Math.min(p.getCardsIn(ZoneType.Library).size(), 4);
|
||||
cards.addAll(p.getCardsIn(ZoneType.Library, fetchNum));
|
||||
} else if (origin.contains(ZoneType.Library) && sa.hasParam("Search")) {
|
||||
// Search library using changezoneall effect need a param "Search"
|
||||
if (sa.getActivatingPlayer().hasKeyword("LimitSearchLibrary")) {
|
||||
for (final Player p : tgtPlayers) {
|
||||
cards.addAll(p.getCardsIn(origin));
|
||||
cards.removeAll(p.getCardsIn(ZoneType.Library));
|
||||
int fetchNum = Math.min(p.getCardsIn(ZoneType.Library).size(), 4);
|
||||
cards.addAll(p.getCardsIn(ZoneType.Library, fetchNum));
|
||||
}
|
||||
}
|
||||
if (sa.getActivatingPlayer().hasKeyword("CantSearchLibrary")) {
|
||||
// all these cards have "then that player shuffles", mandatory shuffle
|
||||
cards.removeAll(game.getCardsIn(ZoneType.Library));
|
||||
}
|
||||
} else {
|
||||
for (final Player p : tgtPlayers) {
|
||||
@@ -65,8 +71,12 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (origin.contains(ZoneType.Library) && sa.hasParam("Search")) {
|
||||
if (origin.contains(ZoneType.Library) && sa.hasParam("Search") && !sa.getActivatingPlayer().hasKeyword("CantSearchLibrary")) {
|
||||
List<Card> libCards = CardLists.getValidCards(cards, "Card.inZoneLibrary", sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
List<Card> libCardsYouOwn = CardLists.filterControlledBy(libCards, sa.getActivatingPlayer());
|
||||
if (!libCardsYouOwn.isEmpty()) { // Only searching one's own library would fire Archive Trap's altcost
|
||||
sa.getActivatingPlayer().incLibrarySearched();
|
||||
}
|
||||
sa.getActivatingPlayer().getController().reveal("Looking at the Library", libCards, ZoneType.Library, sa.getActivatingPlayer());
|
||||
}
|
||||
cards = AbilityUtils.filterListByType(cards, sa.getParam("ChangeType"), sa);
|
||||
|
||||
@@ -629,9 +629,6 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
origin = ZoneType.listValueOf(sa.getParam("Origin"));
|
||||
}
|
||||
|
||||
if(origin.contains(ZoneType.Library) && !sa.hasParam("NoLooking")) {
|
||||
sa.getActivatingPlayer().incLibrarySearched();
|
||||
}
|
||||
|
||||
ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination"));
|
||||
// this needs to be zero indexed. Top = 0, Third = 2
|
||||
@@ -672,6 +669,8 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
List<Card> fetchList;
|
||||
boolean shuffleMandatory = true;
|
||||
boolean searchedLibrary = false;
|
||||
if (defined) {
|
||||
fetchList = new ArrayList<Card>(AbilityUtils.getDefinedCards(card, sa.getParam("Defined"), sa));
|
||||
if (!sa.hasParam("ChangeNum")) {
|
||||
@@ -682,16 +681,32 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
fetchList = game.getCardsIn(origin);
|
||||
} else {
|
||||
fetchList = player.getCardsIn(origin);
|
||||
if (origin.contains(ZoneType.Library) && decider.hasKeyword("LimitSearchLibrary")
|
||||
&& !sa.hasParam("NoLooking")) {// Aven Mindcensor
|
||||
fetchList.removeAll(player.getCardsIn(ZoneType.Library));
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
fetchList.addAll(player.getCardsIn(ZoneType.Library, fetchNum));
|
||||
if (origin.contains(ZoneType.Library) && !sa.hasParam("NoLooking")) {
|
||||
searchedLibrary = true;
|
||||
if (decider.hasKeyword("LimitSearchLibrary")) { // Aven Mindcensor
|
||||
fetchList.removeAll(player.getCardsIn(ZoneType.Library));
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
if (fetchNum == 0) {
|
||||
searchedLibrary = false;
|
||||
}System.out.println(fetchNum);
|
||||
fetchList.addAll(player.getCardsIn(ZoneType.Library, fetchNum));
|
||||
}
|
||||
if (decider.hasKeyword("CantSearchLibrary")) {
|
||||
fetchList.removeAll(player.getCardsIn(ZoneType.Library));
|
||||
// "if you do/sb does, shuffle" is not mandatory (usually a triggered ability), should has this param.
|
||||
// "then shuffle" is mandatory
|
||||
shuffleMandatory = !sa.hasParam("ShuffleNonMandatory");
|
||||
searchedLibrary = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (searchedLibrary && decider.equals(player)) { // should only count the number of searching player's own library
|
||||
decider.incLibrarySearched();
|
||||
}
|
||||
|
||||
if (!defined) {
|
||||
if (origin.contains(ZoneType.Library) && !defined && !sa.hasParam("NoLooking")) {
|
||||
if (origin.contains(ZoneType.Library) && !defined && !sa.hasParam("NoLooking") && !decider.hasKeyword("CantSearchLibrary")) {
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
List<Card> shown = !decider.hasKeyword("LimitSearchLibrary") ? player.getCardsIn(ZoneType.Library) : player.getCardsIn(ZoneType.Library, fetchNum);
|
||||
// Look at whole library before moving onto choosing a card
|
||||
@@ -889,7 +904,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
decider.getController().reveal(card + " - Revealed card: ", movedCards, zt, player);
|
||||
}
|
||||
|
||||
if ((origin.contains(ZoneType.Library) && !destination.equals(ZoneType.Library) && !defined)
|
||||
if ((origin.contains(ZoneType.Library) && !destination.equals(ZoneType.Library) && !defined && shuffleMandatory)
|
||||
|| (sa.hasParam("Shuffle") && "True".equals(sa.getParam("Shuffle")))) {
|
||||
player.shuffle();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ import forge.game.combat.AttackingBand;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.player.PlayerController.ManaPaymentPurpose;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiDialog;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
private int numPowerSurgeLands;
|
||||
|
||||
/** The number of times this player has searched his library. */
|
||||
private int numLibrarySearched = 0;
|
||||
private int numLibrarySearchedOwn = 0;
|
||||
|
||||
/** The prowl. */
|
||||
private ArrayList<String> prowl = new ArrayList<String>();
|
||||
@@ -2229,14 +2229,14 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
public final void setLibrarySearched(final int l) {
|
||||
this.numLibrarySearched = l;
|
||||
this.numLibrarySearchedOwn = l;
|
||||
}
|
||||
|
||||
public final int getLibrarySearched() {
|
||||
return this.numLibrarySearched;
|
||||
return this.numLibrarySearchedOwn;
|
||||
}
|
||||
public final void incLibrarySearched() {
|
||||
this.numLibrarySearched++;
|
||||
this.numLibrarySearchedOwn++;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,10 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.Card;
|
||||
import forge.FThreads;
|
||||
import forge.game.event.GameEventFlipCoin;
|
||||
import forge.game.player.Player;
|
||||
import forge.gui.match.CMatchUI;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
/**
|
||||
* Holds player interactions using standard windows
|
||||
|
||||
Reference in New Issue
Block a user