Player: add hasRevolt similar to other Conditions, now way to calculate it, does set it in GameAction

This commit is contained in:
Hanmac
2017-01-07 11:29:06 +00:00
parent 593f4f64b1
commit 9531e16d02
6 changed files with 30 additions and 5 deletions

View File

@@ -208,6 +208,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView {
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;
if ("True".equalsIgnoreCase(params.get("FatefulHour")) && hostController.getLife() > 5) return false; if ("True".equalsIgnoreCase(params.get("FatefulHour")) && hostController.getLife() > 5) return false;
if ("True".equalsIgnoreCase(params.get("Revolt")) && !hostController.hasRevolt()) return false;
if (params.containsKey("Presence")) { if (params.containsKey("Presence")) {
if (hostCard.getCastFrom() == null || hostCard.getCastSA() == null) if (hostCard.getCastFrom() == null || hostCard.getCastSA() == null)

View File

@@ -166,7 +166,11 @@ public class GameAction {
if (fromBattlefield && c.getSVar("EndOfTurnLeavePlay").equals("Dash")) { if (fromBattlefield && c.getSVar("EndOfTurnLeavePlay").equals("Dash")) {
c.removeSVar("EndOfTurnLeavePlay"); c.removeSVar("EndOfTurnLeavePlay");
} }
if (fromBattlefield && !toBattlefield) {
c.getController().setRevolt(true);
}
// Don't copy Tokens, copy only cards leaving the battlefield // Don't copy Tokens, copy only cards leaving the battlefield
// and returning to hand (to recreate their spell ability information) // and returning to hand (to recreate their spell ability information)
if (suppress || (!fromBattlefield && !toHand)) { if (suppress || (!fromBattlefield && !toHand)) {

View File

@@ -1099,7 +1099,9 @@ public class CardFactoryUtil {
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);
} }
if (sq[0].contains("Revolt")) {
return doXMath(Integer.parseInt(sq[cc.hasRevolt() ? 1 : 2]), m, c);
}
if (sq[0].contains("Landfall")) { if (sq[0].contains("Landfall")) {
return doXMath(Integer.parseInt(sq[cc.hasLandfall() ? 1 : 2]), m, c); return doXMath(Integer.parseInt(sq[cc.hasLandfall() ? 1 : 2]), m, c);
} }

View File

@@ -107,6 +107,8 @@ public class Player extends GameEntity implements Comparable<Player> {
private int numDiscardedThisTurn = 0; private int numDiscardedThisTurn = 0;
private int numCardsInHandStartedThisTurnWith = 0; private int numCardsInHandStartedThisTurnWith = 0;
private boolean revolt = false;
private CardCollection sacrificedThisTurn = new CardCollection(); private CardCollection sacrificedThisTurn = new CardCollection();
private Map<CounterType, Integer> countersAddedtoPermThisTurn = Maps.newEnumMap(CounterType.class); private Map<CounterType, Integer> countersAddedtoPermThisTurn = Maps.newEnumMap(CounterType.class);
@@ -1898,8 +1900,7 @@ public class Player extends GameEntity implements Comparable<Player> {
} }
public final boolean hasMetalcraft() { public final boolean hasMetalcraft() {
final CardCollectionView list = CardLists.filter(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS); return CardLists.count(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS) >= 3;
return list.size() >= 3;
} }
public final boolean hasThreshold() { public final boolean hasThreshold() {
@@ -1910,6 +1911,14 @@ public class Player extends GameEntity implements Comparable<Player> {
return getZone(ZoneType.Hand).isEmpty(); return getZone(ZoneType.Hand).isEmpty();
} }
public final boolean hasRevolt() {
return revolt;
}
public final void setRevolt(final boolean val) {
revolt = val;
}
public final boolean hasDelirium() { public final boolean hasDelirium() {
return CardFactoryUtil.getCardTypesFromList(getCardsIn(ZoneType.Graveyard)) >= 4; return CardFactoryUtil.getCardTypesFromList(getCardsIn(ZoneType.Graveyard)) >= 4;
} }
@@ -1953,7 +1962,7 @@ public class Player extends GameEntity implements Comparable<Player> {
prowl.add(type); prowl.add(type);
} }
public final void resetProwl() { public final void resetProwl() {
prowl = new ArrayList<String>(); prowl.clear();
} }
public final void setLibrarySearched(final int l) { public final void setLibrarySearched(final int l) {
@@ -2588,6 +2597,7 @@ public class Player extends GameEntity implements Comparable<Player> {
resetCounterToPermThisTurn(); resetCounterToPermThisTurn();
clearAssignedDamage(); clearAssignedDamage();
resetAttackersDeclaredThisTurn(); resetAttackersDeclaredThisTurn();
setRevolt(false);
} }
public boolean canCastSorcery() { public boolean canCastSorcery() {

View File

@@ -91,6 +91,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (value.equals("Hellbent")) { if (value.equals("Hellbent")) {
this.setHellbent(true); this.setHellbent(true);
} }
if (value.equals("Revolt")) {
this.setRevolt(true);
}
if (value.equals("Kicked")) { if (value.equals("Kicked")) {
this.kicked = true; this.kicked = true;
} }
@@ -228,6 +231,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
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.isDelirium() && !activator.hasDelirium()) return false;
if (this.isRevolt() && !activator.hasRevolt()) 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

@@ -153,6 +153,7 @@ public class SpellAbilityVariables implements Cloneable {
private boolean metalcraft = false; private boolean metalcraft = false;
private boolean delirium = false; private boolean delirium = false;
private boolean hellbent = false; private boolean hellbent = false;
private boolean revolt = false;
/** The surge. */ /** The surge. */
private boolean surge = false; private boolean surge = false;
@@ -469,6 +470,7 @@ 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; }
/** /**
* <p> * <p>
* Setter for the field <code>surge</code>. * Setter for the field <code>surge</code>.
@@ -684,6 +686,8 @@ public class SpellAbilityVariables implements Cloneable {
public final boolean isDelirium() { return this.delirium; } public final boolean isDelirium() { return this.delirium; }
public final boolean isHellbent() { return this.hellbent; } public final boolean isHellbent() { return this.hellbent; }
public final boolean isRevolt() { return this.revolt; }
/** /**
* Checks if is surge. * Checks if is surge.