Implemented Voice of the Many

This commit is contained in:
Evan Kranzler 2019-08-07 13:32:29 -04:00
parent 33791d390a
commit 8b9cdcd48c
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,78 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class VoiceOfTheMany extends CardImpl {
public VoiceOfTheMany(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.DRUID);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// When Voice of the Many enters the battlefield, draw a card for each opponent who controls fewer creatures than you do.
this.addAbility(new EntersBattlefieldTriggeredAbility(new VoiceOfTheManyEffect()));
}
private VoiceOfTheMany(final VoiceOfTheMany card) {
super(card);
}
@Override
public VoiceOfTheMany copy() {
return new VoiceOfTheMany(this);
}
}
class VoiceOfTheManyEffect extends OneShotEffect {
VoiceOfTheManyEffect() {
super(Outcome.Benefit);
staticText = "draw a card for each opponent who controls fewer creatures than you do";
}
private VoiceOfTheManyEffect(final VoiceOfTheManyEffect effect) {
super(effect);
}
@Override
public VoiceOfTheManyEffect copy() {
return new VoiceOfTheManyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int myCount = game.getBattlefield().getAllActivePermanents(
StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game
).size();
int toDraw = game
.getOpponents(source.getControllerId())
.stream()
.mapToInt(uuid -> game.getBattlefield().getAllActivePermanents(
StaticFilters.FILTER_PERMANENT_CREATURE, uuid, game
).size() < myCount ? 1 : 0)
.sum();
if (toDraw == 0) {
return true;
}
return new DrawCardSourceControllerEffect(toDraw).apply(game, source);
}
}

View file

@ -131,6 +131,7 @@ public final class Commander2019Edition extends ExpansionSet {
cards.add(new SetCardInfo("Trostani, Selesnya's Voice", 204, Rarity.MYTHIC, mage.cards.t.TrostaniSelesnyasVoice.class)); cards.add(new SetCardInfo("Trostani, Selesnya's Voice", 204, Rarity.MYTHIC, mage.cards.t.TrostaniSelesnyasVoice.class));
cards.add(new SetCardInfo("Urban Evolution", 205, Rarity.UNCOMMON, mage.cards.u.UrbanEvolution.class)); cards.add(new SetCardInfo("Urban Evolution", 205, Rarity.UNCOMMON, mage.cards.u.UrbanEvolution.class));
cards.add(new SetCardInfo("Vesuvan Shapeshifter", 101, Rarity.RARE, mage.cards.v.VesuvanShapeshifter.class)); cards.add(new SetCardInfo("Vesuvan Shapeshifter", 101, Rarity.RARE, mage.cards.v.VesuvanShapeshifter.class));
cards.add(new SetCardInfo("Voice of the Many", 36, Rarity.UNCOMMON, mage.cards.v.VoiceOfTheMany.class));
cards.add(new SetCardInfo("Volrath, the Shapestealer", 51, Rarity.MYTHIC, mage.cards.v.VolrathTheShapestealer.class)); cards.add(new SetCardInfo("Volrath, the Shapestealer", 51, Rarity.MYTHIC, mage.cards.v.VolrathTheShapestealer.class));
cards.add(new SetCardInfo("Vraska the Unseen", 207, Rarity.MYTHIC, mage.cards.v.VraskaTheUnseen.class)); cards.add(new SetCardInfo("Vraska the Unseen", 207, Rarity.MYTHIC, mage.cards.v.VraskaTheUnseen.class));
cards.add(new SetCardInfo("Willbender", 102, Rarity.UNCOMMON, mage.cards.w.Willbender.class)); cards.add(new SetCardInfo("Willbender", 102, Rarity.UNCOMMON, mage.cards.w.Willbender.class));