Player: add hasDesert for Desert Battlefield or Graveyard checks

This commit is contained in:
Hanmac
2017-06-17 13:17:03 +00:00
parent 662be6b56e
commit 8ba50cf61f
5 changed files with 27 additions and 2 deletions

View File

@@ -1882,6 +1882,12 @@ public class Player extends GameEntity implements Comparable<Player> {
return CardLists.count(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS) >= 3; return CardLists.count(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS) >= 3;
} }
public final boolean hasDesert() {
return CardLists.count(
getCardsIn(Arrays.asList(ZoneType.Battlefield, ZoneType.Graveyard)),
CardPredicates.isType("Desert")) > 0;
}
public final boolean hasThreshold() { public final boolean hasThreshold() {
return getZone(ZoneType.Graveyard).size() >= 7; return getZone(ZoneType.Graveyard).size() >= 7;
} }

View File

@@ -94,6 +94,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (value.equals("Revolt")) { if (value.equals("Revolt")) {
this.setRevolt(true); this.setRevolt(true);
} }
if (value.equals("Desert")) {
this.setDesert(true);
}
if (value.equals("Kicked")) { if (value.equals("Kicked")) {
this.kicked = true; this.kicked = true;
} }
@@ -232,6 +235,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (this.isMetalcraft() && !activator.hasMetalcraft()) return false; if (this.isMetalcraft() && !activator.hasMetalcraft()) return false;
if (this.isDelirium() && !activator.hasDelirium()) return false; if (this.isDelirium() && !activator.hasDelirium()) return false;
if (this.isRevolt() && !activator.hasRevolt()) return false; if (this.isRevolt() && !activator.hasRevolt()) return false;
if (this.isDesert() && !activator.hasDesert()) return false;
if (this.kicked && !sa.isKicked()) return false; if (this.kicked && !sa.isKicked()) return false;
if (this.kicked1 && !sa.isOptionalCostPaid(OptionalCost.Kicker1)) return false; if (this.kicked1 && !sa.isOptionalCostPaid(OptionalCost.Kicker1)) return false;

View File

@@ -17,10 +17,11 @@
*/ */
package forge.game.spellability; package forge.game.spellability;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.google.common.collect.Lists;
import forge.game.Game; import forge.game.Game;
import forge.game.ability.AbilityUtils; import forge.game.ability.AbilityUtils;
import forge.game.card.Card; import forge.game.card.Card;
@@ -86,8 +87,11 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
if (value.equals("Hellbent")) { if (value.equals("Hellbent")) {
this.setHellbent(true); this.setHellbent(true);
} }
if (value.equals("Desert")) {
this.setDesert(true);
}
if (value.startsWith("Prowl")) { if (value.startsWith("Prowl")) {
final List<String> prowlTypes = new ArrayList<String>(); final List<String> prowlTypes = Lists.newArrayList();
prowlTypes.add("Rogue"); prowlTypes.add("Rogue");
if (value.split("Prowl").length > 1) { if (value.split("Prowl").length > 1) {
prowlTypes.add(value.split("Prowl")[1]); prowlTypes.add(value.split("Prowl")[1]);
@@ -371,6 +375,11 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
return false; return false;
} }
} }
if (this.isDesert()) {
if (!activator.hasDesert()) {
return false;
}
}
if (this.getProwlTypes() != null && !this.getProwlTypes().isEmpty()) { if (this.getProwlTypes() != null && !this.getProwlTypes().isEmpty()) {
// only true if the activating player has damaged the opponent with // only true if the activating player has damaged the opponent with
// one of the specified types // one of the specified types

View File

@@ -154,6 +154,7 @@ public class SpellAbilityVariables implements Cloneable {
private boolean delirium = false; private boolean delirium = false;
private boolean hellbent = false; private boolean hellbent = false;
private boolean revolt = false; private boolean revolt = false;
private boolean desert = false;
/** The surge. */ /** The surge. */
private boolean surge = false; private boolean surge = false;
@@ -471,6 +472,8 @@ public class SpellAbilityVariables implements Cloneable {
public void setDelirium(boolean delirium) { this.delirium = delirium; } public void setDelirium(boolean delirium) { this.delirium = delirium; }
public void setRevolt(final boolean bRevolt) { revolt = bRevolt; } public void setRevolt(final boolean bRevolt) { revolt = bRevolt; }
public void setDesert(final boolean bDesert) { desert = bDesert; }
/** /**
* <p> * <p>
* Setter for the field <code>surge</code>. * Setter for the field <code>surge</code>.
@@ -689,6 +692,8 @@ public class SpellAbilityVariables implements Cloneable {
public final boolean isRevolt() { return this.revolt; } public final boolean isRevolt() { return this.revolt; }
public final boolean isDesert() { return this.desert; }
/** /**
* Checks if is surge. * Checks if is surge.
* *

View File

@@ -491,6 +491,7 @@ public class StaticAbility extends CardTraitBase implements Comparable<StaticAbi
if (condition.equals("Hellbent") && !controller.hasHellbent()) return false; if (condition.equals("Hellbent") && !controller.hasHellbent()) return false;
if (condition.equals("Metalcraft") && !controller.hasMetalcraft()) return false; if (condition.equals("Metalcraft") && !controller.hasMetalcraft()) return false;
if (condition.equals("Delirium") && !controller.hasDelirium()) return false; if (condition.equals("Delirium") && !controller.hasDelirium()) return false;
if (condition.equals("Desert") && !controller.hasDesert()) return false;
if (condition.equals("PlayerTurn")) { if (condition.equals("PlayerTurn")) {
if (!ph.isPlayerTurn(controller)) { if (!ph.isPlayerTurn(controller)) {