- Adding Delirium SpellAbilityVariable akin to Metalcraft

This commit is contained in:
Sol
2016-03-08 14:36:33 +00:00
parent 5d29703b06
commit d51c96ad77
7 changed files with 34 additions and 61 deletions

View File

@@ -176,6 +176,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView {
final Game game = hostController.getGame(); final Game game = hostController.getGame();
if ("True".equalsIgnoreCase(params.get("Metalcraft")) && !hostController.hasMetalcraft()) return false; if ("True".equalsIgnoreCase(params.get("Metalcraft")) && !hostController.hasMetalcraft()) return false;
if ("True".equalsIgnoreCase(params.get("Delirium")) && !hostController.hasDelirium()) return false;
if ("True".equalsIgnoreCase(params.get("Threshold")) && !hostController.hasThreshold()) return false; if ("True".equalsIgnoreCase(params.get("Threshold")) && !hostController.hasThreshold()) return false;
if ("True".equalsIgnoreCase(params.get("Hellbent")) && !hostController.hasHellbent()) return false; if ("True".equalsIgnoreCase(params.get("Hellbent")) && !hostController.hasHellbent()) return false;
if ("True".equalsIgnoreCase(params.get("Bloodthirst")) && !hostController.hasBloodthirst()) return false; if ("True".equalsIgnoreCase(params.get("Bloodthirst")) && !hostController.hasBloodthirst()) return false;

View File

@@ -1290,6 +1290,9 @@ public class CardFactoryUtil {
if (sq[0].contains("Metalcraft")) { if (sq[0].contains("Metalcraft")) {
return doXMath(Integer.parseInt(sq[cc.hasMetalcraft() ? 1 : 2]), m, c); return doXMath(Integer.parseInt(sq[cc.hasMetalcraft() ? 1 : 2]), m, c);
} }
if (sq[0].contains("Delirium")) {
return doXMath(Integer.parseInt(sq[cc.hasDelirium() ? 1 : 2]), m, c);
}
if (sq[0].contains("FatefulHour")) { if (sq[0].contains("FatefulHour")) {
return doXMath(Integer.parseInt(sq[cc.getLife() <= 5 ? 1 : 2]), m, c); return doXMath(Integer.parseInt(sq[cc.getLife() <= 5 ? 1 : 2]), m, c);
} }

View File

@@ -1834,6 +1834,10 @@ public class Player extends GameEntity implements Comparable<Player> {
return getZone(ZoneType.Hand).isEmpty(); return getZone(ZoneType.Hand).isEmpty();
} }
public final boolean hasDelirium() {
return CardFactoryUtil.getCardTypesFromList(getCardsIn(ZoneType.Graveyard)) >= 4;
}
public final boolean hasLandfall() { public final boolean hasLandfall() {
final CardCollectionView list = getZone(ZoneType.Battlefield).getCardsAddedThisTurn(null); final CardCollectionView list = getZone(ZoneType.Battlefield).getCardsAddedThisTurn(null);
return Iterables.any(list, CardPredicates.Presets.LANDS); return Iterables.any(list, CardPredicates.Presets.LANDS);

View File

@@ -84,6 +84,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (value.equals("Metalcraft")) { if (value.equals("Metalcraft")) {
this.setMetalcraft(true); this.setMetalcraft(true);
} }
if (value.equals("Delirium")) {
this.setDelirium(true);
}
if (value.equals("Hellbent")) { if (value.equals("Hellbent")) {
this.setHellbent(true); this.setHellbent(true);
} }
@@ -221,6 +224,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (this.isHellbent() && !activator.hasHellbent()) return false; if (this.isHellbent() && !activator.hasHellbent()) return false;
if (this.isThreshold() && !activator.hasThreshold()) return false; if (this.isThreshold() && !activator.hasThreshold()) return false;
if (this.isMetalcraft() && !activator.hasMetalcraft()) return false; if (this.isMetalcraft() && !activator.hasMetalcraft()) return false;
if (this.isDelirium() && !activator.hasDelirium()) 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

@@ -77,6 +77,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
if (value.equals("Metalcraft")) { if (value.equals("Metalcraft")) {
this.setMetalcraft(true); this.setMetalcraft(true);
} }
if (value.equals("Delirium")) {
this.setDelirium(true);
}
if (value.equals("Hellbent")) { if (value.equals("Hellbent")) {
this.setHellbent(true); this.setHellbent(true);
} }
@@ -332,6 +335,11 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
return false; return false;
} }
} }
if (this.isDelirium()) {
if (!activator.hasDelirium()) {
return false;
}
}
if (this.isSurge()) { if (this.isSurge()) {
if (!activator.hasSurge()) { if (!activator.hasSurge()) {
return false; return false;

View File

@@ -71,7 +71,8 @@ public class SpellAbilityVariables {
this.chosenColors = sav.getColorToCheck(); this.chosenColors = sav.getColorToCheck();
this.threshold = sav.isThreshold(); this.threshold = sav.isThreshold();
this.surge = sav.isSurge(); this.surge = sav.isSurge();
this.metalcraft = sav.isThreshold(); this.metalcraft = sav.isMetalcraft();
this.delirium = sav.isDelirium();
this.hellbent = sav.isHellbent(); this.hellbent = sav.isHellbent();
this.allTargetsLegal = sav.isAllTargetsLegal(); this.allTargetsLegal = sav.isAllTargetsLegal();
this.shareAllColors = sav.getShareAllColors(); this.shareAllColors = sav.getShareAllColors();
@@ -145,13 +146,10 @@ public class SpellAbilityVariables {
/** The n cards in hand. */ /** The n cards in hand. */
private int cardsInHand = -1; private int cardsInHand = -1;
/** The threshold. */ // Conditional States for Cards
private boolean threshold = false; private boolean threshold = false;
/** The metalcraft. */
private boolean metalcraft = false; private boolean metalcraft = false;
private boolean delirium = false;
/** The hellbent. */
private boolean hellbent = false; private boolean hellbent = false;
/** The surge. */ /** The surge. */
@@ -453,42 +451,18 @@ public class SpellAbilityVariables {
this.setCardsInHand(cards); this.setCardsInHand(cards);
} }
// specific named conditions
/**
* <p>
* Setter for the field <code>hellbent</code>.
* </p>
*
* @param bHellbent
* a boolean.
*/
public final void setHellbent(final boolean bHellbent) { public final void setHellbent(final boolean bHellbent) {
this.hellbent = bHellbent; this.hellbent = bHellbent;
} }
/**
* <p>
* Setter for the field <code>threshold</code>.
* </p>
*
* @param bThreshold
* a boolean.
*/
public final void setThreshold(final boolean bThreshold) { public final void setThreshold(final boolean bThreshold) {
this.threshold = bThreshold; this.threshold = bThreshold;
} }
/** public final void setMetalcraft(final boolean bMetalcraft) { this.metalcraft = bMetalcraft; }
* <p>
* Setter for the field <code>metalcraft</code>. public void setDelirium(boolean delirium) { this.delirium = delirium; }
* </p>
*
* @param bMetalcraft
* a boolean.
*/
public final void setMetalcraft(final boolean bMetalcraft) {
this.metalcraft = bMetalcraft;
}
/** /**
* <p> * <p>
@@ -699,32 +673,13 @@ public class SpellAbilityVariables {
return this.gameLimitToCheck; return this.gameLimitToCheck;
} }
/** public final boolean isThreshold() { return this.threshold; }
* Checks if is threshold.
*
* @return the threshold
*/
public final boolean isThreshold() {
return this.threshold;
}
/** public final boolean isMetalcraft() { return this.metalcraft; }
* Checks if is metalcraft.
*
* @return the metalcraft
*/
public final boolean isMetalcraft() {
return this.metalcraft;
}
/** public final boolean isDelirium() { return this.delirium; }
* Checks if is hellbent.
* public final boolean isHellbent() { return this.hellbent; }
* @return the hellbent
*/
public final boolean isHellbent() {
return this.hellbent;
}
/** /**
* Checks if is surge. * Checks if is surge.
@@ -1004,9 +959,6 @@ public class SpellAbilityVariables {
return enchantedControllerOnly; return enchantedControllerOnly;
} }
/**
* @param opponentOnly the opponentOnly to set
*/
public void setEnchantedControllerOnly(boolean enchantedControllerOnly) { public void setEnchantedControllerOnly(boolean enchantedControllerOnly) {
this.enchantedControllerOnly = enchantedControllerOnly; this.enchantedControllerOnly = enchantedControllerOnly;
} }

View File

@@ -465,6 +465,7 @@ public class StaticAbility extends CardTraitBase {
if (condition.equals("Threshold") && !controller.hasThreshold()) return false; if (condition.equals("Threshold") && !controller.hasThreshold()) return false;
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("PlayerTurn")) { if (condition.equals("PlayerTurn")) {
if (!controller.getGame().getPhaseHandler().isPlayerTurn(controller)) { if (!controller.getGame().getPhaseHandler().isPlayerTurn(controller)) {