[MOM] Implement Tribute to the World Tree

This commit is contained in:
theelk801 2023-04-10 19:33:14 -04:00
parent eac4ce8cdf
commit 96f6d3b011
2 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,70 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TributeToTheWorldTree extends CardImpl {
public TributeToTheWorldTree(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}{G}{G}");
// Whenever a creature enters the battlefield under your control, draw a card if its power is 3 or greater. Otherwise, put two +1/+1 counters on it.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
new TributeToTheWorldTreeEffect(), StaticFilters.FILTER_PERMANENT_A_CREATURE
));
}
private TributeToTheWorldTree(final TributeToTheWorldTree card) {
super(card);
}
@Override
public TributeToTheWorldTree copy() {
return new TributeToTheWorldTree(this);
}
}
class TributeToTheWorldTreeEffect extends OneShotEffect {
TributeToTheWorldTreeEffect() {
super(Outcome.Benefit);
staticText = "draw a card if its power is 3 or greater. Otherwise, put two +1/+1 counters on it";
}
private TributeToTheWorldTreeEffect(final TributeToTheWorldTreeEffect effect) {
super(effect);
}
@Override
public TributeToTheWorldTreeEffect copy() {
return new TributeToTheWorldTreeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) getValue("permanentEnteringBattlefield");
if (permanent == null) {
return false;
}
if (permanent.getPower().getValue() < 3) {
return permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
}
Player player = game.getPlayer(source.getControllerId());
return player != null && player.drawCards(1, source, game) > 0;
}
}

View file

@ -234,6 +234,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Trailblazing Historian", 168, Rarity.COMMON, mage.cards.t.TrailblazingHistorian.class));
cards.add(new SetCardInfo("Tranquil Cove", 275, Rarity.COMMON, mage.cards.t.TranquilCove.class));
cards.add(new SetCardInfo("Transcendent Message", 83, Rarity.RARE, mage.cards.t.TranscendentMessage.class));
cards.add(new SetCardInfo("Tribute to the World Tree", 211, Rarity.RARE, mage.cards.t.TributeToTheWorldTree.class));
cards.add(new SetCardInfo("Unseal the Necropolis", 128, Rarity.COMMON, mage.cards.u.UnsealTheNecropolis.class));
cards.add(new SetCardInfo("Urn of Godfire", 266, Rarity.COMMON, mage.cards.u.UrnOfGodfire.class));
cards.add(new SetCardInfo("Vanquish the Weak", 129, Rarity.COMMON, mage.cards.v.VanquishTheWeak.class));