- Merge: Merge the latest trunk into SplitCards.

This commit is contained in:
Agetian
2013-03-03 18:22:56 +00:00
8 changed files with 32 additions and 4 deletions

View File

@@ -143,7 +143,6 @@ public class AbilityUtils {
final Object crd = root.getTriggeringObject(defined.substring(9));
if (crd instanceof Card) {
c = Singletons.getModel().getGame().getCardState((Card) crd);
c = (Card) crd;
} else if (crd instanceof List<?>) {
for (final Card cardItem : (List<Card>) crd) {
cards.add(cardItem);

View File

@@ -81,6 +81,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (value.equals("Kicked")) {
this.setKicked(true);
}
if (value.equals("AllTargetsLegal")) {
this.setAllTargetsLegal(true);
}
}
if (params.containsKey("ConditionZone")) {
@@ -196,6 +199,14 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
return false;
}
}
if (this.isAllTargetsLegal()) {
SpellAbility root = sa.getRootAbility();
for (Card c : root.getTarget().getTargetCards()) {
if (!CardFactoryUtil.isTargetStillValid(sa, c)) {
return false;
}
}
}
if (this.isSorcerySpeed() && !activator.canCastSorcery()) {
return false;

View File

@@ -69,6 +69,7 @@ public class SpellAbilityVariables {
this.threshold = sav.isThreshold();
this.metalcraft = sav.isThreshold();
this.hellbent = sav.isHellbent();
this.allTargetsLegal = sav.isAllTargetsLegal();
this.prowl = new ArrayList<String>(sav.getProwl());
this.isPresent = sav.getIsPresent();
this.presentCompare = sav.getPresentCompare();
@@ -136,6 +137,8 @@ public class SpellAbilityVariables {
/** The Kicked. */
private boolean kicked = false;
private boolean allTargetsLegal = false;
/** The prowl. */
private ArrayList<String> prowl = new ArrayList<String>();
@@ -519,6 +522,21 @@ public class SpellAbilityVariables {
}
/**
* @return the allTargetsLegal
*/
public boolean isAllTargetsLegal() {
return allTargetsLegal;
}
/**
* @param allTargetsLegal0 the allTargetsLegal to set
*/
public void setAllTargetsLegal(boolean allTargets) {
this.allTargetsLegal = allTargets;
}
/**
* <p>
* Setter for the field <code>prowl</code>.

View File

@@ -248,7 +248,7 @@ public class GameAction {
copied.getCharacteristics().resetCardColor();
}
if (zoneFrom.is(ZoneType.Battlefield)) {
if (zoneFrom.is(ZoneType.Battlefield) && !c.isToken()) {
copied.setSuspendCast(false);
copied.setState(CardCharacteristicName.Original);
// Soulbond unpairing

View File

@@ -460,6 +460,7 @@ public class ComputerUtilMana {
private static List<Card> getAvailableMana(final Player ai, final boolean checkPlayable) {
final GameState game = Singletons.getModel().getGame();
final List<Card> list = ai.getCardsIn(ZoneType.Battlefield);
list.addAll(ai.getCardsIn(ZoneType.Hand));
final List<Card> manaSources = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {