forked from External/mage
Implemented Journey for the Elixir
This commit is contained in:
parent
b7c1274ceb
commit
3659a2dc0b
6 changed files with 164 additions and 6 deletions
123
Mage.Sets/src/mage/cards/j/JourneyForTheElixir.java
Normal file
123
Mage.Sets/src/mage/cards/j/JourneyForTheElixir.java
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class JourneyForTheElixir extends CardImpl {
|
||||
|
||||
public JourneyForTheElixir(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
|
||||
// Search your library and graveyard for a basic land card and a card named Jiang Yanggu, reveal them, put them into your hand, then shuffle your library.
|
||||
this.getSpellAbility().addEffect(new JourneyForTheElixirEffect());
|
||||
}
|
||||
|
||||
public JourneyForTheElixir(final JourneyForTheElixir card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JourneyForTheElixir copy() {
|
||||
return new JourneyForTheElixir(this);
|
||||
}
|
||||
}
|
||||
|
||||
class JourneyForTheElixirEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("card named Jiang Yanggu");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Jiang Yanggu"));
|
||||
}
|
||||
|
||||
public JourneyForTheElixirEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
this.staticText = "search your library and graveyard for a basic land card "
|
||||
+ "and a card named Jiang Yanggu, reveal them, "
|
||||
+ "put them into your hand, then shuffle your library";
|
||||
}
|
||||
|
||||
public JourneyForTheElixirEffect(final JourneyForTheElixirEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JourneyForTheElixirEffect copy() {
|
||||
return new JourneyForTheElixirEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
boolean walkerFound = false;
|
||||
boolean landFound = false;
|
||||
Cards cardsToHand = new CardsImpl();
|
||||
if (player.chooseUse(outcome, "Search your graveyard?", source, game)) {
|
||||
TargetCardInGraveyard targetWalker = new TargetCardInGraveyard(0, 1, filter);
|
||||
targetWalker.setNotTarget(true);
|
||||
if (player.choose(outcome, targetWalker, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(targetWalker.getFirstTarget());
|
||||
if (card != null) {
|
||||
cardsToHand.add(card);
|
||||
walkerFound = true;
|
||||
}
|
||||
}
|
||||
TargetCardInGraveyard targetLand = new TargetCardInGraveyard(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND_A);
|
||||
targetLand.setNotTarget(true);
|
||||
if (player.choose(outcome, targetLand, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(targetLand.getFirstTarget());
|
||||
if (card != null) {
|
||||
cardsToHand.add(card);
|
||||
landFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!walkerFound || !landFound) {
|
||||
TargetCardInLibrary targetWalker = new TargetCardInLibrary(0, 1, filter);
|
||||
targetWalker.setNotTarget(true);
|
||||
if (!walkerFound && player.searchLibrary(targetWalker, game, false)) {
|
||||
Card card = game.getCard(targetWalker.getFirstTarget());
|
||||
if (card != null) {
|
||||
cardsToHand.add(card);
|
||||
}
|
||||
}
|
||||
TargetCardInLibrary targetLand = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND_A);
|
||||
targetLand.setNotTarget(true);
|
||||
if (!landFound && player.searchLibrary(targetLand, game, false)) {
|
||||
Card card = game.getCard(targetLand.getFirstTarget());
|
||||
if (card != null) {
|
||||
cardsToHand.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SEARCHED, player.getId(), player.getId()));
|
||||
player.revealCards(source, cardsToHand, game);
|
||||
player.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ public final class JiangYangguMuYanling extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Heavenly Qilin", 6, Rarity.COMMON, mage.cards.h.HeavenlyQilin.class));
|
||||
cards.add(new SetCardInfo("Island", 21, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Jiang Yanggu", 22, Rarity.MYTHIC, mage.cards.j.JiangYanggu.class));
|
||||
cards.add(new SetCardInfo("Journey for the Elixir", 36, Rarity.RARE, mage.cards.j.JourneyForTheElixir.class));
|
||||
cards.add(new SetCardInfo("Leopard-Spotted Jiao", 23, Rarity.COMMON, mage.cards.l.LeopardSpottedJiao.class));
|
||||
cards.add(new SetCardInfo("Meandering River", 19, Rarity.COMMON, mage.cards.m.MeanderingRiver.class));
|
||||
cards.add(new SetCardInfo("Moon-Eating Dog", 10, Rarity.UNCOMMON, mage.cards.m.MoonEatingDog.class));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package org.mage.test.player;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -1991,11 +1990,21 @@ public class TestPlayer implements Player {
|
|||
return computerPlayer.searchLibrary(target, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, boolean triggerEvents) {
|
||||
return computerPlayer.searchLibrary(target, game, triggerEvents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId) {
|
||||
return computerPlayer.searchLibrary(target, game, targetPlayerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents) {
|
||||
return computerPlayer.searchLibrary(target, game, targetPlayerId, triggerEvents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Game game) {
|
||||
return computerPlayer.flipCoin(game);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package org.mage.test.stub;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -583,11 +582,21 @@ public class PlayerStub implements Player {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, boolean triggerEvents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayLand() {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.players;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -352,14 +351,19 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game);
|
||||
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game, boolean triggerEvents);
|
||||
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param target
|
||||
* @param game
|
||||
* @param targetPlayerId player whose library will be searched
|
||||
* @param triggerEvents whether searching will trigger any game events
|
||||
* @return true if search was successful
|
||||
*/
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId);
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents);
|
||||
|
||||
boolean canPlayLand();
|
||||
|
||||
|
|
|
|||
|
|
@ -2354,11 +2354,21 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game) {
|
||||
return searchLibrary(target, game, playerId);
|
||||
return searchLibrary(target, game, playerId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, boolean triggerEvents) {
|
||||
return searchLibrary(target, game, playerId, triggerEvents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId) {
|
||||
return searchLibrary(target, game, targetPlayerId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents) {
|
||||
//20091005 - 701.14c
|
||||
Library searchedLibrary = null;
|
||||
String searchInfo = null;
|
||||
|
|
@ -2414,7 +2424,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
for (UUID targetId : newTarget.getTargets()) {
|
||||
target.add(targetId, game);
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SEARCHED, targetPlayerId, playerId));
|
||||
if (triggerEvents) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SEARCHED, targetPlayerId, playerId));
|
||||
}
|
||||
} else if (targetPlayerId.equals(playerId) && handleLibraryCastableCards(library, game, targetPlayerId)) { // for handling Panglacial Wurm
|
||||
newTarget.clearChosen();
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue