mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
Implemented Ashiok, Dream Render
This commit is contained in:
parent
bea26691a8
commit
254972be77
170 changed files with 294 additions and 212 deletions
|
|
@ -41,7 +41,7 @@ public class RecruiterEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
TargetCardInLibrary targetCards = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter);
|
||||
Cards cards = new CardsImpl();
|
||||
if (controller.searchLibrary(targetCards, game)) {
|
||||
if (controller.searchLibrary(targetCards, source, game)) {
|
||||
cards.addAll(targetCards.getTargets());
|
||||
}
|
||||
controller.revealCards(staticText, cards, game);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class ReplaceOpponentCardsInHandWithSelectedEffect extends OneShotEffect
|
|||
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(searchLibraryForNum, searchLibraryForNum, new FilterCard());
|
||||
|
||||
controller.searchLibrary(target, game, targetOpponent.getId());
|
||||
controller.searchLibrary(target, source, game, targetOpponent.getId());
|
||||
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card targetCard = game.getCard(cardId);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect {
|
|||
if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a card named " + filter.getMessage() + '?', source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
|
||||
target.clearChosen();
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
cardFound = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect {
|
|||
return false;
|
||||
}
|
||||
target.clearChosen();
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards cards = new CardsImpl();
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class SearchLibraryPutInHandOrOnBattlefieldEffect extends SearchEffect {
|
|||
return false;
|
||||
}
|
||||
target.clearChosen();
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards cards = new CardsImpl();
|
||||
boolean askToPutOntoBf = false;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
|
|||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (player.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
player.moveCards(new CardsImpl(target.getTargets()).getCards(game),
|
||||
Zone.BATTLEFIELD, source, game, tapped, false, false, null);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (player.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
player.moveCards(new CardsImpl(target.getTargets()).getCards(game),
|
||||
Zone.BATTLEFIELD, source, game, tapped, false, ownerIsController, null);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
Cards foundCards = new CardsImpl(target.getTargets());
|
||||
if (reveal && !foundCards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), foundCards, game);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class SearchLibraryWithLessCMCPutInPlayEffect extends OneShotEffect {
|
|||
FilterCard advancedFilter = filter.copy(); // never change static objects so copy the object here before
|
||||
advancedFilter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, source.getManaCostsToPay().getX() + 1));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(advancedFilter);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class PartnersWithSearchEffect extends OneShotEffect {
|
|||
filter.add(new NamePredicate(partnerName));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
if (player.chooseUse(Outcome.Benefit, "Search your library for a card named " + partnerName + " and put it into your hand?", source, game)) {
|
||||
player.searchLibrary(target, game);
|
||||
player.searchLibrary(target, source, game);
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class TransmuteEffect extends OneShotEffect {
|
|||
FilterCard filter = new FilterCard("card with converted mana cost " + sourceObject.getConvertedManaCost());
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, sourceObject.getConvertedManaCost()));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, filter);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards revealed = new CardsImpl(target.getTargets());
|
||||
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
||||
|
|
|
|||
|
|
@ -337,20 +337,21 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
boolean removeFromLibrary(Card card, Game game);
|
||||
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game);
|
||||
boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game);
|
||||
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game, boolean triggerEvents);
|
||||
boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, boolean triggerEvents);
|
||||
|
||||
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId);
|
||||
boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, UUID targetPlayerId);
|
||||
|
||||
/**
|
||||
* @param target
|
||||
* @param source
|
||||
* @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 triggerEvents);
|
||||
boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, UUID targetPlayerId, boolean triggerEvents);
|
||||
|
||||
/**
|
||||
* Reveals all players' libraries. Useful for abilities like Jace, Architect of Thought's -8
|
||||
|
|
|
|||
|
|
@ -2430,22 +2430,22 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game) {
|
||||
return searchLibrary(target, game, playerId, true);
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game) {
|
||||
return searchLibrary(target, source, game, playerId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, boolean triggerEvents) {
|
||||
return searchLibrary(target, game, playerId, triggerEvents);
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, boolean triggerEvents) {
|
||||
return searchLibrary(target, source, game, playerId, triggerEvents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId) {
|
||||
return searchLibrary(target, game, targetPlayerId, true);
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, UUID targetPlayerId) {
|
||||
return searchLibrary(target, source, game, targetPlayerId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents) {
|
||||
public boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, UUID targetPlayerId, boolean triggerEvents) {
|
||||
//20091005 - 701.14c
|
||||
Library searchedLibrary = null;
|
||||
String searchInfo = null;
|
||||
|
|
@ -2462,7 +2462,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (searchedLibrary == null) {
|
||||
return false;
|
||||
}
|
||||
GameEvent event = GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, targetPlayerId, playerId, playerId, Integer.MAX_VALUE);
|
||||
GameEvent event = GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, targetPlayerId, source.getSourceId(), playerId, Integer.MAX_VALUE);
|
||||
if (!game.replaceEvent(event)) {
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(searchInfo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue