Implemented Return of the Wildspeaker

This commit is contained in:
Evan Kranzler 2019-09-19 19:55:25 -04:00
parent 069751773c
commit ee9b76ab35
2 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,84 @@
package mage.cards.r;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ReturnOfTheWildspeaker extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("non-Human creatures");
static {
filter.add(Predicates.not(new SubtypePredicate(SubType.HUMAN)));
}
public ReturnOfTheWildspeaker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{G}");
// Choose one
// Draw cards equal to the greatest power among non-Human creatures you control.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(ReturnOfTheWildspeakerValue.instance)
.setText("draw cards equal to the greatest power among non-Human creatures you control"));
// Non-Human creatures you control get +3/+3 until end of turn.
this.getSpellAbility().addMode(new Mode(
new BoostControlledEffect(3, 3, Duration.EndOfTurn, filter)
));
}
private ReturnOfTheWildspeaker(final ReturnOfTheWildspeaker card) {
super(card);
}
@Override
public ReturnOfTheWildspeaker copy() {
return new ReturnOfTheWildspeaker(this);
}
}
enum ReturnOfTheWildspeakerValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game.getBattlefield()
.getAllActivePermanents(sourceAbility.getControllerId())
.stream()
.filter(Permanent::isCreature)
.filter(permanent -> !permanent.hasSubtype(SubType.HUMAN, game))
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.max()
.getAsInt();
}
@Override
public DynamicValue copy() {
return instance;
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -184,6 +184,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Redcap Melee", 135, Rarity.UNCOMMON, mage.cards.r.RedcapMelee.class));
cards.add(new SetCardInfo("Redcap Raiders", 136, Rarity.COMMON, mage.cards.r.RedcapRaiders.class));
cards.add(new SetCardInfo("Resolute Rider", 214, Rarity.UNCOMMON, mage.cards.r.ResoluteRider.class));
cards.add(new SetCardInfo("Return of the Wildspeaker", 172, Rarity.RARE, mage.cards.r.ReturnOfTheWildspeaker.class));
cards.add(new SetCardInfo("Return to Nature", 173, Rarity.COMMON, mage.cards.r.ReturnToNature.class));
cards.add(new SetCardInfo("Revenge of Ravens", 104, Rarity.UNCOMMON, mage.cards.r.RevengeOfRavens.class));
cards.add(new SetCardInfo("Righteousness", 27, Rarity.UNCOMMON, mage.cards.r.Righteousness.class));