mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Fixed test
This commit is contained in:
parent
81e5650972
commit
219ab89bcc
8 changed files with 40 additions and 26 deletions
|
@ -80,11 +80,13 @@ class BirchloreRangersManaEffect extends AddManaOfAnyColorEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
if (game.inCheckPlayableState()) {
|
||||
if (game != null && game.inCheckPlayableState()) {
|
||||
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) / 2;
|
||||
List<Mana> netManaCalculated = new ArrayList<>();
|
||||
netManaCalculated.add(new Mana(0, 0, 0, 0, 0, 0, count * 2, 0));
|
||||
return netManaCalculated;
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
netMana.add(Mana.AnyMana(count * 2));
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
return super.getNetMana(game, source);
|
||||
}
|
||||
|
|
|
@ -126,13 +126,15 @@ class GrandArchitectManaAbility extends ActivatedManaAbilityImpl {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
if (game.inCheckPlayableState()) {
|
||||
if (game != null && game.inCheckPlayableState()) {
|
||||
int count = game.getBattlefield().count(filter, getSourceId(), getControllerId(), game);
|
||||
List<Mana> netManaCalculated = new ArrayList<>();
|
||||
ConditionalMana mana = new GrandArchitectConditionalMana();
|
||||
mana.setColorless(count * 2);
|
||||
netManaCalculated.add(mana);
|
||||
return netManaCalculated;
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
ConditionalMana mana = new GrandArchitectConditionalMana();
|
||||
mana.setColorless(count * 2);
|
||||
netMana.add(mana);
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
return super.getNetMana(game);
|
||||
}
|
||||
|
|
|
@ -75,10 +75,12 @@ class HeritageDruidManaEffect extends BasicManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
if (game.inCheckPlayableState()) {
|
||||
if (game != null && game.inCheckPlayableState()) {
|
||||
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) / 3;
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(new Mana(0, count * 3, 0, 0, 0, 0, 0, 0));
|
||||
if (count > 0) {
|
||||
netMana.add(Mana.GreenMana(count * 3));
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
return super.getNetMana(game, source);
|
||||
|
|
|
@ -79,11 +79,13 @@ class SetonKrosanProtectorManaEffect extends BasicManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
if (game.inCheckPlayableState()) {
|
||||
if (game != null && game.inCheckPlayableState()) {
|
||||
// Because the ability can be used multiple times, multiply with untapped druids
|
||||
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(new Mana(0, count, 0,0,0,0,0,0));
|
||||
if (count > 0) {
|
||||
netMana.add(Mana.GreenMana(count));
|
||||
}
|
||||
return netMana;
|
||||
|
||||
}
|
||||
|
|
|
@ -125,10 +125,12 @@ class UrzaLordHighArtificerManaEffect extends BasicManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
if (game.inCheckPlayableState()) {
|
||||
if (game != null && game.inCheckPlayableState()) {
|
||||
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(new Mana(0, 0, count, 0,0,0,0,0));
|
||||
if (count > 0) {
|
||||
netMana.add(Mana.BlueMana(count));
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
return super.getNetMana(game, source);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue