mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
* Improved mana source check. Fixed #1513.
This commit is contained in:
parent
6726f48669
commit
74799d286b
19 changed files with 294 additions and 170 deletions
|
|
@ -127,7 +127,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (this.size() == 0 || noMana) {
|
||||
if (this.isEmpty() || noMana) {
|
||||
setPaid();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -330,35 +330,28 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
if (symbol.length() == 1 || isNumeric(symbol)) {
|
||||
if (Character.isDigit(symbol.charAt(0))) {
|
||||
this.add(new GenericManaCost(Integer.valueOf(symbol)));
|
||||
} else {
|
||||
if (symbol.equals("S")) {
|
||||
this.add(new SnowManaCost());
|
||||
} else if (symbol.equals("C")) {
|
||||
this.add(new ColorlessManaCost(1));
|
||||
} else if (!symbol.equals("X")) {
|
||||
this.add(new ColoredManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
|
||||
} else {
|
||||
// check X wasn't added before
|
||||
if (modifierForX == 0) {
|
||||
// count X occurence
|
||||
for (String s : symbols) {
|
||||
if (s.equals("X")) {
|
||||
modifierForX++;
|
||||
}
|
||||
}
|
||||
this.add(new VariableManaCost(modifierForX));
|
||||
} else if (symbol.equals("S")) {
|
||||
this.add(new SnowManaCost());
|
||||
} else if (symbol.equals("C")) {
|
||||
this.add(new ColorlessManaCost(1));
|
||||
} else if (!symbol.equals("X")) {
|
||||
this.add(new ColoredManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
|
||||
} else // check X wasn't added before
|
||||
if (modifierForX == 0) {
|
||||
// count X occurence
|
||||
for (String s : symbols) {
|
||||
if (s.equals("X")) {
|
||||
modifierForX++;
|
||||
}
|
||||
}
|
||||
//TODO: handle multiple {X} and/or {Y} symbols
|
||||
}
|
||||
this.add(new VariableManaCost(modifierForX));
|
||||
} //TODO: handle multiple {X} and/or {Y} symbols
|
||||
} else if (Character.isDigit(symbol.charAt(0))) {
|
||||
this.add((T) new MonoHybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
} else if (symbol.contains("P")) {
|
||||
this.add((T) new PhyrexianManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
|
||||
} else {
|
||||
if (Character.isDigit(symbol.charAt(0))) {
|
||||
this.add((T) new MonoHybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
} else if (symbol.contains("P")) {
|
||||
this.add((T) new PhyrexianManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
|
||||
} else {
|
||||
this.add((T) new HybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(0)), ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
}
|
||||
this.add((T) new HybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(0)), ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.filter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -36,7 +35,7 @@ import mage.game.Game;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @author North
|
||||
*
|
||||
*
|
||||
* @param <E>
|
||||
*/
|
||||
public interface Filter<E> extends Serializable {
|
||||
|
|
@ -64,9 +63,13 @@ public interface Filter<E> extends Serializable {
|
|||
}
|
||||
|
||||
boolean match(E o, Game game);
|
||||
|
||||
void add(Predicate predicate);
|
||||
|
||||
boolean checkObjectClass(Object object);
|
||||
|
||||
String getMessage();
|
||||
|
||||
void setMessage(String message);
|
||||
|
||||
Filter<E> copy();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
|
@ -20,16 +20,16 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.filter;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
|
||||
|
|
@ -60,9 +60,14 @@ public class FilterAbility extends FilterImpl<Ability> {
|
|||
return new AbilityTypePredicate(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return object instanceof Ability;
|
||||
}
|
||||
|
||||
private static final class AbilityZonePredicate implements Predicate<Ability> {
|
||||
|
||||
private Zone zone;
|
||||
private final Zone zone;
|
||||
|
||||
public AbilityZonePredicate(Zone zone) {
|
||||
this.zone = zone;
|
||||
|
|
@ -81,7 +86,7 @@ public class FilterAbility extends FilterImpl<Ability> {
|
|||
|
||||
private static final class AbilityTypePredicate implements Predicate<Ability> {
|
||||
|
||||
private AbilityType type;
|
||||
private final AbilityType type;
|
||||
|
||||
public AbilityTypePredicate(AbilityType type) {
|
||||
this.type = type;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,10 @@ public abstract class FilterImpl<E> implements Filter<E> {
|
|||
|
||||
@Override
|
||||
public boolean match(E e, Game game) {
|
||||
return Predicates.and(predicates).apply(e, game);
|
||||
if (checkObjectClass(e)) {
|
||||
return Predicates.and(predicates).apply(e, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ public class FilterObject<E extends MageObject> extends FilterImpl<E> {
|
|||
return new FilterObject<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return object instanceof MageObject;
|
||||
}
|
||||
|
||||
public FilterObject(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ public class FilterPermanent extends FilterObject<Permanent> implements FilterIn
|
|||
this.add(new SubtypePredicate(subtype));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return object instanceof Permanent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
|
||||
if (!this.match(permanent, game)) {
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.filter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -64,6 +63,11 @@ public class FilterPlayer extends FilterImpl<Player> {
|
|||
extraPredicates.add(predicate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return object instanceof Player;
|
||||
}
|
||||
|
||||
public boolean match(Player player, UUID sourceId, UUID playerId, Game game) {
|
||||
if (!this.match(player, game)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.filter.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -54,6 +53,11 @@ public class FilterControlledCreatureInPlay extends FilterImpl<Object> implement
|
|||
creatureFilter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return object instanceof Permanent;
|
||||
}
|
||||
|
||||
public FilterControlledCreatureInPlay(final FilterControlledCreatureInPlay filter) {
|
||||
super(filter);
|
||||
this.creatureFilter = filter.creatureFilter.copy();
|
||||
|
|
@ -62,7 +66,7 @@ public class FilterControlledCreatureInPlay extends FilterImpl<Object> implement
|
|||
@Override
|
||||
public boolean match(Object o, Game game) {
|
||||
if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent)o, game);
|
||||
return creatureFilter.match((Permanent) o, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -70,7 +74,7 @@ public class FilterControlledCreatureInPlay extends FilterImpl<Object> implement
|
|||
@Override
|
||||
public boolean match(Object o, UUID sourceId, UUID playerId, Game game) {
|
||||
if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent)o, sourceId, playerId, game);
|
||||
return creatureFilter.match((Permanent) o, sourceId, playerId, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,19 +24,17 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.filter.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageItem;
|
||||
import mage.filter.FilterImpl;
|
||||
import mage.filter.FilterInPlay;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.MageItem;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -63,13 +61,17 @@ public class FilterCreatureOrPlayer extends FilterImpl<MageItem> implements Filt
|
|||
this.playerFilter = filter.playerFilter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(MageItem o, Game game) {
|
||||
if (o instanceof Player) {
|
||||
return playerFilter.match((Player)o, game);
|
||||
}
|
||||
else if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent)o, game);
|
||||
return playerFilter.match((Player) o, game);
|
||||
} else if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent) o, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -77,10 +79,9 @@ public class FilterCreatureOrPlayer extends FilterImpl<MageItem> implements Filt
|
|||
@Override
|
||||
public boolean match(MageItem o, UUID sourceId, UUID playerId, Game game) {
|
||||
if (o instanceof Player) {
|
||||
return playerFilter.match((Player)o, sourceId, playerId, game);
|
||||
}
|
||||
else if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent)o, sourceId, playerId, game);
|
||||
return playerFilter.match((Player) o, sourceId, playerId, game);
|
||||
} else if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent) o, sourceId, playerId, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.filter.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageItem;
|
||||
import mage.filter.FilterImpl;
|
||||
import mage.filter.FilterInPlay;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
|
@ -36,9 +37,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageItem;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
|
@ -63,6 +61,11 @@ public class FilterPermanentOrPlayer extends FilterImpl<MageItem> implements Fil
|
|||
this.playerFilter = filter.playerFilter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(MageItem o, Game game) {
|
||||
if (o instanceof Player) {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,11 @@ public class FilterPlaneswalkerOrPlayer extends FilterImpl<Object> {
|
|||
this.playerFilter = filter.playerFilter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(Object o, Game game) {
|
||||
if (o instanceof Player) {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ public class FilterSpellOrPermanent extends FilterImpl<Object> implements Filter
|
|||
this.spellFilter = filter.spellFilter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(Object o, Game game) {
|
||||
if (o instanceof Spell) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
|
@ -130,8 +129,7 @@ public class ManaPool implements Serializable {
|
|||
}
|
||||
for (ManaPoolItem mana : manaItems) {
|
||||
if (filter != null) {
|
||||
MageObject sourceObject = game.getObject(mana.getSourceId());
|
||||
if (!filter.match(sourceObject, game)) {
|
||||
if (!filter.match(mana.getSourceObject(), game)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,7 +168,7 @@ public class ManaPool implements Serializable {
|
|||
if (mana.isConditional()
|
||||
&& mana.getConditionalMana().get(manaType) > 0
|
||||
&& mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) {
|
||||
if (filter == null || filter.match(game.getObject(mana.getSourceId()), game)) {
|
||||
if (filter == null || filter.match(mana.getSourceObject(), game)) {
|
||||
return mana.getConditionalMana().get(manaType);
|
||||
}
|
||||
}
|
||||
|
|
@ -378,13 +376,13 @@ public class ManaPool implements Serializable {
|
|||
Mana mana = manaToAdd.copy();
|
||||
if (!game.replaceEvent(new ManaEvent(EventType.ADD_MANA, source.getId(), source.getSourceId(), playerId, mana))) {
|
||||
if (mana instanceof ConditionalMana) {
|
||||
ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceId(), source.getOriginalId());
|
||||
ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game), source.getOriginalId());
|
||||
if (emptyOnTurnsEnd) {
|
||||
item.setDuration(Duration.EndOfTurn);
|
||||
}
|
||||
this.manaItems.add(item);
|
||||
} else {
|
||||
ManaPoolItem item = new ManaPoolItem(mana.getRed(), mana.getGreen(), mana.getBlue(), mana.getWhite(), mana.getBlack(), mana.getGeneric() + mana.getColorless(), source.getSourceId(), source.getOriginalId(), mana.getFlag());
|
||||
ManaPoolItem item = new ManaPoolItem(mana.getRed(), mana.getGreen(), mana.getBlue(), mana.getWhite(), mana.getBlack(), mana.getGeneric() + mana.getColorless(), source.getSourceObject(game), source.getOriginalId(), mana.getFlag());
|
||||
if (emptyOnTurnsEnd) {
|
||||
item.setDuration(Duration.EndOfTurn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.players;
|
|||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.ManaType;
|
||||
|
|
@ -47,7 +48,7 @@ public class ManaPoolItem implements Serializable {
|
|||
private int black = 0;
|
||||
private int colorless = 0;
|
||||
private ConditionalMana conditionalMana;
|
||||
private UUID sourceId;
|
||||
private MageObject sourceObject;
|
||||
private UUID originalId; // originalId of the mana producing ability
|
||||
private boolean flag = false;
|
||||
private Duration duration;
|
||||
|
|
@ -56,24 +57,24 @@ public class ManaPoolItem implements Serializable {
|
|||
public ManaPoolItem() {
|
||||
}
|
||||
|
||||
public ManaPoolItem(int red, int green, int blue, int white, int black, int colorless, UUID sourceId, UUID originalId, boolean flag) {
|
||||
public ManaPoolItem(int red, int green, int blue, int white, int black, int colorless, MageObject sourceObject, UUID originalId, boolean flag) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
this.white = white;
|
||||
this.black = black;
|
||||
this.colorless = colorless;
|
||||
this.sourceId = sourceId;
|
||||
this.sourceObject = sourceObject;
|
||||
this.originalId = originalId;
|
||||
this.flag = flag;
|
||||
this.duration = Duration.EndOfStep;
|
||||
}
|
||||
|
||||
public ManaPoolItem(ConditionalMana conditionalMana, UUID sourceId, UUID originalId) {
|
||||
public ManaPoolItem(ConditionalMana conditionalMana, MageObject sourceObject, UUID originalId) {
|
||||
this.conditionalMana = conditionalMana;
|
||||
this.sourceId = sourceId;
|
||||
this.sourceObject = sourceObject;
|
||||
this.originalId = originalId;
|
||||
this.conditionalMana.setManaProducerId(sourceId);
|
||||
this.conditionalMana.setManaProducerId(sourceObject.getId());
|
||||
this.conditionalMana.setManaProducerOriginalId(originalId);
|
||||
this.flag = conditionalMana.getFlag();
|
||||
this.duration = Duration.EndOfStep;
|
||||
|
|
@ -89,7 +90,7 @@ public class ManaPoolItem implements Serializable {
|
|||
if (item.conditionalMana != null) {
|
||||
this.conditionalMana = item.conditionalMana.copy();
|
||||
}
|
||||
this.sourceId = item.sourceId;
|
||||
this.sourceObject = item.sourceObject;
|
||||
this.originalId = item.originalId;
|
||||
this.flag = item.flag;
|
||||
this.duration = item.duration;
|
||||
|
|
@ -100,8 +101,12 @@ public class ManaPoolItem implements Serializable {
|
|||
return new ManaPoolItem(this);
|
||||
}
|
||||
|
||||
public MageObject getSourceObject() {
|
||||
return sourceObject;
|
||||
}
|
||||
|
||||
public UUID getSourceId() {
|
||||
return sourceId;
|
||||
return sourceObject.getId();
|
||||
}
|
||||
|
||||
public UUID getOriginalId() {
|
||||
|
|
|
|||
|
|
@ -2336,8 +2336,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
// returns only mana producers that don't require mana payment
|
||||
protected List<Permanent> getAvailableManaProducers(Game game) {
|
||||
List<Permanent> result = new ArrayList<>();
|
||||
protected List<MageObject> getAvailableManaProducers(Game game) {
|
||||
List<MageObject> result = new ArrayList<>();
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(playerId)) {
|
||||
boolean canAdd = false;
|
||||
for (ManaAbility ability : permanent.getAbilities().getManaAbilities(Zone.BATTLEFIELD)) {
|
||||
|
|
@ -2353,6 +2353,21 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
result.add(permanent);
|
||||
}
|
||||
}
|
||||
for (Card card : getHand().getCards(game)) {
|
||||
boolean canAdd = false;
|
||||
for (ManaAbility ability : card.getAbilities(game).getManaAbilities(Zone.HAND)) {
|
||||
if (!ability.getManaCosts().isEmpty()) {
|
||||
canAdd = false;
|
||||
break;
|
||||
}
|
||||
if (ability.canActivate(playerId, game)) {
|
||||
canAdd = true;
|
||||
}
|
||||
}
|
||||
if (canAdd) {
|
||||
result.add(card);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue