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("Bloodthirst")) && !hostController.hasBloodthirst()) 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 (hostCard.getCastFrom() == null || hostCard.getCastSA() == null)

View File

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

View File

@@ -1099,7 +1099,9 @@ public class CardFactoryUtil {
if (sq[0].contains("FatefulHour")) {
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")) {
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 numCardsInHandStartedThisTurnWith = 0;
private boolean revolt = false;
private CardCollection sacrificedThisTurn = new CardCollection();
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() {
final CardCollectionView list = CardLists.filter(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS);
return list.size() >= 3;
return CardLists.count(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS) >= 3;
}
public final boolean hasThreshold() {
@@ -1910,6 +1911,14 @@ public class Player extends GameEntity implements Comparable<Player> {
return getZone(ZoneType.Hand).isEmpty();
}
public final boolean hasRevolt() {
return revolt;
}
public final void setRevolt(final boolean val) {
revolt = val;
}
public final boolean hasDelirium() {
return CardFactoryUtil.getCardTypesFromList(getCardsIn(ZoneType.Graveyard)) >= 4;
}
@@ -1953,7 +1962,7 @@ public class Player extends GameEntity implements Comparable<Player> {
prowl.add(type);
}
public final void resetProwl() {
prowl = new ArrayList<String>();
prowl.clear();
}
public final void setLibrarySearched(final int l) {
@@ -2588,6 +2597,7 @@ public class Player extends GameEntity implements Comparable<Player> {
resetCounterToPermThisTurn();
clearAssignedDamage();
resetAttackersDeclaredThisTurn();
setRevolt(false);
}
public boolean canCastSorcery() {

View File

@@ -91,6 +91,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (value.equals("Hellbent")) {
this.setHellbent(true);
}
if (value.equals("Revolt")) {
this.setRevolt(true);
}
if (value.equals("Kicked")) {
this.kicked = true;
}
@@ -228,6 +231,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (this.isThreshold() && !activator.hasThreshold()) return false;
if (this.isMetalcraft() && !activator.hasMetalcraft()) 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.kicked1 && !sa.isOptionalCostPaid(OptionalCost.Kicker1)) return false;

View File

@@ -153,6 +153,7 @@ public class SpellAbilityVariables implements Cloneable {
private boolean metalcraft = false;
private boolean delirium = false;
private boolean hellbent = false;
private boolean revolt = false;
/** The surge. */
private boolean surge = false;
@@ -469,6 +470,7 @@ public class SpellAbilityVariables implements Cloneable {
public void setDelirium(boolean delirium) { this.delirium = delirium; }
public void setRevolt(final boolean bRevolt) { revolt = bRevolt; }
/**
* <p>
* 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 isHellbent() { return this.hellbent; }
public final boolean isRevolt() { return this.revolt; }
/**
* Checks if is surge.