mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TDM] Implement Avenger of the Fallen
This commit is contained in:
parent
532c18be13
commit
753c11f7a6
3 changed files with 80 additions and 12 deletions
49
Mage.Sets/src/mage/cards/a/AvengerOfTheFallen.java
Normal file
49
Mage.Sets/src/mage/cards/a/AvengerOfTheFallen.java
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
|
||||||
|
import mage.abilities.hint.Hint;
|
||||||
|
import mage.abilities.hint.ValueHint;
|
||||||
|
import mage.abilities.keyword.DeathtouchAbility;
|
||||||
|
import mage.abilities.keyword.MobilizeAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class AvengerOfTheFallen extends CardImpl {
|
||||||
|
|
||||||
|
private static final DynamicValue xValue = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURES, null);
|
||||||
|
private static final Hint hint = new ValueHint("Creature cards in your graveyard", xValue);
|
||||||
|
|
||||||
|
public AvengerOfTheFallen(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.HUMAN);
|
||||||
|
this.subtype.add(SubType.WARRIOR);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Deathtouch
|
||||||
|
this.addAbility(DeathtouchAbility.getInstance());
|
||||||
|
|
||||||
|
// Mobilize X where X is the number of creature cards in your graveyard.
|
||||||
|
this.addAbility(new MobilizeAbility(xValue).addHint(hint));
|
||||||
|
}
|
||||||
|
|
||||||
|
private AvengerOfTheFallen(final AvengerOfTheFallen card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AvengerOfTheFallen copy() {
|
||||||
|
return new AvengerOfTheFallen(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,6 +33,7 @@ public final class TarkirDragonstorm extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Anafenza, Unyielding Lineage", 2, Rarity.RARE, mage.cards.a.AnafenzaUnyieldingLineage.class));
|
cards.add(new SetCardInfo("Anafenza, Unyielding Lineage", 2, Rarity.RARE, mage.cards.a.AnafenzaUnyieldingLineage.class));
|
||||||
cards.add(new SetCardInfo("Attuned Hunter", 135, Rarity.UNCOMMON, mage.cards.a.AttunedHunter.class));
|
cards.add(new SetCardInfo("Attuned Hunter", 135, Rarity.UNCOMMON, mage.cards.a.AttunedHunter.class));
|
||||||
cards.add(new SetCardInfo("Auroral Procession", 169, Rarity.UNCOMMON, mage.cards.a.AuroralProcession.class));
|
cards.add(new SetCardInfo("Auroral Procession", 169, Rarity.UNCOMMON, mage.cards.a.AuroralProcession.class));
|
||||||
|
cards.add(new SetCardInfo("Avenger of the Fallen", 73, Rarity.RARE, mage.cards.a.AvengerOfTheFallen.class));
|
||||||
cards.add(new SetCardInfo("Awaken the Honored Dead", 170, Rarity.RARE, mage.cards.a.AwakenTheHonoredDead.class));
|
cards.add(new SetCardInfo("Awaken the Honored Dead", 170, Rarity.RARE, mage.cards.a.AwakenTheHonoredDead.class));
|
||||||
cards.add(new SetCardInfo("Barrensteppe Siege", 171, Rarity.RARE, mage.cards.b.BarrensteppeSiege.class));
|
cards.add(new SetCardInfo("Barrensteppe Siege", 171, Rarity.RARE, mage.cards.b.BarrensteppeSiege.class));
|
||||||
cards.add(new SetCardInfo("Bearer of Glory", 4, Rarity.COMMON, mage.cards.b.BearerOfGlory.class));
|
cards.add(new SetCardInfo("Bearer of Glory", 4, Rarity.COMMON, mage.cards.b.BearerOfGlory.class));
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,13 @@ package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AttacksTriggeredAbility;
|
import mage.abilities.common.AttacksTriggeredAbility;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.token.RedWarriorToken;
|
import mage.game.permanent.token.RedWarriorToken;
|
||||||
import mage.players.Player;
|
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -16,10 +17,11 @@ import mage.util.CardUtil;
|
||||||
public class MobilizeAbility extends AttacksTriggeredAbility {
|
public class MobilizeAbility extends AttacksTriggeredAbility {
|
||||||
|
|
||||||
public MobilizeAbility(int count) {
|
public MobilizeAbility(int count) {
|
||||||
super(new MobilizeEffect(count), false, "Mobilize " + count + " <i>(Whenever this creature attacks, create "
|
this(StaticValue.get(count));
|
||||||
+ (count == 1 ? "a" : CardUtil.numberToText(count)) + " tapped and attacking 1/1 red Warrior creature "
|
}
|
||||||
+ (count == 1 ? "token" : "tokens") + ". Sacrifice " + (count == 1 ? "it" : "them")
|
|
||||||
+ " at the beginning of the next end step.)");
|
public MobilizeAbility(DynamicValue count) {
|
||||||
|
super(new MobilizeEffect(count), false, makeText(count));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MobilizeAbility(final MobilizeAbility ability) {
|
protected MobilizeAbility(final MobilizeAbility ability) {
|
||||||
|
|
@ -30,13 +32,33 @@ public class MobilizeAbility extends AttacksTriggeredAbility {
|
||||||
public MobilizeAbility copy() {
|
public MobilizeAbility copy() {
|
||||||
return new MobilizeAbility(this);
|
return new MobilizeAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String makeText(DynamicValue amount) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String message;
|
||||||
|
String numToText;
|
||||||
|
boolean plural;
|
||||||
|
if (amount instanceof StaticValue) {
|
||||||
|
int count = ((StaticValue) amount).getValue();
|
||||||
|
message = "" + count;
|
||||||
|
numToText = CardUtil.numberToText(count, "a");
|
||||||
|
plural = count > 1;
|
||||||
|
} else {
|
||||||
|
message = "X, where X is " + amount.getMessage() + '.';
|
||||||
|
numToText = "X";
|
||||||
|
plural = true;
|
||||||
|
}
|
||||||
|
return "Mobilize " + message + " <i>(Whenever this creature attacks, create " +
|
||||||
|
numToText + " tapped and attacking 1/1 red Warrior creature token" + (plural ? "s" : "") +
|
||||||
|
". Sacrifice " + (plural ? "them" : "it") + " at the beginning of the next end step.)</i>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MobilizeEffect extends OneShotEffect {
|
class MobilizeEffect extends OneShotEffect {
|
||||||
|
|
||||||
private final int count;
|
private final DynamicValue count;
|
||||||
|
|
||||||
MobilizeEffect(int count) {
|
MobilizeEffect(DynamicValue count) {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
@ -53,13 +75,9 @@ class MobilizeEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CreateTokenEffect effect = new CreateTokenEffect(new RedWarriorToken(), this.count, true, true);
|
CreateTokenEffect effect = new CreateTokenEffect(new RedWarriorToken(), this.count, true, true);
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
effect.sacrificeTokensCreatedAtNextEndStep(game, source);
|
effect.sacrificeTokensCreatedAtNextEndStep(game, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue