mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Retained some schemas
This commit is contained in:
@@ -602,7 +602,12 @@ public class AiAttackController {
|
||||
return true;
|
||||
}
|
||||
|
||||
return totalPoisonDamage >= 10 - opp.getPoisonCounters();
|
||||
if (totalPoisonDamage >= 10 - opp.getPoisonCounters()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private final GameEntity chooseDefender(final Combat c, final boolean bAssault) {
|
||||
@@ -1450,7 +1455,10 @@ public class AiAttackController {
|
||||
if (color != null) {
|
||||
return color;
|
||||
}
|
||||
return artifact;//should never get here
|
||||
if (artifact != null) {
|
||||
return artifact;
|
||||
}
|
||||
return null;//should never get here
|
||||
}
|
||||
|
||||
private void doLightmineFieldAttackLogic(List<Card> attackersLeft, int numForcedAttackers, boolean playAggro) {
|
||||
|
||||
@@ -1516,9 +1516,13 @@ public class AiController {
|
||||
// Hopefully there's not much to do with the extra mana immediately, can wait for Main 2
|
||||
return true;
|
||||
}
|
||||
// Might need an extra land to cast something, or for some kind of an ETB ability with a cost or an
|
||||
// alternative cost (if we cast it in Main 1), or to use an activated ability on the battlefield
|
||||
return (predictedMana > totalCMCInHand || !canCastWithLandDrop) && (!hasRelevantAbsOTB || isTapLand) && !hasLandBasedEffect;
|
||||
if ((predictedMana <= totalCMCInHand && canCastWithLandDrop) || (hasRelevantAbsOTB && !isTapLand) || hasLandBasedEffect) {
|
||||
// Might need an extra land to cast something, or for some kind of an ETB ability with a cost or an
|
||||
// alternative cost (if we cast it in Main 1), or to use an activated ability on the battlefield
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private final SpellAbility getSpellAbilityToPlay() {
|
||||
@@ -1637,8 +1641,12 @@ public class AiController {
|
||||
return SpellApiToAi.Converter.get(spell.getApi()).doTriggerAI(player, spell, mandatory);
|
||||
if (spell instanceof WrappedAbility)
|
||||
return doTrigger(((WrappedAbility)spell).getWrappedAbility(), mandatory);
|
||||
// For non-converted triggers (such as Cumulative Upkeep) that don't have costs or targets to worry about
|
||||
return spell.getPayCosts() == Cost.Zero && spell.getTargetRestrictions() == null;
|
||||
if (spell.getPayCosts() == Cost.Zero && spell.getTargetRestrictions() == null) {
|
||||
// For non-converted triggers (such as Cumulative Upkeep) that don't have costs or targets to worry about
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -795,7 +795,11 @@ public class ComputerUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ComputerUtilCard.hasActiveUndyingOrPersist(c);
|
||||
if (ComputerUtilCard.hasActiveUndyingOrPersist(c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1155,25 +1159,30 @@ public class ComputerUtil {
|
||||
final int highestCMC = Math.max(6, Aggregates.max(nonLandsInHand, CardPredicates.Accessors.fnGetCmc));
|
||||
final int discardCMC = discard.getCMC();
|
||||
if (discard.isLand()) {
|
||||
// Don't need more land.
|
||||
return landsInPlay.size() >= highestCMC
|
||||
if (landsInPlay.size() >= highestCMC
|
||||
|| (landsInPlay.size() + landsInHand.size() > 6 && landsInHand.size() > 1)
|
||||
|| (landsInPlay.size() > 3 && nonLandsInHand.size() == 0);
|
||||
|| (landsInPlay.size() > 3 && nonLandsInHand.size() == 0)) {
|
||||
// Don't need more land.
|
||||
return true;
|
||||
}
|
||||
} else { //non-land
|
||||
if (discardCMC > landsInPlay.size() + landsInHand.size() + 2) {
|
||||
// not castable for some time.
|
||||
return true;
|
||||
} else // Probably don't need small stuff now.
|
||||
if (!game.getPhaseHandler().isPlayerTurn(ai)
|
||||
} else if (!game.getPhaseHandler().isPlayerTurn(ai)
|
||||
&& game.getPhaseHandler().getPhase().isAfter(PhaseType.MAIN2)
|
||||
&& discardCMC > landsInPlay.size() + landsInHand.size()
|
||||
&& discardCMC > landsInPlay.size() + 1
|
||||
&& nonLandsInHand.size() > 1) {
|
||||
// not castable for at least one other turn.
|
||||
return true;
|
||||
} else return landsInPlay.size() > 5 && discard.getCMC() <= 1
|
||||
&& !discard.hasProperty("hasXCost", ai, null, null);
|
||||
} else if (landsInPlay.size() > 5 && discard.getCMC() <= 1
|
||||
&& !discard.hasProperty("hasXCost", ai, null, null)) {
|
||||
// Probably don't need small stuff now.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns true if it's better to wait until blockers are declared
|
||||
@@ -1914,12 +1923,16 @@ public class ComputerUtil {
|
||||
if (predictThreatenedObjects(ai, null).contains(source)) {
|
||||
return true;
|
||||
}
|
||||
return game.getPhaseHandler().inCombat() &&
|
||||
ComputerUtilCombat.combatantWouldBeDestroyed(ai, source, game.getCombat());
|
||||
if (game.getPhaseHandler().inCombat() &&
|
||||
ComputerUtilCombat.combatantWouldBeDestroyed(ai, source, game.getCombat())) {
|
||||
return true;
|
||||
}
|
||||
} else if (zone.getZoneType() == ZoneType.Exile && sa.getMayPlay() != null) {
|
||||
// play cards in exile that can only be played that turn
|
||||
if (game.getPhaseHandler().getPhase() == PhaseType.MAIN2) {
|
||||
return source.mayPlay(sa.getMayPlay()) != null;
|
||||
if (source.mayPlay(sa.getMayPlay()) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -2847,8 +2860,10 @@ public class ComputerUtil {
|
||||
return false;
|
||||
} else if (Iterables.any(list, CardTraitPredicates.hasParam("AiLogic", "LoseLife"))) {
|
||||
return false;
|
||||
} else return !Iterables.any(list, CardTraitPredicates.hasParam("AiLogic", "LichDraw"));
|
||||
|
||||
} else if (Iterables.any(list, CardTraitPredicates.hasParam("AiLogic", "LichDraw"))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean lifegainNegative(final Player player, final Card source) {
|
||||
@@ -3046,7 +3061,10 @@ public class ComputerUtil {
|
||||
if ((serious) && (ComputerUtilCombat.lifeInSeriousDanger(ai, combat, payment))) {
|
||||
return true;
|
||||
}
|
||||
return (!serious) && (ComputerUtilCombat.lifeInDanger(ai, combat, payment));
|
||||
if ((!serious) && (ComputerUtilCombat.lifeInDanger(ai, combat, payment))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1742,14 +1742,20 @@ public class ComputerUtilCard {
|
||||
if (!c.isCreature()) {
|
||||
return false;
|
||||
}
|
||||
return c.hasKeyword("CARDNAME can't attack or block.") || (c.hasKeyword("CARDNAME doesn't untap during your untap step.") && c.isTapped()) || (c.getOwner() == ai && ai.getOpponents().contains(c.getController()));
|
||||
if (c.hasKeyword("CARDNAME can't attack or block.") || (c.hasKeyword("CARDNAME doesn't untap during your untap step.") && c.isTapped()) || (c.getOwner() == ai && ai.getOpponents().contains(c.getController()))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasActiveUndyingOrPersist(final Card c) {
|
||||
if (c.hasKeyword(Keyword.UNDYING) && c.getCounters(CounterType.P1P1) == 0) {
|
||||
return true;
|
||||
}
|
||||
return c.hasKeyword(Keyword.PERSIST) && c.getCounters(CounterType.M1M1) == 0;
|
||||
if (c.hasKeyword(Keyword.PERSIST) && c.getCounters(CounterType.M1M1) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isPresentOnBattlefield(final Game game, final String cardName) {
|
||||
|
||||
@@ -879,18 +879,19 @@ public class ComputerUtilCombat {
|
||||
} else if (mode == TriggerType.DamageDone) {
|
||||
willTrigger = true;
|
||||
if (trigParams.containsKey("ValidSource")) {
|
||||
if (CardTraitBase.matchesValid(defender, trigParams.get("ValidSource").split(","), source)
|
||||
if (!(CardTraitBase.matchesValid(defender, trigParams.get("ValidSource").split(","), source)
|
||||
&& defender.getNetCombatDamage() > 0
|
||||
&& (!trigParams.containsKey("ValidTarget")
|
||||
|| CardTraitBase.matchesValid(attacker, trigParams.get("ValidTarget").split(","), source))) {
|
||||
return true;
|
||||
|| CardTraitBase.matchesValid(attacker, trigParams.get("ValidTarget").split(","), source)))) {
|
||||
return false;
|
||||
}
|
||||
return CardTraitBase.matchesValid(attacker, trigParams.get("ValidSource").split(","), source)
|
||||
if (!(CardTraitBase.matchesValid(attacker, trigParams.get("ValidSource").split(","), source)
|
||||
&& attacker.getNetCombatDamage() > 0
|
||||
&& (!trigParams.containsKey("ValidTarget")
|
||||
|| CardTraitBase.matchesValid(defender, trigParams.get("ValidTarget").split(","), source));
|
||||
|| CardTraitBase.matchesValid(defender, trigParams.get("ValidTarget").split(","), source)))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return willTrigger;
|
||||
@@ -1789,7 +1790,11 @@ public class ComputerUtilCombat {
|
||||
}
|
||||
|
||||
// all damage will be prevented
|
||||
return attacker.hasKeyword("PreventAllDamageBy Creature.blockingSource");
|
||||
if (attacker.hasKeyword("PreventAllDamageBy Creature.blockingSource")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// can the blocker destroy the attacker?
|
||||
@@ -1912,7 +1917,9 @@ public class ComputerUtilCombat {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return attackerLife <= 2 * defenderDamage;
|
||||
if (attackerLife <= 2 * defenderDamage) {
|
||||
return true;
|
||||
}
|
||||
} // defender double strike
|
||||
|
||||
else { // no double strike for defender
|
||||
@@ -1936,7 +1943,7 @@ public class ComputerUtilCombat {
|
||||
return defenderDamage >= attackerLife;
|
||||
|
||||
} // defender no double strike
|
||||
// should never arrive here
|
||||
return false;// should never arrive here
|
||||
} // canDestroyAttacker
|
||||
|
||||
// For AI safety measures like Regeneration
|
||||
@@ -2157,7 +2164,9 @@ public class ComputerUtilCombat {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return defenderLife <= 2 * attackerDamage;
|
||||
if (defenderLife <= 2 * attackerDamage) {
|
||||
return true;
|
||||
}
|
||||
} // attacker double strike
|
||||
|
||||
else { // no double strike for attacker
|
||||
@@ -2181,7 +2190,7 @@ public class ComputerUtilCombat {
|
||||
return attackerDamage >= defenderLife;
|
||||
|
||||
} // attacker no double strike
|
||||
// should never arrive here
|
||||
return false;// should never arrive here
|
||||
} // canDestroyBlocker
|
||||
|
||||
|
||||
|
||||
@@ -880,10 +880,12 @@ public class ComputerUtilMana {
|
||||
|
||||
// For combat tricks, always obey mana reservation
|
||||
if (curPhase == PhaseType.COMBAT_DECLARE_BLOCKERS || curPhase == PhaseType.CLEANUP) {
|
||||
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_DECLBLK);
|
||||
} else if (!(ai.getGame().getPhaseHandler().isPlayerTurn(ai)) && (curPhase == PhaseType.COMBAT_DECLARE_BLOCKERS || curPhase == PhaseType.CLEANUP)) {
|
||||
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_ENEMY_DECLBLK);
|
||||
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.CHOSEN_FOG_EFFECT);
|
||||
if (!(ai.getGame().getPhaseHandler().isPlayerTurn(ai))) {
|
||||
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_ENEMY_DECLBLK);
|
||||
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.CHOSEN_FOG_EFFECT);
|
||||
}
|
||||
else
|
||||
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_DECLBLK);
|
||||
} else {
|
||||
if ((AiCardMemory.isRememberedCard(ai, sourceCard, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_DECLBLK)) ||
|
||||
(AiCardMemory.isRememberedCard(ai, sourceCard, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_ENEMY_DECLBLK))) {
|
||||
@@ -905,8 +907,10 @@ public class ComputerUtilMana {
|
||||
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2);
|
||||
}
|
||||
else {
|
||||
// This mana source is held elsewhere for a Main Phase 2 spell.
|
||||
return AiCardMemory.isRememberedCard(ai, sourceCard, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2);
|
||||
if (AiCardMemory.isRememberedCard(ai, sourceCard, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2)) {
|
||||
// This mana source is held elsewhere for a Main Phase 2 spell.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -377,12 +377,15 @@ public class SpecialCardAi {
|
||||
// Already enough to kill the blockers and survive, don't overpump
|
||||
return false;
|
||||
}
|
||||
// Can't kill or cripple anyone, as well as can't Trample over, so don't pump
|
||||
return !oppCantDie || source.hasKeyword(Keyword.TRAMPLE) || source.hasKeyword(Keyword.WITHER)
|
||||
|| source.hasKeyword(Keyword.INFECT) || predictedPT.getLeft() > oppT;
|
||||
if (oppCantDie && !source.hasKeyword(Keyword.TRAMPLE) && !source.hasKeyword(Keyword.WITHER)
|
||||
&& !source.hasKeyword(Keyword.INFECT) && predictedPT.getLeft() <= oppT) {
|
||||
// Can't kill or cripple anyone, as well as can't Trample over, so don't pump
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we got here, it should be a favorable combat pump, resulting in at least one
|
||||
// opposing creature dying, and hopefully with the Pummeler surviving combat.
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean predictOverwhelmingDamage(final Player ai, final SpellAbility sa) {
|
||||
@@ -471,13 +474,15 @@ public class SpecialCardAi {
|
||||
}
|
||||
|
||||
if (isExileMode) {
|
||||
// We probably need a low-CMC card to exile to it, exiling a higher CMC spell may be suboptimal
|
||||
// since the AI does not prioritize/value cards vs. permission at the moment.
|
||||
if (blueCards.size() < 2) {
|
||||
// Need to have something else in hand that is blue in addition to Force of Will itself,
|
||||
// otherwise the AI will fail to play the card and the card will disappear from the pool
|
||||
return false;
|
||||
} else return !CardLists.filter(blueCards, CardPredicates.lessCMC(3)).isEmpty();
|
||||
} else if (CardLists.filter(blueCards, CardPredicates.lessCMC(3)).isEmpty()) {
|
||||
// We probably need a low-CMC card to exile to it, exiling a higher CMC spell may be suboptimal
|
||||
// since the AI does not prioritize/value cards vs. permission at the moment.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -891,13 +896,15 @@ public class SpecialCardAi {
|
||||
}
|
||||
} else if (blackViseOTB && computerHandSize + exiledWithNecro - 1 >= 4) {
|
||||
// try not to overdraw in presence of Black Vise
|
||||
return false;
|
||||
} else // Only activate in AI's own turn (sans the exception above)
|
||||
if (computerHandSize + exiledWithNecro - 1 >= maxHandSize) {
|
||||
return false;
|
||||
} else if (computerHandSize + exiledWithNecro - 1 >= maxHandSize) {
|
||||
// Only draw until we reach max hand size
|
||||
return false;
|
||||
} else return ph.isPlayerTurn(ai) && ph.is(PhaseType.MAIN2);
|
||||
|
||||
} else if (!ph.isPlayerTurn(ai) || !ph.is(PhaseType.MAIN2)) {
|
||||
// Only activate in AI's own turn (sans the exception above)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1426,12 +1433,14 @@ public class SpecialCardAi {
|
||||
} else if (blackViseOTB && computerHandSize + 1 > 4) {
|
||||
// try not to overdraw in presence of Black Vise
|
||||
return false;
|
||||
} else // Only activate in AI's own turn (sans the exception above)
|
||||
if (computerHandSize + 1 > maxHandSize) {
|
||||
} else if (computerHandSize + 1 > maxHandSize) {
|
||||
// Only draw until we reach max hand size
|
||||
return false;
|
||||
} else return ph.isPlayerTurn(ai);
|
||||
|
||||
} else if (!ph.isPlayerTurn(ai)) {
|
||||
// Only activate in AI's own turn (sans the exception above)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,10 @@ public abstract class SpellAbilityAi {
|
||||
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source, sa)) {
|
||||
return false;
|
||||
}
|
||||
return ComputerUtilCost.checkRemoveCounterCost(cost, source, sa);
|
||||
if (!ComputerUtilCost.checkRemoveCounterCost(cost, source, sa)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,9 +117,12 @@ public class AnimateAi extends SpellAbilityAi {
|
||||
boolean activateAsPotentialBlocker = sa.hasParam("UntilYourNextTurn")
|
||||
&& ai.getGame().getPhaseHandler().getNextTurn() != ai
|
||||
&& source.isPermanent();
|
||||
return !ph.isPlayerTurn(ai) || ai.getLife() >= 6 || opponent.getLife() <= 6
|
||||
|| !Iterables.any(opponent.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES)
|
||||
|| sa.hasParam("AILogic") || sa.hasParam("Permanent") || activateAsPotentialBlocker;
|
||||
if (ph.isPlayerTurn(ai) && ai.getLife() < 6 && opponent.getLife() > 6
|
||||
&& Iterables.any(opponent.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES)
|
||||
&& !sa.hasParam("AILogic") && !sa.hasParam("Permanent") && !activateAsPotentialBlocker) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -327,7 +327,11 @@ public class CountersMoveAi extends SpellAbilityAi {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return CounterType.M1M1.equals(cType) && card.hasKeyword(Keyword.PERSIST);
|
||||
if (CounterType.M1M1.equals(cType) && card.hasKeyword(Keyword.PERSIST)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -421,7 +425,11 @@ public class CountersMoveAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
// source would leave the game
|
||||
return !card.hasSVar("EndOfTurnLeavePlay");
|
||||
if (!card.hasSVar("EndOfTurnLeavePlay")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -45,7 +45,10 @@ public class CountersMultiplyAi extends SpellAbilityAi {
|
||||
if (c.getCounters(counterType) <= 0) {
|
||||
return false;
|
||||
}
|
||||
return c.canReceiveCounters(counterType);
|
||||
if (!c.canReceiveCounters(counterType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
for (Map.Entry<CounterType, Integer> e : c.getCounters().entrySet()) {
|
||||
// has negative counter it would double
|
||||
@@ -85,7 +88,11 @@ public class CountersMultiplyAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
}
|
||||
return !ComputerUtil.waitForBlocking(sa);
|
||||
if (ComputerUtil.waitForBlocking(sa)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,7 +133,9 @@ public class CountersMultiplyAi extends SpellAbilityAi {
|
||||
if (c.getCounters(counterType) <= 0) {
|
||||
return false;
|
||||
}
|
||||
return c.canReceiveCounters(counterType);
|
||||
if (!c.canReceiveCounters(counterType)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -592,7 +592,11 @@ public class CountersPutAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
return !ComputerUtil.waitForBlocking(sa);
|
||||
if (ComputerUtil.waitForBlocking(sa)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1067,8 +1071,10 @@ public class CountersPutAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
int totBlkPower = Aggregates.sum(combat.getBlockers(source), CardPredicates.Accessors.fnGetNetPower);
|
||||
return source.getNetToughness() <= totBlkPower
|
||||
&& source.getNetToughness() + amount > totBlkPower;
|
||||
if (source.getNetToughness() <= totBlkPower
|
||||
&& source.getNetToughness() + amount > totBlkPower) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (combat.isBlocking(source)) {
|
||||
for (Card blocked : combat.getAttackersBlockedBy(source)) {
|
||||
@@ -1079,8 +1085,10 @@ public class CountersPutAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
int totAtkPower = Aggregates.sum(combat.getAttackersBlockedBy(source), CardPredicates.Accessors.fnGetNetPower);
|
||||
return source.getNetToughness() <= totAtkPower
|
||||
&& source.getNetToughness() + amount > totAtkPower;
|
||||
if (source.getNetToughness() <= totAtkPower
|
||||
&& source.getNetToughness() + amount > totAtkPower) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -233,8 +233,12 @@ public class DamageAllAi extends SpellAbilityAi {
|
||||
return true;
|
||||
}
|
||||
|
||||
return computerList.isEmpty() || ComputerUtilCard.evaluateCreatureList(computerList) <= ComputerUtilCard
|
||||
.evaluateCreatureList(humanList);
|
||||
if (!computerList.isEmpty() && ComputerUtilCard.evaluateCreatureList(computerList) > ComputerUtilCard
|
||||
.evaluateCreatureList(humanList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,7 +320,11 @@ public class DamageAllAi extends SpellAbilityAi {
|
||||
return true;
|
||||
}
|
||||
|
||||
return computerList.isEmpty() || ComputerUtilCard.evaluateCreatureList(computerList) + 50 < ComputerUtilCard
|
||||
.evaluateCreatureList(humanList);
|
||||
if (!computerList.isEmpty() && ComputerUtilCard.evaluateCreatureList(computerList) + 50 >= ComputerUtilCard
|
||||
.evaluateCreatureList(humanList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -845,7 +845,10 @@ public class DamageDealAi extends DamageAiBase {
|
||||
if (!positive && !(saMe instanceof AbilitySub)) {
|
||||
return false;
|
||||
}
|
||||
return urgent || SpellAbilityAi.playReusable(ai, saMe);
|
||||
if (!urgent && !SpellAbilityAi.playReusable(ai, saMe)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -295,9 +295,11 @@ public class DestroyAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !list.isEmpty()
|
||||
&& CardLists.filterControlledBy(list, ai).isEmpty()
|
||||
&& !CardLists.getNotKeyword(list, Keyword.INDESTRUCTIBLE).isEmpty();
|
||||
if (list.isEmpty()
|
||||
|| !CardLists.filterControlledBy(list, ai).isEmpty()
|
||||
|| CardLists.getNotKeyword(list, Keyword.INDESTRUCTIBLE).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,10 @@ public class DestroyAllAi extends SpellAbilityAi {
|
||||
AiBlockController block = new AiBlockController(ai);
|
||||
block.assignBlockersForCombat(combat);
|
||||
|
||||
return ComputerUtilCombat.lifeInSeriousDanger(ai, combat);
|
||||
if (ComputerUtilCombat.lifeInSeriousDanger(ai, combat)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} // only lands involved
|
||||
else if (CardLists.getNotType(opplist, "Land").isEmpty() && CardLists.getNotType(ailist, "Land").isEmpty()) {
|
||||
if (ai.isCardInPlay("Crucible of Worlds") && !opponent.isCardInPlay("Crucible of Worlds") && !opplist.isEmpty()) {
|
||||
@@ -161,9 +164,13 @@ public class DestroyAllAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
// check if the AI would lose more lands than the opponent would
|
||||
return ComputerUtilCard.evaluatePermanentList(ailist) <= ComputerUtilCard.evaluatePermanentList(opplist) + 1;
|
||||
if (ComputerUtilCard.evaluatePermanentList(ailist) > ComputerUtilCard.evaluatePermanentList(opplist) + 1) {
|
||||
return false;
|
||||
}
|
||||
} // otherwise evaluate both lists by CMC and pass only if human permanents are more valuable
|
||||
else return (ComputerUtilCard.evaluatePermanentList(ailist) + 3) < ComputerUtilCard.evaluatePermanentList(opplist);
|
||||
|
||||
else if ((ComputerUtilCard.evaluatePermanentList(ailist) + 3) >= ComputerUtilCard.evaluatePermanentList(opplist)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,10 @@ public class DrawAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
return canLoot(ai, sa);
|
||||
if (!canLoot(ai, sa)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -104,7 +107,11 @@ public class DrawAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
return ComputerUtilCost.checkRemoveCounterCost(cost, source, sa);
|
||||
if (!ComputerUtilCost.checkRemoveCounterCost(cost, source, sa)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -195,7 +202,9 @@ public class DrawAi extends SpellAbilityAi {
|
||||
if (numHand == 0 && numDraw == numDiscard) {
|
||||
return false; // no looting since everything is dumped
|
||||
}
|
||||
return numHand + numDraw >= numDiscard; // net loss of cards
|
||||
if (numHand + numDraw < numDiscard) {
|
||||
return false; // net loss of cards
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -477,8 +486,11 @@ public class DrawAi extends SpellAbilityAi {
|
||||
|
||||
// ability is not targeted
|
||||
if (numCards >= computerLibrarySize) {
|
||||
return ai.isCardInPlay("Laboratory Maniac");
|
||||
if (ai.isCardInPlay("Laboratory Maniac")) {
|
||||
return true;
|
||||
}
|
||||
// Don't deck yourself
|
||||
return false;
|
||||
}
|
||||
|
||||
if (numCards == 0 && !drawback) {
|
||||
@@ -491,7 +503,9 @@ public class DrawAi extends SpellAbilityAi {
|
||||
&& !assumeSafeX) {
|
||||
// Don't draw too many cards and then risk discarding cards at
|
||||
// EOT
|
||||
return drawback;
|
||||
if (!drawback) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -273,9 +273,10 @@ public class FightAi extends SpellAbilityAi {
|
||||
if (!canKill(opponent, fighter, -pumpDefense)) { // can survive
|
||||
return true;
|
||||
} else {
|
||||
// trade
|
||||
return MyRandom.getRandom().nextInt(20) < (opponent.getCMC() - fighter.getCMC());
|
||||
}
|
||||
if (MyRandom.getRandom().nextInt(20)<(opponent.getCMC() - fighter.getCMC())) { // trade
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -288,7 +289,10 @@ public class FightAi extends SpellAbilityAi {
|
||||
|| ComputerUtil.canRegenerate(opponent.getController(), opponent)) {
|
||||
return false;
|
||||
}
|
||||
return fighter.hasKeyword(Keyword.DEATHTOUCH)
|
||||
|| ComputerUtilCombat.getDamageToKill(opponent) <= fighter.getNetPower() + pumpAttack;
|
||||
if (fighter.hasKeyword(Keyword.DEATHTOUCH)
|
||||
|| ComputerUtilCombat.getDamageToKill(opponent) <= fighter.getNetPower() + pumpAttack) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ public class FlipACoinAi extends SpellAbilityAi {
|
||||
if (AILogic.equals("Never")) {
|
||||
return false;
|
||||
} else if (AILogic.equals("PhaseOut")) {
|
||||
return ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), sa).contains(sa.getHostCard());
|
||||
if (!ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), sa).contains(sa.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
} else if (AILogic.equals("KillOrcs")) {
|
||||
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.END_OF_TURN) ) {
|
||||
return false;
|
||||
|
||||
@@ -120,7 +120,9 @@ public class LifeExchangeVariantAi extends SpellAbilityAi {
|
||||
MagicStack stack = game.getStack();
|
||||
if (!stack.isEmpty()) {
|
||||
SpellAbility saTop = stack.peekAbility();
|
||||
return ComputerUtil.predictDamageFromSpell(saTop, ai) >= aiLife;
|
||||
if (ComputerUtil.predictDamageFromSpell(saTop, ai) >= aiLife) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ public class LifeGainAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ComputerUtilCost.checkRemoveCounterCost(cost, source);
|
||||
if (!ComputerUtilCost.checkRemoveCounterCost(cost, source)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// don't sac possible blockers
|
||||
if (!ph.getPhase().equals(PhaseType.COMBAT_DECLARE_BLOCKERS)
|
||||
@@ -61,7 +63,9 @@ public class LifeGainAi extends SpellAbilityAi {
|
||||
skipCheck |= ComputerUtilCost.isSacrificeSelfCost(cost) && !source.isCreature();
|
||||
|
||||
if (!skipCheck) {
|
||||
return ComputerUtilCost.checkSacrificeCost(ai, cost, source, sa, false);
|
||||
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source, sa,false)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,8 +146,12 @@ public class LifeLoseAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
return SpellAbilityAi.isSorcerySpeed(sa) || sa.hasParam("ActivationPhases") || SpellAbilityAi.playReusable(ai, sa)
|
||||
|| ComputerUtil.activateForCost(sa, ai);
|
||||
if (SpellAbilityAi.isSorcerySpeed(sa) || sa.hasParam("ActivationPhases") || SpellAbilityAi.playReusable(ai, sa)
|
||||
|| ComputerUtil.activateForCost(sa, ai)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -80,7 +80,9 @@ public class ManifestAi extends SpellAbilityAi {
|
||||
// Set PayX here to maximum value.
|
||||
int x = ComputerUtilMana.determineLeftoverMana(sa, ai);
|
||||
source.setSVar("PayX", Integer.toString(x));
|
||||
return x > 0;
|
||||
if (x <= 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -119,7 +121,9 @@ public class ManifestAi extends SpellAbilityAi {
|
||||
return false;
|
||||
|
||||
// card has ETBTrigger or ETBReplacement
|
||||
return !card.hasETBTrigger(false) && !card.hasETBReplacement();
|
||||
if (card.hasETBTrigger(false) || card.hasETBReplacement()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ public class PeekAndRevealAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
if ("Main2".equals(sa.getParam("AILogic"))) {
|
||||
return !aiPlayer.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2);
|
||||
}
|
||||
if (aiPlayer.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// So far this only appears on Triggers, but will expand
|
||||
// once things get converted from Dig + NoMove
|
||||
return true;
|
||||
|
||||
@@ -75,10 +75,12 @@ public class PoisonAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
Player max = players.max(PlayerPredicates.compareByPoison());
|
||||
// ai is one of the max
|
||||
return ai.getPoisonCounters() != max.getPoisonCounters();
|
||||
if (ai.getPoisonCounters() == max.getPoisonCounters()) {
|
||||
// ai is one of the max
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean tgtPlayer(Player ai, SpellAbility sa, boolean mandatory) {
|
||||
@@ -90,8 +92,10 @@ public class PoisonAi extends SpellAbilityAi {
|
||||
public boolean apply(Player input) {
|
||||
if (input.cantLose()) {
|
||||
return false;
|
||||
} else return input.canReceiveCounters(CounterType.POISON);
|
||||
|
||||
} else if (!input.canReceiveCounters(CounterType.POISON)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -80,7 +80,11 @@ public class RevealAi extends RevealAiBase {
|
||||
|
||||
}
|
||||
|
||||
return revealHandTargetAI(ai, sa/*, false, mandatory*/);
|
||||
if (!revealHandTargetAI(ai, sa/*, false, mandatory*/)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,10 @@ public class SetStateAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
return "Transform".equals(mode) || "Flip".equals(mode);
|
||||
if("Transform".equals(mode) || "Flip".equals(mode)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -133,7 +133,7 @@ public final class ImageKeys {
|
||||
// if there's an art variant try without it
|
||||
if (setlessFilename.matches(".*[0-9]*$")) {
|
||||
file = findFile(dir, setlessFilename.replaceAll("[0-9]*$", ""));
|
||||
return file;
|
||||
if (file != null) { return file; }
|
||||
}
|
||||
}
|
||||
} else if (filename.contains("/")) {
|
||||
@@ -144,7 +144,7 @@ public final class ImageKeys {
|
||||
// try lowering the art index to the minimum for regular cards
|
||||
if (setlessFilename.contains(".full")) {
|
||||
file = findFile(dir, setlessFilename.replaceAll("[0-9]*[.]full", "1.full"));
|
||||
return file;
|
||||
if (file != null) { return file; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,13 @@ public abstract class LobbyPlayer {
|
||||
}
|
||||
LobbyPlayer other = (LobbyPlayer) obj;
|
||||
if (name == null) {
|
||||
return other.name == null;
|
||||
} else return name.equals(other.name);
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getAvatarIndex() {
|
||||
|
||||
@@ -598,7 +598,10 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
if (multiWordTypes[0].startsWith(type) && !multiWordTypes[0].equals(type)) {
|
||||
return true;
|
||||
}
|
||||
return multiWordTypes[1].startsWith(type) && !multiWordTypes[1].equals(type);
|
||||
if (multiWordTypes[1].startsWith(type) && !multiWordTypes[1].equals(type)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Constant {
|
||||
|
||||
@@ -216,7 +216,10 @@ public class DeckRecognizer {
|
||||
if (line.toLowerCase().contains("schemes")) {
|
||||
return true;
|
||||
}
|
||||
return line.toLowerCase().contains("vanguard");
|
||||
if (line.toLowerCase().contains("vanguard")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setDateConstraint(int month, Integer year) {
|
||||
|
||||
@@ -159,7 +159,11 @@ public final class PaperCard implements Comparable<IPaperCard>, InventoryItemFro
|
||||
if (!edition.equals(other.edition)) {
|
||||
return false;
|
||||
}
|
||||
return (other.foil == foil) && (other.artIndex == artIndex);
|
||||
if ((other.foil != foil) || (other.artIndex != artIndex)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1069,7 +1069,11 @@ public class CombatUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !attacker.hasKeyword(Keyword.INTIMIDATE) || blocker.isArtifact() || blocker.sharesColorWith(attacker);
|
||||
if (attacker.hasKeyword(Keyword.INTIMIDATE) && !blocker.isArtifact() && !blocker.sharesColorWith(attacker)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // canBlock()
|
||||
|
||||
public static boolean canAttackerBeBlockedWithAmount(Card attacker, int amount, Combat combat) {
|
||||
|
||||
@@ -149,11 +149,13 @@ public class CostDiscard extends CostPartWithList {
|
||||
}
|
||||
}
|
||||
|
||||
// not enough cards in hand to pay
|
||||
return (amount == null) || (amount <= handList.size() - adjustment);
|
||||
if ((amount != null) && (amount > handList.size() - adjustment)) {
|
||||
// not enough cards in hand to pay
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -78,7 +78,11 @@ public class CostPayLife extends CostPart {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !payer.hasKeyword("You can't pay life to cast spells or activate abilities.");
|
||||
if (payer.hasKeyword("You can't pay life to cast spells or activate abilities.")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2476,7 +2476,10 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
"Skip all combat phases of this turn.");
|
||||
return true;
|
||||
}
|
||||
return hasKeyword("Skip all combat phases of this turn.");
|
||||
if (hasKeyword("Skip all combat phases of this turn.")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSkippingMain() {
|
||||
@@ -2596,7 +2599,10 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
removeKeyword("Skip your next draw step.");
|
||||
return true;
|
||||
}
|
||||
return hasKeyword("Skip your draw step.");
|
||||
if (hasKeyword("Skip your draw step.")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public CardCollectionView getInboundTokens() {
|
||||
|
||||
@@ -23,9 +23,13 @@ public class PlayerProperty {
|
||||
|
||||
Game game = player.getGame();
|
||||
if (property.equals("You")) {
|
||||
return player.equals(sourceController);
|
||||
if (!player.equals(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("Opponent")) {
|
||||
return !player.equals(sourceController) && player.isOpponentOf(sourceController);
|
||||
if (player.equals(sourceController) || !player.isOpponentOf(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("OpponentOf ")) {
|
||||
final String v = property.split(" ")[1];
|
||||
final List<Player> players = AbilityUtils.getDefinedPlayers(source, v, spellAbility);
|
||||
@@ -35,24 +39,42 @@ public class PlayerProperty {
|
||||
}
|
||||
}
|
||||
} else if (property.equals("YourTeam")) {
|
||||
return player.sameTeam(sourceController);
|
||||
if (!player.sameTeam(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("Allies")) {
|
||||
return !player.equals(sourceController) && !player.isOpponentOf(sourceController);
|
||||
if (player.equals(sourceController) || player.isOpponentOf(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("Active")) {
|
||||
return player.equals(game.getPhaseHandler().getPlayerTurn());
|
||||
if (!player.equals(game.getPhaseHandler().getPlayerTurn())) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("NonActive")) {
|
||||
return !player.equals(game.getPhaseHandler().getPlayerTurn());
|
||||
if (player.equals(game.getPhaseHandler().getPlayerTurn())) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("OpponentToActive")) {
|
||||
final Player active = game.getPhaseHandler().getPlayerTurn();
|
||||
return !player.equals(active) && player.isOpponentOf(active);
|
||||
if (player.equals(active) || !player.isOpponentOf(active)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("Other")) {
|
||||
return !player.equals(sourceController);
|
||||
if (player.equals(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("OtherThanSourceOwner")) {
|
||||
return !player.equals(source.getOwner());
|
||||
if (player.equals(source.getOwner())) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("isMonarch")) {
|
||||
return player.equals(game.getMonarch());
|
||||
if (!player.equals(game.getMonarch())) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("hasBlessing")) {
|
||||
return player.hasBlessing();
|
||||
if (!player.hasBlessing()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("wasDealtCombatDamageThisCombatBy ")) {
|
||||
String v = property.split(" ")[1];
|
||||
|
||||
@@ -69,7 +91,9 @@ public class PlayerProperty {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
return found >= count;
|
||||
if (found < count) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("wasDealtDamageThisGameBy ")) {
|
||||
String v = property.split(" ")[1];
|
||||
|
||||
@@ -86,7 +110,9 @@ public class PlayerProperty {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
return found >= count;
|
||||
if (found < count) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("wasDealtDamageThisTurnBy ")) {
|
||||
String v = property.split(" ")[1];
|
||||
int count = 1;
|
||||
@@ -103,7 +129,9 @@ public class PlayerProperty {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
return found >= count;
|
||||
if (found < count) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("wasDealtCombatDamageThisTurnBy ")) {
|
||||
String v = property.split(" ")[1];
|
||||
|
||||
@@ -121,54 +149,90 @@ public class PlayerProperty {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
return found >= count;
|
||||
if (found < count) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("attackedBySourceThisCombat")) {
|
||||
return game.getCombat() != null && player.equals(game.getCombat().getDefenderPlayerByAttacker(source));
|
||||
if (game.getCombat() == null || !player.equals(game.getCombat().getDefenderPlayerByAttacker(source))) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("wasDealtDamageThisTurn")) {
|
||||
return player.getAssignedDamage() != 0;
|
||||
if (player.getAssignedDamage() == 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("wasDealtCombatDamageThisTurn")) {
|
||||
return player.getAssignedCombatDamage() != 0;
|
||||
if (player.getAssignedCombatDamage() == 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("LostLifeThisTurn")) {
|
||||
return player.getLifeLostThisTurn() > 0;
|
||||
if (player.getLifeLostThisTurn() <= 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("DeclaredAttackerThisTurn")) {
|
||||
return player.getAttackersDeclaredThisTurn() > 0;
|
||||
if (player.getAttackersDeclaredThisTurn() <= 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("TappedLandForManaThisTurn")) {
|
||||
return player.hasTappedLandForManaThisTurn();
|
||||
if (!player.hasTappedLandForManaThisTurn()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("NoCardsInHandAtBeginningOfTurn")) {
|
||||
return player.getNumCardsInHandStartedThisTurnWith() <= 0;
|
||||
if (player.getNumCardsInHandStartedThisTurnWith() > 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("CardsInHandAtBeginningOfTurn")) {
|
||||
return player.getNumCardsInHandStartedThisTurnWith() > 0;
|
||||
if (player.getNumCardsInHandStartedThisTurnWith() <= 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("WithCardsInHand")) {
|
||||
if (property.contains("AtLeast")) {
|
||||
int amount = Integer.parseInt(property.split("AtLeast")[1]);
|
||||
return player.getCardsIn(ZoneType.Hand).size() >= amount;
|
||||
if (player.getCardsIn(ZoneType.Hand).size() < amount) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.equals("IsRemembered")) {
|
||||
return source.isRemembered(player);
|
||||
if (!source.isRemembered(player)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("IsNotRemembered")) {
|
||||
return !source.isRemembered(player);
|
||||
if (source.isRemembered(player)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("EnchantedBy")) {
|
||||
return player.isEnchantedBy(source);
|
||||
if (!player.isEnchantedBy(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("Chosen")) {
|
||||
return source.getChosenPlayer() != null && source.getChosenPlayer().equals(player);
|
||||
if (source.getChosenPlayer() == null || !source.getChosenPlayer().equals(player)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("LifeEquals_")) {
|
||||
int life = AbilityUtils.calculateAmount(source, property.substring(11), null);
|
||||
return player.getLife() == life;
|
||||
if (player.getLife() != life) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("IsPoisoned")) {
|
||||
return player.getPoisonCounters() > 0;
|
||||
if (player.getPoisonCounters() <= 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("controls")) {
|
||||
final String[] type = property.substring(8).split("_");
|
||||
final CardCollectionView list = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), type[0], sourceController, source);
|
||||
String comparator = type[1];
|
||||
String compareTo = comparator.substring(2);
|
||||
int y = StringUtils.isNumeric(compareTo) ? Integer.parseInt(compareTo) : 0;
|
||||
return Expressions.compare(list.size(), comparator, y);
|
||||
if (!Expressions.compare(list.size(), comparator, y)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("withMore")) {
|
||||
final String cardType = property.split("sThan")[0].substring(8);
|
||||
final Player controller = "Active".equals(property.split("sThan")[1]) ? game.getPhaseHandler().getPlayerTurn() : sourceController;
|
||||
final CardCollectionView oppList = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType));
|
||||
final CardCollectionView yourList = CardLists.filter(controller.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType));
|
||||
return oppList.size() > yourList.size();
|
||||
if (oppList.size() <= yourList.size()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("withAtLeast")) {
|
||||
final String cardType = property.split("More")[1].split("sThan")[0];
|
||||
final int amount = Integer.parseInt(property.substring(11, 12));
|
||||
@@ -176,19 +240,25 @@ public class PlayerProperty {
|
||||
final CardCollectionView oppList = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType));
|
||||
final CardCollectionView yourList = CardLists.filter(controller.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType));
|
||||
System.out.println(yourList.size());
|
||||
return oppList.size() >= yourList.size() + amount;
|
||||
if (oppList.size() < yourList.size() + amount) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("hasMore")) {
|
||||
final Player controller = property.contains("Than") && "Active".equals(property.split("Than")[1]) ? game.getPhaseHandler().getPlayerTurn() : sourceController;
|
||||
if (property.substring(7).startsWith("Life") && player.getLife() <= controller.getLife()) {
|
||||
return false;
|
||||
} else return !property.substring(7).startsWith("CardsInHand")
|
||||
|| player.getCardsIn(ZoneType.Hand).size() > controller.getCardsIn(ZoneType.Hand).size();
|
||||
} else if (property.substring(7).startsWith("CardsInHand")
|
||||
&& player.getCardsIn(ZoneType.Hand).size() <= controller.getCardsIn(ZoneType.Hand).size()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("hasFewer")) {
|
||||
final Player controller = "Active".equals(property.split("Than")[1]) ? game.getPhaseHandler().getPlayerTurn() : sourceController;
|
||||
final ZoneType zt = property.substring(8).startsWith("CreaturesInYard") ? ZoneType.Graveyard : ZoneType.Battlefield;
|
||||
final CardCollectionView oppList = CardLists.filter(player.getCardsIn(zt), Presets.CREATURES);
|
||||
final CardCollectionView yourList = CardLists.filter(controller.getCardsIn(zt), Presets.CREATURES);
|
||||
return oppList.size() < yourList.size();
|
||||
if (oppList.size() >= yourList.size()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("withMost")) {
|
||||
final String kind = property.substring(8);
|
||||
if (kind.equals("Life")) {
|
||||
@@ -198,7 +268,9 @@ public class PlayerProperty {
|
||||
highestLife = p.getLife();
|
||||
}
|
||||
}
|
||||
return player.getLife() == highestLife;
|
||||
if (player.getLife() != highestLife) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (kind.equals("PermanentInPlay")) {
|
||||
int typeNum = 0;
|
||||
@@ -214,7 +286,9 @@ public class PlayerProperty {
|
||||
}
|
||||
}
|
||||
|
||||
return controlmost.size() == 1 && controlmost.contains(player);
|
||||
if (controlmost.size() != 1 || !controlmost.contains(player)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (kind.equals("CardsInHand")) {
|
||||
int largestHand = 0;
|
||||
@@ -225,7 +299,9 @@ public class PlayerProperty {
|
||||
withLargestHand = p;
|
||||
}
|
||||
}
|
||||
return player.equals(withLargestHand);
|
||||
if (!player.equals(withLargestHand)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (kind.startsWith("Type")) {
|
||||
String type = property.split("Type")[1];
|
||||
@@ -249,7 +325,9 @@ public class PlayerProperty {
|
||||
if (checkOnly && controlmost.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
return controlmost.contains(player);
|
||||
if (!controlmost.contains(player)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("withLowest")) {
|
||||
if (property.substring(10).equals("Life")) {
|
||||
@@ -264,14 +342,20 @@ public class PlayerProperty {
|
||||
lowestlifep.add(p);
|
||||
}
|
||||
}
|
||||
return lowestlifep.contains(player);
|
||||
if (!lowestlifep.contains(player)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("LessThanHalfStartingLifeTotal")) {
|
||||
return player.getLife() < (int) Math.ceil(player.getStartingLife() / 2.0);
|
||||
if (player.getLife() >= (int) Math.ceil(player.getStartingLife() / 2.0)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("Triggered")) {
|
||||
return AbilityUtils.getDefinedPlayers(source, property, spellAbility).contains(player);
|
||||
if (!AbilityUtils.getDefinedPlayers(source, property, spellAbility).contains(player)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,9 @@ public class ReplaceAddCounter extends ReplacementEffect {
|
||||
|
||||
if (mapParams.containsKey("ValidCounterType")) {
|
||||
String type = this.getMapParams().get("ValidCounterType");
|
||||
return CounterType.getType(type) == runParams.get("CounterType");
|
||||
if (CounterType.getType(type) != runParams.get("CounterType")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -59,7 +59,9 @@ public class ReplaceCounter extends ReplacementEffect {
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidType")) {
|
||||
String type = this.getMapParams().get("ValidType");
|
||||
return !type.equals("Spell") || spellAbility.isSpell();
|
||||
if (type.equals("Spell") && !spellAbility.isSpell()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,9 @@ public class ReplaceDestroy extends ReplacementEffect {
|
||||
}
|
||||
}
|
||||
if (hasParam("ValidSource")) {
|
||||
return matchesValid(runParams.get("Source"), getParam("ValidSource").split(","), getHostCard());
|
||||
if (!matchesValid(runParams.get("Source"), getParam("ValidSource").split(","), getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -62,7 +62,9 @@ public class ReplaceDiscard extends ReplacementEffect {
|
||||
}
|
||||
}
|
||||
if (this.getMapParams().containsKey("DiscardFromEffect")) {
|
||||
return null != runParams.get("Source");
|
||||
if (null == runParams.get("Source")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -55,9 +55,11 @@ public class ReplaceDraw extends ReplacementEffect {
|
||||
}
|
||||
if (this.getMapParams().containsKey("NotFirstCardInDrawStep")) {
|
||||
final Player p = (Player)runParams.get("Affected");
|
||||
return p.numDrawnThisDrawStep() != 0
|
||||
|| !this.getHostCard().getGame().getPhaseHandler().is(PhaseType.DRAW)
|
||||
|| !this.getHostCard().getGame().getPhaseHandler().isPlayerTurn(p);
|
||||
if (p.numDrawnThisDrawStep() == 0
|
||||
&& this.getHostCard().getGame().getPhaseHandler().is(PhaseType.DRAW)
|
||||
&& this.getHostCard().getGame().getPhaseHandler().isPlayerTurn(p)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -57,7 +57,9 @@ public class ReplaceDrawCards extends ReplacementEffect {
|
||||
String comparator = this.getMapParams().get("Number");
|
||||
final String operator = comparator.substring(0, 2);
|
||||
final int operandValue = Integer.parseInt(comparator.substring(2));
|
||||
return Expressions.compare(n, operator, operandValue);
|
||||
if (!Expressions.compare(n, operator, operandValue)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -57,7 +57,9 @@ public class ReplaceGainLife extends ReplacementEffect {
|
||||
}
|
||||
}
|
||||
if ("True".equals(this.getMapParams().get("SourceController"))) {
|
||||
return runParams.get("Source") != null && runParams.get("Affected").equals(((Card) runParams.get("Source")).getController());
|
||||
if (runParams.get("Source") == null || !runParams.get("Affected").equals(((Card)runParams.get("Source")).getController())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -29,7 +29,9 @@ public class ReplaceGameLoss extends ReplacementEffect {
|
||||
return false;
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidPlayer")) {
|
||||
return matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidPlayer").split(","), this.getHostCard());
|
||||
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidPlayer").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -105,7 +105,9 @@ public class ReplaceMoved extends ReplacementEffect {
|
||||
if (runParams.containsKey("Cause")) {
|
||||
SpellAbility cause = (SpellAbility) runParams.get("Cause");
|
||||
if (cause != null) {
|
||||
return !cause.isValid(getParam("NotCause").split(","), controller, getHostCard(), null);
|
||||
if (cause.isValid(getParam("NotCause").split(","), controller, getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@ public class ReplaceProduceMana extends ReplacementEffect {
|
||||
}
|
||||
|
||||
if (this.getMapParams().containsKey("ValidCard")) {
|
||||
return matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard());
|
||||
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,9 @@ public class ReplaceSetInMotion extends ReplacementEffect {
|
||||
return false;
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidPlayer")) {
|
||||
return matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidPlayer").split(","), this.getHostCard());
|
||||
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidPlayer").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -31,7 +31,9 @@ public class ReplaceSurveil extends ReplacementEffect {
|
||||
}
|
||||
|
||||
if (hasParam("ValidPlayer")) {
|
||||
return matchesValid(runParams.get("Affected"), getParam("ValidPlayer").split(","), getHostCard());
|
||||
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidPlayer").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -45,7 +45,9 @@ public class ReplaceToken extends ReplacementEffect {
|
||||
|
||||
if (hasParam("ValidToken")) {
|
||||
if (runParams.containsKey("Token")) {
|
||||
return matchesValid(runParams.get("Token"), getParam("ValidToken").split(","), getHostCard());
|
||||
if (!matchesValid(runParams.get("Token"), getParam("ValidToken").split(","), getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// in case RE is not updated yet
|
||||
return false;
|
||||
|
||||
@@ -30,7 +30,9 @@ public class ReplaceTurnFaceUp extends ReplacementEffect {
|
||||
return false;
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidCard")) {
|
||||
return matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard());
|
||||
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,9 @@ public class ReplaceUntap extends ReplacementEffect {
|
||||
final Card card = (Card) o;
|
||||
// all replace untap with untapStep does have "your untap step"
|
||||
final Player player = card.getController();
|
||||
return player.getGame().getPhaseHandler().is(PhaseType.UNTAP, player);
|
||||
if (!player.getGame().getPhaseHandler().is(PhaseType.UNTAP, player)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1720,7 +1720,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
if (isSpell() && text.contains("was spent to cast")) {
|
||||
return true;
|
||||
}
|
||||
return isAbility() && text.contains("mana spent to pay");
|
||||
if (isAbility() && text.contains("mana spent to pay")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void checkActivationResloveSubs() {
|
||||
|
||||
@@ -444,7 +444,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
||||
final int svarValue = AbilityUtils.calculateAmount(host, this.getsVarToCheck(), sa);
|
||||
final int operandValue = AbilityUtils.calculateAmount(host, this.getsVarOperand(), sa);
|
||||
|
||||
return Expressions.compare(svarValue, this.getsVarOperator(), operandValue);
|
||||
if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,11 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
}
|
||||
|
||||
// TODO: this is an exception for Aftermath. Needs to be somehow generalized.
|
||||
return this.getZone() == ZoneType.Graveyard || !sa.isAftermath() || !sa.isRightSplit();
|
||||
if (this.getZone() != ZoneType.Graveyard && sa.isAftermath() && sa.isRightSplit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -311,7 +315,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
}
|
||||
}
|
||||
|
||||
return isPhase;
|
||||
if (!isPhase) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -350,7 +356,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
|
||||
if (sa.isSpell()) {
|
||||
final CardPlayOption o = c.mayPlay(sa.getMayPlay());
|
||||
return o != null && o.getPlayer() == activator;
|
||||
if (o != null && o.getPlayer() == activator) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -507,7 +515,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
final int svarValue = AbilityUtils.calculateAmount(sa.getHostCard(), this.getsVarToCheck(), sa);
|
||||
final int operandValue = AbilityUtils.calculateAmount(sa.getHostCard(), this.getsVarOperand(), sa);
|
||||
|
||||
return Expressions.compare(svarValue, this.getsVarOperator(), operandValue);
|
||||
if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -572,7 +582,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
int gameActivationLimit = AbilityUtils.calculateAmount(c, limit, sa);
|
||||
this.setGameActivationLimit(gameActivationLimit);
|
||||
|
||||
return (this.getGameActivationLimit() == -1) || (sa.getActivationsThisGame() < this.getGameActivationLimit());
|
||||
if ((this.getGameActivationLimit() != -1) && (sa.getActivationsThisGame() >= this.getGameActivationLimit())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -516,8 +516,12 @@ public class StaticAbility extends CardTraitBase implements Comparable<StaticAbi
|
||||
return false;
|
||||
}
|
||||
|
||||
return !hasParam("PlayerAttackedWithCreatureThisTurn")
|
||||
|| player.getAttackedWithCreatureThisTurn();
|
||||
if (hasParam("PlayerAttackedWithCreatureThisTurn")
|
||||
&& !player.getAttackedWithCreatureThisTurn()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -702,7 +706,9 @@ public class StaticAbility extends CardTraitBase implements Comparable<StaticAbi
|
||||
final String svarOperator = comparator.substring(0, 2);
|
||||
final String svarOperand = comparator.substring(2);
|
||||
final int operandValue = AbilityUtils.calculateAmount(this.hostCard, svarOperand, this);
|
||||
return Expressions.compare(sVar, svarOperator, operandValue);
|
||||
if (!Expressions.compare(sVar, svarOperator, operandValue)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -24,7 +24,9 @@ public class StaticAbilityCantAttach {
|
||||
}
|
||||
Card tcard = (Card) target;
|
||||
|
||||
return card.isValid(stAb.getParam("ValidCardToTarget").split(","), tcard.getController(), tcard, null);
|
||||
if (!card.isValid(stAb.getParam("ValidCardToTarget").split(","), tcard.getController(), tcard, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -82,7 +82,9 @@ public class StaticAbilityCantAttackBlock {
|
||||
}
|
||||
if (params.containsKey("UnlessDefender")) {
|
||||
final String type = params.get("UnlessDefender");
|
||||
return !defender.hasProperty(type, hostCard.getController(), hostCard, null);
|
||||
if (defender.hasProperty(type, hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -83,7 +83,9 @@ public class StaticAbilityCantBeCast {
|
||||
int limit = Integer.parseInt(params.get("NumLimitEachTurn"));
|
||||
String valid = params.containsKey("ValidCard") ? params.get("ValidCard") : "Card";
|
||||
List<Card> thisTurnCast = CardUtil.getThisTurnCast(valid, card);
|
||||
return CardLists.filterControlledBy(thisTurnCast, activator).size() >= limit;
|
||||
if (CardLists.filterControlledBy(thisTurnCast, activator).size() < limit) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -136,8 +138,12 @@ public class StaticAbilityCantBeCast {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !params.containsKey("NonActivatorTurn") || (activator == null)
|
||||
|| !activator.getGame().getPhaseHandler().isPlayerTurn(activator);
|
||||
if (params.containsKey("NonActivatorTurn") && (activator != null)
|
||||
&& activator.getGame().getPhaseHandler().isPlayerTurn(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,8 +174,12 @@ public class StaticAbilityCantBeCast {
|
||||
}
|
||||
}
|
||||
|
||||
return !params.containsKey("Player") || (player == null)
|
||||
|| player.isValid(params.get("Player"), hostCard.getController(), hostCard, null);
|
||||
if (params.containsKey("Player") && (player != null)
|
||||
&& !player.isValid(params.get("Player"), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,9 +19,14 @@ public class StaticAbilityCantPutCounter {
|
||||
|
||||
// for the other part
|
||||
if (staticAbility.hasParam("ValidCard")) {
|
||||
return card.isValid(staticAbility.getParam("ValidCard").split(","), hostCard.getController(), hostCard, null);
|
||||
} else return !staticAbility.hasParam("ValidPlayer");
|
||||
|
||||
if (!card.isValid(staticAbility.getParam("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
} else if (staticAbility.hasParam("ValidPlayer")) {
|
||||
// for the other part
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean applyCantPutCounter(final StaticAbility staticAbility, final Player player,
|
||||
@@ -37,8 +42,13 @@ public class StaticAbilityCantPutCounter {
|
||||
|
||||
// for the other part
|
||||
if (staticAbility.hasParam("ValidPlayer")) {
|
||||
return player.isValid(staticAbility.getParam("ValidPlayer").split(","), hostCard.getController(), hostCard, null);
|
||||
} else return !staticAbility.hasParam("ValidCard");
|
||||
|
||||
if (!player.isValid(staticAbility.getParam("ValidPlayer").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
} else if (staticAbility.hasParam("ValidCard")) {
|
||||
// for the other part
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,9 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
|
||||
if (this.mapParams.containsKey("TurnCount")) {
|
||||
int turn = Integer.parseInt(this.mapParams.get("TurnCount"));
|
||||
return phaseHandler.getTurn() == turn;
|
||||
if (phaseHandler.getTurn() != turn) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -354,7 +356,10 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
}
|
||||
}
|
||||
|
||||
return meetsCommonRequirements(this.mapParams);
|
||||
if ( !meetsCommonRequirements(this.mapParams))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +382,8 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
String condition = this.mapParams.get("Condition");
|
||||
if ("AltCost".equals(condition)) {
|
||||
final Card moved = (Card) runParams.get("Card");
|
||||
return null == moved || moved.isOptionalCostPaid(OptionalCost.AltCost);
|
||||
if( null != moved && !moved.isOptionalCostPaid(OptionalCost.AltCost))
|
||||
return false;
|
||||
} else if ("AttackedPlayerWithMostLife".equals(condition)) {
|
||||
GameEntity attacked = (GameEntity) runParams.get("Attacked");
|
||||
if (attacked == null) {
|
||||
@@ -385,8 +391,10 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
// ends up being in Defender at that point.
|
||||
attacked = (GameEntity) runParams.get("Defender");
|
||||
}
|
||||
return attacked != null && attacked.isValid("Player.withMostLife",
|
||||
this.getHostCard().getController(), this.getHostCard(), null);
|
||||
if (attacked == null || !attacked.isValid("Player.withMostLife",
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
} else if ("AttackedPlayerWhoAttackedYouLastTurn".equals(condition)) {
|
||||
GameEntity attacked = (GameEntity) runParams.get("Attacked");
|
||||
if (attacked == null) {
|
||||
@@ -403,7 +411,9 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
}
|
||||
}
|
||||
|
||||
return attacked != null && valid;
|
||||
if (attacked == null || !valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,8 +49,10 @@ public class TriggerAbandoned extends Trigger {
|
||||
@Override
|
||||
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
return matchesValid(runParams2.get("Scheme"), this.mapParams.get("ValidCard").split(","),
|
||||
this.getHostCard());
|
||||
if (!matchesValid(runParams2.get("Scheme"), this.mapParams.get("ValidCard").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -52,8 +52,10 @@ public class TriggerAdapt extends Trigger {
|
||||
public final boolean performTest(final Map<String, Object> runParams2) {
|
||||
final Card sac = (Card) runParams2.get("Card");
|
||||
if (hasParam("ValidCard")) {
|
||||
return sac.isValid(getParam("ValidCard").split(","), getHostCard().getController(),
|
||||
getHostCard(), null);
|
||||
if (!sac.isValid(getParam("ValidCard").split(","), getHostCard().getController(),
|
||||
getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,9 @@ public class TriggerAttached extends Trigger {
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("ValidTarget")) {
|
||||
return matchesValid(tgt, this.mapParams.get("ValidTarget").split(","), this.getHostCard());
|
||||
if (!matchesValid(tgt, this.mapParams.get("ValidTarget").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -73,7 +73,9 @@ public class TriggerAttackerBlocked extends Trigger {
|
||||
getHostCard().getController(), getHostCard()
|
||||
);
|
||||
|
||||
return count != 0;
|
||||
if ( count == 0 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -73,8 +73,12 @@ public class TriggerAttackerBlockedByCreature extends Trigger {
|
||||
if (this.mapParams.containsKey("ValidBlocker")) {
|
||||
final String validBlocker = this.mapParams.get("ValidBlocker");
|
||||
if (validBlocker.equals("LessPowerThanAttacker")) {
|
||||
return blocker.getNetPower() < attacker.getNetPower();
|
||||
} else return matchesValid(blocker, validBlocker.split(","), this.getHostCard());
|
||||
if (blocker.getNetPower() >= attacker.getNetPower()) {
|
||||
return false;
|
||||
}
|
||||
} else if (!matchesValid(blocker, validBlocker.split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -58,8 +58,10 @@ public class TriggerAttackerUnblocked extends Trigger {
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidDefender")) {
|
||||
return matchesValid(runParams2.get("Defender"), this.mapParams.get("ValidDefender").split(","),
|
||||
this.getHostCard());
|
||||
if (!matchesValid(runParams2.get("Defender"), this.mapParams.get("ValidDefender").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,8 +73,10 @@ public class TriggerAttackerUnblockedOnce extends Trigger {
|
||||
*/
|
||||
}
|
||||
if (hasParam("ValidAttackingPlayer")) {
|
||||
return matchesValid(runParams2.get("AttackingPlayer"),
|
||||
this.mapParams.get("ValidAttackingPlayer").split(","), this.getHostCard());
|
||||
if (!matchesValid(runParams2.get("AttackingPlayer"),
|
||||
this.mapParams.get("ValidAttackingPlayer").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,9 @@ public class TriggerAttackersDeclared extends Trigger {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,9 @@ public class TriggerAttacks extends Trigger {
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -24,8 +24,10 @@ public class TriggerBecomeMonarch extends Trigger {
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("BeginTurn")) {
|
||||
return matchesValid(game.getMonarchBeginTurn(), this.mapParams.get("BeginTurn").split(","),
|
||||
host);
|
||||
if (!matchesValid(game.getMonarchBeginTurn(), this.mapParams.get("BeginTurn").split(","),
|
||||
host)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,8 +52,10 @@ public class TriggerBecomeMonstrous extends Trigger {
|
||||
@Override
|
||||
public final boolean performTest(Map<String, Object> runParams2) {
|
||||
if (hasParam("ValidCard")) {
|
||||
return matchesValid(runParams2.get("Card"), getParam("ValidCard").split(","),
|
||||
this.getHostCard());
|
||||
if (!matchesValid(runParams2.get("Card"), getParam("ValidCard").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -50,8 +50,10 @@ public class TriggerBecomeRenowned extends Trigger {
|
||||
@Override
|
||||
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
return matchesValid(runParams2.get("Card"), this.mapParams.get("ValidCard").split(","),
|
||||
this.getHostCard());
|
||||
if (!matchesValid(runParams2.get("Card"), this.mapParams.get("ValidCard").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -77,7 +77,9 @@ public class TriggerBecomesTarget extends Trigger {
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("FirstTime")) {
|
||||
return runParams2.containsKey("FirstTime");
|
||||
if (!runParams2.containsKey("FirstTime")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -70,7 +70,9 @@ public class TriggerBecomesTargetOnce extends Trigger {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,9 @@ public class TriggerBlocks extends Trigger {
|
||||
}
|
||||
}
|
||||
|
||||
return foundMatch;
|
||||
if (!foundMatch) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -60,8 +60,10 @@ public class TriggerChampioned extends Trigger {
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidSource")) {
|
||||
return source.isValid(this.mapParams.get("ValidSource").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard(), null);
|
||||
if (!source.isValid(this.mapParams.get("ValidSource").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,8 +58,10 @@ public class TriggerChangesController extends Trigger {
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidOriginalController")) {
|
||||
return matchesValid(runParams2.get("OriginalController"), this.mapParams.get("ValidOriginalController").split(","),
|
||||
this.getHostCard());
|
||||
if (!matchesValid(runParams2.get("OriginalController"), this.mapParams.get("ValidOriginalController").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -59,7 +59,9 @@ public class TriggerClashed extends Trigger {
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("Won")) {
|
||||
return this.mapParams.get("Won").equals(runParams2.get("Won"));
|
||||
if (!this.mapParams.get("Won").equals(runParams2.get("Won"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -109,7 +109,9 @@ public class TriggerCounterAdded extends Trigger {
|
||||
final int operand = Integer.parseInt(fullParam.substring(2));
|
||||
final int actualAmount = (Integer) runParams2.get("CounterAmount");
|
||||
|
||||
return Expressions.compare(actualAmount, operator, operand);
|
||||
if (!Expressions.compare(actualAmount, operator, operand)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -93,8 +93,10 @@ public class TriggerCounterAddedOnce extends Trigger {
|
||||
return false;
|
||||
}
|
||||
|
||||
return source.isValid(getParam("ValidSource").split(","), getHostCard().getController(),
|
||||
getHostCard(), null);
|
||||
if (!source.isValid(getParam("ValidSource").split(","), getHostCard().getController(),
|
||||
getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -71,7 +71,9 @@ public class TriggerCounterRemoved extends Trigger {
|
||||
if (hasParam("NewCounterAmount")) {
|
||||
final String amtString = getParam("NewCounterAmount");
|
||||
int amt = Integer.parseInt(amtString);
|
||||
return amt == addedNewCounterAmount.intValue();
|
||||
if(amt != addedNewCounterAmount.intValue()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -62,7 +62,9 @@ public class TriggerCounterRemovedOnce extends Trigger {
|
||||
|
||||
if (hasParam("CounterType")) {
|
||||
final String type = getParam("CounterType");
|
||||
return type.equals(removedType.toString());
|
||||
if (!type.equals(removedType.toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -80,7 +80,9 @@ public class TriggerCountered extends Trigger {
|
||||
if (ctrdSA != null) {
|
||||
if (validType.equals("Spell") && !ctrdSA.isSpell()) {
|
||||
return false;
|
||||
} else return !validType.equals("Ability") || ctrdSA.isAbility();
|
||||
} else if (validType.equals("Ability") && !ctrdSA.isAbility()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,7 +94,9 @@ public class TriggerDamageDealtOnce extends Trigger {
|
||||
final int operand = Integer.parseInt(fullParam.substring(2));
|
||||
final int actualAmount = (Integer) runParams2.get("DamageAmount");
|
||||
|
||||
return Expressions.compare(actualAmount, operator, operand);
|
||||
if (!Expressions.compare(actualAmount, operator, operand)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -45,7 +45,9 @@ public class TriggerDamageDoneOnce extends Trigger {
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("ValidTarget")) {
|
||||
return matchesValid(tgt, this.mapParams.get("ValidTarget").split(","), this.getHostCard());
|
||||
if (!matchesValid(tgt, this.mapParams.get("ValidTarget").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,9 @@ public class TriggerDestroyed extends Trigger {
|
||||
}
|
||||
}
|
||||
if (hasParam("ValidCard")) {
|
||||
return matchesValid(runParams2.get("Card"), getParam("ValidCard").split(","), getHostCard());
|
||||
if (!matchesValid(runParams2.get("Card"), getParam("ValidCard").split(","), getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,9 @@ public class TriggerDiscarded extends Trigger {
|
||||
}
|
||||
if (this.mapParams.containsKey("IsMadness")) {
|
||||
Boolean madness = (Boolean) runParams2.get("IsMadness");
|
||||
return !(this.mapParams.get("IsMadness").equals("True") ^ madness);
|
||||
if (this.mapParams.get("IsMadness").equals("True") ^ madness) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,11 @@ public class TriggerDrawn extends Trigger {
|
||||
}
|
||||
|
||||
// trigger should not happen while Mulligan
|
||||
return game.getAge() != GameStage.Mulligan;
|
||||
if (game.getAge() == GameStage.Mulligan) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -84,8 +84,10 @@ public class TriggerExiled extends Trigger {
|
||||
if (cause == null) {
|
||||
return false;
|
||||
}
|
||||
return cause.getHostCard().isValid(getParam("ValidCause").split(","), getHostCard().getController(),
|
||||
getHostCard(), null);
|
||||
if (!cause.getHostCard().isValid(getParam("ValidCause").split(","), getHostCard().getController(),
|
||||
getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -60,8 +60,10 @@ public class TriggerExploited extends Trigger {
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidSource")) {
|
||||
return source.isValid(this.mapParams.get("ValidSource").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard(), null);
|
||||
if (!source.isValid(this.mapParams.get("ValidSource").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@ public class TriggerFlippedCoin extends Trigger {
|
||||
if (this.mapParams.containsKey("ValidResult")) {
|
||||
final boolean result = (Boolean) runParams2.get("Result");
|
||||
final boolean valid = "Win".equals(this.mapParams.get("ValidResult"));
|
||||
return !(result ^ valid);
|
||||
if (result ^ valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -536,7 +536,9 @@ public class TriggerHandler {
|
||||
final String dest = (String) runParams.get("Destination");
|
||||
if (dest.equals("Battlefield") && runParams.get("Card") instanceof Card) {
|
||||
final Card card = (Card) runParams.get("Card");
|
||||
return !card.isCreature();
|
||||
if (card.isCreature()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Torpor Orb check
|
||||
|
||||
@@ -73,7 +73,9 @@ public class TriggerInvestigated extends Trigger {
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("OnlyFirst")) {
|
||||
return (int) runParams2.get("Num") == 1;
|
||||
if ((int) runParams2.get("Num") != 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ public class TriggerLandPlayed extends Trigger {
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("NotFirstLand")) {
|
||||
return land.getController().getLandsPlayedThisTurn() >= 1;
|
||||
if (land.getController().getLandsPlayedThisTurn() < 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,9 @@ public class TriggerLifeGained extends Trigger {
|
||||
}
|
||||
if (hasParam("Spell")) {
|
||||
final SpellAbility spellAbility = (SpellAbility) runParams2.get("SourceSA");
|
||||
return spellAbility != null && spellAbility.getRootAbility().isSpell();
|
||||
if (spellAbility == null || !spellAbility.getRootAbility().isSpell()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -59,7 +59,9 @@ public class TriggerLifeLost extends Trigger {
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("FirstTime")) {
|
||||
return (boolean) runParams2.get("FirstTime");
|
||||
if (!(boolean)runParams2.get("FirstTime")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -57,8 +57,10 @@ public class TriggerPayCumulativeUpkeep extends Trigger {
|
||||
}
|
||||
final Card card = (Card) runParams2.get("Card");
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
return card.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard(), null);
|
||||
if (!card.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,8 +57,10 @@ public class TriggerPayEcho extends Trigger {
|
||||
}
|
||||
final Card card = (Card) runParams2.get("Card");
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
return card.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard(), null);
|
||||
if (!card.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,9 +20,13 @@ public class TriggerPhaseOut extends Trigger {
|
||||
if (this.mapParams.get("ValidCard").equals("Card.Self")) {
|
||||
// Since Phased out cards aren't visible in .isValid, use a special check here.
|
||||
// NOTE: All Phase Out Triggers should use ValidCard$ Card.Self
|
||||
return phaser == this.getHostCard();
|
||||
} else return phaser.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard(), null);
|
||||
if (phaser != this.getHostCard()) {
|
||||
return false;
|
||||
}
|
||||
} else if (!phaser.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user