mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Implemented Amulet of Safekeeping
This commit is contained in:
parent
745dee6c36
commit
b90426c6b7
4 changed files with 112 additions and 13 deletions
100
Mage.Sets/src/mage/cards/a/AmuletOfSafekeeping.java
Normal file
100
Mage.Sets/src/mage/cards/a/AmuletOfSafekeeping.java
Normal file
|
@ -0,0 +1,100 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CounterUnlessPaysEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class AmuletOfSafekeeping extends CardImpl {
|
||||
|
||||
public AmuletOfSafekeeping(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// Whenever you become the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays {1}.
|
||||
this.addAbility(new AmuletOfSafekeepingTriggeredAbility());
|
||||
|
||||
// Creature tokens get -1/-0.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new BoostAllEffect(
|
||||
-1, 0, Duration.WhileOnBattlefield,
|
||||
StaticFilters.FILTER_CREATURE_TOKENS, false
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public AmuletOfSafekeeping(final AmuletOfSafekeeping card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AmuletOfSafekeeping copy() {
|
||||
return new AmuletOfSafekeeping(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AmuletOfSafekeepingTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private static final FilterStackObject filter = new FilterStackObject();
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
public AmuletOfSafekeepingTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(new GenericManaCost(1)));
|
||||
}
|
||||
|
||||
public AmuletOfSafekeepingTriggeredAbility(final AmuletOfSafekeepingTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AmuletOfSafekeepingTriggeredAbility copy() {
|
||||
return new AmuletOfSafekeepingTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (event.getTargetId().equals(getControllerId())
|
||||
&& filter.match(stackObject, getSourceId(), getControllerId(), game)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(stackObject.getId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you become the target of a spell or ability an opponent controls, "
|
||||
+ "counter that spell or ability unless its controller pays {1}";
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -10,29 +9,28 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class LeylineOfTheMeek extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creature tokens");
|
||||
static {
|
||||
filter.add(new TokenPredicate());
|
||||
}
|
||||
|
||||
public LeylineOfTheMeek(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
||||
|
||||
// If Leyline of the Meek is in your opening hand, you may begin the game with it on the battlefield.
|
||||
this.addAbility(LeylineAbility.getInstance());
|
||||
|
||||
|
||||
// Creature tokens get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)));
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new BoostAllEffect(
|
||||
1, 1, Duration.WhileOnBattlefield,
|
||||
StaticFilters.FILTER_CREATURE_TOKENS, false
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public LeylineOfTheMeek(final LeylineOfTheMeek card) {
|
||||
|
|
|
@ -38,6 +38,7 @@ public final class CoreSet2019 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Ajani, Adversary of Tyrants", 3, Rarity.MYTHIC, mage.cards.a.AjaniAdversaryOfTyrants.class));
|
||||
cards.add(new SetCardInfo("Ajani, Wise Counselor", 281, Rarity.MYTHIC, mage.cards.a.AjaniWiseCounselor.class));
|
||||
cards.add(new SetCardInfo("Alpine Moon", 128, Rarity.RARE, mage.cards.a.AlpineMoon.class));
|
||||
cards.add(new SetCardInfo("Amulet of Safekeeping", 226, Rarity.RARE, mage.cards.a.AmuletOfSafekeeping.class));
|
||||
cards.add(new SetCardInfo("Anticipate", 44, Rarity.COMMON, mage.cards.a.Anticipate.class));
|
||||
cards.add(new SetCardInfo("Apex of Power", 129, Rarity.MYTHIC, mage.cards.a.ApexOfPower.class));
|
||||
cards.add(new SetCardInfo("Arisen Gorgon", 292, Rarity.UNCOMMON, mage.cards.a.ArisenGorgon.class));
|
||||
|
|
|
@ -452,7 +452,7 @@ public final class StaticFilters {
|
|||
));
|
||||
FILTER_SPELLS_INSTANT_OR_SORCERY.setLockedFilter(true);
|
||||
}
|
||||
public static final FilterPermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens");
|
||||
public static final FilterCreaturePermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens");
|
||||
|
||||
static {
|
||||
FILTER_CREATURE_TOKENS.add(new TokenPredicate());
|
||||
|
|
Loading…
Reference in a new issue