Refactoring snow mana to allow tracking how much is spent (Ready for Review) (#7406)

* refactored mana methods to WUBRG order

* more WUBRG refactoring

* added new mana tracking object

* fixed code error

* fixed missing mana count

* fixed null pointer exception in tests

* fixed issue with equality

* more equality fixes

* some cosmetic changes to ManaTest

* added copy method to setToMana

* fixed some initialization issues

* fixed serialization issue

* [KHM] Implemented Search for Glory

* updated mana handling to track snow

* added tests for snow mana tracking

* updated implementation of setter methods

* updated paramater to use copy methods

* fixed snow mana test to ensure proper mana tapping

* replaced instances of getPayment with getUsedManaToPay

* updated tracking of snow mana

* reverted snow mana tracking removal

* finished reverting change
This commit is contained in:
Evan Kranzler 2021-01-21 18:13:51 -05:00 committed by GitHub
parent 5e4b5239d8
commit e5344b7a96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 1006 additions and 720 deletions

View file

@ -3,13 +3,12 @@ package mage;
import mage.constants.ColoredManaSymbol;
import mage.constants.ManaType;
import mage.filter.FilterMana;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotSame;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.junit.Assert.*;
/**
* Custom unit tests for {link Mana}.
@ -145,7 +144,7 @@ public class ManaTest {
public void shouldCreateManaFromIntegers() {
// when
Mana mana = new Mana(1, 2, 3, 4, 5, 6, 7, 8);
Mana mana = new Mana(4, 3, 5, 1, 2, 6, 7, 8);
// then
assertEquals(1, mana.getRed());
@ -163,7 +162,7 @@ public class ManaTest {
// given
// when
Mana mana = new Mana(-1, 2, 3, 4, 5, 6, 7, 0);
Mana mana = new Mana(4, 3, 5, -1, 2, 6, 7, 0);
// then
assertEquals(0, mana.getRed());
@ -315,11 +314,11 @@ public class ManaTest {
thisMana.add(thatMana);
// then
assertEquals(2, thisMana.getRed());
assertEquals(4, thisMana.getGreen());
assertEquals(6, thisMana.getBlue());
assertEquals(8, thisMana.getWhite());
assertEquals(10, thisMana.getBlack());
assertEquals(2, thisMana.getWhite());
assertEquals(4, thisMana.getBlue());
assertEquals(6, thisMana.getBlack());
assertEquals(8, thisMana.getRed());
assertEquals(10, thisMana.getGreen());
assertEquals(12, thisMana.getGeneric());
assertEquals(14, thisMana.getAny());
}
@ -420,7 +419,7 @@ public class ManaTest {
public void shouldSubtractCost() {
// given
Mana thisMana = new Mana(2, 2, 2, 2, 2, 2, 2, 0);
Mana thatMana = new Mana(10, 1, 1, 1, 10, 1, 1, 0);
Mana thatMana = new Mana(1, 1, 10, 10, 1, 1, 1, 0);
// when
thisMana.subtractCost(thatMana);
@ -471,7 +470,7 @@ public class ManaTest {
@Test
public void shouldReturnCount() {
// given
Mana mana = new Mana(1, 2, 3, 4, 5, 6, 7, 0);
Mana mana = new Mana(4, 3, 5, 1, 2, 6, 7, 0);
FilterMana filter = new FilterMana();
filter.setBlack(true);
@ -489,7 +488,7 @@ public class ManaTest {
@Test
public void shouldReturnString() {
// given
Mana mana = new Mana(1, 2, 3, 0, 3, 6, 2, 0);
Mana mana = new Mana(0, 3, 3, 1, 2, 6, 2, 0);
// when
String ret = mana.toString();