mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[AFC] a few changes to Valiant Endeavor and Wild Endeavor
This commit is contained in:
parent
c25d794367
commit
418f61e5d9
2 changed files with 77 additions and 87 deletions
|
@ -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,16 +14,17 @@ 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 {
|
||||
|
||||
public ValiantEndeavor(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[] { CardType.SORCERY }, "{4}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}{W}");
|
||||
|
||||
// Roll two d6 and choose on result. Destroy each creature with power greater
|
||||
// than or equal to that result. Then create a number of 2/2 white Knight
|
||||
|
@ -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,37 +63,32 @@ 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);
|
||||
int firstResult = results.get(0);
|
||||
int secondResult = results.get(1);
|
||||
int first, second;
|
||||
if (firstResult != secondResult
|
||||
&& controller.chooseUse(outcome, "Destroy each creature with power greater than or equal to your choice",
|
||||
"The other number will be the amount of 2/2 white Knight tokens with vigilance.",
|
||||
"" + firstResult, "" + secondResult, source, game)) {
|
||||
first = firstResult;
|
||||
second = secondResult;
|
||||
} else {
|
||||
first = secondResult;
|
||||
second = firstResult;
|
||||
}
|
||||
|
||||
final FilterCreaturePermanent filter = new FilterCreaturePermanent(
|
||||
String.format("creatures with power greater than or equal to %s", first));
|
||||
filter.add(new PowerPredicate(ComparisonType.MORE_THAN, first - 1));
|
||||
|
||||
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);
|
||||
|
||||
return true;
|
||||
|
||||
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;
|
||||
if (firstResult != secondResult
|
||||
&& controller.chooseUse(outcome, "Destroy each creature with power greater than or equal to your choice",
|
||||
"The other number will be the amount of 2/2 white Knight tokens with vigilance.",
|
||||
"" + firstResult, "" + secondResult, source, game)) {
|
||||
first = firstResult;
|
||||
second = secondResult;
|
||||
} else {
|
||||
first = secondResult;
|
||||
second = firstResult;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
final FilterCreaturePermanent filter = new FilterCreaturePermanent(
|
||||
String.format("creatures with power greater than or equal to %s", first));
|
||||
filter.add(new PowerPredicate(ComparisonType.MORE_THAN, first - 1));
|
||||
|
||||
Effect wrathEffect = new DestroyAllEffect(filter);
|
||||
wrathEffect.apply(game, source);
|
||||
|
||||
new KnightToken().putOntoBattlefield(second, game, source, source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,23 +13,26 @@ 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 {
|
||||
|
||||
public WildEndeavor(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[] { CardType.SORCERY }, "{4}{G}{G}");
|
||||
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) {
|
||||
|
@ -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,38 +67,39 @@ 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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
new BeastToken().putOntoBattlefield(first, game, source, source.getControllerId());
|
||||
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, second, StaticFilters.FILTER_CARD_BASIC_LAND);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue