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))));
|
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), new CardView(new EmblemView(((Emblem) object), sourceCard))));
|
||||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
||||||
} else {
|
} else {
|
||||||
StackAbility stackAbility = ((StackAbility) object);
|
if (object instanceof StackAbility) {
|
||||||
stackAbility.newId();
|
StackAbility stackAbility = ((StackAbility) object);
|
||||||
stack.put(stackObject.getId(), new CardView(((StackAbility) stackObject)));
|
stackAbility.newId();
|
||||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
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 {
|
} else {
|
||||||
logger.error("Stack Object for stack ability not found: " + stackObject.getStackAbility().getRule());
|
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.common.TargetControlledPermanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.CardUtil;
|
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.getEffects().addAll(card.getSpellAbility().getEffects().copy());
|
||||||
this.getTargets().addAll(card.getSpellAbility().getTargets().copy());
|
this.getTargets().addAll(card.getSpellAbility().getTargets().copy());
|
||||||
this.getChoices().addAll(card.getSpellAbility().getChoices().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.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||||
this.timing = card.getSpellAbility().getTiming();
|
this.timing = card.getSpellAbility().getTiming();
|
||||||
this.addTarget(new TargetControlledPermanent(new FilterControlledLandPermanent(filterMessage)));
|
this.addTarget(new TargetControlledPermanent(new FilterControlledLandPermanent(filterMessage)));
|
||||||
|
|
|
@ -34,7 +34,6 @@ import mage.constants.SpellAbilityType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterLandCard;
|
import mage.filter.common.FilterLandCard;
|
||||||
import mage.target.common.TargetCardInHand;
|
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.getEffects().addAll(card.getSpellAbility().getEffects().copy());
|
||||||
this.getTargets().addAll(card.getSpellAbility().getTargets().copy());
|
this.getTargets().addAll(card.getSpellAbility().getTargets().copy());
|
||||||
this.getChoices().addAll(card.getSpellAbility().getChoices().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.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||||
this.timing = card.getSpellAbility().getTiming();
|
this.timing = card.getSpellAbility().getTiming();
|
||||||
|
|
||||||
|
|
|
@ -169,10 +169,13 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
||||||
@Override
|
@Override
|
||||||
public Set<Card> getCards(FilterCard filter, UUID sourceId, UUID playerId, Game game) {
|
public Set<Card> getCards(FilterCard filter, UUID sourceId, UUID playerId, Game game) {
|
||||||
Set<Card> cards = new LinkedHashSet<>();
|
Set<Card> cards = new LinkedHashSet<>();
|
||||||
for (UUID card : this) {
|
for (UUID cardId : this) {
|
||||||
boolean match = filter.match(game.getCard(card), sourceId, playerId, game);
|
Card card = game.getCard(cardId);
|
||||||
if (match) {
|
if (card != null) {
|
||||||
cards.add(game.getCard(card));
|
boolean match = filter.match(card, sourceId, playerId, game);
|
||||||
|
if (match) {
|
||||||
|
cards.add(game.getCard(cardId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cards;
|
return cards;
|
||||||
|
|
Loading…
Reference in a new issue