mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
Implemented Ajani's Last Stand
This commit is contained in:
parent
63203936f6
commit
f77c9bc112
7 changed files with 143 additions and 14 deletions
103
Mage.Sets/src/mage/cards/a/AjanisLastStand.java
Normal file
103
Mage.Sets/src/mage/cards/a/AjanisLastStand.java
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DiscardedByOpponentTriggeredAbility;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.token.AvatarToken2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class AjanisLastStand extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.PLAINS));
|
||||
}
|
||||
|
||||
public AjanisLastStand(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
||||
|
||||
// Whenever a creature or planeswalker you control dies, you may sacrifice Ajani's Last Stand. If you do, create a 4/4 white Avatar creature token with flying.
|
||||
this.addAbility(new AjanisLastStandTriggeredAbility());
|
||||
|
||||
// When a spell or ability an opponent controls causes you to discard this card, if you control a Plains, create a 4/4 white Avatar creature token with flying.
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new DiscardedByOpponentTriggeredAbility(new CreateTokenEffect(new AvatarToken2())),
|
||||
new PermanentsOnTheBattlefieldCondition(filter),
|
||||
"When a spell or ability an opponent controls causes you to discard this card, "
|
||||
+ "if you control a Plains, create a 4/4 white Avatar creature token with flying."
|
||||
));
|
||||
}
|
||||
|
||||
public AjanisLastStand(final AjanisLastStand card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjanisLastStand copy() {
|
||||
return new AjanisLastStand(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AjanisLastStandTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public AjanisLastStandTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(
|
||||
new CreateTokenEffect(new AvatarToken2()),
|
||||
new SacrificeSourceCost()
|
||||
), false);
|
||||
}
|
||||
|
||||
public AjanisLastStandTriggeredAbility(final AjanisLastStandTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjanisLastStandTriggeredAbility copy() {
|
||||
return new AjanisLastStandTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getToZone() == Zone.GRAVEYARD) {
|
||||
if (zEvent.getTarget().getControllerId().equals(controllerId)
|
||||
&& (zEvent.getTarget().isCreature()
|
||||
|| zEvent.getTarget().isPlaneswalker())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature or planeswalker you control dies, "
|
||||
+ "you may sacrifice {this}. "
|
||||
+ "If you do, create a 4/4 white Avatar creature token with flying.";
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ package mage.cards.g;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiscardedByOpponentTriggerAbility;
|
||||
import mage.abilities.common.DiscardedByOpponentTriggeredAbility;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -24,7 +24,7 @@ public final class GuerrillaTactics extends CardImpl {
|
|||
this.getSpellAbility().addTarget(new TargetAnyTarget());
|
||||
|
||||
// When a spell or ability an opponent controls causes you to discard Guerrilla Tactics, Guerrilla Tactics deals 4 damage to any target.
|
||||
Ability ability = new DiscardedByOpponentTriggerAbility(new DamageTargetEffect(4));
|
||||
Ability ability = new DiscardedByOpponentTriggeredAbility(new DamageTargetEffect(4));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package mage.cards.m;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiscardedByOpponentTriggerAbility;
|
||||
import mage.abilities.common.DiscardedByOpponentTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
|
@ -24,7 +24,7 @@ public final class Metrognome extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
// When a spell or ability an opponent controls causes you to discard Metrognome, create four 1/1 colorless Gnome artifact creature tokens.
|
||||
this.addAbility(new DiscardedByOpponentTriggerAbility(new CreateTokenEffect(new GnomeToken(), 4)));
|
||||
this.addAbility(new DiscardedByOpponentTriggeredAbility(new CreateTokenEffect(new GnomeToken(), 4)));
|
||||
|
||||
// {4}, {tap}: Create a 1/1 colorless Gnome artifact creature token.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new GnomeToken()), new ManaCostsImpl("{4}"));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package mage.cards.q;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DiscardedByOpponentTriggerAbility;
|
||||
import mage.abilities.common.DiscardedByOpponentTriggeredAbility;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
import mage.abilities.keyword.SplitSecondAbility;
|
||||
|
|
@ -31,7 +31,7 @@ public final class Quagnoth extends CardImpl {
|
|||
this.addAbility(ShroudAbility.getInstance());
|
||||
|
||||
// When a spell or ability an opponent controls causes you to discard Quagnoth, return it to your hand.
|
||||
this.addAbility(new DiscardedByOpponentTriggerAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new DiscardedByOpponentTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public Quagnoth(final Quagnoth card) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public final class CoreSet2019 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Aerial Engineer", 211, Rarity.UNCOMMON, mage.cards.a.AerialEngineer.class));
|
||||
cards.add(new SetCardInfo("Aggressive Mammoth", 302, Rarity.RARE, mage.cards.a.AggressiveMammoth.class));
|
||||
cards.add(new SetCardInfo("Air Elemental", 308, Rarity.UNCOMMON, mage.cards.a.AirElemental.class));
|
||||
cards.add(new SetCardInfo("Ajani's Last Stand", 4, Rarity.RARE, mage.cards.a.AjanisLastStand.class));
|
||||
cards.add(new SetCardInfo("Ajani's Pridemate", 5, Rarity.UNCOMMON, mage.cards.a.AjanisPridemate.class));
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -13,23 +12,23 @@ import mage.game.stack.StackObject;
|
|||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class DiscardedByOpponentTriggerAbility extends TriggeredAbilityImpl {
|
||||
public class DiscardedByOpponentTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public DiscardedByOpponentTriggerAbility(Effect effect) {
|
||||
public DiscardedByOpponentTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public DiscardedByOpponentTriggerAbility(Effect effect, boolean optional) {
|
||||
public DiscardedByOpponentTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.GRAVEYARD, effect, optional);
|
||||
}
|
||||
|
||||
public DiscardedByOpponentTriggerAbility(final DiscardedByOpponentTriggerAbility ability) {
|
||||
public DiscardedByOpponentTriggeredAbility(final DiscardedByOpponentTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscardedByOpponentTriggerAbility copy() {
|
||||
return new DiscardedByOpponentTriggerAbility(this);
|
||||
public DiscardedByOpponentTriggeredAbility copy() {
|
||||
return new DiscardedByOpponentTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -50,6 +49,6 @@ public class DiscardedByOpponentTriggerAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When a spell or ability an opponent controls causes you to discard {this}, " + super.getRule();
|
||||
return "When a spell or ability an opponent controls causes you to discard this card, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
public final class AvatarToken2 extends TokenImpl {
|
||||
public AvatarToken2() {
|
||||
super("Angel", "4/4 white Avatar creature token with flying");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setWhite(true);
|
||||
subtype.add(SubType.AVATAR);
|
||||
power = new MageInt(4);
|
||||
toughness = new MageInt(4);
|
||||
addAbility(FlyingAbility.getInstance());
|
||||
}
|
||||
|
||||
public AvatarToken2(final AvatarToken2 token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public AvatarToken2 copy() {
|
||||
return new AvatarToken2(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue