Implemented Endless Atlas

This commit is contained in:
Evan Kranzler 2018-07-27 12:09:10 -04:00
parent a66df1082f
commit e6250c5969
2 changed files with 75 additions and 0 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.e;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public final class EndlessAtlas extends CardImpl {
public EndlessAtlas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {2}, {T}: Draw a card. Activate this ability only if you control three or more lands with the same name.
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new DrawCardSourceControllerEffect(1),
new GenericManaCost(2),
new EndlessAtlasCondition()
);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public EndlessAtlas(final EndlessAtlas card) {
super(card);
}
@Override
public EndlessAtlas copy() {
return new EndlessAtlas(this);
}
}
class EndlessAtlasCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Map<String, Integer> landMap = new HashMap();
for (Permanent land : game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND,
source.getControllerId(), game
)) {
if (land != null) {
int landCount = landMap.getOrDefault(land.getName(), 0);
if (landCount > 1) {
return true;
}
landMap.put(land.getName(), landCount + 1);
}
}
return false;
}
@Override
public String toString() {
return "you control three or more lands with the same name";
}
}

View file

@ -46,6 +46,7 @@ public final class Commander2018 extends ExpansionSet {
cards.add(new SetCardInfo("Empyrial Storm", 2, Rarity.RARE, mage.cards.e.EmpyrialStorm.class));
cards.add(new SetCardInfo("Enchanter's Bane", 21, Rarity.RARE, mage.cards.e.EnchantersBane.class));
cards.add(new SetCardInfo("Enchantress's Presence", 141, Rarity.RARE, mage.cards.e.EnchantresssPresence.class));
cards.add(new SetCardInfo("Endless Atlas", 55, Rarity.RARE, mage.cards.e.EndlessAtlas.class));
cards.add(new SetCardInfo("Entreat the Dead", 15, Rarity.RARE, mage.cards.e.EntreatTheDead.class));
cards.add(new SetCardInfo("Estrid's Invocation", 8, Rarity.RARE, mage.cards.e.EstridsInvocation.class));
cards.add(new SetCardInfo("Explosive Vegetation", 144, Rarity.UNCOMMON, mage.cards.e.ExplosiveVegetation.class));