Fixed that the information what mana was payed to pay the mana cost of a spell or ability were not correct if "spend mana as though" abilities were involved in the payment (fixes #3604).

This commit is contained in:
LevelX2 2017-07-10 16:53:02 +02:00
parent dc5007003b
commit 5a3243890d
8 changed files with 109 additions and 23 deletions

View file

@ -237,6 +237,38 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
any += mana.getAny();
}
/**
* Increases the given mana by one.
*
* @param manaType
*/
public void increase(ManaType manaType) {
switch (manaType) {
case BLACK:
black++;
break;
case BLUE:
blue++;
break;
case COLORLESS:
colorless++;
break;
case GENERIC:
generic++;
break;
case GREEN:
green++;
break;
case RED:
red++;
break;
case WHITE:
white++;
break;
}
}
/**
* Increases the Red mana by one.
*/
@ -815,11 +847,12 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
}
/**
* Returns if this objects mana contains any coloured mana the same as the passed in
* {@link Mana}'s mana.
* Returns if this objects mana contains any coloured mana the same as the
* passed in {@link Mana}'s mana.
*
* @param mana the mana to check for
* @return true if this contains any of the same type of coloured mana that this has
* @return true if this contains any of the same type of coloured mana that
* this has
*/
public boolean containsAny(final Mana mana) {
if (mana.black > 0 && this.black > 0) {
@ -832,7 +865,7 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
return true;
} else if (mana.green > 0 && this.green > 0) {
return true;
}
}
return false;
}