From ed6b7aeb19d728009d7a55fa05207bcf5c4b6730 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Wed, 27 Jan 2021 09:31:16 -0600 Subject: [PATCH] [KLD] Gonti, Lord of Luxury - Add "Look at" effect to ETB and remove static ability --- .../src/mage/cards/g/GontiLordOfLuxury.java | 55 +++++++------------ Mage.Sets/src/mage/cards/t/ThiefOfSanity.java | 20 +++---- 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java b/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java index ca20f6e12bc..1fdb01bdc86 100644 --- a/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java +++ b/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java @@ -50,10 +50,9 @@ public final class GontiLordOfLuxury extends CardImpl { Ability ability = new EntersBattlefieldTriggeredAbility(new GontiLordOfLuxuryEffect()); ability.addTarget(new TargetOpponent()); this.addAbility(ability); - this.addAbility(new SimpleStaticAbility(Zone.ALL, new GontiLordOfLuxuryLookEffect())); } - public GontiLordOfLuxury(final GontiLordOfLuxury card) { + private GontiLordOfLuxury(final GontiLordOfLuxury card) { super(card); } @@ -70,7 +69,7 @@ class GontiLordOfLuxuryEffect extends OneShotEffect { this.staticText = "look at the top four cards of target opponent's library, exile one of them face down, then put the rest on the bottom of that library in a random order. For as long as that card remains exiled, you may look at it, you may cast it, and you may spend mana as though it were mana of any type to cast it"; } - public GontiLordOfLuxuryEffect(final GontiLordOfLuxuryEffect effect) { + private GontiLordOfLuxuryEffect(final GontiLordOfLuxuryEffect effect) { super(effect); } @@ -111,6 +110,10 @@ class GontiLordOfLuxuryEffect extends OneShotEffect { effect = new GontiLordOfLuxurySpendAnyManaEffect(); effect.setTargetPointer(new FixedTarget(card.getId(), game)); game.addEffect(effect, source); + // For as long as that card remains exiled, you may look at it + effect = new GontiLordOfLuxuryLookEffect(controller.getId()); + effect.setTargetPointer(new FixedTarget(card.getId(), game)); + game.addEffect(effect, source); } } } @@ -131,7 +134,7 @@ class GontiLordOfLuxuryCastFromExileEffect extends AsThoughEffectImpl { staticText = "You may cast that card for as long as it remains exiled, and you may spend mana as though it were mana of any color to cast that spell"; } - public GontiLordOfLuxuryCastFromExileEffect(final GontiLordOfLuxuryCastFromExileEffect effect) { + private GontiLordOfLuxuryCastFromExileEffect(final GontiLordOfLuxuryCastFromExileEffect effect) { super(effect); } @@ -175,7 +178,7 @@ class GontiLordOfLuxurySpendAnyManaEffect extends AsThoughEffectImpl implements staticText = "you may spend mana as though it were mana of any color to cast it"; } - public GontiLordOfLuxurySpendAnyManaEffect(final GontiLordOfLuxurySpendAnyManaEffect effect) { + private GontiLordOfLuxurySpendAnyManaEffect(final GontiLordOfLuxurySpendAnyManaEffect effect) { super(effect); } @@ -215,13 +218,17 @@ class GontiLordOfLuxurySpendAnyManaEffect extends AsThoughEffectImpl implements class GontiLordOfLuxuryLookEffect extends AsThoughEffectImpl { - public GontiLordOfLuxuryLookEffect() { + private final UUID authorizedPlayerId; + + public GontiLordOfLuxuryLookEffect(UUID authorizedPlayerId) { super(AsThoughEffectType.LOOK_AT_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit); + this.authorizedPlayerId = authorizedPlayerId; staticText = "You may look at the cards exiled with {this}"; } - public GontiLordOfLuxuryLookEffect(final GontiLordOfLuxuryLookEffect effect) { + private GontiLordOfLuxuryLookEffect(final GontiLordOfLuxuryLookEffect effect) { super(effect); + this.authorizedPlayerId = effect.authorizedPlayerId; } @Override @@ -236,35 +243,11 @@ class GontiLordOfLuxuryLookEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - Card theCard = game.getCard(objectId); - if (theCard == null) { - return false; + UUID cardId = getTargetPointer().getFirst(game, source); + if (cardId == null) { + this.discard(); // card is no longer in the origin zone, effect can be discarded } - objectId = theCard.getMainCard().getId(); // for split cards - if (affectedControllerId.equals(source.getControllerId()) - && game.getState().getZone(objectId) == Zone.EXILED) { - Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = source.getSourceObject(game); - if (controller != null - && sourceObject != null) { - Card card = game.getCard(objectId); - if (card != null - && card.isFaceDown(game)) { - Set exileZones = (Set) game.getState().getValue( - GontiLordOfLuxury.VALUE_PREFIX + source.getSourceId().toString()); - if (exileZones != null) { - for (ExileZone exileZone : game.getExile().getExileZones()) { - if (exileZone.contains(objectId)) { - if (!exileZones.contains(exileZone.getId())) { - return false; - } - } - } - return true; - } - } - } - } - return false; + return affectedControllerId.equals(authorizedPlayerId) + && objectId.equals(cardId); } } diff --git a/Mage.Sets/src/mage/cards/t/ThiefOfSanity.java b/Mage.Sets/src/mage/cards/t/ThiefOfSanity.java index 69478078a88..74d521c0fc6 100644 --- a/Mage.Sets/src/mage/cards/t/ThiefOfSanity.java +++ b/Mage.Sets/src/mage/cards/t/ThiefOfSanity.java @@ -44,7 +44,7 @@ public final class ThiefOfSanity extends CardImpl { this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new ThiefOfSanityEffect(), false, true)); } - public ThiefOfSanity(final ThiefOfSanity card) { + private ThiefOfSanity(final ThiefOfSanity card) { super(card); } @@ -62,7 +62,7 @@ class ThiefOfSanityEffect extends OneShotEffect { + "For as long as that card remains exiled, you may look at it, you may cast it, and you may spend mana as though it were mana of any type to cast it"; } - public ThiefOfSanityEffect(final ThiefOfSanityEffect effect) { + private ThiefOfSanityEffect(final ThiefOfSanityEffect effect) { super(effect); } @@ -122,7 +122,7 @@ class ThiefOfSanityEffect extends OneShotEffect { class ThiefOfSanityCastFromExileEffect extends AsThoughEffectImpl { - final UUID authorizedPlayerId; + private final UUID authorizedPlayerId; public ThiefOfSanityCastFromExileEffect(UUID authorizedPlayerId) { super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit); @@ -130,7 +130,7 @@ class ThiefOfSanityCastFromExileEffect extends AsThoughEffectImpl { staticText = "For as long as that card remains exiled, you may cast it"; } - public ThiefOfSanityCastFromExileEffect(final ThiefOfSanityCastFromExileEffect effect) { + private ThiefOfSanityCastFromExileEffect(final ThiefOfSanityCastFromExileEffect effect) { super(effect); this.authorizedPlayerId = effect.authorizedPlayerId; } @@ -156,7 +156,7 @@ class ThiefOfSanityCastFromExileEffect extends AsThoughEffectImpl { if (theCard == null || theCard.isLand()) { return false; } - objectId = theCard.getMainCard().getId();// for split cards + objectId = theCard.getMainCard().getId(); // for split cards if (objectId.equals(cardId) && affectedControllerId.equals(authorizedPlayerId)) { @@ -170,7 +170,7 @@ class ThiefOfSanityCastFromExileEffect extends AsThoughEffectImpl { class ThiefOfSanitySpendAnyManaEffect extends AsThoughEffectImpl implements AsThoughManaEffect { - final UUID authorizedPlayerId; + private final UUID authorizedPlayerId; public ThiefOfSanitySpendAnyManaEffect(UUID authorizedPlayerId) { super(AsThoughEffectType.SPEND_OTHER_MANA, Duration.Custom, Outcome.Benefit); @@ -178,7 +178,7 @@ class ThiefOfSanitySpendAnyManaEffect extends AsThoughEffectImpl implements AsTh staticText = "For as long as that card remains exiled, you may spend mana as though it were mana of any color to cast it"; } - public ThiefOfSanitySpendAnyManaEffect(final ThiefOfSanitySpendAnyManaEffect effect) { + private ThiefOfSanitySpendAnyManaEffect(final ThiefOfSanitySpendAnyManaEffect effect) { super(effect); this.authorizedPlayerId = effect.authorizedPlayerId; } @@ -201,7 +201,7 @@ class ThiefOfSanitySpendAnyManaEffect extends AsThoughEffectImpl implements AsTh // if the card moved from exile to spell the zone change counter is increased by 1 (effect must applies before and on stack, use isCheckPlayableMode?) return affectedControllerId.equals(authorizedPlayerId); } else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) { - // object has moved zone so effect can be discarted + // object has moved zone so effect can be discarded this.discard(); } return false; @@ -215,7 +215,7 @@ class ThiefOfSanitySpendAnyManaEffect extends AsThoughEffectImpl implements AsTh class ThiefOfSanityLookEffect extends AsThoughEffectImpl { - final UUID authorizedPlayerId; + private final UUID authorizedPlayerId; public ThiefOfSanityLookEffect(UUID authorizedPlayerId) { super(AsThoughEffectType.LOOK_AT_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit); @@ -223,7 +223,7 @@ class ThiefOfSanityLookEffect extends AsThoughEffectImpl { staticText = "For as long as that card remains exiled, you may look at it"; } - public ThiefOfSanityLookEffect(final ThiefOfSanityLookEffect effect) { + private ThiefOfSanityLookEffect(final ThiefOfSanityLookEffect effect) { super(effect); this.authorizedPlayerId = effect.authorizedPlayerId; }