Fixed test

This commit is contained in:
Oleg Agafonov 2020-07-11 21:01:40 +04:00
parent 81e5650972
commit 219ab89bcc
8 changed files with 40 additions and 26 deletions

View file

@ -1,7 +1,6 @@
package mage.abilities.mana;
import java.util.List;
import mage.Mana;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.TapSourceCost;
@ -12,9 +11,11 @@ import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.constants.Zone;
import mage.game.Game;
import java.util.List;
/**
* For cards like:
* {tap}: Add three mana of any one color. Spend this mana only to cast creature spells.
* {tap}: Add three mana of any one color. Spend this mana only to cast creature spells.
*
* @author noxx
*/
@ -47,7 +48,10 @@ public class ConditionalAnyColorManaAbility extends ActivatedManaAbilityImpl {
@Override
public List<Mana> getNetMana(Game game) {
this.netMana.clear();
this.netMana.add(new Mana(0,0,0,0,0,0, amount.calculate(game, this, null), 0));
int count = amount.calculate(game, this, null);
if (count > 0) {
this.netMana.add(Mana.AnyMana(count));
}
return super.getNetMana(game);
}
@ -56,7 +60,7 @@ public class ConditionalAnyColorManaAbility extends ActivatedManaAbilityImpl {
return true;
}
@Override
public ConditionalAnyColorManaAbility copy() {
return new ConditionalAnyColorManaAbility(this);

View file

@ -81,13 +81,13 @@ public class DynamicManaAbility extends ActivatedManaAbilityImpl {
@Override
public List<Mana> getNetMana(Game game) {
List<Mana> newNetMana = new ArrayList<>();
List<Mana> netMana = new ArrayList<>();
if (game != null) {
// TODO: effects from replacement effects like Mana Reflection are not considered yet
// TODO: effects that need a X payment (e.g. Mage-Ring Network) return always 0
newNetMana.addAll(manaEffect.getNetMana(game, this));
netMana.addAll(manaEffect.getNetMana(game, this));
}
return newNetMana;
return netMana;
}
@Override

View file

@ -46,13 +46,13 @@ public abstract class TriggeredManaAbility extends TriggeredAbilityImpl implemen
@Override
public List<Mana> getNetMana(Game game) {
if (game != null) {
List<Mana> newNetMana = new ArrayList<>();
List<Mana> netMana = new ArrayList<>();
for (Effect effect : getEffects()) {
if (effect instanceof ManaEffect) {
newNetMana.addAll(((ManaEffect) effect).getNetMana(game, this));
netMana.addAll(((ManaEffect) effect).getNetMana(game, this));
}
}
return newNetMana;
return netMana;
}
return new ArrayList<>(netMana);
}