diff --git a/Mage.Sets/src/mage/cards/a/AsylumVisitor.java b/Mage.Sets/src/mage/cards/a/AsylumVisitor.java index 8838eb8d410..c78c85df330 100644 --- a/Mage.Sets/src/mage/cards/a/AsylumVisitor.java +++ b/Mage.Sets/src/mage/cards/a/AsylumVisitor.java @@ -34,7 +34,7 @@ public final class AsylumVisitor extends CardImpl { // At the beginning of each player's upkeep, if that player has no cards in hand, you draw a card and you lose 1 life. Ability ability = new ConditionalInterveningIfTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), TargetController.ANY, false), - new CardsInHandCondition(ComparisonType.EQUAL_TO, 0, null, TargetController.ACTIVE), + new CardsInHandCondition(ComparisonType.EQUAL_TO, 0, TargetController.ACTIVE), "At the beginning of each player's upkeep, if that player has no cards in hand, you draw a card and you lose 1 life."); Effect effect = new LoseLifeSourceControllerEffect(1); ability.addEffect(effect); diff --git a/Mage.Sets/src/mage/cards/h/HellfireMongrel.java b/Mage.Sets/src/mage/cards/h/HellfireMongrel.java index 20c610c1c5b..b2c23254b79 100644 --- a/Mage.Sets/src/mage/cards/h/HellfireMongrel.java +++ b/Mage.Sets/src/mage/cards/h/HellfireMongrel.java @@ -33,7 +33,7 @@ public final class HellfireMongrel extends CardImpl { // At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Hellfire Mongrel deals 2 damage to that player. this.addAbility(new ConditionalInterveningIfTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), TargetController.OPPONENT, false, true), - (Condition)new CardsInHandCondition(ComparisonType.FEWER_THAN, 3, null, TargetController.ACTIVE), + (Condition)new CardsInHandCondition(ComparisonType.FEWER_THAN, 3, TargetController.ACTIVE), "At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, {this} deals 2 damage to that player." )); } diff --git a/Mage.Sets/src/mage/cards/h/HowltoothHollow.java b/Mage.Sets/src/mage/cards/h/HowltoothHollow.java index 7052465725b..0b10e9cf2ce 100644 --- a/Mage.Sets/src/mage/cards/h/HowltoothHollow.java +++ b/Mage.Sets/src/mage/cards/h/HowltoothHollow.java @@ -27,7 +27,7 @@ import java.util.UUID; public final class HowltoothHollow extends CardImpl { private static final Condition condition - = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0, null, TargetController.EACH_PLAYER); + = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0, TargetController.EACH_PLAYER); private static final Hint hint = new ConditionHint(condition, "Each player has no cards in hand"); public HowltoothHollow(UUID ownerId, CardSetInfo setInfo) { diff --git a/Mage.Sets/src/mage/cards/i/IdleThoughts.java b/Mage.Sets/src/mage/cards/i/IdleThoughts.java index c47ccaa1371..712014849f3 100644 --- a/Mage.Sets/src/mage/cards/i/IdleThoughts.java +++ b/Mage.Sets/src/mage/cards/i/IdleThoughts.java @@ -10,6 +10,7 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.ComparisonType; import mage.constants.Zone; /** @@ -24,7 +25,7 @@ public final class IdleThoughts extends CardImpl { // {2}: Draw a card if you have no cards in hand. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ConditionalOneShotEffect( - new DrawCardSourceControllerEffect(2), new CardsInHandCondition(), "Draw a card if you have no cards in hand"), new ManaCostsImpl<>("{2}"))); + new DrawCardSourceControllerEffect(2), new CardsInHandCondition(ComparisonType.EQUAL_TO, 0), "Draw a card if you have no cards in hand"), new ManaCostsImpl<>("{2}"))); } private IdleThoughts(final IdleThoughts card) { diff --git a/Mage.Sets/src/mage/cards/l/LavabornMuse.java b/Mage.Sets/src/mage/cards/l/LavabornMuse.java index 09fb3bea252..0989e753fa4 100644 --- a/Mage.Sets/src/mage/cards/l/LavabornMuse.java +++ b/Mage.Sets/src/mage/cards/l/LavabornMuse.java @@ -31,7 +31,7 @@ public final class LavabornMuse extends CardImpl { // At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Lavaborn Muse deals 3 damage to that player. this.addAbility(new ConditionalInterveningIfTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), TargetController.OPPONENT, false, true), - (Condition)new CardsInHandCondition(ComparisonType.FEWER_THAN, 3, null, TargetController.ACTIVE), + (Condition)new CardsInHandCondition(ComparisonType.FEWER_THAN, 3, TargetController.ACTIVE), "At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, {this} deals 3 damage to that player.")); } diff --git a/Mage.Sets/src/mage/cards/p/PaupersCage.java b/Mage.Sets/src/mage/cards/p/PaupersCage.java index acfaa95c735..dabf04a5a23 100644 --- a/Mage.Sets/src/mage/cards/p/PaupersCage.java +++ b/Mage.Sets/src/mage/cards/p/PaupersCage.java @@ -26,7 +26,7 @@ public final class PaupersCage extends CardImpl { // At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Paupers' Cage deals 2 damage to that player. TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), TargetController.OPPONENT, false, true); - CardsInHandCondition condition = new CardsInHandCondition(ComparisonType.FEWER_THAN, 3, null, TargetController.ACTIVE); + CardsInHandCondition condition = new CardsInHandCondition(ComparisonType.FEWER_THAN, 3, TargetController.ACTIVE); this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, condition, "At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, {this} deals 2 damage to that player.")); } diff --git a/Mage.Sets/src/mage/cards/s/ShriekingAffliction.java b/Mage.Sets/src/mage/cards/s/ShriekingAffliction.java index 9e5da219df1..563b439ad5f 100644 --- a/Mage.Sets/src/mage/cards/s/ShriekingAffliction.java +++ b/Mage.Sets/src/mage/cards/s/ShriekingAffliction.java @@ -28,7 +28,7 @@ public final class ShriekingAffliction extends CardImpl { Zone.BATTLEFIELD, new LoseLifeTargetEffect(3), TargetController.OPPONENT, false, true ), - new CardsInHandCondition(ComparisonType.FEWER_THAN, 2, null, TargetController.ACTIVE), + new CardsInHandCondition(ComparisonType.FEWER_THAN, 2, TargetController.ACTIVE), "At the beginning of each opponent's upkeep, if that player has one or fewer cards in hand, they lose 3 life." )); } diff --git a/Mage.Sets/src/mage/cards/t/TempleOfTheDead.java b/Mage.Sets/src/mage/cards/t/TempleOfTheDead.java index 30e05be1f76..8a4e7056961 100644 --- a/Mage.Sets/src/mage/cards/t/TempleOfTheDead.java +++ b/Mage.Sets/src/mage/cards/t/TempleOfTheDead.java @@ -21,8 +21,8 @@ import java.util.UUID; */ public final class TempleOfTheDead extends CardImpl { - private static final Condition condition = new CardsInHandCondition(ComparisonType.FEWER_THAN, 2, null, TargetController.ANY); - private static final Hint hint = new ConditionHint(condition, "any player has one or fewer cards in hand"); + private static final Condition condition = new CardsInHandCondition(ComparisonType.FEWER_THAN, 2, TargetController.ANY); + private static final Hint hint = new ConditionHint(condition, "a player has one or fewer cards in hand"); public TempleOfTheDead(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); diff --git a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java index ba339eb8089..e85da2af870 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java @@ -11,34 +11,23 @@ import mage.util.CardUtil; import java.util.UUID; /** - * Cards in hand condition. This condition can decorate other - * conditions as well as be used standalone. + * Cards in hand condition * * @author LevelX */ public class CardsInHandCondition implements Condition { - private final Condition condition; private final ComparisonType type; private final int count; private final TargetController targetController; - public CardsInHandCondition() { - this(ComparisonType.EQUAL_TO, 0); - } - public CardsInHandCondition(ComparisonType type, int count) { - this(type, count, null); + this(type, count, TargetController.YOU); } - public CardsInHandCondition(ComparisonType type, int count, Condition conditionToDecorate) { - this(type, count, conditionToDecorate, TargetController.YOU); - } - - public CardsInHandCondition(ComparisonType type, int count, Condition conditionToDecorate, TargetController targetController) { + public CardsInHandCondition(ComparisonType type, int count, TargetController targetController) { this.type = type; this.count = count; - this.condition = conditionToDecorate; this.targetController = targetController; } @@ -85,9 +74,6 @@ public class CardsInHandCondition implements Condition { } //If a decorated condition exists, check it as well and apply them together. - if (this.condition != null) { - conditionApplies = conditionApplies && this.condition.apply(game, source); - } } return conditionApplies; @@ -95,13 +81,19 @@ public class CardsInHandCondition implements Condition { @Override public String toString() { - StringBuilder sb = new StringBuilder("if"); + StringBuilder sb = new StringBuilder("if "); switch (targetController) { case YOU: - sb.append(" you have "); + sb.append("you have "); + break; + case ACTIVE: + sb.append("that player has "); + break; + case EACH_PLAYER: + sb.append("each player has "); break; case ANY: - sb.append(" each player has "); + sb.append("a player has "); break; } switch (this.type) { @@ -113,6 +105,14 @@ public class CardsInHandCondition implements Condition { sb.append(CardUtil.numberToText(count + 1)); sb.append(" or more "); break; + case OR_LESS: + sb.append(CardUtil.numberToText(count)); + sb.append(" or fewer "); + break; + case OR_GREATER: + sb.append(CardUtil.numberToText(count)); + sb.append(" or more "); + break; case EQUAL_TO: if (count > 0) { sb.append("exactly ");