[AFC] a few changes to Valiant Endeavor and Wild Endeavor

This commit is contained in:
Evan Kranzler 2021-08-26 06:38:49 -04:00
parent c25d794367
commit 418f61e5d9
2 changed files with 77 additions and 87 deletions

View file

@ -1,17 +1,11 @@
package mage.cards.v;
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.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
@ -20,10 +14,11 @@ import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game;
import mage.game.permanent.token.KnightToken;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.List;
import java.util.UUID;
/**
*
* @author zeffirojoe
*/
public final class ValiantEndeavor extends CardImpl {
@ -51,8 +46,9 @@ class ValiantEndeavorEffect extends OneShotEffect {
ValiantEndeavorEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "Roll two d6 and choose one result. Destroy each creature with power greater than or equal to that result."
+ "Then create a number of 2/2/ white Knight creature tokens with vigilance equal to the other result.";
this.staticText = "Roll two d6 and choose one result. Destroy each creature " +
"with power greater than or equal to that result. Then create a number of " +
"2/2 white Knight creature tokens with vigilance equal to the other result.";
}
private ValiantEndeavorEffect(final ValiantEndeavorEffect effect) {
@ -67,8 +63,10 @@ class ValiantEndeavorEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<Integer> results = controller.rollDice(source, game, 6, 2);
if (controller == null) {
return false;
}
List<Integer> results = controller.rollDice(outcome, source, game, 6, 2, 0);
int firstResult = results.get(0);
int secondResult = results.get(1);
int first, second;
@ -90,14 +88,7 @@ class ValiantEndeavorEffect extends OneShotEffect {
Effect wrathEffect = new DestroyAllEffect(filter);
wrathEffect.apply(game, source);
Effect tokenEffect = new CreateTokenTargetEffect(new KnightToken(), second);
tokenEffect.setTargetPointer(new FixedTarget(controller.getId()));
tokenEffect.apply(game, source);
new KnightToken().putOntoBattlefield(second, game, source, source.getControllerId());
return true;
}
return false;
}
}

View file

@ -1,17 +1,10 @@
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.Card;
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;
@ -20,10 +13,14 @@ import mage.game.Game;
import mage.game.permanent.token.BeastToken;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTarget;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
* @author zeffirojoe
*/
public final class WildEndeavor extends CardImpl {
@ -36,7 +33,6 @@ public final class WildEndeavor extends CardImpl {
// 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) {
@ -53,8 +49,10 @@ 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.";
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) {
@ -69,8 +67,10 @@ class WildEndeavorEffect extends OneShotEffect {
@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);
if (controller == null) {
return false;
}
List<Integer> results = controller.rollDice(outcome, source, game, 4, 2, 0);
int firstResult = results.get(0);
int secondResult = results.get(1);
int first, second;
@ -85,22 +85,21 @@ class WildEndeavorEffect extends OneShotEffect {
second = firstResult;
}
Effect effect = new CreateTokenTargetEffect(new BeastToken(), first);
effect.setTargetPointer(new FixedTarget(controller.getId()));
effect.apply(game, source);
new BeastToken().putOntoBattlefield(first, game, source, source.getControllerId());
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.searchLibrary(target, source, game);
Set<Card> cards = target
.getTargets()
.stream()
.map(game::getCard)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
controller.moveCards(
cards, Zone.BATTLEFIELD, source, game, true,
false, false, null
);
controller.shuffleLibrary(source, game);
return true;
}
}
}
return false;
}
}