[MIC] Implemented Tomb Tyrant

This commit is contained in:
Evan Kranzler 2021-09-18 16:41:48 -04:00
parent 2cf005f971
commit 3d0571d5e9
3 changed files with 125 additions and 2 deletions

View file

@ -0,0 +1,118 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.CompoundCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.hint.common.MyTurnHint;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.players.Player;
import mage.util.RandomUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TombTyrant extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.ZOMBIE, "Zombies");
private static final FilterCard filter2 = new FilterCreatureCard();
static {
filter2.add(SubType.ZOMBIE.getPredicate());
}
private static final Condition condition = new CompoundCondition(
"during your turn and only if there are at least three Zombie creature cards in your graveyard",
MyTurnCondition.instance, new CardsInControllerGraveyardCondition(3, filter2)
);
private static final Hint hint = new ValueHint(
"Zombie creatures in your graveyard", new CardsInControllerGraveyardCount(filter2)
);
public TombTyrant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.NOBLE);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Other Zombies you control get +1/+1.
this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(
1, 1, Duration.WhileOnBattlefield, filter, true
)));
// {2}{B}, {T}, Sacrifice a creature: Return a Zombie creature card at random from your graveyard to the battlefield. Activate only during your turn and only if there are at least three Zombie creature cards in your graveyard.
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, new TombTyrantEffect(),
new ManaCostsImpl<>("{2}{B}"), condition
);
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE));
this.addAbility(ability.addHint(MyTurnHint.instance).addHint(hint));
}
private TombTyrant(final TombTyrant card) {
super(card);
}
@Override
public TombTyrant copy() {
return new TombTyrant(this);
}
}
class TombTyrantEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCreatureCard();
static {
filter.add(SubType.ZOMBIE.getPredicate());
}
TombTyrantEffect() {
super(Outcome.Benefit);
staticText = "return a Zombie creature card at random from your graveyard to the battlefield";
}
private TombTyrantEffect(final TombTyrantEffect effect) {
super(effect);
}
@Override
public TombTyrantEffect copy() {
return new TombTyrantEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Card card = RandomUtil.randomFromCollection(player.getGraveyard().getCards(filter, game));
return card != null && player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -133,6 +133,7 @@ public final class MidnightHuntCommander extends ExpansionSet {
cards.add(new SetCardInfo("Temple of Deceit", 184, Rarity.RARE, mage.cards.t.TempleOfDeceit.class));
cards.add(new SetCardInfo("Temple of Plenty", 185, Rarity.RARE, mage.cards.t.TempleOfPlenty.class));
cards.add(new SetCardInfo("Temple of the False God", 186, Rarity.UNCOMMON, mage.cards.t.TempleOfTheFalseGod.class));
cards.add(new SetCardInfo("Tomb Tyrant", 23, Rarity.RARE, mage.cards.t.TombTyrant.class));
cards.add(new SetCardInfo("Trostani's Summoner", 156, Rarity.UNCOMMON, mage.cards.t.TrostanisSummoner.class));
cards.add(new SetCardInfo("Unbreakable Formation", 95, Rarity.RARE, mage.cards.u.UnbreakableFormation.class));
cards.add(new SetCardInfo("Unclaimed Territory", 187, Rarity.UNCOMMON, mage.cards.u.UnclaimedTerritory.class));

View file

@ -1,4 +1,3 @@
package mage.abilities.costs.common;
import mage.abilities.Ability;
@ -7,6 +6,7 @@ import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.constants.AbilityType;
import mage.constants.Outcome;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledPermanent;
@ -23,6 +23,10 @@ public class SacrificeTargetCost extends CostImpl {
private final List<Permanent> permanents = new ArrayList<>();
public SacrificeTargetCost(FilterControlledPermanent filter) {
this(new TargetControlledPermanent(filter));
}
public SacrificeTargetCost(TargetControlledPermanent target) {
this.addTarget(target);
target.setNotTarget(true); // sacrifice is never targeted
@ -88,7 +92,7 @@ public class SacrificeTargetCost extends CostImpl {
}
}
// solves issue #8097, if a sacrifice cost is optional and you don't have valid targets, then the cost can be paid
if(validTargets == 0 && targets.get(0).getMinNumberOfTargets() == 0){
if (validTargets == 0 && targets.get(0).getMinNumberOfTargets() == 0) {
return true;
}
return false;