[AFC] Implemented Wild Endeavor (#8028)

* [AFC] Implemented Wild Endeavor

* cleanup

* Adding my missed author tags

* matching existing implementation
This commit is contained in:
Joseph Zeffiro 2021-08-26 06:30:55 -04:00 committed by GitHub
parent 5e08c5d279
commit c25d794367
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 108 additions and 1 deletions

View file

@ -26,7 +26,7 @@ import mage.constants.Duration;
/**
*
* @author anonymous
* @author zeffirojoe
*/
public final class FeySteed extends CardImpl {

View file

@ -0,0 +1,106 @@
package mage.cards.w;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.token.BeastToken;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author zeffirojoe
*/
public final class WildEndeavor extends CardImpl {
public WildEndeavor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[] { CardType.SORCERY }, "{4}{G}{G}");
// Roll two d4 and choose one result. Create a number of 3/3 green Beast
// creature tokens equal to that result. Then search your library for a number
// of basic land cards equal to the other result, put them onto the battlefield
// tapped, then shuffle.
this.getSpellAbility().addEffect(new WildEndeavorEffect());
}
private WildEndeavor(final WildEndeavor card) {
super(card);
}
@Override
public WildEndeavor copy() {
return new WildEndeavor(this);
}
}
class WildEndeavorEffect extends OneShotEffect {
WildEndeavorEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "Roll two d4 and choose one result. Create a number of 3/3 green Beast creature tokens equal to that result"
+ "Then search your library for a number of basic land cards equal to the other result, put them onto the battlefield tapped, then shuffle.";
}
private WildEndeavorEffect(final WildEndeavorEffect effect) {
super(effect);
}
@Override
public WildEndeavorEffect copy() {
return new WildEndeavorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<Integer> results = controller.rollDice(source, game, 4, 2);
int firstResult = results.get(0);
int secondResult = results.get(1);
int first, second;
if (firstResult != secondResult && controller.chooseUse(outcome,
"Choose the amount of 3/3 green Beast creature tokens.",
"The other number is the amount of basic lands you search from your library and put on the battlefield tapped.",
"" + firstResult, "" + secondResult, source, game)) {
first = firstResult;
second = secondResult;
} else {
first = secondResult;
second = firstResult;
}
Effect effect = new CreateTokenTargetEffect(new BeastToken(), first);
effect.setTargetPointer(new FixedTarget(controller.getId()));
effect.apply(game, source);
TargetCardInLibrary target = new TargetCardInLibrary(0, second, StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
controller.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source,
game, true, false, false, null);
controller.shuffleLibrary(source, game);
return true;
}
}
}
return false;
}
}

View file

@ -278,6 +278,7 @@ public final class ForgottenRealmsCommander extends ExpansionSet {
cards.add(new SetCardInfo("Wand of Orcus", 28, Rarity.RARE, mage.cards.w.WandOfOrcus.class));
cards.add(new SetCardInfo("Warstorm Surge", 149, Rarity.RARE, mage.cards.w.WarstormSurge.class));
cards.add(new SetCardInfo("Wayfarer's Bauble", 222, Rarity.COMMON, mage.cards.w.WayfarersBauble.class));
cards.add(new SetCardInfo("Wild Endeavor", 43, Rarity.RARE, mage.cards.w.WildEndeavor.class));
cards.add(new SetCardInfo("Wild Growth", 174, Rarity.COMMON, mage.cards.w.WildGrowth.class));
cards.add(new SetCardInfo("Wild-Magic Sorcerer", 36, Rarity.RARE, mage.cards.w.WildMagicSorcerer.class));
cards.add(new SetCardInfo("Winds of Rath", 78, Rarity.RARE, mage.cards.w.WindsOfRath.class));