From 5d2a56e542fcc7250928aec84adbe8b25d9e5f03 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 9 Feb 2019 04:08:17 +0400 Subject: [PATCH] Added 2+ gates control hint for cards and other; --- .../src/mage/cards/g/GoblinGathering.java | 2 + Mage.Sets/src/mage/cards/m/MazesEnd.java | 64 +++++++++++++------ .../src/mage/cards/o/OpalLakeGatekeepers.java | 22 ++++--- .../src/mage/cards/p/PlazaOfHarmony.java | 3 +- .../src/mage/cards/s/SaruliGatekeepers.java | 22 ++++--- .../mage/cards/s/SmeltWardGatekeepers.java | 20 +++--- .../src/mage/cards/s/SunspireGatekeepers.java | 19 +++--- .../src/mage/cards/u/UbulSarGatekeepers.java | 14 ++-- 8 files changed, 108 insertions(+), 58 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GoblinGathering.java b/Mage.Sets/src/mage/cards/g/GoblinGathering.java index 3c6dec39ae..7f93f57fbc 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinGathering.java +++ b/Mage.Sets/src/mage/cards/g/GoblinGathering.java @@ -4,6 +4,7 @@ import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.hint.ValueHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -27,6 +28,7 @@ public final class GoblinGathering extends CardImpl { this.getSpellAbility().addEffect(new CreateTokenEffect( new GoblinToken(), GoblinGatheringDynamicValue.instance )); + this.getSpellAbility().addHint(new ValueHint("You can create tokens", GoblinGatheringDynamicValue.instance)); } private GoblinGathering(final GoblinGathering card) { diff --git a/Mage.Sets/src/mage/cards/m/MazesEnd.java b/Mage.Sets/src/mage/cards/m/MazesEnd.java index d76dbd7271..c575930d28 100644 --- a/Mage.Sets/src/mage/cards/m/MazesEnd.java +++ b/Mage.Sets/src/mage/cards/m/MazesEnd.java @@ -1,18 +1,16 @@ - - package mage.cards.m; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.ReturnToHandFromBattlefieldSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.abilities.hint.ValueHint; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -27,20 +25,24 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInLibrary; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class MazesEnd extends CardImpl { private static final FilterCard filterCard = new FilterCard("Gate card"); + static { filterCard.add(new SubtypePredicate(SubType.GATE)); } public MazesEnd(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.LAND},""); + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); // Maze's End enters the battlefield tapped. @@ -54,8 +56,8 @@ public final class MazesEnd extends CardImpl { ability.addEffect(new MazesEndEffect()); ability.addCost(new TapSourceCost()); ability.addCost(new ReturnToHandFromBattlefieldSourceCost()); + ability.addHint(new ValueHint("Gates with different names you control", GatesWithDifferentNamesYouControlCount.instance)); this.addAbility(ability); - } public MazesEnd(final MazesEnd card) { @@ -68,6 +70,40 @@ public final class MazesEnd extends CardImpl { } } +enum GatesWithDifferentNamesYouControlCount implements DynamicValue { + + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + List names = new ArrayList<>(); + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { + if (permanent.hasSubtype(SubType.GATE, game)) { + if (!names.contains(permanent.getName())) { + names.add(permanent.getName()); + } + } + } + return names.size(); + } + + @Override + public GatesWithDifferentNamesYouControlCount copy() { + return instance; + } + + @Override + public String toString() { + return "X"; + } + + @Override + public String getMessage() { + return "Gates with different names you control"; + } +} + + class MazesEndEffect extends OneShotEffect { public MazesEndEffect() { @@ -86,15 +122,8 @@ class MazesEndEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - List names = new ArrayList<>(); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { - if (permanent.hasSubtype(SubType.GATE, game)) { - if (!names.contains(permanent.getName())) { - names.add(permanent.getName()); - } - } - } - if (names.size() >= 10) { + int count = GatesWithDifferentNamesYouControlCount.instance.calculate(game, source, this); + if (count >= 10) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.won(game); @@ -102,5 +131,4 @@ class MazesEndEffect extends OneShotEffect { } return false; } - } diff --git a/Mage.Sets/src/mage/cards/o/OpalLakeGatekeepers.java b/Mage.Sets/src/mage/cards/o/OpalLakeGatekeepers.java index 4a41c8e08d..4d57054223 100644 --- a/Mage.Sets/src/mage/cards/o/OpalLakeGatekeepers.java +++ b/Mage.Sets/src/mage/cards/o/OpalLakeGatekeepers.java @@ -1,13 +1,12 @@ - - package mage.cards.o; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.hint.ConditionHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -16,8 +15,9 @@ import mage.constants.SubType; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; +import java.util.UUID; + /** - * * @author LevelX2 */ @@ -25,12 +25,15 @@ import mage.filter.predicate.mageobject.SubtypePredicate; public final class OpalLakeGatekeepers extends CardImpl { private static final FilterControlledPermanent filter = new FilterControlledPermanent(); + static { filter.add(new SubtypePredicate(SubType.GATE)); } - public OpalLakeGatekeepers (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}"); + private static final Condition gatesCondition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1); + + public OpalLakeGatekeepers(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); this.subtype.add(SubType.VEDALKEN); this.subtype.add(SubType.SOLDIER); @@ -40,11 +43,12 @@ public final class OpalLakeGatekeepers extends CardImpl { // When Opal Lake Gatekeepers enters the battlefield, if you control two or more Gates, you may draw a card. this.addAbility(new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)), - new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1), - "When Opal Lake Gatekeepers enters the battlefield, if you control two or more Gates, you may draw a card.")); + gatesCondition, + "When Opal Lake Gatekeepers enters the battlefield, if you control two or more Gates, you may draw a card.") + .addHint(new ConditionHint(gatesCondition, "You control two or more Gates"))); } - public OpalLakeGatekeepers (final OpalLakeGatekeepers card) { + public OpalLakeGatekeepers(final OpalLakeGatekeepers card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/p/PlazaOfHarmony.java b/Mage.Sets/src/mage/cards/p/PlazaOfHarmony.java index d88d7c0981..4a452918e6 100644 --- a/Mage.Sets/src/mage/cards/p/PlazaOfHarmony.java +++ b/Mage.Sets/src/mage/cards/p/PlazaOfHarmony.java @@ -5,6 +5,7 @@ import mage.abilities.condition.Condition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.hint.ConditionHint; import mage.abilities.mana.AnyColorLandsProduceManaAbility; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; @@ -42,7 +43,7 @@ public final class PlazaOfHarmony extends CardImpl { new EntersBattlefieldTriggeredAbility(new GainLifeEffect(3)), condition, "When {this} enters the battlefield, " + "if you control two or more Gates, you gain 3 life." - )); + ).addHint(new ConditionHint(condition, "You control two or more Gates"))); // {T}: Add {C}. this.addAbility(new ColorlessManaAbility()); diff --git a/Mage.Sets/src/mage/cards/s/SaruliGatekeepers.java b/Mage.Sets/src/mage/cards/s/SaruliGatekeepers.java index 0d7f4450b6..2105f70749 100644 --- a/Mage.Sets/src/mage/cards/s/SaruliGatekeepers.java +++ b/Mage.Sets/src/mage/cards/s/SaruliGatekeepers.java @@ -1,13 +1,12 @@ - - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.hint.ConditionHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -16,8 +15,9 @@ import mage.constants.SubType; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; +import java.util.UUID; + /** - * * @author LevelX2 */ @@ -25,12 +25,15 @@ import mage.filter.predicate.mageobject.SubtypePredicate; public final class SaruliGatekeepers extends CardImpl { private static final FilterControlledPermanent filter = new FilterControlledPermanent(); + static { filter.add(new SubtypePredicate(SubType.GATE)); } - public SaruliGatekeepers (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}"); + private static final Condition gatesCondition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1); + + public SaruliGatekeepers(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.WARRIOR); @@ -40,11 +43,12 @@ public final class SaruliGatekeepers extends CardImpl { // When Saruli Gatekeepers enters the battlefield, if you control two or more Gates, gain 7 life. this.addAbility(new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new GainLifeEffect(7)), - new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1), - "When {this} enters the battlefield, if you control two or more Gates, gain 7 life.")); + gatesCondition, + "When {this} enters the battlefield, if you control two or more Gates, gain 7 life.") + .addHint(new ConditionHint(gatesCondition, "You control two or more Gates"))); } - public SaruliGatekeepers (final SaruliGatekeepers card) { + public SaruliGatekeepers(final SaruliGatekeepers card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/s/SmeltWardGatekeepers.java b/Mage.Sets/src/mage/cards/s/SmeltWardGatekeepers.java index e607e3faf6..dcf97b4eb7 100644 --- a/Mage.Sets/src/mage/cards/s/SmeltWardGatekeepers.java +++ b/Mage.Sets/src/mage/cards/s/SmeltWardGatekeepers.java @@ -1,16 +1,15 @@ - - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.UntapTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.abilities.hint.ConditionHint; import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -22,8 +21,9 @@ import mage.filter.predicate.permanent.ControllerPredicate; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ @@ -32,13 +32,16 @@ public final class SmeltWardGatekeepers extends CardImpl { private static final FilterControlledPermanent filter = new FilterControlledPermanent(); private static final FilterCreaturePermanent targetFilter = new FilterCreaturePermanent("creature an opponent controls"); + static { filter.add(new SubtypePredicate(SubType.GATE)); targetFilter.add(new ControllerPredicate(TargetController.OPPONENT)); } - public SmeltWardGatekeepers (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}"); + private static final Condition gatesCondition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1); + + public SmeltWardGatekeepers(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WARRIOR); @@ -48,16 +51,17 @@ public final class SmeltWardGatekeepers extends CardImpl { // When Smelt-Ward Gatekeepers enters the battlefield, if you control two or more Gates, gain control of target creature an opponent controls until end of turn. Untap that creature. That creature gains haste until end of turn. Ability ability = new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new GainControlTargetEffect(Duration.EndOfTurn)), - new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1), + gatesCondition, "When {this} enters the battlefield, if you control two or more Gates, gain control of target creature an opponent controls until end of turn. Untap that creature. That creature gains haste until end of turn."); ability.addEffect(new UntapTargetEffect()); ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn)); Target target = new TargetCreaturePermanent(targetFilter); ability.addTarget(target); + ability.addHint(new ConditionHint(gatesCondition, "You control two or more Gates")); this.addAbility(ability); } - public SmeltWardGatekeepers (final SmeltWardGatekeepers card) { + public SmeltWardGatekeepers(final SmeltWardGatekeepers card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/s/SunspireGatekeepers.java b/Mage.Sets/src/mage/cards/s/SunspireGatekeepers.java index 2817418444..08eb558a54 100644 --- a/Mage.Sets/src/mage/cards/s/SunspireGatekeepers.java +++ b/Mage.Sets/src/mage/cards/s/SunspireGatekeepers.java @@ -1,12 +1,12 @@ - - package mage.cards.s; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.hint.ConditionHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -19,7 +19,6 @@ import mage.game.permanent.token.KnightToken; import java.util.UUID; /** - * * @author LevelX2 */ @@ -27,12 +26,15 @@ import java.util.UUID; public final class SunspireGatekeepers extends CardImpl { private static final FilterControlledPermanent filter = new FilterControlledPermanent(); + static { filter.add(new SubtypePredicate(SubType.GATE)); } - public SunspireGatekeepers (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); + private static final Condition gatesCondition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1); + + public SunspireGatekeepers(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SOLDIER); @@ -42,11 +44,12 @@ public final class SunspireGatekeepers extends CardImpl { // When Sunspire Gatekeepers enter the battlefield, if you control two or more Gates, create a 2/2 white Knight creature token with vigilance. this.addAbility(new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KnightToken())), - new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1), - "When {this} enters the battlefield, if you control two or more Gates, create a 2/2 white Knight creature token with vigilance.")); + gatesCondition, + "When {this} enters the battlefield, if you control two or more Gates, create a 2/2 white Knight creature token with vigilance.") + .addHint(new ConditionHint(gatesCondition, "you control two or more Gates"))); } - public SunspireGatekeepers (final SunspireGatekeepers card) { + public SunspireGatekeepers(final SunspireGatekeepers card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/u/UbulSarGatekeepers.java b/Mage.Sets/src/mage/cards/u/UbulSarGatekeepers.java index 7dcfd6782f..fe7e7d09ab 100644 --- a/Mage.Sets/src/mage/cards/u/UbulSarGatekeepers.java +++ b/Mage.Sets/src/mage/cards/u/UbulSarGatekeepers.java @@ -1,13 +1,13 @@ - package mage.cards.u; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.hint.ConditionHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; @@ -18,8 +18,9 @@ import mage.filter.predicate.permanent.ControllerPredicate; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class UbulSarGatekeepers extends CardImpl { @@ -32,8 +33,10 @@ public final class UbulSarGatekeepers extends CardImpl { targetFilter.add(new ControllerPredicate(TargetController.OPPONENT)); } + private static final Condition gatesCondition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1); + public UbulSarGatekeepers(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); this.subtype.add(SubType.ZOMBIE); this.subtype.add(SubType.SOLDIER); @@ -43,10 +46,11 @@ public final class UbulSarGatekeepers extends CardImpl { // Whenever Ubul Sar Gatekeepers enters the battlefield, if you control two or more Gates, target creature an opponent controls gets -2/-2 until end of turn. Ability ability = new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(-2, -2, Duration.EndOfTurn)), - new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1), + gatesCondition, "Whenever {this} enters the battlefield, if you control two or more Gates, target creature an opponent controls gets -2/-2 until end of turn."); Target target = new TargetCreaturePermanent(targetFilter); ability.addTarget(target); + ability.addHint(new ConditionHint(gatesCondition, "You control two or more Gates")); this.addAbility(ability); }