mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Fixed some exception problems.
This commit is contained in:
parent
9eb71e24be
commit
6b90c1fd7f
7 changed files with 32 additions and 19 deletions
|
|
@ -74,7 +74,7 @@ public class AttachEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
return player.addAttachment(source.getSourceId(), game);
|
||||
}
|
||||
if (source.getTargets().get(0) instanceof TargetCard) { // e.g. Spellweaver Volute
|
||||
if (!source.getTargets().isEmpty() && source.getTargets().get(0) instanceof TargetCard) { // e.g. Spellweaver Volute
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (card != null) {
|
||||
return card.addAttachment(source.getSourceId(), game);
|
||||
|
|
|
|||
|
|
@ -433,7 +433,9 @@ public abstract class MatchImpl implements Match {
|
|||
sb.append(" QUITTED");
|
||||
}
|
||||
sb.append("<br/>");
|
||||
sb.append("DeckHash: ").append(mp.getDeck().getDeckHashCode()).append("<br/>");
|
||||
if (mp.getDeck() != null) {
|
||||
sb.append("DeckHash: ").append(mp.getDeck().getDeckHashCode()).append("<br/>");
|
||||
}
|
||||
}
|
||||
if (getDraws() > 0) {
|
||||
sb.append(" Draws: ").append(getDraws()).append("<br/>");
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ import mage.cards.Card;
|
|||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.SplitCardHalf;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.*;
|
||||
|
|
@ -858,9 +857,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
Cards cards = new CardsImpl(cardsToLibrary); // prevent possible ConcurrentModificationException
|
||||
if (!anyOrder) {
|
||||
while (!cards.isEmpty()) {
|
||||
UUID cardId = cards.getRandom(game).getId();
|
||||
cards.remove(cardId);
|
||||
moveObjectToLibrary(cardId, source == null ? null : source.getSourceId(), game, false, false);
|
||||
Card card = cards.getRandom(game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
moveObjectToLibrary(card.getId(), source == null ? null : source.getSourceId(), game, false, false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TargetCard target = new TargetCard(Zone.ALL, new FilterCard("card to put on the bottom of your library (last one chosen will be bottommost)"));
|
||||
|
|
@ -1866,7 +1867,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
player.gainLife(actualDamage, game);
|
||||
}
|
||||
// Unstable ability - Earl of Squirrel
|
||||
if (sourceAbilities.containsKey(SquirrellinkAbility.getInstance().getId())) {
|
||||
if (sourceAbilities != null && sourceAbilities.containsKey(SquirrellinkAbility.getInstance().getId())) {
|
||||
Player player = game.getPlayer(sourceControllerId);
|
||||
new SquirrelToken().putOntoBattlefield(actualDamage, game, sourceId, player.getId());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue