diff --git a/Mage.Sets/src/mage/cards/g/GandalfFriendOfTheShire.java b/Mage.Sets/src/mage/cards/g/GandalfFriendOfTheShire.java new file mode 100644 index 0000000000..239baf322e --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GandalfFriendOfTheShire.java @@ -0,0 +1,85 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.game.events.GameEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GandalfFriendOfTheShire extends CardImpl { + + private static final FilterCard filter = new FilterCard("sorcery spells"); + + static { + filter.add(CardType.SORCERY.getPredicate()); + } + + public GandalfFriendOfTheShire(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.AVATAR); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // You may cast sorcery spells as though they had flash. + this.addAbility(new SimpleStaticAbility(new CastAsThoughItHadFlashAllEffect(Duration.WhileOnBattlefield, filter))); + + // Whenever the Ring tempts you, if you chose a creature other than Gandalf, Friend of the Shire as your Ring-bearer, draw a card. + this.addAbility(new GandalfFriendOfTheShireTriggeredAbility()); + } + + private GandalfFriendOfTheShire(final GandalfFriendOfTheShire card) { + super(card); + } + + @Override + public GandalfFriendOfTheShire copy() { + return new GandalfFriendOfTheShire(this); + } +} + +class GandalfFriendOfTheShireTriggeredAbility extends TriggeredAbilityImpl { + + GandalfFriendOfTheShireTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1)); + this.setTriggerPhrase("Whenever the Ring tempts you, if you chose a creature other than {this} as your Ring-bearer, "); + } + + private GandalfFriendOfTheShireTriggeredAbility(final GandalfFriendOfTheShireTriggeredAbility ability) { + super(ability); + } + + @Override + public GandalfFriendOfTheShireTriggeredAbility copy() { + return new GandalfFriendOfTheShireTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TEMPTED_BY_RING; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return this.isControlledBy(event.getPlayerId()) + && event.getTargetId() != null + && !event.getTargetId().equals(this.getSourceId()); + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 19d4f4a5ea..95e741cdb3 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -25,6 +25,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Frodo Baggins", 404, Rarity.UNCOMMON, mage.cards.f.FrodoBaggins.class)); cards.add(new SetCardInfo("Frodo, Sauron's Bane", 18, Rarity.RARE, mage.cards.f.FrodoSauronsBane.class)); cards.add(new SetCardInfo("Gandalf the Grey", 207, Rarity.RARE, mage.cards.g.GandalfTheGrey.class)); + cards.add(new SetCardInfo("Gandalf, Friend of the Shire", 401, Rarity.UNCOMMON, mage.cards.g.GandalfFriendOfTheShire.class)); cards.add(new SetCardInfo("Gollum, Patient Plotter", 84, Rarity.UNCOMMON, mage.cards.g.GollumPatientPlotter.class)); cards.add(new SetCardInfo("Island", 274, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Lobelia Sackville-Baggins", 399, Rarity.RARE, mage.cards.l.LobeliaSackvilleBaggins.class)); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index aef605940d..0ebe172136 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -589,7 +589,7 @@ public abstract class GameImpl implements Game { } player.chooseRingBearer(this); getOrCreateTheRing(playerId).addNextAbility(this); - fireEvent(GameEvent.getEvent(GameEvent.EventType.TEMPTED_BY_RING, playerId, null, playerId)); + fireEvent(GameEvent.getEvent(GameEvent.EventType.TEMPTED_BY_RING, player.getRingBearerId(), null, playerId)); } @Override @@ -1857,8 +1857,8 @@ public abstract class GameImpl implements Game { /** * @param plane - * @param toPlayerId controller and owner of the plane (may only be one - * per game..) + * @param toPlayerId controller and owner of the plane (may only be one + * per game..) * @return boolean - whether the plane was added successfully or not */ @Override diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index c952b40143..4cca3abce7 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -48839,6 +48839,7 @@ Sauron, the Lidless Eye|The Lord of the Rings: Tales of Middle-earth|288|M|{3}{B Trailblazer's Boots|The Lord of the Rings: Tales of Middle-earth|398|R|{2}|Artifact - Equipment|||Equipped creature has nonbasic landwalk.$Equip {2}| Lobelia Sackville-Baggins|The Lord of the Rings: Tales of Middle-earth|399|R|{2}{B}|Legendary Creature - Halfling Citizen|2|3|Flash$Menace$When Lobelia Sackville-Baggins enters the battlefield, exile target creature card from an opponent's graveyard that was put there from the battlefield this turn, then create X Treasure tokens, where X is the exiled card's power.| Wizard's Rockets|The Lord of the Rings: Tales of Middle-earth|400|C|{1}|Artifact|||Wizard's Rockets enters the battlefield tapped.${X}, {T}, Sacrifice Wizard's Rockets: Add X mana in any combination of colors.$When Wizard's Rockets is put into a graveyard from the battlefield, draw a card.| +Gandalf, Friend of the Shire|The Lord of the Rings: Tales of Middle-earth|401|U|{3}{U}|Legendary Creature - Avatar Wizard|2|4|Flash$You may cast sorcery spells as though they had flash.$Whenever the Ring tempts you, if you chose a creature other than Gandalf, Friend of the Shire as your Ring-bearer, draw a card.| Delighted Halfling|The Lord of the Rings: Tales of Middle-earth|402|R|{G}|Creature - Halfling Citizen|1|2|{T}: Add {C}${T}: Add one mana of any color. Spend this mana only to cast a legendary spell, and that spell can't be countered.| Bilbo, Retired Burglar|The Lord of the Rings: Tales of Middle-earth|403|U|{1}{U}{R}|Legendary Creature - Halfling Rogue|1|3|When Bilbo, Retired Burglar enters or leaves the battlefield, the Ring tempts you.$Whenever Bilbo deals combat damage to a player, create a Treasure token.| Frodo Baggins|The Lord of the Rings: Tales of Middle-earth|404|U|{G}{W}|Legendary Creature - Halfling Scout|1|3|Whenever Frodo Baggins or another legendary creature enters the battlefield under your control, the Ring tempts you.$As long as Frodo is your Ring-bearer, it must be blocked if able.|