[C21] Implemented Archaeomancer's Map

This commit is contained in:
Evan Kranzler 2021-04-08 17:21:41 -04:00
parent 6d13960505
commit cf3b3cbb76
3 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,81 @@
package mage.cards.a;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ArchaeomancersMap extends CardImpl {
private static final FilterCard filter = new FilterCard("basic Plains cards");
private static final FilterPermanent filter2 = new FilterLandPermanent();
static {
filter.add(SubType.PLAINS.getPredicate());
filter.add(SuperType.BASIC.getPredicate());
filter2.add(TargetController.OPPONENT.getControllerPredicate());
}
public ArchaeomancersMap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{W}");
// When Archaeomancer's Map enters the battlefield, search your library for up to two basic Plains cards, reveal them, put them into your hand, then shuffle.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(2, filter), true)
));
// Whenever a land enters the battlefield under an opponent's control, if that player controls more lands than you, you may put a land card from your hand onto the battlefield.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldAllTriggeredAbility(
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A), filter2
), ArchaeomancersMapCondition.instance, "Whenever a land enters the battlefield " +
"under an opponent's control, if that player controls more lands than you, " +
"you may put a land card from your hand onto the battlefield."
));
}
private ArchaeomancersMap(final ArchaeomancersMap card) {
super(card);
}
@Override
public ArchaeomancersMap copy() {
return new ArchaeomancersMap(this);
}
}
enum ArchaeomancersMapCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
UUID playerId = (UUID) source.getEffects().get(0).getValue("permanentEnteringControllerId");
return playerId != null && game.getBattlefield().count(
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND,
source.getSourceId(), playerId, game
) > game.getBattlefield().count(
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND,
source.getSourceId(), source.getControllerId(), game
);
}
}

View file

@ -24,6 +24,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Ancient Den", 276, Rarity.COMMON, mage.cards.a.AncientDen.class));
cards.add(new SetCardInfo("Angel of the Ruins", 11, Rarity.RARE, mage.cards.a.AngelOfTheRuins.class));
cards.add(new SetCardInfo("Arcane Signet", 234, Rarity.COMMON, mage.cards.a.ArcaneSignet.class));
cards.add(new SetCardInfo("Archaeomancer's Map", 12, Rarity.RARE, mage.cards.a.ArchaeomancersMap.class));
cards.add(new SetCardInfo("Audacious Reshapers", 47, Rarity.RARE, mage.cards.a.AudaciousReshapers.class));
cards.add(new SetCardInfo("Boros Charm", 210, Rarity.UNCOMMON, mage.cards.b.BorosCharm.class));
cards.add(new SetCardInfo("Boros Locket", 236, Rarity.COMMON, mage.cards.b.BorosLocket.class));

View file

@ -88,6 +88,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
return false;
}
this.getEffects().setValue("permanentEnteringBattlefield", permanent);
this.getEffects().setValue("permanentEnteringControllerId", permanent.getControllerId());
if (setTargetPointer == SetTargetPointer.NONE) {
return true;
}