mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
updated searching/shuffling interaction
This commit is contained in:
parent
607b554fac
commit
e03aaee4b6
29 changed files with 270 additions and 170 deletions
|
|
@ -98,16 +98,18 @@ class InameDeathAspectEffect extends SearchEffect<InameDeathAspectEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
player.searchLibrary(target, game);
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null){
|
||||
card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false);
|
||||
if (player != null && player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null){
|
||||
card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -93,15 +93,16 @@ class PathToExileEffect extends OneShotEffect {
|
|||
if (permanent.moveToZone(Zone.EXILED, source.getId(), game, false)) {
|
||||
if (player.chooseUse(Outcome.PutCardInPlay, "Use Path to Exile effect?", game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
|
||||
player.searchLibrary(target, game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), permanent.getControllerId())) {
|
||||
Permanent land = game.getPermanent(card.getId());
|
||||
if (land != null)
|
||||
land.setTapped(true);
|
||||
}
|
||||
}
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), permanent.getControllerId())) {
|
||||
Permanent land = game.getPermanent(card.getId());
|
||||
if (land != null)
|
||||
land.setTapped(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -102,12 +102,12 @@ class IncreasingAmbitionEffect extends SearchEffect<IncreasingAmbitionEffect> {
|
|||
else {
|
||||
target = new TargetCardInLibrary();
|
||||
}
|
||||
player.searchLibrary(target, game);
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null){
|
||||
card.moveToZone(Constants.Zone.HAND, source.getId(), game, false);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null)
|
||||
card.moveToZone(Constants.Zone.HAND, source.getId(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ public class BitterheartWitch extends CardImpl<BitterheartWitch> {
|
|||
this.addAbility(DeathtouchAbility.getInstance());
|
||||
|
||||
// When Bitterheart Witch dies, you may search your library for a Curse card, put it onto the battlefield attached to target player, then shuffle your library.
|
||||
this.addAbility(new DiesTriggeredAbility(new BitterheartWitchEffect(), true));
|
||||
Ability ability = new DiesTriggeredAbility(new BitterheartWitchEffect(), true);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -98,25 +100,21 @@ class BitterheartWitchEffect extends OneShotEffect<BitterheartWitchEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
TargetPlayer target = new TargetPlayer();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null && targetPlayer != null) {
|
||||
TargetCardInLibrary targetCard = new TargetCardInLibrary(filter);
|
||||
targetCard.setRequired(true);
|
||||
if (player.searchLibrary(targetCard, game)) {
|
||||
Card card = game.getCard(targetCard.getFirstTarget());
|
||||
if (card != null) {
|
||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||
player.chooseTarget(Outcome.Detriment, target, source, game);
|
||||
Player targetPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (targetPlayer != null) {
|
||||
player.shuffleLibrary(game);
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
return targetPlayer.addAttachment(card.getId(), game);
|
||||
}
|
||||
}
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
targetPlayer.addAttachment(card.getId(), game);
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,9 +106,10 @@ class CaravanVigilEffect extends OneShotEffect<CaravanVigilEffect> {
|
|||
}
|
||||
}
|
||||
player.revealCards("Caravan Vigil", cards, game);
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class SeedguideAsh extends CardImpl<SeedguideAsh> {
|
|||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
// When Seedguide Ash dies, you may search your library for up to three Forest cards and put them onto the battlefield tapped. If you do, shuffle your library.
|
||||
this.addAbility(new DiesTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 3, filter), true, Constants.Outcome.PutLandInPlay), true));
|
||||
this.addAbility(new DiesTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 3, filter), true, false, Constants.Outcome.PutLandInPlay), true));
|
||||
}
|
||||
|
||||
public SeedguideAsh(final SeedguideAsh card) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class BorderlandRanger extends CardImpl<BorderlandRanger> {
|
|||
this.color.setGreen(true);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(new TargetCardInLibrary(filter)), true));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(new TargetCardInLibrary(filter), false), true));
|
||||
}
|
||||
|
||||
public BorderlandRanger(final BorderlandRanger card) {
|
||||
|
|
|
|||
|
|
@ -95,38 +95,41 @@ class CultivateEffect extends OneShotEffect<CultivateEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
player.searchLibrary(target, game);
|
||||
if (target.getTargets().size() > 0) {
|
||||
Cards revealed = new CardsImpl();
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
revealed.add(card);
|
||||
}
|
||||
player.revealCards("Cultivate", revealed, game);
|
||||
if (target.getTargets().size() == 2) {
|
||||
TargetCard target2 = new TargetCard(Zone.PICK, filter);
|
||||
target2.setRequired(true);
|
||||
player.choose(Outcome.Benefit, revealed, target2, game);
|
||||
Card card = revealed.get(target2.getFirstTarget(), game);
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
revealed.remove(card);
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null)
|
||||
permanent.setTapped(true);
|
||||
card = revealed.getCards(game).iterator().next();
|
||||
card.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
}
|
||||
else if (target.getTargets().size() == 1) {
|
||||
Card card = revealed.getCards(game).iterator().next();
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null)
|
||||
permanent.setTapped(true);
|
||||
}
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
Cards revealed = new CardsImpl();
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
revealed.add(card);
|
||||
}
|
||||
player.revealCards("Cultivate", revealed, game);
|
||||
if (target.getTargets().size() == 2) {
|
||||
TargetCard target2 = new TargetCard(Zone.PICK, filter);
|
||||
target2.setRequired(true);
|
||||
player.choose(Outcome.Benefit, revealed, target2, game);
|
||||
Card card = revealed.get(target2.getFirstTarget(), game);
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
revealed.remove(card);
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null)
|
||||
permanent.setTapped(true);
|
||||
card = revealed.getCards(game).iterator().next();
|
||||
card.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
}
|
||||
else if (target.getTargets().size() == 1) {
|
||||
Card card = revealed.getCards(game).iterator().next();
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null)
|
||||
permanent.setTapped(true);
|
||||
}
|
||||
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,15 +104,19 @@ class HoardingDragonEffect extends OneShotEffect<HoardingDragonEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
player.searchLibrary(target, game);
|
||||
if (target.getTargets().size() > 0) {
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
if (card != null){
|
||||
game.getExile().add(exileId, "Hoarding Dragon exile", card);
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return true;
|
||||
if (player != null) {
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null)
|
||||
card.moveToExile(exileId, "Hoarding Dragon exile", source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -133,10 +133,10 @@ class ArachnusSpinnerEffect extends OneShotEffect<ArachnusSpinnerEffect> {
|
|||
if (player.searchLibrary(target, game)) {
|
||||
card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
player.shuffleLibrary(game);
|
||||
zone = Zone.LIBRARY;
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
if (card != null) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
|
|
|
|||
|
|
@ -116,12 +116,10 @@ class DistantMemoriesEffect extends OneShotEffect<DistantMemoriesEffect> {
|
|||
} else {
|
||||
player.drawCards(3, game);
|
||||
}
|
||||
} else {
|
||||
player.shuffleLibrary(game);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
player.shuffleLibrary(game);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ class GreenSunsZenithSearchEffect extends OneShotEffect<GreenSunsZenithSearchEff
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null)
|
||||
return false;
|
||||
FilterCard filter = new FilterCard("green creature card with converted mana cost X or less");
|
||||
filter.getColor().setGreen(true);
|
||||
filter.setUseColor(true);
|
||||
|
|
@ -92,14 +94,14 @@ class GreenSunsZenithSearchEffect extends OneShotEffect<GreenSunsZenithSearchEff
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId : (List<UUID>) target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
card.putOntoBattlefield(game, Constants.Zone.HAND, source.getId(), source.getControllerId());
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null)
|
||||
card.putOntoBattlefield(game, Constants.Zone.HAND, source.getId(), source.getControllerId());
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class TreasureMage extends CardImpl<TreasureMage> {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
|
||||
SearchEffect effect = new SearchLibraryRevealPutInHandEffect(target);
|
||||
SearchEffect effect = new SearchLibraryRevealPutInHandEffect(target, false);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, true));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,16 +111,18 @@ class BrutalizerExarchEffect1 extends OneShotEffect<BrutalizerExarchEffect1> {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterCreatureCard("creature card in your library"));
|
||||
target.setRequired(true);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
player.revealCards("Brutalizer Exarch", cards, game);
|
||||
player.shuffleLibrary(game);
|
||||
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
if (card != null)
|
||||
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
|
||||
return true;
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class SilvergladeElemental extends CardImpl<SilvergladeElemental> {
|
|||
this.color.setGreen(true);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false), true));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, false), true));
|
||||
}
|
||||
|
||||
public SilvergladeElemental(final SilvergladeElemental card) {
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ class StrataScytheImprintEffect extends OneShotEffect<StrataScytheImprintEffect>
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null)
|
||||
return false;
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard());
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
|
|
@ -103,8 +105,8 @@ class StrataScytheImprintEffect extends OneShotEffect<StrataScytheImprintEffect>
|
|||
}
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class TrinketMage extends CardImpl<TrinketMage> {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
|
||||
SearchEffect effect = new SearchLibraryRevealPutInHandEffect(target);
|
||||
SearchEffect effect = new SearchLibraryRevealPutInHandEffect(target, false);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, true));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class FarhavenElf extends CardImpl<FarhavenElf> {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// When Farhaven Elf enters the battlefield, you may search your library for a basic land card and put it onto the battlefield tapped. If you do, shuffle your library.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true), true));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, false), true));
|
||||
}
|
||||
|
||||
public FarhavenElf(final FarhavenElf card) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class RangerOfEos extends CardImpl<RangerOfEos> {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, filter);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target), true));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target, false), true));
|
||||
}
|
||||
|
||||
public RangerOfEos(final RangerOfEos card) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class CivicWayfinder extends CardImpl<CivicWayfinder> {
|
|||
this.color.setGreen(true);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(new TargetCardInLibrary(new FilterBasicLandCard())), true));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(new TargetCardInLibrary(new FilterBasicLandCard()), false), true));
|
||||
}
|
||||
|
||||
public CivicWayfinder(final CivicWayfinder card) {
|
||||
|
|
|
|||
|
|
@ -120,11 +120,9 @@ class QuestForTheHolyRelicEffect extends OneShotEffect<QuestForTheHolyRelicEffec
|
|||
Permanent permanent = game.getPermanent(targetCreature.getFirstTarget());
|
||||
permanent.addAttachment(equipment.getId(), game);
|
||||
}
|
||||
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
}
|
||||
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue