fixed Ghostly Pilferer triggered ability

This commit is contained in:
Evan Kranzler 2020-06-16 22:03:14 -04:00
parent 6804216ddc
commit 03a46ffec1
5 changed files with 58 additions and 128 deletions

View file

@ -2,13 +2,13 @@ package mage.cards.g;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BecomesTappedSourceTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
import mage.abilities.keyword.InspiredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -34,10 +34,10 @@ public final class GhostlyPilferer extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Whenever Ghostly Pilferer becomes tapped, you may pay {2}. If you do, draw a card.
this.addAbility(new BecomesTappedSourceTriggeredAbility(new DoIfCostPaid(
// Whenever Ghostly Pilferer becomes untapped, you may pay {2}. If you do, draw a card.
this.addAbility(new InspiredAbility(new DoIfCostPaid(
new DrawCardSourceControllerEffect(1), new GenericManaCost(2)
)));
), false, false));
// Whenever an opponent casts a spell from anywhere other than their hand, draw a card.
this.addAbility(new GhostlyPilfererTriggeredAbility());

View file

@ -1,30 +1,24 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.Ability;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.InspiredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class Hollowsage extends CardImpl {
public Hollowsage(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.MERFOLK);
this.subtype.add(SubType.WIZARD);
@ -32,10 +26,9 @@ public final class Hollowsage extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Hollowsage becomes untapped, you may have target player discard a card.
TriggeredAbility ability = new BecomesUntappedTriggeredAbility(new DiscardTargetEffect(1), true);
Ability ability = new InspiredAbility(new DiscardTargetEffect(1), true, false);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
public Hollowsage(final Hollowsage card) {
@ -47,38 +40,3 @@ public final class Hollowsage extends CardImpl {
return new Hollowsage(this);
}
}
class BecomesUntappedTriggeredAbility extends TriggeredAbilityImpl {
public BecomesUntappedTriggeredAbility(Effect effect, boolean isOptional) {
super(Zone.BATTLEFIELD, effect, isOptional);
}
public BecomesUntappedTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
}
public BecomesUntappedTriggeredAbility(final BecomesUntappedTriggeredAbility ability) {
super(ability);
}
@Override
public BecomesUntappedTriggeredAbility copy() {
return new BecomesUntappedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UNTAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getTargetId().equals(sourceId);
}
@Override
public String getRule() {
return "When {this} becomes untapped, " + super.getRule();
}
}

View file

@ -1,9 +1,6 @@
package mage.cards.k;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
@ -11,35 +8,35 @@ import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
import mage.abilities.keyword.InspiredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author emerald000
*/
public final class KeyToTheCity extends CardImpl {
public KeyToTheCity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {T}, Discard a card: Up to one target creature can't be blocked this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedTargetEffect(), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(new CantBeBlockedTargetEffect(), new TapSourceCost());
ability.addCost(new DiscardCardCost());
ability.addTarget(new TargetCreaturePermanent(0, 1));
this.addAbility(ability);
// Whenever Key to the City becomes untapped, you may pay {2}. If you do, draw a card.
this.addAbility(new KeyToTheCityTriggeredAbility());
this.addAbility(new InspiredAbility(new DoIfCostPaid(
new DrawCardSourceControllerEffect(1), new GenericManaCost(2)
), false, false));
}
public KeyToTheCity(final KeyToTheCity card) {
private KeyToTheCity(final KeyToTheCity card) {
super(card);
}
@ -48,35 +45,3 @@ public final class KeyToTheCity extends CardImpl {
return new KeyToTheCity(this);
}
}
class KeyToTheCityTriggeredAbility extends TriggeredAbilityImpl{
KeyToTheCityTriggeredAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new GenericManaCost(2)));
}
KeyToTheCityTriggeredAbility(final KeyToTheCityTriggeredAbility ability) {
super(ability);
}
@Override
public KeyToTheCityTriggeredAbility copy() {
return new KeyToTheCityTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UNTAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getTargetId().equals(this.getSourceId());
}
@Override
public String getRule() {
return "Whenever Key to the City becomes untapped, you may pay {2}. If you do, draw a card.";
}
}

View file

@ -1,29 +1,29 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
@ -37,21 +37,28 @@ import mage.game.events.GameEvent.EventType;
/**
* Inspired ability word
*
*
* @author LevelX2
*/
public class InspiredAbility extends TriggeredAbilityImpl {
private final boolean isInspired;
public InspiredAbility(Effect effect) {
this(effect, false);
}
public InspiredAbility(Effect effect, boolean optional) {
this(effect, optional, true);
}
public InspiredAbility(Effect effect, boolean optional, boolean isInspired) {
super(Zone.BATTLEFIELD, effect, optional);
this.isInspired = isInspired;
}
public InspiredAbility(final InspiredAbility ability) {
super(ability);
this.isInspired = ability.isInspired;
}
@Override
@ -71,6 +78,6 @@ public class InspiredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return "<i>Inspired</i> &mdash; Whenever {this} becomes untapped, " + super.getRule();
return (isInspired ? "<i>Inspired</i> &mdash; " : "") + "Whenever {this} becomes untapped, " + super.getRule();
}
}

View file

@ -37489,7 +37489,7 @@ Discontinuity|Core Set 2021|48|M|{3}{U}{U}{U}|Instant|||As long as it's your tur
Enthralling Hold|Core Set 2021|49|U|{3}{U}{U}|Enchantment - Aura|||Enchant creature$You can't choose an untapped creature as this spell's target as you cast it.$You control enchanted creature.|
Frantic Inventory|Core Set 2021|50|C|{1}{U}|Instant|||Draw a card, then draw cards equal to the number of cards named Frantic Inventory in your graveyard.|
Frost Breath|Core Set 2021|51|C|{2}{U}|Instant|||Tap up to two target creatures. Those creatures don't untap during their controller's next untap step.|
Ghostly Pilferer|Core Set 2021|52|R|{1}{U}|Creature - Spirit Rogue|2|1|Whenever Ghostly Pilferer becomes tapped, you may pay {2}. If you do, draw a card.$Whenever an opponent casts a spell from anywhere other than their hand, draw a card.$Discard a card: Ghostly Pilferer can't be blocked this turn.|
Ghostly Pilferer|Core Set 2021|52|R|{1}{U}|Creature - Spirit Rogue|2|1|Whenever Ghostly Pilferer becomes untapped, you may pay {2}. If you do, draw a card.$Whenever an opponent casts a spell from anywhere other than their hand, draw a card.$Discard a card: Ghostly Pilferer can't be blocked this turn.|
Jeskai Elder|Core Set 2021|53|U|{1}{U}|Creature - Human Monk|1|2|Prowess$Whenever Jeskai Elder deals combat damage to a player, you may draw a card. If you do, discard a card.|
Keen Glidemaster|Core Set 2021|54|C|{1}{U}|Creature - Human Soldier|2|1|{2}{U}: Target creature gains flying until end of turn.|
Library Larcenist|Core Set 2021|55|C|{2}{U}|Creature - Merfolk Rogue|1|2|Whenever Library Larcenist attacks, draw a card.|