replace his or her to their

This commit is contained in:
Ingmar Goudt 2019-01-16 13:48:43 +01:00
parent bd0b1bffa4
commit 32ecb5ceab
14 changed files with 456 additions and 452 deletions

View file

@ -25,7 +25,7 @@ public final class ClearTheLand extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
// Each player reveals the top five cards of his or her library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.
// Each player reveals the top five cards of their library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.
getSpellAbility().addEffect(new ClearTheLandEffect());
}
@ -43,7 +43,7 @@ class ClearTheLandEffect extends OneShotEffect {
public ClearTheLandEffect() {
super(Outcome.Benefit);
this.staticText = "Each player reveals the top five cards of his or her library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.";
this.staticText = "Each player reveals the top five cards of their library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.";
}
public ClearTheLandEffect(final ClearTheLandEffect effect) {

View file

@ -41,7 +41,7 @@ public final class DelayTactic extends CardImpl {
this.getSpellAbility().addEffect(new GainAbilityAllEffect(HexproofAbility.getInstance(), Duration.EndOfTurn, new FilterControlledCreaturePermanent())
.setText("Creatures you control gain hexproof until end of turn"));
// Creatures target opponent controls don't untap during his or her next untap step.
// Creatures target opponent controls don't untap during their next untap step.
Mode mode = new Mode();
mode.addEffect(new DelayTacticEffect());
mode.addTarget(new TargetOpponent());
@ -63,7 +63,7 @@ class DelayTacticEffect extends OneShotEffect {
DelayTacticEffect() {
super(Outcome.Benefit);
this.staticText = "Creatures target opponent controls don't untap during his or her next untap step";
this.staticText = "Creatures target opponent controls don't untap during their next untap step";
}
DelayTacticEffect(final DelayTacticEffect effect) {

View file

@ -32,7 +32,7 @@ public final class EnslavedHorror extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// When Enslaved Horror enters the battlefield, each other player may return a creature card from his or her graveyard to the battlefield.
// When Enslaved Horror enters the battlefield, each other player may return a creature card from their graveyard to the battlefield.
this.addAbility(new EntersBattlefieldTriggeredAbility(new EnslavedHorrorEffect()));
}

View file

@ -22,7 +22,7 @@ public final class HintOfInsanity extends CardImpl {
public HintOfInsanity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}");
// Target player reveals his or her hand. That player discards all nonland cards with the same name as another card in his or her hand.
// Target player reveals their hand. That player discards all nonland cards with the same name as another card in their hand.
this.getSpellAbility().addEffect(new HintOfInsanityEffect());
this.getSpellAbility().addTarget(new TargetPlayer());

View file

@ -33,7 +33,7 @@ public final class MineMineMine extends CardImpl {
public MineMineMine(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}{G}");
// When Mine, Mine, Mine enters the battlefield, each player puts his or her library into his or her hand.
// When Mine, Mine, Mine enters the battlefield, each player puts their library into their hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new MineMineMineDrawEffect()));
// Players have no maximum hand size and don't lose the game for drawing from an empty library.
@ -45,7 +45,7 @@ public final class MineMineMine extends CardImpl {
// Each player can't cast more than one spell each turn.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantCastMoreThanOneSpellEffect(TargetController.ANY)));
// When Mine, Mine, Mine leaves the battlefield, each player shuffles his or her hand and graveyard into his or her library.
// When Mine, Mine, Mine leaves the battlefield, each player shuffles their hand and graveyard into their library.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ShuffleHandGraveyardAllEffect(), false));
}

View file

@ -28,7 +28,7 @@ public final class OnceMoreWithFeeling extends CardImpl {
public OnceMoreWithFeeling(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}{W}{W}{W}");
// Exile all permanents and all cards from all graveyards. Each player shuffles his or her hand into his or her library, then draws seven cards. Each player's life total becomes 10. Exile Once More with Feeling.
// Exile all permanents and all cards from all graveyards. Each player shuffles their hand into their library, then draws seven cards. Each player's life total becomes 10. Exile Once More with Feeling.
this.getSpellAbility().addEffect(new OnceMoreWithFeelingEffect());
Effect effect = new DrawCardAllEffect(7);
effect.setText(", then draws seven cards");

View file

@ -1,111 +1,111 @@
package mage.cards.p;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
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.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author jeffwadsworth
*/
public final class Paroxysm extends CardImpl {
public Paroxysm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// At the beginning of the upkeep of enchanted creature's controller, that player reveals the top card of his or her library.
// If that card is a land card, destroy that creature. Otherwise, it gets +3/+3 until end of turn.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD,
new ParoxysmEffect(),
TargetController.CONTROLLER_ATTACHED_TO,
false, false, "At the beginning of the upkeep of enchanted creature's controller, "));
}
public Paroxysm(final Paroxysm card) {
super(card);
}
@Override
public Paroxysm copy() {
return new Paroxysm(this);
}
}
class ParoxysmEffect extends OneShotEffect {
ParoxysmEffect() {
super(Outcome.BoostCreature);
this.staticText = "that player reveals the top card of his or her library. \n"
+ "If that card is a land card, destroy that creature. \n"
+ "Otherwise, it gets +3/+3 until end of turn.";
}
ParoxysmEffect(final ParoxysmEffect effect) {
super(effect);
}
@Override
public ParoxysmEffect copy() {
return new ParoxysmEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura != null) {
Permanent creatureAttachedTo = game.getPermanent(aura.getAttachedTo());
if (creatureAttachedTo != null) {
Player controllerOfCreature = game.getPlayer(creatureAttachedTo.getControllerId());
if (controllerOfCreature != null) {
Card revealCardFromTop = controllerOfCreature.getLibrary().getFromTop(game);
if (revealCardFromTop != null) {
Cards cards = new CardsImpl();
cards.add(revealCardFromTop);
controllerOfCreature.revealCards(source, cards, game);
if (revealCardFromTop.isLand()) {
creatureAttachedTo.destroy(source.getSourceId(), game, false);
} else {
ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creatureAttachedTo.getId()));
game.addEffect(effect, source);
}
return true;
}
}
}
}
return false;
}
}
package mage.cards.p;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
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.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author jeffwadsworth
*/
public final class Paroxysm extends CardImpl {
public Paroxysm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// At the beginning of the upkeep of enchanted creature's controller, that player reveals the top card of their library.
// If that card is a land card, destroy that creature. Otherwise, it gets +3/+3 until end of turn.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD,
new ParoxysmEffect(),
TargetController.CONTROLLER_ATTACHED_TO,
false, false, "At the beginning of the upkeep of enchanted creature's controller, "));
}
public Paroxysm(final Paroxysm card) {
super(card);
}
@Override
public Paroxysm copy() {
return new Paroxysm(this);
}
}
class ParoxysmEffect extends OneShotEffect {
ParoxysmEffect() {
super(Outcome.BoostCreature);
this.staticText = "that player reveals the top card of their library. \n"
+ "If that card is a land card, destroy that creature. \n"
+ "Otherwise, it gets +3/+3 until end of turn.";
}
ParoxysmEffect(final ParoxysmEffect effect) {
super(effect);
}
@Override
public ParoxysmEffect copy() {
return new ParoxysmEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura != null) {
Permanent creatureAttachedTo = game.getPermanent(aura.getAttachedTo());
if (creatureAttachedTo != null) {
Player controllerOfCreature = game.getPlayer(creatureAttachedTo.getControllerId());
if (controllerOfCreature != null) {
Card revealCardFromTop = controllerOfCreature.getLibrary().getFromTop(game);
if (revealCardFromTop != null) {
Cards cards = new CardsImpl();
cards.add(revealCardFromTop);
controllerOfCreature.revealCards(source, cards, game);
if (revealCardFromTop.isLand()) {
creatureAttachedTo.destroy(source.getSourceId(), game, false);
} else {
ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creatureAttachedTo.getId()));
game.addEffect(effect, source);
}
return true;
}
}
}
}
return false;
}
}

View file

@ -31,7 +31,7 @@ public final class PsychicBattle extends CardImpl {
public PsychicBattle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{U}");
// Whenever a player chooses one or more targets, each player reveals the top card of his or her library. The player who reveals the card with the highest converted mana cost may change the target or targets. If two or more cards are tied for highest cost, the target or targets remain unchanged. Changing targets this way doesn't trigger abilities of permanents named Psychic Battle.
// Whenever a player chooses one or more targets, each player reveals the top card of their library. The player who reveals the card with the highest converted mana cost may change the target or targets. If two or more cards are tied for highest cost, the target or targets remain unchanged. Changing targets this way doesn't trigger abilities of permanents named Psychic Battle.
this.addAbility(new PsychicBattleTriggeredAbility());
}

View file

@ -29,7 +29,7 @@ public final class PsychicSurgery extends CardImpl {
public PsychicSurgery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
// Whenever an opponent shuffles his or her library, you may look at the top two cards of that library.
// Whenever an opponent shuffles their library, you may look at the top two cards of that library.
// You may exile one of those cards. Then put the rest on top of that library in any order.
this.addAbility(new PsychicSurgeryTriggeredAbility());
}

View file

@ -13,6 +13,7 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -32,7 +33,7 @@ public final class ScholarOfAthreos extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScholarOfAthreosEffect(), new ManaCostsImpl("{2}{B}")));
}
public ScholarOfAthreos(final ScholarOfAthreos card) {
private ScholarOfAthreos(final ScholarOfAthreos card) {
super(card);
}
@ -49,7 +50,7 @@ class ScholarOfAthreosEffect extends OneShotEffect {
staticText = "Each opponent loses 1 life. You gain life equal to the life lost this way";
}
public ScholarOfAthreosEffect(final ScholarOfAthreosEffect effect) {
private ScholarOfAthreosEffect(final ScholarOfAthreosEffect effect) {
super(effect);
}
@ -57,7 +58,10 @@ class ScholarOfAthreosEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
int lifeLost = 0;
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
lifeLost += game.getPlayer(opponentId).loseLife(1, game, false);
Player opponent = game.getPlayer(opponentId);
if(opponent != null) {
lifeLost += opponent.loseLife(1, game, false);
}
}
game.getPlayer(source.getControllerId()).gainLife(lifeLost, game, source);
return true;

View file

@ -1,87 +1,87 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author jeffwadsworth
*/
public final class ScryingGlass extends CardImpl {
public ScryingGlass(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {3}, {tap}: Choose a number greater than 0 and a color. Target opponent reveals his or her hand. If that opponent reveals exactly the chosen number of cards of the chosen color, you draw a card.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryingGlassEffect(), new ManaCostsImpl("{3}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public ScryingGlass(final ScryingGlass card) {
super(card);
}
@Override
public ScryingGlass copy() {
return new ScryingGlass(this);
}
}
class ScryingGlassEffect extends OneShotEffect {
public ScryingGlassEffect() {
super(Outcome.Neutral);
staticText = "Choose a number greater than 0 and a color. Target opponent reveals his or her hand. If that opponent reveals exactly the chosen number of cards of the chosen color, you draw a card";
}
public ScryingGlassEffect(final ScryingGlassEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetOpponent = game.getPlayer(source.getFirstTarget());
ChoiceColor color = new ChoiceColor();
int amount = 0;
if (controller != null
&& targetOpponent != null) {
amount = controller.getAmount(1, Integer.MAX_VALUE, "Choose a number", game);
controller.choose(Outcome.Discard, color, game);
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(color.getColor()));
targetOpponent.revealCards(source, targetOpponent.getHand(), game);
if (targetOpponent.getHand().count(filter, game) == amount) {
game.informPlayers(controller.getName() + " has chosen the exact number and color of the revealed cards from " + targetOpponent.getName() + "'s hand. They draw a card.");
controller.drawCards(1, game);
return true;
} else {
game.informPlayers(controller.getName() + " has chosen incorrectly and will not draw a card.");
}
}
return false;
}
@Override
public ScryingGlassEffect copy() {
return new ScryingGlassEffect(this);
}
}
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author jeffwadsworth
*/
public final class ScryingGlass extends CardImpl {
public ScryingGlass(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {3}, {tap}: Choose a number greater than 0 and a color. Target opponent reveals their hand. If that opponent reveals exactly the chosen number of cards of the chosen color, you draw a card.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryingGlassEffect(), new ManaCostsImpl("{3}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public ScryingGlass(final ScryingGlass card) {
super(card);
}
@Override
public ScryingGlass copy() {
return new ScryingGlass(this);
}
}
class ScryingGlassEffect extends OneShotEffect {
public ScryingGlassEffect() {
super(Outcome.Neutral);
staticText = "Choose a number greater than 0 and a color. Target opponent reveals their hand. If that opponent reveals exactly the chosen number of cards of the chosen color, you draw a card";
}
public ScryingGlassEffect(final ScryingGlassEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetOpponent = game.getPlayer(source.getFirstTarget());
ChoiceColor color = new ChoiceColor();
int amount = 0;
if (controller != null
&& targetOpponent != null) {
amount = controller.getAmount(1, Integer.MAX_VALUE, "Choose a number", game);
controller.choose(Outcome.Discard, color, game);
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(color.getColor()));
targetOpponent.revealCards(source, targetOpponent.getHand(), game);
if (targetOpponent.getHand().count(filter, game) == amount) {
game.informPlayers(controller.getName() + " has chosen the exact number and color of the revealed cards from " + targetOpponent.getName() + "'s hand. They draw a card.");
controller.drawCards(1, game);
return true;
} else {
game.informPlayers(controller.getName() + " has chosen incorrectly and will not draw a card.");
}
}
return false;
}
@Override
public ScryingGlassEffect copy() {
return new ScryingGlassEffect(this);
}
}

View file

@ -1,104 +1,104 @@
package mage.cards.s;
import java.util.Arrays;
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.game.Game;
import mage.players.Player;
import mage.util.RandomUtil;
/**
*
* @author jeffwadsworth
*/
/*
The card is chosen at random, so the computer just picks a card at random from
the controller's graveyard. Devs, feel free to set up something else...
*/
public final class SearchForSurvivors extends CardImpl {
public SearchForSurvivors(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
// Reorder your graveyard at random. An opponent chooses a card at random in your graveyard. If it's a creature card, put it onto the battlefield. Otherwise, exile it.
this.getSpellAbility().addEffect(new SearchForSurvivorsEffect());
}
public SearchForSurvivors(final SearchForSurvivors card) {
super(card);
}
@Override
public SearchForSurvivors copy() {
return new SearchForSurvivors(this);
}
}
class SearchForSurvivorsEffect extends OneShotEffect {
public SearchForSurvivorsEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "Reorder your graveyard at random. "
+ "An opponent chooses a card at random in your graveyard. "
+ "If it's a creature card, put it onto the battlefield. "
+ "Otherwise, exile it";
}
public SearchForSurvivorsEffect(final SearchForSurvivorsEffect effect) {
super(effect);
}
@Override
public SearchForSurvivorsEffect copy() {
return new SearchForSurvivorsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
game.informPlayers("The controller of Search for Survivors will have his or her graveyard randomized. "
+ " A card will be chosen at random from the controller's graveyard. "
+ " The result is essentially the same as the card rule");
// randomly arrange the graveyard
UUID[] shuffled = controller.getGraveyard().toArray(new UUID[0]);
for (int n = shuffled.length - 1; n > 0; n--) {
int r = RandomUtil.nextInt(n + 1);
UUID temp = shuffled[r];
shuffled[r] = shuffled[n];
shuffled[n] = temp;
}
controller.getGraveyard().clear();
controller.getGraveyard().addAll(Arrays.asList(shuffled));
// end of randomize
Cards cards = new CardsImpl();
controller.getGraveyard().getCards(game).forEach((card) -> {
cards.add(card);
});
if (!cards.isEmpty()) {
Card card = cards.getRandom(game);
cards.clear();
cards.add(card);
controller.revealCards(source, cards, game); // reveal the card randomly chosen.
if (card.isCreature()) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
controller.moveCards(card, Zone.EXILED, source, game);
}
}
return true;
}
return false;
}
}
package mage.cards.s;
import java.util.Arrays;
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.game.Game;
import mage.players.Player;
import mage.util.RandomUtil;
/**
*
* @author jeffwadsworth
*/
/*
The card is chosen at random, so the computer just picks a card at random from
the controller's graveyard. Devs, feel free to set up something else...
*/
public final class SearchForSurvivors extends CardImpl {
public SearchForSurvivors(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
// Reorder your graveyard at random. An opponent chooses a card at random in your graveyard. If it's a creature card, put it onto the battlefield. Otherwise, exile it.
this.getSpellAbility().addEffect(new SearchForSurvivorsEffect());
}
public SearchForSurvivors(final SearchForSurvivors card) {
super(card);
}
@Override
public SearchForSurvivors copy() {
return new SearchForSurvivors(this);
}
}
class SearchForSurvivorsEffect extends OneShotEffect {
public SearchForSurvivorsEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "Reorder your graveyard at random. "
+ "An opponent chooses a card at random in your graveyard. "
+ "If it's a creature card, put it onto the battlefield. "
+ "Otherwise, exile it";
}
public SearchForSurvivorsEffect(final SearchForSurvivorsEffect effect) {
super(effect);
}
@Override
public SearchForSurvivorsEffect copy() {
return new SearchForSurvivorsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
game.informPlayers("The controller of Search for Survivors will have their graveyard randomized. "
+ " A card will be chosen at random from the controller's graveyard. "
+ " The result is essentially the same as the card rule");
// randomly arrange the graveyard
UUID[] shuffled = controller.getGraveyard().toArray(new UUID[0]);
for (int n = shuffled.length - 1; n > 0; n--) {
int r = RandomUtil.nextInt(n + 1);
UUID temp = shuffled[r];
shuffled[r] = shuffled[n];
shuffled[n] = temp;
}
controller.getGraveyard().clear();
controller.getGraveyard().addAll(Arrays.asList(shuffled));
// end of randomize
Cards cards = new CardsImpl();
controller.getGraveyard().getCards(game).forEach((card) -> {
cards.add(card);
});
if (!cards.isEmpty()) {
Card card = cards.getRandom(game);
cards.clear();
cards.add(card);
controller.revealCards(source, cards, game); // reveal the card randomly chosen.
if (card.isCreature()) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
controller.moveCards(card, Zone.EXILED, source, game);
}
}
return true;
}
return false;
}
}

View file

@ -74,7 +74,7 @@ public final class ShapeAnew extends CardImpl {
if (artifactCard != null) {
targetController.moveCards(artifactCard, Zone.BATTLEFIELD, source, game);
}
// 1/1/2011: If the first card the player reveals is an artifact card, he or she will still have to shuffle his or her library even though no other cards were revealed this way.
// 1/1/2011: If the first card the player reveals is an artifact card, he or she will still have to shuffle their library even though no other cards were revealed this way.
targetController.shuffleLibrary(source, game);
return true;
}

View file

@ -1,135 +1,135 @@
package mage.cards.v;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroySourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
/**
* @author jeffwadsworth
*/
public final class VolrathsDungeon extends CardImpl {
public VolrathsDungeon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
// Pay 5 life: Destroy Volrath's Dungeon. Any player may activate this ability but only during his or her turn.
ActivatedAbility ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new DestroySourceEffect().setText("Destroy {this}. Any player may activate this ability but only during his or her turn."),
new PayLifeActivePlayerCost(5));
ability.setMayActivate(TargetController.ACTIVE);
this.addAbility(ability);
// Discard a card: Target player puts a card from his or her hand on top of his or her library. Activate this ability only any time you could cast a sorcery.
FilterCard filter = new FilterCard("a card for payment");
Ability ability2 = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new VolrathsDungeonEffect(), new DiscardCardCost(filter));
ability2.addTarget(new TargetPlayer());
this.addAbility(ability2);
}
public VolrathsDungeon(final VolrathsDungeon card) {
super(card);
}
@Override
public VolrathsDungeon copy() {
return new VolrathsDungeon(this);
}
}
class PayLifeActivePlayerCost extends CostImpl {
private final DynamicValue amount;
public PayLifeActivePlayerCost(int amount) {
this.amount = new StaticValue(amount);
this.text = "Pay " + amount + " life";
}
public PayLifeActivePlayerCost(DynamicValue amount, String text) {
this.amount = amount.copy();
this.text = "Pay " + text;
}
public PayLifeActivePlayerCost(PayLifeActivePlayerCost cost) {
super(cost);
this.amount = cost.amount.copy();
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
int lifeToPayAmount = amount.calculate(game, ability, null);
return game.getPlayer(game.getActivePlayerId()).getLife() >= lifeToPayAmount;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
int lifeToPayAmount = amount.calculate(game, ability, null);
Player activatingPlayer = game.getPlayer(game.getActivePlayerId());
if (activatingPlayer != null
&& activatingPlayer.chooseUse(Outcome.LoseLife, "Do you wish to pay " + lifeToPayAmount + " life?", ability, game)) {
Player player = game.getPlayer(game.getActivePlayerId());
if (player != null) {
this.paid = player.loseLife(lifeToPayAmount, game, false) == lifeToPayAmount;
}
}
return paid;
}
@Override
public PayLifeActivePlayerCost copy() {
return new PayLifeActivePlayerCost(this);
}
}
class VolrathsDungeonEffect extends OneShotEffect {
public VolrathsDungeonEffect() {
super(Outcome.Detriment);
this.staticText = "Target player puts a card from his or her hand on top of his or her library";
}
public VolrathsDungeonEffect(final VolrathsDungeonEffect effect) {
super(effect);
}
@Override
public VolrathsDungeonEffect copy() {
return new VolrathsDungeonEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetedPlayer = game.getPlayer(source.getFirstTarget());
if (targetedPlayer != null) {
TargetCardInHand target = new TargetCardInHand();
if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) {
Card card = game.getCard(target.getFirstTarget());
return card != null && targetedPlayer.putCardOnTopXOfLibrary(card, game, source, 0);
}
}
return false;
}
}
package mage.cards.v;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroySourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
/**
* @author jeffwadsworth
*/
public final class VolrathsDungeon extends CardImpl {
public VolrathsDungeon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
// Pay 5 life: Destroy Volrath's Dungeon. Any player may activate this ability but only during their turn.
ActivatedAbility ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new DestroySourceEffect().setText("Destroy {this}. Any player may activate this ability but only during their turn."),
new PayLifeActivePlayerCost(5));
ability.setMayActivate(TargetController.ACTIVE);
this.addAbility(ability);
// Discard a card: Target player puts a card from their hand on top of their library. Activate this ability only any time you could cast a sorcery.
FilterCard filter = new FilterCard("a card for payment");
Ability ability2 = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new VolrathsDungeonEffect(), new DiscardCardCost(filter));
ability2.addTarget(new TargetPlayer());
this.addAbility(ability2);
}
public VolrathsDungeon(final VolrathsDungeon card) {
super(card);
}
@Override
public VolrathsDungeon copy() {
return new VolrathsDungeon(this);
}
}
class PayLifeActivePlayerCost extends CostImpl {
private final DynamicValue amount;
public PayLifeActivePlayerCost(int amount) {
this.amount = new StaticValue(amount);
this.text = "Pay " + amount + " life";
}
public PayLifeActivePlayerCost(DynamicValue amount, String text) {
this.amount = amount.copy();
this.text = "Pay " + text;
}
public PayLifeActivePlayerCost(PayLifeActivePlayerCost cost) {
super(cost);
this.amount = cost.amount.copy();
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
int lifeToPayAmount = amount.calculate(game, ability, null);
return game.getPlayer(game.getActivePlayerId()).getLife() >= lifeToPayAmount;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
int lifeToPayAmount = amount.calculate(game, ability, null);
Player activatingPlayer = game.getPlayer(game.getActivePlayerId());
if (activatingPlayer != null
&& activatingPlayer.chooseUse(Outcome.LoseLife, "Do you wish to pay " + lifeToPayAmount + " life?", ability, game)) {
Player player = game.getPlayer(game.getActivePlayerId());
if (player != null) {
this.paid = player.loseLife(lifeToPayAmount, game, false) == lifeToPayAmount;
}
}
return paid;
}
@Override
public PayLifeActivePlayerCost copy() {
return new PayLifeActivePlayerCost(this);
}
}
class VolrathsDungeonEffect extends OneShotEffect {
public VolrathsDungeonEffect() {
super(Outcome.Detriment);
this.staticText = "Target player puts a card from their hand on top of their library";
}
public VolrathsDungeonEffect(final VolrathsDungeonEffect effect) {
super(effect);
}
@Override
public VolrathsDungeonEffect copy() {
return new VolrathsDungeonEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetedPlayer = game.getPlayer(source.getFirstTarget());
if (targetedPlayer != null) {
TargetCardInHand target = new TargetCardInHand();
if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) {
Card card = game.getCard(target.getFirstTarget());
return card != null && targetedPlayer.putCardOnTopXOfLibrary(card, game, source, 0);
}
}
return false;
}
}