mirror of
https://github.com/magefree/mage.git
synced 2026-01-23 19:59:54 -08:00
Creeping Dread tests and error checking
This commit is contained in:
parent
99e3703d17
commit
5b36756127
2 changed files with 171 additions and 12 deletions
|
|
@ -124,15 +124,17 @@ class CreepingDreadEffect extends OneShotEffect {
|
|||
TargetCard target = new TargetCard(Zone.HAND, new FilterCard());
|
||||
if(opponent.choose(Outcome.Discard, opponent.getHand(), target, game)) {
|
||||
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
for (CardType cType : typesChosen) {
|
||||
for (CardType oType : card.getCardType()) {
|
||||
if (cType == oType) {
|
||||
opponentsAffected.add(opponent);
|
||||
break;
|
||||
if (card != null) {
|
||||
if (!typesChosen.isEmpty()) {
|
||||
for (CardType cType : typesChosen) {
|
||||
for (CardType oType : card.getCardType()) {
|
||||
if (cType == oType) {
|
||||
opponentsAffected.add(opponent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cardsChosen.put(opponent, card);
|
||||
}
|
||||
|
|
@ -148,11 +150,13 @@ class CreepingDreadEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// everyone discards the card at the same time
|
||||
for (Map.Entry<Player, Card> entry : cardsChosen.entrySet()) {
|
||||
Player player = entry.getKey();
|
||||
Card cardChosen = entry.getValue();
|
||||
if (player != null && cardChosen != null) {
|
||||
player.discard(cardChosen, source, game);
|
||||
if (!cardsChosen.isEmpty()) {
|
||||
for (Map.Entry<Player, Card> entry : cardsChosen.entrySet()) {
|
||||
Player player = entry.getKey();
|
||||
Card cardChosen = entry.getValue();
|
||||
if (player != null && cardChosen != null) {
|
||||
player.discard(cardChosen, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue