mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- More getCards read-only list errors.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -114,7 +115,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
List<Card> handList = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> handList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Hand));
|
||||
String type = this.getType();
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
@@ -179,7 +180,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
@Override
|
||||
public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
List<Card> handList = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> handList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Hand));
|
||||
String discType = this.getType();
|
||||
final String amount = this.getAmount();
|
||||
this.resetList();
|
||||
|
||||
@@ -207,7 +207,7 @@ public class CostExile extends CostPartWithList {
|
||||
final String amount = this.getAmount();
|
||||
Integer c = this.convertAmount();
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
List<Card> list = activator.getCardsIn(this.getFrom());
|
||||
List<Card> list = new ArrayList<Card>(activator.getCardsIn(this.getFrom()));
|
||||
if (this.getType().equals("All")) {
|
||||
this.setList(list);
|
||||
for (final Card card : list) {
|
||||
@@ -258,7 +258,7 @@ public class CostExile extends CostPartWithList {
|
||||
if (this.getThis()) {
|
||||
this.getList().add(source);
|
||||
} else if (this.getType().equals("All")) {
|
||||
this.setList(ability.getActivatingPlayer().getCardsIn(this.getFrom()));
|
||||
this.setList(new ArrayList<Card>(ability.getActivatingPlayer().getCardsIn(this.getFrom())));
|
||||
} else {
|
||||
Integer c = this.convertAmount();
|
||||
if (c == null) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -94,7 +95,7 @@ public class CostMill extends CostPartWithList {
|
||||
c = AbilityFactory.calculateAmount(source, this.getAmount(), ability);
|
||||
}
|
||||
|
||||
this.setList(ai.getCardsIn(ZoneType.Library, c));
|
||||
this.setList(new ArrayList<Card>(ai.getCardsIn(ZoneType.Library, c)));
|
||||
|
||||
if ((this.getList() == null) || (this.getList().size() < c)) {
|
||||
return false;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
@@ -108,7 +109,7 @@ public class CostReturn extends CostPartWithList {
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
if (!this.getThis()) {
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
@@ -233,7 +234,7 @@ public class CostReturn extends CostPartWithList {
|
||||
msg.append("s");
|
||||
}
|
||||
|
||||
this.typeList = sa.getActivatingPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
this.typeList = new ArrayList<Card>(sa.getActivatingPlayer().getCardsIn(ZoneType.Battlefield));
|
||||
this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
@@ -98,7 +99,7 @@ public class CostReveal extends CostPartWithList {
|
||||
@Override
|
||||
public final boolean decideAIPayment(final Player ai, final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
final String type = this.getType();
|
||||
List<Card> hand = ai.getCardsIn(ZoneType.Hand);
|
||||
List<Card> hand = new ArrayList<Card>(ai.getCardsIn(ZoneType.Hand));
|
||||
this.resetList();
|
||||
|
||||
if (this.getThis()) {
|
||||
@@ -155,7 +156,7 @@ public class CostReveal extends CostPartWithList {
|
||||
this.addToList(source);
|
||||
payment.setPaidManaPart(this);
|
||||
} else if (this.getType().equals("Hand")) {
|
||||
this.setList(activator.getCardsIn(ZoneType.Hand));
|
||||
this.setList(new ArrayList<Card>(activator.getCardsIn(ZoneType.Hand)));
|
||||
payment.setPaidManaPart(this);
|
||||
} else {
|
||||
Integer num = this.convertAmount();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
@@ -101,7 +102,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
// You can always sac all
|
||||
if (!this.getThis()) {
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
@@ -156,7 +157,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
final String amount = this.getAmount();
|
||||
final String type = this.getType();
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
List<Card> list = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
|
||||
list = CardLists.getValidCards(list, type.split(";"), activator, source);
|
||||
if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
|
||||
list = CardLists.getNotType(list, "Creature");
|
||||
@@ -206,7 +207,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
if (this.getThis()) {
|
||||
this.getList().add(source);
|
||||
} else if (this.getAmount().equals("All")) {
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
|
||||
typeList = CardLists.getNotType(typeList, "Creature");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
@@ -116,7 +117,7 @@ public class CostTapType extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
@@ -155,7 +156,7 @@ public class CostTapType extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
List<Card> typeList = ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = new ArrayList<Card>(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield));
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
||||
final String amount = this.getAmount();
|
||||
|
||||
Reference in New Issue
Block a user