mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- More getCards read-only list errors.
This commit is contained in:
@@ -6711,7 +6711,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (property.startsWith("TopGraveyard")) {
|
} else if (property.startsWith("TopGraveyard")) {
|
||||||
final List<Card> list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
final List<Card> list = new ArrayList<Card>(this.getOwner().getCardsIn(ZoneType.Graveyard));
|
||||||
Collections.reverse(list);
|
Collections.reverse(list);
|
||||||
if (list.isEmpty() || !this.equals(list.get(0))) {
|
if (list.isEmpty() || !this.equals(list.get(0))) {
|
||||||
return false;
|
return false;
|
||||||
@@ -6834,11 +6834,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
final String restriction = property.split("sharesNameWith ")[1];
|
final String restriction = property.split("sharesNameWith ")[1];
|
||||||
if (restriction.equals("YourGraveyard")) {
|
if (restriction.equals("YourGraveyard")) {
|
||||||
final List<Card> list = sourceController.getCardsIn(ZoneType.Graveyard);
|
final List<Card> list = sourceController.getCardsIn(ZoneType.Graveyard);
|
||||||
if (list.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
boolean shares = false;
|
boolean shares = false;
|
||||||
for (final Card card : sourceController.getCardsIn(ZoneType.Graveyard)) {
|
for (final Card card : list) {
|
||||||
if (this.getName().equals(card.getName())) {
|
if (this.getName().equals(card.getName())) {
|
||||||
shares = true;
|
shares = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ public class GameAction {
|
|||||||
final Player owner = c.getOwner();
|
final Player owner = c.getOwner();
|
||||||
final PlayerZone grave = owner.getZone(ZoneType.Graveyard);
|
final PlayerZone grave = owner.getZone(ZoneType.Graveyard);
|
||||||
final PlayerZone exile = owner.getZone(ZoneType.Exile);
|
final PlayerZone exile = owner.getZone(ZoneType.Exile);
|
||||||
final List<Card> ownerBoard = owner.getCardsIn(ZoneType.Battlefield);
|
final List<Card> ownerBoard = new ArrayList<Card>(owner.getCardsIn(ZoneType.Battlefield));
|
||||||
|
|
||||||
if (c.getName().equals("Nissa's Chosen") && origZone.is(ZoneType.Battlefield)) {
|
if (c.getName().equals("Nissa's Chosen") && origZone.is(ZoneType.Battlefield)) {
|
||||||
return this.moveToLibrary(c, -1);
|
return this.moveToLibrary(c, -1);
|
||||||
@@ -497,7 +497,8 @@ public class GameAction {
|
|||||||
|
|
||||||
// Recover keyword
|
// Recover keyword
|
||||||
if (c.isCreature() && origZone.is(ZoneType.Battlefield)) {
|
if (c.isCreature() && origZone.is(ZoneType.Battlefield)) {
|
||||||
for (final Card recoverable : c.getOwner().getCardsIn(ZoneType.Graveyard)) {
|
List<Card> cards = new ArrayList<Card>(c.getOwner().getCardsIn(ZoneType.Graveyard));
|
||||||
|
for (final Card recoverable : cards) {
|
||||||
if (recoverable.hasStartOfKeyword("Recover") && !recoverable.equals(c)) {
|
if (recoverable.hasStartOfKeyword("Recover") && !recoverable.equals(c)) {
|
||||||
|
|
||||||
final String recoverCost = recoverable.getKeyword().get(recoverable.getKeywordPosition("Recover"))
|
final String recoverCost = recoverable.getKeyword().get(recoverable.getKeywordPosition("Recover"))
|
||||||
|
|||||||
@@ -443,7 +443,8 @@ public final class GameActionUtil {
|
|||||||
Player p = Singletons.getControl().getPlayer();
|
Player p = Singletons.getControl().getPlayer();
|
||||||
if ("All".equals(part.getType())) {
|
if ("All".equals(part.getType())) {
|
||||||
if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) {
|
if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) {
|
||||||
for (final Card card : p.getCardsIn(ZoneType.Graveyard)) {
|
List<Card> cards = new ArrayList<Card>(p.getCardsIn(ZoneType.Graveyard));
|
||||||
|
for (final Card card : cards) {
|
||||||
Singletons.getModel().getGame().getAction().exile(card);
|
Singletons.getModel().getGame().getAction().exile(card);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -454,8 +455,7 @@ public final class GameActionUtil {
|
|||||||
} else {
|
} else {
|
||||||
CostExile costExile = (CostExile) part;
|
CostExile costExile = (CostExile) part;
|
||||||
ZoneType from = costExile.getFrom();
|
ZoneType from = costExile.getFrom();
|
||||||
List<Card> list = p.getCardsIn(from);
|
List<Card> list = CardLists.getValidCards(p.getCardsIn(from), part.getType().split(";"), p, source);
|
||||||
list = CardLists.getValidCards(list, part.getType().split(";"), p, source);
|
|
||||||
final int nNeeded = AbilityFactory.calculateAmount(source, part.getAmount(), ability);
|
final int nNeeded = AbilityFactory.calculateAmount(source, part.getAmount(), ability);
|
||||||
if (list.size() >= nNeeded) {
|
if (list.size() >= nNeeded) {
|
||||||
for (int i = 0; i < nNeeded; i++) {
|
for (int i = 0; i < nNeeded; i++) {
|
||||||
@@ -760,8 +760,7 @@ public final class GameActionUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
for (int i = 0; i < damage; i++) {
|
for (int i = 0; i < damage; i++) {
|
||||||
List<Card> nonTokens = player.getCardsIn(ZoneType.Battlefield);
|
List<Card> nonTokens = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), Presets.NON_TOKEN);
|
||||||
nonTokens = CardLists.filter(nonTokens, Presets.NON_TOKEN);
|
|
||||||
if (nonTokens.size() == 0) {
|
if (nonTokens.size() == 0) {
|
||||||
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
|
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
|
||||||
} else {
|
} else {
|
||||||
@@ -1198,16 +1197,13 @@ public final class GameActionUtil {
|
|||||||
} // execute()
|
} // execute()
|
||||||
|
|
||||||
private boolean getsBonus(final Card c) {
|
private boolean getsBonus(final Card c) {
|
||||||
List<Card> list = c.getController().getCardsIn(ZoneType.Battlefield);
|
for (Card card : c.getController().getCardsIn(ZoneType.Battlefield)) {
|
||||||
list = CardLists.filter(list, new Predicate<Card>() {
|
if (card.getName().equals("Guan Yu, Sainted Warrior")
|
||||||
@Override
|
|| card.getName().equals("Zhang Fei, Fierce Warrior")) {
|
||||||
public boolean apply(final Card c) {
|
return true;
|
||||||
return c.getName().equals("Guan Yu, Sainted Warrior")
|
|
||||||
|| c.getName().equals("Zhang Fei, Fierce Warrior");
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
return false;
|
||||||
return list.size() > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // Liu_Bei
|
}; // Liu_Bei
|
||||||
|
|||||||
@@ -316,8 +316,7 @@ public class AbilityFactoryCounters {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
list = player.getCardsIn(ZoneType.Battlefield);
|
list = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||||
list = CardLists.filter(list, new Predicate<Card>() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
return c.canBeTargetedBy(sa) && !c.hasKeyword("CARDNAME can't have counters placed on it.")
|
return c.canBeTargetedBy(sa) && !c.hasKeyword("CARDNAME can't have counters placed on it.")
|
||||||
@@ -458,7 +457,6 @@ public class AbilityFactoryCounters {
|
|||||||
boolean chance = true;
|
boolean chance = true;
|
||||||
final Target abTgt = sa.getTarget();
|
final Target abTgt = sa.getTarget();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
List<Card> list;
|
|
||||||
Card choice = null;
|
Card choice = null;
|
||||||
final String type = params.get("CounterType");
|
final String type = params.get("CounterType");
|
||||||
final String amountStr = params.get("CounterNum");
|
final String amountStr = params.get("CounterNum");
|
||||||
@@ -466,10 +464,9 @@ public class AbilityFactoryCounters {
|
|||||||
|
|
||||||
final Player player = af.isCurse() ? ai.getOpponent() : ai;
|
final Player player = af.isCurse() ? ai.getOpponent() : ai;
|
||||||
|
|
||||||
list = player.getCardsIn(ZoneType.Battlefield);
|
|
||||||
|
|
||||||
if (abTgt != null) {
|
if (abTgt != null) {
|
||||||
list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source);
|
List<Card> list =
|
||||||
|
CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), abTgt.getValidTgts(), source.getController(), source);
|
||||||
|
|
||||||
if (list.size() == 0) {
|
if (list.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
@@ -579,8 +576,7 @@ public class AbilityFactoryCounters {
|
|||||||
// things like Powder Keg, which are way too complex for the AI
|
// things like Powder Keg, which are way too complex for the AI
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list = player.getCardsIn(ZoneType.Battlefield);
|
list = CardLists.getTargetableCards(player.getCardsIn(ZoneType.Battlefield), sa);
|
||||||
list = CardLists.getTargetableCards(list, sa);
|
|
||||||
list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source);
|
list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source);
|
||||||
|
|
||||||
if (list.isEmpty() && mandatory) {
|
if (list.isEmpty() && mandatory) {
|
||||||
@@ -1447,8 +1443,7 @@ public class AbilityFactoryCounters {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<Card> cperms = ai.getCardsIn(ZoneType.Battlefield);
|
List<Card> cperms = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||||
cperms = CardLists.filter(cperms, new Predicate<Card>() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card crd) {
|
public boolean apply(final Card crd) {
|
||||||
for (final Counters c1 : Counters.values()) {
|
for (final Counters c1 : Counters.values()) {
|
||||||
@@ -1460,8 +1455,7 @@ public class AbilityFactoryCounters {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
List<Card> hperms = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
List<Card> hperms = CardLists.filter(ai.getOpponent().getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||||
hperms = CardLists.filter(hperms, new Predicate<Card>() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card crd) {
|
public boolean apply(final Card crd) {
|
||||||
for (final Counters c1 : Counters.values()) {
|
for (final Counters c1 : Counters.values()) {
|
||||||
@@ -1853,11 +1847,8 @@ public class AbilityFactoryCounters {
|
|||||||
final boolean curse = af.isCurse();
|
final boolean curse = af.isCurse();
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
|
|
||||||
hList = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
hList = CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
|
||||||
cList = ai.getCardsIn(ZoneType.Battlefield);
|
cList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
|
||||||
|
|
||||||
hList = CardLists.getValidCards(hList, valid, source.getController(), source);
|
|
||||||
cList = CardLists.getValidCards(cList, valid, source.getController(), source);
|
|
||||||
|
|
||||||
if (abCost != null) {
|
if (abCost != null) {
|
||||||
// AI currently disabled for these costs
|
// AI currently disabled for these costs
|
||||||
@@ -2563,14 +2554,12 @@ public class AbilityFactoryCounters {
|
|||||||
}
|
}
|
||||||
} else { // targeted
|
} else { // targeted
|
||||||
final Player player = af.isCurse() ? ai.getOpponent() : ai;
|
final Player player = af.isCurse() ? ai.getOpponent() : ai;
|
||||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
List<Card> list = CardLists.getTargetableCards(player.getCardsIn(ZoneType.Battlefield), sa);
|
||||||
list = CardLists.getTargetableCards(list, sa);
|
|
||||||
list = CardLists.getValidCards(list, abTgt.getValidTgts(), host.getController(), host);
|
list = CardLists.getValidCards(list, abTgt.getValidTgts(), host.getController(), host);
|
||||||
if (list.isEmpty() && mandatory) {
|
if (list.isEmpty() && mandatory) {
|
||||||
// If there isn't any prefered cards to target, gotta choose
|
// If there isn't any prefered cards to target, gotta choose
|
||||||
// non-preferred ones
|
// non-preferred ones
|
||||||
list = player.getOpponent().getCardsIn(ZoneType.Battlefield);
|
list = CardLists.getTargetableCards(player.getOpponent().getCardsIn(ZoneType.Battlefield), sa);
|
||||||
list = CardLists.getTargetableCards(list, sa);
|
|
||||||
list = CardLists.getValidCards(list, abTgt.getValidTgts(), host.getController(), host);
|
list = CardLists.getValidCards(list, abTgt.getValidTgts(), host.getController(), host);
|
||||||
preferred = false;
|
preferred = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,8 +349,7 @@ public class AbilityFactoryPreventDamage {
|
|||||||
|
|
||||||
final List<Card> threatenedTargets = new ArrayList<Card>();
|
final List<Card> threatenedTargets = new ArrayList<Card>();
|
||||||
// filter AIs battlefield by what I can target
|
// filter AIs battlefield by what I can target
|
||||||
List<Card> targetables = ai.getCardsIn(ZoneType.Battlefield);
|
List<Card> targetables = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, hostCard);
|
||||||
targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), ai, hostCard);
|
|
||||||
|
|
||||||
for (final Card c : targetables) {
|
for (final Card c : targetables) {
|
||||||
if (objects.contains(c)) {
|
if (objects.contains(c)) {
|
||||||
|
|||||||
@@ -1737,10 +1737,8 @@ public class AbilityFactoryPump {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Player opp = ai.getOpponent();
|
final Player opp = ai.getOpponent();
|
||||||
List<Card> comp = ai.getCardsIn(ZoneType.Battlefield);
|
List<Card> comp = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
|
||||||
comp = CardLists.getValidCards(comp, valid, source.getController(), source);
|
List<Card> human = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
|
||||||
List<Card> human = opp.getCardsIn(ZoneType.Battlefield);
|
|
||||||
human = CardLists.getValidCards(human, valid, source.getController(), source);
|
|
||||||
|
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
if (tgt != null && sa.canTarget(opp) && params.containsKey("IsCurse")) {
|
if (tgt != null && sa.canTarget(opp) && params.containsKey("IsCurse")) {
|
||||||
|
|||||||
@@ -319,8 +319,7 @@ public class AbilityFactoryRegenerate {
|
|||||||
} else {
|
} else {
|
||||||
tgt.resetTargets();
|
tgt.resetTargets();
|
||||||
// filter AIs battlefield by what I can target
|
// filter AIs battlefield by what I can target
|
||||||
List<Card> targetables = ai.getCardsIn(ZoneType.Battlefield);
|
List<Card> targetables = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, hostCard);
|
||||||
targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), ai, hostCard);
|
|
||||||
targetables = CardLists.getTargetableCards(targetables, sa);
|
targetables = CardLists.getTargetableCards(targetables, sa);
|
||||||
|
|
||||||
if (targetables.size() == 0) {
|
if (targetables.size() == 0) {
|
||||||
|
|||||||
@@ -284,8 +284,8 @@ public class AbilityFactorySacrifice {
|
|||||||
num = (num == null) ? "1" : num;
|
num = (num == null) ? "1" : num;
|
||||||
final int amount = AbilityFactory.calculateAmount(sa.getSourceCard(), num, sa);
|
final int amount = AbilityFactory.calculateAmount(sa.getSourceCard(), num, sa);
|
||||||
|
|
||||||
List<Card> list = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
List<Card> list =
|
||||||
list = CardLists.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
|
|
||||||
if (list.size() == 0) {
|
if (list.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
@@ -425,13 +425,8 @@ public class AbilityFactorySacrifice {
|
|||||||
amount = Math.min(ComputerUtil.determineLeftoverMana(sa, ai), amount);
|
amount = Math.min(ComputerUtil.determineLeftoverMana(sa, ai), amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Card> humanList = opp.getCardsIn(ZoneType.Battlefield);
|
List<Card> humanList =
|
||||||
humanList = CardLists.getValidCards(humanList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
List<Card> computerList = ai.getCardsIn(ZoneType.Battlefield);
|
|
||||||
if (defined.equals("Opponent")) {
|
|
||||||
computerList = new ArrayList<Card>();
|
|
||||||
}
|
|
||||||
computerList = CardLists.getValidCards(computerList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
|
||||||
|
|
||||||
// Since all of the cards have remAIDeck:True, I enabled 1 for 1
|
// Since all of the cards have remAIDeck:True, I enabled 1 for 1
|
||||||
// (or X for X) trades for special decks
|
// (or X for X) trades for special decks
|
||||||
@@ -439,8 +434,8 @@ public class AbilityFactorySacrifice {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (defined.equals("You")) {
|
} else if (defined.equals("You")) {
|
||||||
List<Card> computerList = ai.getCardsIn(ZoneType.Battlefield);
|
List<Card> computerList =
|
||||||
computerList = CardLists.getValidCards(computerList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
for (Card c : computerList) {
|
for (Card c : computerList) {
|
||||||
if (!c.getSVar("SacMe").equals("") || CardFactoryUtil.evaluateCreature(c) <= 135) {
|
if (!c.getSVar("SacMe").equals("") || CardFactoryUtil.evaluateCreature(c) <= 135) {
|
||||||
return true;
|
return true;
|
||||||
@@ -565,8 +560,7 @@ public class AbilityFactorySacrifice {
|
|||||||
*/
|
*/
|
||||||
public static List<Card> sacrificeHuman(final Player p, final int amount, final String valid, final SpellAbility sa,
|
public static List<Card> sacrificeHuman(final Player p, final int amount, final String valid, final SpellAbility sa,
|
||||||
final boolean destroy, final boolean optional) {
|
final boolean destroy, final boolean optional) {
|
||||||
List<Card> battlefield = p.getCardsIn(ZoneType.Battlefield);
|
List<Card> list = AbilityFactory.filterListByType(p.getCardsIn(ZoneType.Battlefield), valid, sa);
|
||||||
List<Card> list = AbilityFactory.filterListByType(battlefield, valid, sa);
|
|
||||||
List<Card> sacList = new ArrayList<Card>();
|
List<Card> sacList = new ArrayList<Card>();
|
||||||
|
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
@@ -856,11 +850,10 @@ public class AbilityFactorySacrifice {
|
|||||||
valid = valid.replace("X", Integer.toString(xPay));
|
valid = valid.replace("X", Integer.toString(xPay));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Card> humanlist = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
List<Card> humanlist =
|
||||||
List<Card> computerlist = ai.getCardsIn(ZoneType.Battlefield);
|
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source);
|
||||||
|
List<Card> computerlist =
|
||||||
humanlist = CardLists.getValidCards(humanlist, valid.split(","), source.getController(), source);
|
CardLists.getValidCards(computerlist = ai.getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source);
|
||||||
computerlist = CardLists.getValidCards(computerlist, valid.split(","), source.getController(), source);
|
|
||||||
|
|
||||||
if (abCost != null) {
|
if (abCost != null) {
|
||||||
// AI currently disabled for some costs
|
// AI currently disabled for some costs
|
||||||
|
|||||||
@@ -924,7 +924,8 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
|
|
||||||
if (params.get("NumCards").equals("X") && source.getSVar("X").startsWith("Count$xPaid")) {
|
if (params.get("NumCards").equals("X") && source.getSVar("X").startsWith("Count$xPaid")) {
|
||||||
// Set PayX here to maximum value.
|
// Set PayX here to maximum value.
|
||||||
final int cardsToDiscard = Math.min(ComputerUtil.determineLeftoverMana(sa, ai), ai.getOpponent().getCardsIn(ZoneType.Library).size());
|
final int cardsToDiscard =
|
||||||
|
Math.min(ComputerUtil.determineLeftoverMana(sa, ai), ai.getOpponent().getCardsIn(ZoneType.Library).size());
|
||||||
source.setSVar("PayX", Integer.toString(cardsToDiscard));
|
source.setSVar("PayX", Integer.toString(cardsToDiscard));
|
||||||
if (cardsToDiscard <= 0) {
|
if (cardsToDiscard <= 0) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class AnimateAllEffect extends SpellEffect
|
|||||||
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
|
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
|
||||||
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
|
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
|
||||||
} else {
|
} else {
|
||||||
list = tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield);
|
list = new ArrayList<Card>(tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield));
|
||||||
}
|
}
|
||||||
|
|
||||||
list = CardLists.getValidCards(list, valid.split(","), host.getController(), host);
|
list = CardLists.getValidCards(list, valid.split(","), host.getController(), host);
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ class CardFactoryArtifacts {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
final Player target = this.getTargetPlayer();
|
final Player target = this.getTargetPlayer();
|
||||||
final List<Card> library = this.getTargetPlayer().getCardsIn(ZoneType.Library);
|
final List<Card> library = new ArrayList<Card>(this.getTargetPlayer().getCardsIn(ZoneType.Library));
|
||||||
|
|
||||||
boolean loop = true;
|
boolean loop = true;
|
||||||
final List<Card> grinding = new ArrayList<Card>();
|
final List<Card> grinding = new ArrayList<Card>();
|
||||||
|
|||||||
@@ -829,8 +829,7 @@ public class CardFactoryCreatures {
|
|||||||
final Player player = card.getController();
|
final Player player = card.getController();
|
||||||
final Player opp = player.getOpponent();
|
final Player opp = player.getOpponent();
|
||||||
int max = 0;
|
int max = 0;
|
||||||
List<Card> play = opp.getCardsIn(ZoneType.Battlefield);
|
List<Card> play = CardLists.filter(opp.getCardsIn(ZoneType.Battlefield), Presets.NON_TOKEN);
|
||||||
play = CardLists.filter(play, Presets.NON_TOKEN);
|
|
||||||
play = CardLists.filter(play, Presets.WHITE);
|
play = CardLists.filter(play, Presets.WHITE);
|
||||||
max += play.size();
|
max += play.size();
|
||||||
|
|
||||||
@@ -1098,7 +1097,7 @@ public class CardFactoryCreatures {
|
|||||||
// name a card
|
// name a card
|
||||||
final String choice = JOptionPane.showInputDialog(null, "Name a card", cardName,
|
final String choice = JOptionPane.showInputDialog(null, "Name a card", cardName,
|
||||||
JOptionPane.QUESTION_MESSAGE);
|
JOptionPane.QUESTION_MESSAGE);
|
||||||
final List<Card> hand = this.getTargetPlayer().getCardsIn(ZoneType.Hand);
|
final List<Card> hand = new ArrayList<Card>(this.getTargetPlayer().getCardsIn(ZoneType.Hand));
|
||||||
int numCards = card.getXManaCostPaid();
|
int numCards = card.getXManaCostPaid();
|
||||||
numCards = Math.min(hand.size(), numCards);
|
numCards = Math.min(hand.size(), numCards);
|
||||||
|
|
||||||
|
|||||||
@@ -91,10 +91,9 @@ class CardFactoryEnchantments {
|
|||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
final Player human = Singletons.getControl().getPlayer();
|
final Player human = Singletons.getControl().getPlayer();
|
||||||
List<Card> grave = human.getCardsIn(ZoneType.Graveyard);
|
List<Card> grave = CardLists.filter(human.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||||
List<Card> aiGrave = human.getOpponent().getCardsIn(ZoneType.Graveyard);
|
List<Card> aiGrave =
|
||||||
grave = CardLists.filter(grave, CardPredicates.Presets.CREATURES);
|
CardLists.filter(human.getOpponent().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||||
aiGrave = CardLists.filter(aiGrave, CardPredicates.Presets.CREATURES);
|
|
||||||
|
|
||||||
if (this.once || ((grave.size() < 2) && (aiGrave.size() < 2))) {
|
if (this.once || ((grave.size() < 2) && (aiGrave.size() < 2))) {
|
||||||
this.once = false;
|
this.once = false;
|
||||||
@@ -112,7 +111,8 @@ class CardFactoryEnchantments {
|
|||||||
|
|
||||||
final Card c = GuiChoose.one("Choose first creature to exile", chooseGrave);
|
final Card c = GuiChoose.one("Choose first creature to exile", chooseGrave);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
List<Card> newGrave = CardLists.filter(c.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
List<Card> newGrave =
|
||||||
|
CardLists.filter(c.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||||
newGrave.remove(c);
|
newGrave.remove(c);
|
||||||
|
|
||||||
final Object o2 = GuiChoose.one("Choose second creature to exile", newGrave);
|
final Object o2 = GuiChoose.one("Choose second creature to exile", newGrave);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class CardFactoryInstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void humanResolve() {
|
public void humanResolve() {
|
||||||
final List<Card> libraryList = card.getController().getCardsIn(ZoneType.Library);
|
final List<Card> libraryList = new ArrayList<Card>(card.getController().getCardsIn(ZoneType.Library));
|
||||||
final List<Card> selectedCards = new ArrayList<Card>();
|
final List<Card> selectedCards = new ArrayList<Card>();
|
||||||
|
|
||||||
Object o = GuiChoose.oneOrNone("Select first card", libraryList);
|
Object o = GuiChoose.oneOrNone("Select first card", libraryList);
|
||||||
@@ -230,7 +230,7 @@ public class CardFactoryInstants {
|
|||||||
final Player player = card.getController();
|
final Player player = card.getController();
|
||||||
final int max = card.getXManaCostPaid();
|
final int max = card.getXManaCostPaid();
|
||||||
|
|
||||||
final List<Card> graveList = tPlayer.getCardsIn(ZoneType.Graveyard);
|
final List<Card> graveList = new ArrayList<Card>(tPlayer.getCardsIn(ZoneType.Graveyard));
|
||||||
final int x = Math.min(max, graveList.size());
|
final int x = Math.min(max, graveList.size());
|
||||||
|
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ public class CardFactorySorceries {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
final Player player = this.getTargetPlayer();
|
final Player player = this.getTargetPlayer();
|
||||||
final List<Card> lib = player.getCardsIn(ZoneType.Library);
|
final List<Card> lib = new ArrayList<Card>(player.getCardsIn(ZoneType.Library));
|
||||||
|
|
||||||
for (final Card c : Iterables.filter(player.getCardsIn(ZoneType.Graveyard), nonBasicLands)) {
|
for (final Card c : Iterables.filter(player.getCardsIn(ZoneType.Graveyard), nonBasicLands)) {
|
||||||
for (final Card rem : Iterables.filter(lib, CardPredicates.nameEquals(c.getName()))) {
|
for (final Card rem : Iterables.filter(lib, CardPredicates.nameEquals(c.getName()))) {
|
||||||
@@ -1152,8 +1152,7 @@ public class CardFactorySorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
List<Card> grave = card.getController().getCardsIn(ZoneType.Graveyard);
|
List<Card> grave = CardLists.filter(card.getController().getCardsIn(ZoneType.Graveyard), Presets.CREATURES);
|
||||||
grave = CardLists.filter(grave, Presets.CREATURES);
|
|
||||||
grave = CardLists.filter(grave, new Predicate<Card>() {
|
grave = CardLists.filter(grave, new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
@@ -1300,9 +1299,9 @@ public class CardFactorySorceries {
|
|||||||
final ArrayList<String> display = new ArrayList<String>();
|
final ArrayList<String> display = new ArrayList<String>();
|
||||||
|
|
||||||
// get all
|
// get all
|
||||||
final List<Card> creatures = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
|
final List<Card> creatures =
|
||||||
List<Card> grave = card.getController().getCardsIn(ZoneType.Graveyard);
|
CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
|
||||||
grave = CardLists.filter(grave, Presets.CREATURES);
|
List<Card> grave = CardLists.filter(card.getController().getCardsIn(ZoneType.Graveyard), Presets.CREATURES);
|
||||||
|
|
||||||
for (Player p : Singletons.getModel().getGame().getPlayers()) {
|
for (Player p : Singletons.getModel().getGame().getPlayers()) {
|
||||||
if (p.canBeTargetedBy(spell)) {
|
if (p.canBeTargetedBy(spell)) {
|
||||||
@@ -1384,8 +1383,7 @@ public class CardFactorySorceries {
|
|||||||
final Card[] newArtifact = new Card[1];
|
final Card[] newArtifact = new Card[1];
|
||||||
|
|
||||||
// Sacrifice an artifact
|
// Sacrifice an artifact
|
||||||
List<Card> arts = p.getCardsIn(ZoneType.Battlefield);
|
List<Card> arts = CardLists.filter(p.getCardsIn(ZoneType.Battlefield), Presets.ARTIFACTS);
|
||||||
arts = CardLists.filter(arts, Presets.ARTIFACTS);
|
|
||||||
final Object toSac = GuiChoose.oneOrNone("Sacrifice an artifact", arts);
|
final Object toSac = GuiChoose.oneOrNone("Sacrifice an artifact", arts);
|
||||||
if (toSac != null) {
|
if (toSac != null) {
|
||||||
final Card c = (Card) toSac;
|
final Card c = (Card) toSac;
|
||||||
|
|||||||
@@ -3207,8 +3207,7 @@ public class CardFactoryUtil {
|
|||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public static int getUsableManaSources(final Player player) {
|
public static int getUsableManaSources(final Player player) {
|
||||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
List<Card> list = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||||
list = CardLists.filter(list, new Predicate<Card>() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
for (final AbilityMana am : c.getAIPlayableMana()) {
|
for (final AbilityMana am : c.getAIPlayableMana()) {
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ public class CostExile extends CostPartWithList {
|
|||||||
this.done();
|
this.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.typeList = sa.getActivatingPlayer().getCardsIn(part.getFrom());
|
this.typeList = new ArrayList<Card>(sa.getActivatingPlayer().getCardsIn(part.getFrom()));
|
||||||
this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
|
|
||||||
for (int i = 0; i < nNeeded; i++) {
|
for (int i = 0; i < nNeeded; i++) {
|
||||||
@@ -534,7 +534,7 @@ public class CostExile extends CostPartWithList {
|
|||||||
} else if (part.getFrom().equals(ZoneType.Stack)) {
|
} else if (part.getFrom().equals(ZoneType.Stack)) {
|
||||||
msg.append(" from the Stack");
|
msg.append(" from the Stack");
|
||||||
}
|
}
|
||||||
this.typeList = sa.getActivatingPlayer().getCardsIn(part.getFrom());
|
this.typeList = new ArrayList<Card>(sa.getActivatingPlayer().getCardsIn(part.getFrom()));
|
||||||
this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
|
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
|
||||||
ButtonUtil.enableOnlyCancel();
|
ButtonUtil.enableOnlyCancel();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package forge.card.cost;
|
package forge.card.cost;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
@@ -419,7 +420,7 @@ public class CostRemoveCounter extends CostPartWithList {
|
|||||||
this.done();
|
this.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.typeList = sa.getActivatingPlayer().getCardsIn(costRemoveCounter.getZone());
|
this.typeList = new ArrayList<Card>(sa.getActivatingPlayer().getCardsIn(costRemoveCounter.getZone()));
|
||||||
this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
|
|
||||||
for (int i = 0; i < nNeeded; i++) {
|
for (int i = 0; i < nNeeded; i++) {
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ public class SpellPermanent extends Spell {
|
|||||||
} else if (controller.isHuman()) {
|
} else if (controller.isHuman()) {
|
||||||
Singletons.getModel().getMatch().getInput().setInput(SpellPermanent.this.championInputComes);
|
Singletons.getModel().getMatch().getInput().setInput(SpellPermanent.this.championInputComes);
|
||||||
} else { // Computer
|
} else { // Computer
|
||||||
List<Card> computer = controller.getCardsIn(ZoneType.Battlefield);
|
List<Card> computer =
|
||||||
computer = CardLists.getValidCards(computer, SpellPermanent.this.championValid, controller, source);
|
CardLists.getValidCards(controller.getCardsIn(ZoneType.Battlefield), SpellPermanent.this.championValid, controller, source);
|
||||||
computer.remove(source);
|
computer.remove(source);
|
||||||
|
|
||||||
CardLists.shuffle(computer);
|
CardLists.shuffle(computer);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class InputMulligan extends Input {
|
|||||||
|
|
||||||
if (c0.getName().equals("Serum Powder") && z0.is(ZoneType.Hand)) {
|
if (c0.getName().equals("Serum Powder") && z0.is(ZoneType.Hand)) {
|
||||||
if (GameActionUtil.showYesNoDialog(c0, "Use " + c0.getName() + "'s ability?")) {
|
if (GameActionUtil.showYesNoDialog(c0, "Use " + c0.getName() + "'s ability?")) {
|
||||||
List<Card> hand = c0.getController().getCardsIn(ZoneType.Hand);
|
List<Card> hand = new ArrayList<Card>(c0.getController().getCardsIn(ZoneType.Hand));
|
||||||
for (Card c : hand) {
|
for (Card c : hand) {
|
||||||
Singletons.getModel().getGame().getAction().exile(c);
|
Singletons.getModel().getGame().getAction().exile(c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3080,8 +3080,8 @@ public class CombatUtil {
|
|||||||
final Ability ability4 = new Ability(c, "0") {
|
final Ability ability4 = new Ability(c, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
List<Card> enchantments = attacker.getController().getCardsIn(ZoneType.Library);
|
List<Card> enchantments =
|
||||||
enchantments = CardLists.filter(enchantments, new Predicate<Card>() {
|
CardLists.filter(attacker.getController().getCardsIn(ZoneType.Library), new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
if (attacker.hasKeyword("Protection from enchantments")
|
if (attacker.hasKeyword("Protection from enchantments")
|
||||||
|
|||||||
@@ -670,9 +670,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
|||||||
*/
|
*/
|
||||||
public final void resetAttackedThisCombat(final Player player) {
|
public final void resetAttackedThisCombat(final Player player) {
|
||||||
// resets the status of attacked/blocked this phase
|
// resets the status of attacked/blocked this phase
|
||||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
List<Card> list = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||||
|
|
||||||
list = CardLists.filter(list, CardPredicates.Presets.CREATURES);
|
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
final Card c = list.get(i);
|
final Card c = list.get(i);
|
||||||
|
|||||||
@@ -1961,8 +1961,10 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
oathFlag = false;
|
oathFlag = false;
|
||||||
}
|
}
|
||||||
} else { // if player == Computer
|
} else { // if player == Computer
|
||||||
final List<Card> creaturesInLibrary = CardLists.filter(player.getCardsIn(ZoneType.Library), CardPredicates.Presets.CREATURES);
|
final List<Card> creaturesInLibrary =
|
||||||
final List<Card> creaturesInBattlefield = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
CardLists.filter(player.getCardsIn(ZoneType.Library), CardPredicates.Presets.CREATURES);
|
||||||
|
final List<Card> creaturesInBattlefield =
|
||||||
|
CardLists.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||||
|
|
||||||
// if there are at least 3 creatures in library,
|
// if there are at least 3 creatures in library,
|
||||||
// or none in play with one in library, oath
|
// or none in play with one in library, oath
|
||||||
@@ -2005,7 +2007,6 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
ability.setDescription(sb.toString());
|
ability.setDescription(sb.toString());
|
||||||
|
|
||||||
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
|
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // upkeepOathOfDruids()
|
} // upkeepOathOfDruids()
|
||||||
@@ -2028,7 +2029,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
final Ability ability = new Ability(oathList.get(0), "0") {
|
final Ability ability = new Ability(oathList.get(0), "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
final List<Card> graveyardCreatures = CardLists.filter(player.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
final List<Card> graveyardCreatures =
|
||||||
|
CardLists.filter(player.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||||
|
|
||||||
if (GameState.compareTypeAmountInGraveyard(player, "Creature") > 0) {
|
if (GameState.compareTypeAmountInGraveyard(player, "Creature") > 0) {
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
@@ -2066,7 +2068,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
*/
|
*/
|
||||||
private static void upkeepKarma() {
|
private static void upkeepKarma() {
|
||||||
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
|
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
|
||||||
final List<Card> karmas = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Karma"));
|
final List<Card> karmas =
|
||||||
|
CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Karma"));
|
||||||
final List<Card> swamps = CardLists.getType(player.getCardsIn(ZoneType.Battlefield), "Swamp");
|
final List<Card> swamps = CardLists.getType(player.getCardsIn(ZoneType.Battlefield), "Swamp");
|
||||||
|
|
||||||
// determine how much damage to deal the current player
|
// determine how much damage to deal the current player
|
||||||
@@ -2276,9 +2279,9 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
final Ability ability = new Ability(source, "0") {
|
final Ability ability = new Ability(source, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
List<Card> enchantmentsInLibrary = source.getController().getCardsIn(ZoneType.Library);
|
|
||||||
final List<Card> enchantmentsAttached = new ArrayList<Card>(source.getEnchantingPlayer().getEnchantedBy());
|
final List<Card> enchantmentsAttached = new ArrayList<Card>(source.getEnchantingPlayer().getEnchantedBy());
|
||||||
enchantmentsInLibrary = CardLists.filter(enchantmentsInLibrary, new Predicate<Card>() {
|
List<Card> enchantmentsInLibrary =
|
||||||
|
CardLists.filter(source.getController().getCardsIn(ZoneType.Library), new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
return c.isEnchantment() && c.hasKeyword("Enchant player")
|
return c.isEnchantment() && c.hasKeyword("Enchant player")
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class ComputerAIGeneral implements Computer {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean hasACardGivingHaste(final Player ai) {
|
public static boolean hasACardGivingHaste(final Player ai) {
|
||||||
final List<Card> all = ai.getCardsIn(ZoneType.Battlefield);
|
final List<Card> all = new ArrayList<Card>(ai.getCardsIn(ZoneType.Battlefield));
|
||||||
all.addAll(CardFactoryUtil.getExternalZoneActivationCards(ai));
|
all.addAll(CardFactoryUtil.getExternalZoneActivationCards(ai));
|
||||||
all.addAll(ai.getCardsIn(ZoneType.Hand));
|
all.addAll(ai.getCardsIn(ZoneType.Hand));
|
||||||
|
|
||||||
|
|||||||
@@ -1855,8 +1855,9 @@ public class ComputerUtil {
|
|||||||
* the source SpellAbility
|
* the source SpellAbility
|
||||||
* @return the card list
|
* @return the card list
|
||||||
*/
|
*/
|
||||||
public static List<Card> sacrificePermanents(final Player ai, final int amount, final List<Card> list, final boolean destroy,
|
public static List<Card> sacrificePermanents(final Player ai, final int amount, final List<Card> cardlist, final boolean destroy,
|
||||||
SpellAbility source) {
|
SpellAbility source) {
|
||||||
|
final List<Card> list = new ArrayList<Card>(cardlist);
|
||||||
final List<Card> sacList = new ArrayList<Card>();
|
final List<Card> sacList = new ArrayList<Card>();
|
||||||
// used in Annihilator and AF_Sacrifice
|
// used in Annihilator and AF_Sacrifice
|
||||||
int max = list.size();
|
int max = list.size();
|
||||||
|
|||||||
@@ -1700,7 +1700,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
|||||||
* @return the card list
|
* @return the card list
|
||||||
*/
|
*/
|
||||||
public final List<Card> mill(final int n, final ZoneType zone, final boolean bottom) {
|
public final List<Card> mill(final int n, final ZoneType zone, final boolean bottom) {
|
||||||
final List<Card> lib = this.getCardsIn(ZoneType.Library);
|
final List<Card> lib = new ArrayList<Card>(this.getCardsIn(ZoneType.Library));
|
||||||
final List<Card> milled = new ArrayList<Card>();
|
final List<Card> milled = new ArrayList<Card>();
|
||||||
|
|
||||||
final int max = Math.min(n, lib.size());
|
final int max = Math.min(n, lib.size());
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ public final class PlayerUtil {
|
|||||||
*/
|
*/
|
||||||
public static Input inputSacrificePermanents(final int nCards) {
|
public static Input inputSacrificePermanents(final int nCards) {
|
||||||
final List<Card> list = Singletons.getControl().getPlayer().getCardsIn(ZoneType.Battlefield);
|
final List<Card> list = Singletons.getControl().getPlayer().getCardsIn(ZoneType.Battlefield);
|
||||||
|
|
||||||
return PlayerUtil.inputSacrificePermanentsFromList(nCards, list, "Select a permanent to sacrifice");
|
return PlayerUtil.inputSacrificePermanentsFromList(nCards, list, "Select a permanent to sacrifice");
|
||||||
} // input_sacrificePermanents()
|
} // input_sacrificePermanents()
|
||||||
|
|
||||||
@@ -260,9 +261,8 @@ public final class PlayerUtil {
|
|||||||
* @since 1.0.15
|
* @since 1.0.15
|
||||||
*/
|
*/
|
||||||
public static Input inputSacrificePermanents(final int nCards, final String type) {
|
public static Input inputSacrificePermanents(final int nCards, final String type) {
|
||||||
List<Card> list = Singletons.getControl().getPlayer().getCardsIn(ZoneType.Battlefield);
|
final List<Card> list = CardLists.getType(Singletons.getControl().getPlayer().getCardsIn(ZoneType.Battlefield), type);
|
||||||
|
|
||||||
list = CardLists.getType(list, type);
|
|
||||||
return PlayerUtil.inputSacrificePermanentsFromList(nCards, list, "Select a " + type + " to sacrifice");
|
return PlayerUtil.inputSacrificePermanentsFromList(nCards, list, "Select a " + type + " to sacrifice");
|
||||||
} // input_sacrificePermanents()
|
} // input_sacrificePermanents()
|
||||||
|
|
||||||
|
|||||||
@@ -121,15 +121,15 @@ public class PlayerZoneBattlefield extends PlayerZone {
|
|||||||
if (c.isLand()) {
|
if (c.isLand()) {
|
||||||
|
|
||||||
// Tectonic Instability
|
// Tectonic Instability
|
||||||
final List<Card> tis = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tectonic Instability"));
|
final List<Card> tis =
|
||||||
|
CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tectonic Instability"));
|
||||||
final Card tisLand = c;
|
final Card tisLand = c;
|
||||||
for (final Card ti : tis) {
|
for (final Card ti : tis) {
|
||||||
final Card source = ti;
|
final Card source = ti;
|
||||||
final SpellAbility ability = new Ability(source, "") {
|
final SpellAbility ability = new Ability(source, "") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
List<Card> lands = tisLand.getController().getCardsIn(ZoneType.Battlefield);
|
List<Card> lands = CardLists.filter(tisLand.getController().getCardsIn(ZoneType.Battlefield), Presets.LANDS);
|
||||||
lands = CardLists.filter(lands, Presets.LANDS);
|
|
||||||
for (final Card land : lands) {
|
for (final Card land : lands) {
|
||||||
land.tap();
|
land.tap();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user