Some minor changes to logging and object handling.

This commit is contained in:
LevelX2 2014-09-21 09:40:19 +02:00
parent 1e6d767eff
commit a3505b6dba
4 changed files with 25 additions and 13 deletions

View file

@ -152,7 +152,7 @@ public class DraftController {
private synchronized void startDraft() {
for (final Entry<UUID, DraftSession> entry: draftSessions.entrySet()) {
if (!entry.getValue().init()) {
logger.fatal("Unable to initialize client");
logger.fatal("Unable to initialize client for playerId " + entry.getKey());
//TODO: generate client error message
return;
}

View file

@ -28,10 +28,6 @@
package mage.sets.mirrodin;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -41,6 +37,9 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
@ -101,7 +100,7 @@ class GoblinCharbelcherEffect extends OneShotEffect {
if (player == null || sourceCard == null) {
return false;
}
Cards cards = new CardsImpl(Zone.PICK);
Cards cards = new CardsImpl();
while (player.getLibrary().size() > 0) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
@ -134,13 +133,12 @@ class GoblinCharbelcherEffect extends OneShotEffect {
}
}
TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library"));
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on the bottom of your library"));
while (player.isInGame() && cards.size() > 1) {
player.choose(Outcome.Neutral, cards, target, game);
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
card.moveToZone(Zone.PICK, source.getSourceId(), game, false);
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, true);
}
target.clearChosen();
}

View file

@ -14,7 +14,7 @@
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL , EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
@ -27,11 +27,16 @@
*/
package mage.abilities.effects;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import mage.abilities.Ability;
import mage.game.Game;
import java.util.*;
import mage.constants.Duration;
import mage.game.Game;
import org.apache.log4j.Logger;
/**
*
@ -40,6 +45,8 @@ import mage.constants.Duration;
*/
public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList<T> {
private static final Logger logger = Logger.getLogger(ContinuousEffectsList.class);
// the effectAbilityMap holds for each effect all abilities that are connected (used) with this effect
private final Map<UUID, HashSet<Ability>> effectAbilityMap = new HashMap<>();
@ -95,6 +102,10 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
private boolean isInactive(T effect, Game game) {
HashSet<Ability> set = effectAbilityMap.get(effect.getId());
if (set == null) {
logger.debug("No abilities for effect found: " + effect.toString());
return false;
}
Iterator<Ability> it = set.iterator();
while (it.hasNext()) {
Ability ability = it.next();

View file

@ -60,6 +60,9 @@ public class ChoiceColor extends ChoiceImpl {
}
public ObjectColor getColor() {
if (choice == null) {
return null;
}
ObjectColor color = new ObjectColor();
switch (choice) {
case "Black":