Some minor formattings.

This commit is contained in:
LevelX2 2014-07-14 09:05:33 +02:00
parent 41e24483f5
commit 943ff0d78d
7 changed files with 61 additions and 39 deletions

View file

@ -60,11 +60,11 @@ public class GameWorker implements Callable {
result.gameResult(game.getWinner());
game.cleanUp();
} catch (MageException ex) {
logger.fatal("GameWorker mage error [" + game.getId() + "]", ex);
logger.fatal("GameWorker mage error [" + game.getId() + "]" +ex, ex);
} catch (Exception e) {
logger.fatal("GameWorker general exception [" + game.getId() + "]", e);
logger.fatal("GameWorker general exception [" + game.getId() + "]" + e, e);
} catch (Error err) {
logger.fatal("GameWorker general error [" + game.getId() + "]", err);
logger.fatal("GameWorker general error [" + game.getId() + "]" +err, err);
}
return null;
}

View file

@ -57,7 +57,7 @@ public class TheTabernacleAtPendrellVale extends CardImpl {
// All creatures have "At the beginning of your upkeep, destroy this creature unless you pay {1}."
Ability ability = new BeginningOfUpkeepTriggeredAbility(new DestroySourceUnlessPaysEffect(new ManaCostsImpl("{1}")), TargetController.YOU, false);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterCreaturePermanent())));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Creatures"))));
}
public TheTabernacleAtPendrellVale(final TheTabernacleAtPendrellVale card) {
@ -91,8 +91,9 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect {
if (player != null && permanent != null) {
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getId(), source.getControllerId(), false))
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
return true;
}
}
permanent.destroy(source.getSourceId(), game, false);
return true;

View file

@ -60,13 +60,15 @@ public class LilianaVess extends CardImpl {
this.subtype.add("Liliana");
this.color.setBlack(true);
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(5)), false));
// +1: Target player discards a card.
LoyaltyAbility ability1 = new LoyaltyAbility(new DiscardTargetEffect(1), 1);
ability1.addTarget(new TargetPlayer());
this.addAbility(ability1);
// -2: Search your library for a card, then shuffle your library and put that card on top of it.
this.addAbility(new LoyaltyAbility(new SearchLibraryPutOnLibraryEffect(new TargetCardInLibrary()), -2));
// -8: Put all creature cards from all graveyards onto the battlefield under your control.
this.addAbility(new LoyaltyAbility(new LilianaVessEffect(), -8));
}

View file

@ -29,9 +29,7 @@ package mage.sets.tempest;
import java.util.List;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -39,7 +37,9 @@ import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.ExileZone;
@ -87,57 +87,59 @@ class ScrollRackEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
FilterCard filter = new FilterCard("card in your hand to exile");
FilterCard filter2 = new FilterCard("card exiled by Scroll Rack to put on top of library");
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
TargetCardInHand target = new TargetCardInHand(0, you.getHand().size(), filter);
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
FilterCard filter = new FilterCard("card in your hand to exile");
FilterCard filter2 = new FilterCard("(move the window) card exiled by " + sourceObject.getLogName() + " to put on top of library");
TargetCardInHand target = new TargetCardInHand(0, controller.getHand().size(), filter);
target.setRequired(false);
int amountExiled = 0;
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getId(), game)) {
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
if (!target.getTargets().isEmpty()) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
card.setFaceDown(true);
if (card.moveToExile(source.getSourceId(), "Scroll Rack Exile", source.getId(), game)) {
if (card.moveToExile(source.getSourceId(), sourceObject.getLogName(), source.getSourceId(), game)) {
amountExiled++;
}
}
}
}
}
game.informPlayers(controller.getName() + " exiles " + amountExiled + " card" + (amountExiled == 1 ? " ":"s ") + "face down from his or her hand");
if (amountExiled > 0) {
int count = Math.min(you.getLibrary().size(), amountExiled);
int count = Math.min(controller.getLibrary().size(), amountExiled);
for (int i = 0; i < count; i++) {
Card card = you.getLibrary().removeFromTop(game);
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Zone.HAND, id, game, false);
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
}
}
}
game.informPlayers(controller.getName() + " moves " + amountExiled + " card" + (amountExiled == 1 ? " ":"s ") + "from library to hand");
TargetCardInExile target2 = new TargetCardInExile(filter2, source.getSourceId());
ExileZone scrollRackExileZone = game.getExile().getExileZone(source.getSourceId());
if (scrollRackExileZone != null) {
while (you.isInGame() && scrollRackExileZone.count(filter, game) > 1) {
you.lookAtCards("exiled cards with " + game.getCard(source.getSourceId()).getName(), scrollRackExileZone, game);
you.choose(Outcome.Neutral, scrollRackExileZone, target2, game);
while (controller.isInGame() && scrollRackExileZone.count(filter, game) > 1) {
controller.lookAtCards("exiled cards with " + sourceObject.getLogName(), scrollRackExileZone, game);
controller.choose(Outcome.Neutral, scrollRackExileZone, target2, game);
Card card = game.getCard(target2.getFirstTarget());
if (card != null) {
game.getExile().removeCard(card, game);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, true, false);
}
target2.clearChosen();
}
if (scrollRackExileZone.count(filter, game) == 1) {
Card card = scrollRackExileZone.get(scrollRackExileZone.iterator().next(), game);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, true, false);
}
return true;
}
return true;
}
return false;
}

View file

@ -61,7 +61,7 @@ public class TriggeredAbilities extends HashMap<String, TriggeredAbility> {
public void checkTriggers(GameEvent event, Game game) {
for (TriggeredAbility ability: this.values()) {
// for effects like when leaves battlefield use ShortLKI to check if permanent was in the correct zone before (e.g. Oblivion Ring)
if (ability.isInUseableZone(game, null, event.getType().equals(GameEvent.EventType.ZONE_CHANGE) ? true :false)) {
if (ability.isInUseableZone(game, null, event.getType().equals(GameEvent.EventType.ZONE_CHANGE))) {
MageObject object = null;
if (!ability.getZone().equals(Zone.COMMAND) && !game.getState().getZone(ability.getSourceId()).equals(ability.getZone())) {
object = game.getShortLivingLKI(ability.getSourceId(), ability.getZone());

View file

@ -33,6 +33,8 @@ import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.filter.FilterPermanent;
import mage.game.Game;
@ -107,6 +109,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
private void setText() {
StringBuilder sb = new StringBuilder();
boolean quotes = (ability instanceof SimpleActivatedAbility) || (ability instanceof TriggeredAbility);
if (excludeSource) {
sb.append("Other ");
}
@ -124,7 +127,13 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
sb.append(" gain ");
}
}
if (quotes) {
sb.append("\"");
}
sb.append(ability.getRule());
if (quotes) {
sb.append("\"");
}
if (duration.toString().length() > 0) {
sb.append(" ").append(duration.toString());
}

View file

@ -31,6 +31,7 @@ package mage.abilities.effects.common.search;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.abilities.Ability;
@ -75,32 +76,39 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null)
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller == null || sourceObject == null) {
return false;
if (player.searchLibrary(target, game)) {
List<Card> cards = new ArrayList<Card>();
}
if (controller.searchLibrary(target, game)) {
List<Card> cards = new ArrayList<>();
for (UUID cardId: (List<UUID>)target.getTargets()) {
Card card = player.getLibrary().remove(cardId, game);
if (card != null)
Card card = controller.getLibrary().remove(cardId, game);
if (card != null) {
cards.add(card);
}
}
Cards foundCards = new CardsImpl();
foundCards.addAll(cards);
if (reveal) {
player.revealCards("Revealed", foundCards, game);
controller.revealCards(sourceObject.getLogName(), foundCards, game);
}
if (forceShuffle) {
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
}
for (Card card: cards) {
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
if (cards.size() > 0) {
game.informPlayers(controller.getName() + " moves " + cards.size() + " card" + (cards.size() == 1 ? " ":"s ") + "on top of his or her library");
}
for (Card card: cards) {
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
}
return true;
}
// shuffle
if (forceShuffle)
player.shuffleLibrary(game);
if (forceShuffle) {
controller.shuffleLibrary(game);
}
return false;
}