diff --git a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java index f1c4c49961..f2b3f9c808 100644 --- a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java @@ -1,5 +1,16 @@ package mage.client.cards; +import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.*; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import javax.swing.*; import mage.cards.Card; import mage.cards.MageCard; import mage.cards.decks.DeckCardInfo; @@ -21,18 +32,6 @@ import mage.view.CardsView; import org.apache.log4j.Logger; import org.mage.card.arcane.CardRenderer; -import javax.swing.*; -import java.awt.*; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.*; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - /** * Created by StravantUser on 2016-09-20. */ @@ -1136,6 +1135,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg if (offsetIntoCol2 < GRID_PADDING) { --col2; } + + // avoids a null ref issue but only deals with symptom of problem. not sure how it gets to this state ever. see issue #3197 + // if (selectionDragStartCards == null) return; int curY = COUNT_LABEL_HEIGHT; for (int rowIndex = 0; rowIndex < cardGrid.size(); ++rowIndex) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExertTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExertTest.java index a051159326..107e2c92cf 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExertTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExertTest.java @@ -115,4 +115,43 @@ public class ExertTest extends CardTestPlayerBase { assertTapped(cCelebrant, true); assertTapped(memnite, true); } + + /* + * Reported bug: Combat Celebrant able to attack again despite being exerted if Always Watching is in play. (Or presumably any Vigilance granting effect) + * NOTE: this test is failing at the moment due to bug in code. See issue #3195 + */ + @Test + public void combatCelebrantExertedCannotAttackDuringNextCombatPhase_InteractionWithAlwaysWatching() { + /* + Combat Celebrant 2R + Creature - Human Warrior 4/1 + If Combat Celebrant hasn't been exerted this turn, you may exert it as it attacks. When you do, untap all other creatures you control and after this phase, there is an additional combat phase. + */ + String cCelebrant = "Combat Celebrant"; + + /* + Always Watching 1WW + Enchantment + Non-token creatures you control get +1/+1 and have vigilance. + */ + String aWatching = "Always Watching"; + String memnite = "Memnite"; // {0} 1/1 + + addCard(Zone.BATTLEFIELD, playerA, aWatching); + addCard(Zone.BATTLEFIELD, playerA, cCelebrant); + addCard(Zone.BATTLEFIELD, playerA, memnite); + + attack(1, playerA, cCelebrant); + attack(1, playerA, memnite); + setChoice(playerA, "Yes"); // exert for extra turn and untap all creatures + attack(1, playerA, cCelebrant); // should not be able to attack again due to "if has not been exerted this turn" + attack(1, playerA, memnite); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertTapped(cCelebrant, false); + assertTapped(memnite, false); + assertLife(playerB, 11); // 5 + 2 + 2 (Celebrant once, Memnite twice with +1/+1 on both) + } }