[HOU] added shared predicate class for Desert controlled or in graveyard

This commit is contained in:
Evan Kranzler 2022-03-21 20:58:39 -04:00
parent 511b42a6ce
commit 313a19865a
10 changed files with 132 additions and 212 deletions

View file

@ -1,13 +1,8 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.OrCondition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.GainLifeEffect;
@ -18,25 +13,16 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author emerald000
*/
public final class DesertsHold extends CardImpl {
private static final FilterControlledPermanent filterDesertPermanent = new FilterControlledPermanent("Desert");
private static final FilterCard filterDesertCard = new FilterCard("Desert card");
static {
filterDesertPermanent.add(SubType.DESERT.getPredicate());
filterDesertCard.add(SubType.DESERT.getPredicate());
}
public DesertsHold(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
@ -46,19 +32,17 @@ public final class DesertsHold extends CardImpl {
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Removal));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// When Desert's Hold enters the battlefield, if you control a Desert or there is a Desert card in your graveyard, you gain 3 life.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new GainLifeEffect(3)),
new OrCondition(
new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(filterDesertPermanent)),
new CardsInControllerGraveyardCondition(1, filterDesertCard)),
"When {this} enters the battlefield, if you control a Desert or there is a Desert card in your graveyard, you gain 3 life."));
DesertControlledOrGraveyardCondition.instance, "When {this} enters the battlefield, " +
"if you control a Desert or there is a Desert card in your graveyard, you gain 3 life."
).addHint(DesertControlledOrGraveyardCondition.getHint()));
// Enchanted creature can't attack or block, and its activated abilities can't be activated.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockAttackActivateAttachedEffect()));
this.addAbility(new SimpleStaticAbility(new CantBlockAttackActivateAttachedEffect()));
}
private DesertsHold(final DesertsHold card) {

View file

@ -1,10 +1,9 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
import mage.cards.CardImpl;
@ -12,14 +11,11 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class GildedCerodon extends CardImpl {
@ -35,9 +31,12 @@ public final class GildedCerodon extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Gilded Cerodon attacks, if you control a Desert or there is a Desert card in your graveyard, target creature can't block this turn.
Ability ability = new ConditionalInterveningIfTriggeredAbility(new AttacksTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn), false), new GildedCerodonCondition(), rule);
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new AttacksTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn), false),
DesertControlledOrGraveyardCondition.instance, rule
);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
this.addAbility(ability.addHint(DesertControlledOrGraveyardCondition.getHint()));
}
@ -50,27 +49,3 @@ public final class GildedCerodon extends CardImpl {
return new GildedCerodon(this);
}
}
class GildedCerodonCondition implements Condition {
private static final FilterPermanent filter = new FilterPermanent();
private static final FilterCard filter2 = new FilterCard();
static {
filter.add(SubType.DESERT.getPredicate());
filter2.add(SubType.DESERT.getPredicate());
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
return (!game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game).isEmpty()
|| !controller.getGraveyard().getCards(filter2, game).isEmpty());
}
@Override
public String toString() {
return "if you control a Desert or there is a Desert card in your graveyard";
}
}

View file

@ -6,6 +6,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.effects.WhileConditionContinuousEffect;
import mage.abilities.effects.common.continuous.BoostSourceWhileControlsEffect;
import mage.abilities.keyword.ReachAbility;
@ -52,7 +53,7 @@ public final class RamunapHydra extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceWhileControlsEffect(new FilterPermanent(SubType.DESERT, "Desert"), 1, 1)));
// Ramunap Hydra gets +1/+1 as long as there is a Desert card in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RamunapHydraBoostEffect(1, 1)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RamunapHydraBoostEffect(1, 1)).addHint(DesertControlledOrGraveyardCondition.getHint()));
}
private RamunapHydra(final RamunapHydra card) {

View file

@ -1,37 +1,24 @@
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.OrCondition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author spjspj
*/
public final class SandStrangler extends CardImpl {
private static final FilterControlledPermanent filterDesertPermanent = new FilterControlledPermanent("Desert");
private static final FilterCard filterDesertCard = new FilterCard("Desert card");
static {
filterDesertPermanent.add(SubType.DESERT.getPredicate());
filterDesertCard.add(SubType.DESERT.getPredicate());
}
public SandStrangler(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
@ -42,13 +29,11 @@ public final class SandStrangler extends CardImpl {
// When Sand Strangler enters the battlefield, if you control a Desert or there is a Desert card in your graveyard, you may have Sand Strangler deal 3 damage to target creature.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(3), true),
new OrCondition(
new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(filterDesertPermanent)),
new CardsInControllerGraveyardCondition(1, filterDesertCard)),
"When {this} enters the battlefield, if you control a Desert or there is a Desert card in your graveyard, you may have {this} deal 3 damage to target creature.");
DesertControlledOrGraveyardCondition.instance, "When {this} enters the battlefield, " +
"if you control a Desert or there is a Desert card in your graveyard, " +
"you may have {this} deal 3 damage to target creature.");
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
this.addAbility(ability.addHint(DesertControlledOrGraveyardCondition.getHint()));
}
private SandStrangler(final SandStrangler card) {

View file

@ -6,6 +6,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
@ -38,11 +39,15 @@ public final class SidewinderNaga extends CardImpl {
this.toughness = new MageInt(2);
// As long as you control a Desert or there is a Desert card in your graveyard, Sidewinder Naga gets +1/+0 and has trample.
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new BoostSourceEffect(1, 0, Duration.WhileOnBattlefield), new DesertInGYorBFCondition(), "As long as you control a Desert or there is a Desert card in your graveyard, {this} gets +1/+0 ");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
ability.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield), new DesertInGYorBFCondition(), "and has trample"));
this.addAbility(ability);
Ability ability = new SimpleStaticAbility(new ConditionalContinuousEffect(
new BoostSourceEffect(1, 0, Duration.WhileOnBattlefield),
DesertControlledOrGraveyardCondition.instance, "As long as you control a Desert " +
"or there is a Desert card in your graveyard, {this} gets +1/+0 "
));
ability.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(
TrampleAbility.getInstance(), Duration.WhileOnBattlefield
),DesertControlledOrGraveyardCondition.instance, "and has trample"));
this.addAbility(ability.addHint(DesertControlledOrGraveyardCondition.getHint()));
}
private SidewinderNaga(final SidewinderNaga card) {
@ -54,33 +59,3 @@ public final class SidewinderNaga extends CardImpl {
return new SidewinderNaga(this);
}
}
class DesertInGYorBFCondition implements Condition {
private static final FilterCard filter = new FilterCard();
static {
filter.add(SubType.DESERT.getPredicate());
}
private static final FilterControlledLandPermanent filter2 = new FilterControlledLandPermanent("a desert");
static {
filter2.add(SubType.DESERT.getPredicate());
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for (Card card : player.getGraveyard().getCards(game)) {
if (filter.match(card, game)) {
return true;
}
}
}
PermanentsOnBattlefieldCount count = new PermanentsOnBattlefieldCount(filter2);
return count.calculate(game, source, null) >= 1;
}
}

View file

@ -1,13 +1,8 @@
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.OrCondition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.LifelinkAbility;
@ -15,24 +10,14 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import java.util.UUID;
/**
*
* @author spjspj
*/
public final class SolitaryCamel extends CardImpl {
private static final FilterControlledPermanent filterDesertPermanent = new FilterControlledPermanent("Desert");
private static final FilterCard filterDesertCard = new FilterCard("Desert card");
static {
filterDesertPermanent.add(SubType.DESERT.getPredicate());
filterDesertCard.add(SubType.DESERT.getPredicate());
}
public SolitaryCamel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
@ -41,13 +26,11 @@ public final class SolitaryCamel extends CardImpl {
this.toughness = new MageInt(2);
// Solitary Camel has lifelink as long as you control a desert or there is a desert card in your graveyard.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new GainAbilitySourceEffect(LifelinkAbility.getInstance()),
new OrCondition(
new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(filterDesertPermanent)),
new CardsInControllerGraveyardCondition(1, filterDesertCard)),
"{this} has lifelink as long as you control a desert or there is a desert card in your graveyard."));
this.addAbility(ability);
DesertControlledOrGraveyardCondition.instance, "{this} has lifelink as long as " +
"you control a desert or there is a desert card in your graveyard."
)).addHint(DesertControlledOrGraveyardCondition.getHint()));
}
private SolitaryCamel(final SolitaryCamel card) {

View file

@ -1,13 +1,9 @@
package mage.cards.u;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.OrCondition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect;
@ -18,26 +14,16 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author spjspj
*/
public final class UnquenchableThirst extends CardImpl {
private static final FilterControlledPermanent filterDesertPermanent = new FilterControlledPermanent("Desert");
private static final FilterCard filterDesertCard = new FilterCard("Desert card");
static {
filterDesertPermanent.add(SubType.DESERT.getPredicate());
filterDesertCard.add(SubType.DESERT.getPredicate());
}
public UnquenchableThirst(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
@ -47,20 +33,17 @@ public final class UnquenchableThirst extends CardImpl {
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// When Unquenchable Thirst enters the battlefield, if you control a Desert or there is a Desert card in your graveyard, tap enchanted creature.
Ability ability2 = new ConditionalInterveningIfTriggeredAbility(
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect()),
new OrCondition(
new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(filterDesertPermanent)),
new CardsInControllerGraveyardCondition(1, filterDesertCard)),
"When {this} enters the battlefield, if you control a Desert or there is a Desert card in your graveyard, tap enchanted creature.");
this.addAbility(ability2);
DesertControlledOrGraveyardCondition.instance, "When {this} enters the battlefield, " +
"if you control a Desert or there is a Desert card in your graveyard, tap enchanted creature."
).addHint(DesertControlledOrGraveyardCondition.getHint()));
// Enchanted creature doesn't untap during its controller's untap step.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepEnchantedEffect()));
this.addAbility(new SimpleStaticAbility(new DontUntapInControllersUntapStepEnchantedEffect()));
}
private UnquenchableThirst(final UnquenchableThirst card) {

View file

@ -1,13 +1,9 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.OrCondition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.DefenderAbility;
@ -16,24 +12,15 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.target.common.TargetPlayerOrPlaneswalker;
import java.util.UUID;
/**
*
* @author spjspj
*/
public final class WallOfForgottenPharaohs extends CardImpl {
private static final FilterControlledPermanent filterDesertPermanent = new FilterControlledPermanent("Desert");
private static final FilterCard filterDesertCard = new FilterCard("Desert card");
static {
filterDesertPermanent.add(SubType.DESERT.getPredicate());
filterDesertCard.add(SubType.DESERT.getPredicate());
}
public WallOfForgottenPharaohs(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
@ -46,17 +33,11 @@ public final class WallOfForgottenPharaohs extends CardImpl {
// {T}: Wall of Forgotten Pharaohs deals 1 damage to target player. Activate this ability only if you control a Desert or there is a Desert card in your graveyard.
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new DamageTargetEffect(1),
new TapSourceCost(),
new OrCondition(
"you control a Desert or there is a Desert card in your graveyard",
new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(filterDesertPermanent)),
new CardsInControllerGraveyardCondition(1, filterDesertCard)
)
Zone.BATTLEFIELD, new DamageTargetEffect(1),
new TapSourceCost(), DesertControlledOrGraveyardCondition.instance
);
ability.addTarget(new TargetPlayerOrPlaneswalker());
this.addAbility(ability);
this.addAbility(ability.addHint(DesertControlledOrGraveyardCondition.getHint()));
}
private WallOfForgottenPharaohs(final WallOfForgottenPharaohs card) {

View file

@ -1,37 +1,24 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.condition.OrCondition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
*
* @author spjspj
*/
public final class WretchedCamel extends CardImpl {
private static final FilterControlledPermanent filterDesertPermanent = new FilterControlledPermanent("Desert");
private static final FilterCard filterDesertCard = new FilterCard("Desert card");
static {
filterDesertPermanent.add(SubType.DESERT.getPredicate());
filterDesertCard.add(SubType.DESERT.getPredicate());
}
public WretchedCamel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
@ -43,13 +30,11 @@ public final class WretchedCamel extends CardImpl {
// When Wretched Camel dies, if you control a Desert or there is a Desert card in your graveyard, target player discards a card.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new DiesSourceTriggeredAbility(new DiscardTargetEffect(1)),
new OrCondition(
new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(filterDesertPermanent)),
new CardsInControllerGraveyardCondition(1, filterDesertCard)),
"When {this} dies, if you control a Desert or there is a Desert card in your graveyard, target player discards a card.");
DesertControlledOrGraveyardCondition.instance, "When {this} dies, " +
"if you control a Desert or there is a Desert card in your graveyard, target player discards a card."
);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
this.addAbility(ability.addHint(DesertControlledOrGraveyardCondition.getHint()));
}
private WretchedCamel(final WretchedCamel card) {

View file

@ -0,0 +1,68 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.hint.Hint;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.players.Player;
/**
* @author TheElk801
*/
public enum DesertControlledOrGraveyardCondition implements Condition {
instance;
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.DESERT);
private static final FilterCard filter2 = new FilterCard();
static {
filter2.add(SubType.DESERT.getPredicate());
}
@Override
public boolean apply(Game game, Ability source) {
if (game.getBattlefield().contains(filter, source, game, 1)) {
return true;
}
Player player = game.getPlayer(source.getControllerId());
return player != null && player.getGraveyard().count(filter2, game) > 0;
}
@Override
public String toString() {
return "you control a Desert or there is a Desert card in your graveyard";
}
public static Hint getHint() {
return DesertControlledOrGraveyardHint.instance;
}
enum DesertControlledOrGraveyardHint implements Hint {
instance;
@Override
public String getText(Game game, Ability ability) {
StringBuilder sb = new StringBuilder();
if (game.getBattlefield().contains(filter, ability, game, 1)) {
sb.append("You control a Desert");
}
Player player = game.getPlayer(ability.getControllerId());
if (player != null && player.getGraveyard().count(filter2, game) > 0) {
if (sb.length() > 0) {
sb.append("<br>");
}
sb.append("You have a Desert card in your graveyard");
}
return sb.toString();
}
@Override
public Hint copy() {
return null;
}
}
}