Refactoring: added mana color check and fix

This commit is contained in:
Oleg Agafonov 2018-05-06 00:48:16 +04:00
parent 7edcec0dc1
commit 459ef9af94
4 changed files with 21 additions and 7 deletions

View file

@ -123,7 +123,7 @@ class HallOfGemstoneEffect extends ReplacementEffectImpl {
int genericAmount = mana.getGeneric();
int colorlessAmount = mana.getColorless();
int coloredAmount = mana.countColored();
switch (colorChosen.getColoredManaSymbol()) {
switch (colorChosen.getOneColoredManaSymbol()) {
case W:
mana.setToMana(Mana.WhiteMana(coloredAmount));
break;

View file

@ -124,7 +124,7 @@ class ProtectiveSphereEffect extends PreventionEffectImpl {
if (event.getTargetId().equals(source.getControllerId())
&& event.getSourceId().equals(target.getFirstTarget())) {
colorsOfChosenSource = game.getObject(target.getFirstTarget()).getColor(game).getColors();
if (colorsOfChosenSource.stream().anyMatch((c) -> (manaUsed.getColor(c.getColoredManaSymbol()) > 0))) {
if (colorsOfChosenSource.stream().anyMatch((c) -> (manaUsed.getColor(c.getOneColoredManaSymbol()) > 0))) {
return true;
}
}