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