mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Fixed some bugs causing null pointer or concurrent modification exceptions.
This commit is contained in:
parent
0cb92e6936
commit
b3eb6f536a
4 changed files with 15 additions and 16 deletions
|
@ -133,10 +133,14 @@ public class GameView implements Serializable {
|
|||
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), new CardView(new EmblemView(((Emblem) object), sourceCard))));
|
||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
||||
} else {
|
||||
if (object instanceof StackAbility) {
|
||||
StackAbility stackAbility = ((StackAbility) object);
|
||||
stackAbility.newId();
|
||||
stack.put(stackObject.getId(), new CardView(((StackAbility) stackObject)));
|
||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
||||
} else {
|
||||
logger.fatal("Object can't be cast to StackAbility: " + object.getName() + " " + object.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Stack Object for stack ability not found: " + stackObject.getStackAbility().getRule());
|
||||
|
|
|
@ -51,7 +51,6 @@ import mage.target.Target;
|
|||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -70,9 +69,6 @@ public class AwakenAbility extends SpellAbility {
|
|||
this.getEffects().addAll(card.getSpellAbility().getEffects().copy());
|
||||
this.getTargets().addAll(card.getSpellAbility().getTargets().copy());
|
||||
this.getChoices().addAll(card.getSpellAbility().getChoices().copy());
|
||||
for (Watcher watcher : card.getSpellAbility().getWatchers()) {
|
||||
this.getWatchers().add(watcher.copy());
|
||||
}
|
||||
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||
this.timing = card.getSpellAbility().getTiming();
|
||||
this.addTarget(new TargetControlledPermanent(new FilterControlledLandPermanent(filterMessage)));
|
||||
|
|
|
@ -34,7 +34,6 @@ import mage.constants.SpellAbilityType;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterLandCard;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -49,9 +48,6 @@ public class RetraceAbility extends SpellAbility {
|
|||
this.getEffects().addAll(card.getSpellAbility().getEffects().copy());
|
||||
this.getTargets().addAll(card.getSpellAbility().getTargets().copy());
|
||||
this.getChoices().addAll(card.getSpellAbility().getChoices().copy());
|
||||
for (Watcher watcher : card.getSpellAbility().getWatchers()) {
|
||||
this.getWatchers().add(watcher.copy());
|
||||
}
|
||||
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||
this.timing = card.getSpellAbility().getTiming();
|
||||
|
||||
|
|
|
@ -169,10 +169,13 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
@Override
|
||||
public Set<Card> getCards(FilterCard filter, UUID sourceId, UUID playerId, Game game) {
|
||||
Set<Card> cards = new LinkedHashSet<>();
|
||||
for (UUID card : this) {
|
||||
boolean match = filter.match(game.getCard(card), sourceId, playerId, game);
|
||||
for (UUID cardId : this) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
boolean match = filter.match(card, sourceId, playerId, game);
|
||||
if (match) {
|
||||
cards.add(game.getCard(card));
|
||||
cards.add(game.getCard(cardId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return cards;
|
||||
|
|
Loading…
Reference in a new issue