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

@ -28,7 +28,7 @@ public final class AncientSpring extends CardImpl {
// {tap}: Add {U}.
this.addAbility(new BlueManaAbility());
// {tap}, Sacrifice Ancient Spring: Add {W}{B}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost());
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -58,7 +58,7 @@ public final class ArixmethesSlumberingIsle extends CardImpl {
this.addAbility(new SpellCastControllerTriggeredAbility(new RemoveCounterSourceEffect(CounterType.SLUMBER.createInstance(1)), true));
// {T}: Add {G}{U}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost()));
}
public ArixmethesSlumberingIsle(final ArixmethesSlumberingIsle card) {

View file

@ -39,7 +39,7 @@ public final class AxebaneGuardian extends CardImpl {
this.addAbility(DefenderAbility.getInstance());
// {tap}: Add X mana in any combination of colors, where X is the number of creatures with defender you control.
this.addAbility(new DynamicManaAbility(new Mana(0,0,0,0,0,0,1, 0), new PermanentsOnBattlefieldCount(filter),
this.addAbility(new DynamicManaAbility(new Mana(0, 0, 0, 0,0, 0,1, 0), new PermanentsOnBattlefieldCount(filter),
"Add X mana in any combination of colors, where X is the number of creatures with defender you control."));
}

View file

@ -31,7 +31,7 @@ public final class AzoriusChancery extends CardImpl {
// When Azorius Chancery enters the battlefield, return a land you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
// {tap}: Add {W}{U}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost()));
}
public AzoriusChancery(final AzoriusChancery card) {

View file

@ -22,7 +22,7 @@ public final class AzoriusSignet extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
// {1}, {tap}: Add {W}{U}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -43,7 +43,7 @@ public final class BalduvianTradingPost extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.ALL, new EnterBattlefieldPayCostOrPutGraveyardEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter)))));
// {tap}: Add {C}{R}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 1), new TapSourceCost()));
// {1}, {tap}: Balduvian Trading Post deals 1 damage to target attacking creature.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new GenericManaCost(1));

View file

@ -25,7 +25,7 @@ public final class BurningTreeEmissary extends CardImpl {
this.toughness = new MageInt(2);
// When Burning-Tree Emissary enters the battlefield, add {R}{G}.
this.addAbility(new EntersBattlefieldTriggeredAbility(new BasicManaEffect(new Mana(1,1,0,0,0,0,0, 0))));
this.addAbility(new EntersBattlefieldTriggeredAbility(new BasicManaEffect(new Mana(0, 0, 0, 1,1, 0,0, 0))));
}
public BurningTreeEmissary(final BurningTreeEmissary card) {

View file

@ -69,11 +69,8 @@ class CadaverousBloomManaEffect extends BasicManaEffect {
int count = player.getHand().size();
if (count > 0) {
Mana mana = new Mana(
getManaTemplate().getRed() * count,
getManaTemplate().getWhite() * count, getManaTemplate().getBlue() * count, getManaTemplate().getBlack() * count, getManaTemplate().getRed() * count,
getManaTemplate().getGreen() * count,
getManaTemplate().getBlue() * count,
getManaTemplate().getWhite() * count,
getManaTemplate().getBlack() * count,
getManaTemplate().getGeneric() * count,
getManaTemplate().getAny() * count,
getManaTemplate().getColorless() * count

View file

@ -29,7 +29,7 @@ public final class CascadeBluffs extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{U/R}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{U/R}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -40,7 +40,7 @@ public final class CoralAtoll extends CardImpl {
// When Coral Atoll enters the battlefield, sacrifice it unless you return an untapped Island you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)))));
// {tap}: Add {C}{U}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 0, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost()));
}

View file

@ -28,7 +28,7 @@ public final class CrosissAttendant extends CardImpl {
this.toughness = new MageInt(3);
// {1}, Sacrifice Crosis's Attendant: Add {U}{B}{R}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -28,7 +28,7 @@ public final class DarigaazsAttendant extends CardImpl {
this.toughness = new MageInt(3);
// {1}, Sacrifice Darigaaz's Attendant: Add {B}{R}{G}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -22,7 +22,7 @@ public final class DarkwaterCatacombs extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
// {1}, {tap}: Add {U}{B}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -24,7 +24,7 @@ public final class DarkwaterEgg extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
// {2}, {tap}, Sacrifice Darkwater Egg: Add {U}{B}. Draw a card.
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{2}"));
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addEffect(new DrawCardSourceControllerEffect(1));

View file

@ -30,7 +30,7 @@ public final class DimirAqueduct extends CardImpl {
// When Dimir Aqueduct enters the battlefield, return a land you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter)));
// {tap}: Add {U}{B}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost()));
}
public DimirAqueduct(final DimirAqueduct card) {

View file

@ -21,7 +21,7 @@ public final class DimirSignet extends CardImpl {
public DimirSignet (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -42,7 +42,7 @@ public final class DormantVolcano extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)))));
// {tap}: Add {C}{R}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 1), new TapSourceCost()));
}

View file

@ -59,12 +59,9 @@ class DoublingCubeEffect extends ManaEffect {
public List<Mana> getNetMana(Game game, Mana possibleManaInPool, Ability source) {
List<Mana> netMana = new ArrayList<>();
netMana.add(new Mana( // remove possible mana conditions
possibleManaInPool.getRed(),
possibleManaInPool.getGreen(),
possibleManaInPool.getBlue(),
possibleManaInPool.getWhite(),
possibleManaInPool.getBlack(),
0, // Generic may not be included
possibleManaInPool.getWhite(), possibleManaInPool.getBlue(), possibleManaInPool.getBlack(), possibleManaInPool.getRed(),
possibleManaInPool.getGreen(),
0, // Generic may not be included
possibleManaInPool.getAny(),
possibleManaInPool.getColorless())
);
@ -91,7 +88,7 @@ class DoublingCubeEffect extends ManaEffect {
redMana += conditionalMana.getRed();
colorlessMana += conditionalMana.getColorless();
}
return new Mana(redMana, greenMana, blueMana, whiteMana, blackMana, 0, 0, colorlessMana);
return new Mana(whiteMana, blueMana, blackMana, redMana, greenMana, 0, 0, colorlessMana);
}
}
return new Mana();

View file

@ -28,7 +28,7 @@ public final class DromarsAttendant extends CardImpl {
this.toughness = new MageInt(3);
// {1}, Sacrifice Dromar's Attendant: Add {W}{U}{B}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -48,11 +48,11 @@ public final class DroneHolocron extends CardImpl {
// {T}, Remove two charge counters from Drone Holocron: Add WU or UB.
cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
}

View file

@ -42,7 +42,7 @@ public final class Everglades extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(1, 1, filter, true)))));
// {tap}: Add {C}{B}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 0, 1, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 0, 0, 0, 1), new TapSourceCost()));
}

View file

@ -30,7 +30,7 @@ public final class FetidHeath extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{W/B}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{W/B}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -28,7 +28,7 @@ public final class FireLitThicket extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{R/G}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{R/G}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -30,7 +30,7 @@ public final class FloodedGrove extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{G/U}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{G/U}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -28,7 +28,7 @@ public final class GeothermalCrevice extends CardImpl {
// {tap}: Add {R}.
this.addAbility(new RedManaAbility());
// {tap}, Sacrifice Geothermal Crevice: Add {B}{G}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost());
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -63,10 +63,10 @@ class GoblinClearCutterManaEffect extends ManaEffect {
public GoblinClearCutterManaEffect() {
super();
this.staticText = "Add 3 mana in any combination of {R} and/or {G}";
netMana.add(new Mana(0, 3, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(1, 2, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(2, 1, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(3, 0, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 0, 3, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 1, 2, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 2, 1, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 3, 0, 0, 0, 0));
}
public GoblinClearCutterManaEffect(final GoblinClearCutterManaEffect effect) {

View file

@ -31,7 +31,7 @@ public final class GolgariRotFarm extends CardImpl {
// When Golgari Rot Farm enters the battlefield, return a land you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter)));
// {tap}: Add {B}{G}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost()));
}
public GolgariRotFarm(final GolgariRotFarm card) {

View file

@ -21,7 +21,7 @@ public final class GolgariSignet extends CardImpl {
public GolgariSignet (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -29,7 +29,7 @@ public final class GravenCairns extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{B/R}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{B/R}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -28,7 +28,7 @@ public final class GrinningIgnus extends CardImpl {
this.toughness = new MageInt(2);
// {R}, Return Grinning Ignus to its owner's hand: Add {C}{C}{R}. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 2), new ManaCostsImpl("{R}"));
Ability ability = new ActivateAsSorceryManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 2), new ManaCostsImpl("{R}"));
ability.addCost(new ReturnToHandFromBattlefieldSourceCost());
this.addAbility(ability);
}

View file

@ -20,7 +20,7 @@ public final class GruulSignet extends CardImpl {
public GruulSignet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -29,7 +29,7 @@ public final class GruulTurf extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost()));
}
public GruulTurf(final GruulTurf card) {

View file

@ -26,7 +26,7 @@ public final class GyreEngineer extends CardImpl {
this.toughness = new MageInt(1);
// {T}: Add {G}{U}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost()));
}
private GyreEngineer(final GyreEngineer card) {

View file

@ -34,7 +34,7 @@ public final class HarabazDruid extends CardImpl {
this.toughness = new MageInt(1);
// {T}: Add X mana of any one color, where X is the number of Allies you control.
this.addAbility(new DynamicManaAbility(new Mana(0,0,0,0,0,0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(),
this.addAbility(new DynamicManaAbility(new Mana(0, 0, 0, 0,0, 0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(),
"Add X mana of any one color, where X is the number of Allies you control", true));
}

View file

@ -2,7 +2,6 @@ package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -21,7 +20,6 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ManaEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInHand;

View file

@ -28,7 +28,7 @@ public final class IrrigationDitch extends CardImpl {
// {tap}: Add {W}.
this.addAbility(new WhiteManaAbility());
// {tap}, Sacrifice Irrigation Ditch: Add {G}{U}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost());
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -31,7 +31,7 @@ public final class IzzetBoilerworks extends CardImpl {
// When Izzet Boilerworks enters the battlefield, return a land you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
// {T}: Add {U}{R}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost()));
}
public IzzetBoilerworks(final IzzetBoilerworks card) {

View file

@ -22,7 +22,7 @@ public final class IzzetSignet extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {1}, {T}: Add {U}{R}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -48,11 +48,11 @@ public final class JediHolocron extends CardImpl {
// {T}, Remove two charge counters from Jedi Holocron: Add GW or WU.
cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
}

View file

@ -42,7 +42,7 @@ public final class JungleBasin extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)))));
// {tap}: Add {C}{G}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 0, 1, 0, 0, 1), new TapSourceCost()));
}

View file

@ -42,7 +42,7 @@ public final class Karoo extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)))));
// {tap}: Add {C}{W}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 1), new TapSourceCost()));
}

View file

@ -31,7 +31,7 @@ public final class KnotvineMystic extends CardImpl {
this.toughness = new MageInt(2);
// {1}, {T}: Add {R}{G}{W}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost());
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost());
ability.addManaCost(new GenericManaCost(1));
this.addAbility(ability);
}

View file

@ -141,7 +141,7 @@ class LaviniaAzoriusRenegadeTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getStackAbility().getManaCostsToPay().getPayment().count() == 0) {
if (spell != null && spell.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}

View file

@ -31,7 +31,7 @@ public final class MarduWarshrieker extends CardImpl {
// <em>Raid</em> - When Mardu Warshrieker enters the battlefield, if you attacked this turn, add {R}{W}{B}.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(
new AddManaToManaPoolSourceControllerEffect(new Mana(1, 0, 0, 1, 1, 0, 0, 0))),
new AddManaToManaPoolSourceControllerEffect(new Mana(1, 0, 1, 1, 0, 0, 0, 0))),
RaidCondition.instance,
"<i>Raid</i> &mdash; When {this} enters the battlefield, if you attacked this turn, add {R}{W}{B}.")
.setAbilityWord(AbilityWord.RAID)

View file

@ -25,7 +25,7 @@ public final class MorgueToad extends CardImpl {
this.toughness = new MageInt(2);
// Sacrifice Morgue Toad: Add {U}{R}.
SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new SacrificeSourceCost());
SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -24,7 +24,7 @@ public final class MossfireEgg extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
// {2}, {tap}, Sacrifice Mossfire Egg: Add {R}{G}. Draw a card.
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{2}"));
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addEffect(new DrawCardSourceControllerEffect(1));

View file

@ -22,7 +22,7 @@ public final class MossfireValley extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
// {1}, {tap}: Add {R}{G}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -28,7 +28,7 @@ public final class MysticGate extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{W/U}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{W/U}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -27,7 +27,7 @@ public final class NantukoElder extends CardImpl {
this.toughness = new MageInt(2);
// {tap}: Add {C}{G}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 0, 1, 0, 0, 1), new TapSourceCost()));
}

View file

@ -51,7 +51,7 @@ enum NoManaSpentToCastTargetCondition implements Condition {
if (targetId != null) {
StackObject stackObject = game.getStack().getStackObject(targetId);
if (stackObject != null) {
return stackObject.getStackAbility().getManaCostsToPay().getPayment().count() == 0;
return stackObject.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0;
}
}
return false;

View file

@ -44,7 +44,7 @@ public final class OmnathLocusOfCreation extends CardImpl {
).setText("you gain 4 life if this is the first time this ability has resolved this turn."), false);
ability.addEffect(new IfAbilityHasResolvedXTimesEffect(
Outcome.PutManaInPool, 2, new BasicManaEffect(new Mana(
1, 1, 1, 1, 0, 0, 0, 0
1, 1, 0, 1, 1, 0, 0, 0
))).setText("If it's the second time, add {R}{G}{W}{U}."));
ability.addEffect(new IfAbilityHasResolvedXTimesEffect(
Outcome.Damage, 3, new DamagePlayersEffect(4, TargetController.OPPONENT)

View file

@ -64,10 +64,10 @@ class OrcishLumberjackManaEffect extends ManaEffect {
public OrcishLumberjackManaEffect() {
super();
this.staticText = "Add three mana in any combination of {R} and/or {G}";
netMana.add(new Mana(0, 3, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(1, 2, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(2, 1, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(3, 0, 0, 0, 0, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 0, 3, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 1, 2, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 2, 1, 0, 0, 0));
netMana.add(new Mana(0, 0, 0, 3, 0, 0, 0, 0));
}
public OrcishLumberjackManaEffect(final OrcishLumberjackManaEffect effect) {

View file

@ -33,7 +33,7 @@ public final class OrzhovBasilica extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
// {T}: Add {W}{B}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost()));
}
public OrzhovBasilica(final OrzhovBasilica card) {

View file

@ -22,7 +22,7 @@ public final class OrzhovSignet extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {1}, {T}: Add {W}{B}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -48,11 +48,11 @@ public final class OutlawHolocron extends CardImpl {
// {T}, Remove two charge counters from Outlaw Holocron: Add BR or RG.cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2));
cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
}

View file

@ -2,7 +2,7 @@
package mage.cards.p;
import java.util.UUID;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -18,7 +18,6 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ManaEvent;
import mage.game.permanent.Permanent;
@ -76,7 +75,7 @@ class PulseOfLlanowarReplacementEffect extends ReplacementEffectImpl {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
new AddManaOfAnyColorEffect(mana.count()).apply(game,source);
mana.setToMana(new Mana(0,0,0,0,0,0,0,0));
mana.setToMana(new Mana(0, 0, 0, 0,0, 0,0,0));
return true;
}

View file

@ -30,7 +30,7 @@ public final class RakdosCarnarium extends CardImpl {
// When Rakdos Carnarium enters the battlefield, return a land you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
// {tap}: Add {B}{R}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost()));
}
public RakdosCarnarium(final RakdosCarnarium card) {

View file

@ -22,7 +22,7 @@ public final class RakdosSignet extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
// {1}, {tap}: Add {B}{R}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -39,7 +39,7 @@ public final class RattleclawMystic extends CardImpl {
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}")));
// When Rattleclaw Mystic is turned face up, add {G}{U}{R}.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new AddManaToManaPoolSourceControllerEffect(new Mana(1,1,1,0,0,0,0, 0))));
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new AddManaToManaPoolSourceControllerEffect(new Mana(0, 1, 0, 1,1, 0,0, 0))));
}

View file

@ -28,7 +28,7 @@ public final class RithsAttendant extends CardImpl {
this.toughness = new MageInt(3);
// {1}, Sacrifice Rith's Attendant: Add {R}{G}{W}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -64,6 +64,6 @@ enum RoilingVortexPredicate implements Predicate<StackObject> {
@Override
public boolean apply(StackObject input, Game game) {
return input.getStackAbility().getManaCostsToPay().getPayment().count() == 0;
return input.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0;
}
}

View file

@ -51,7 +51,7 @@ class SavageVentmawManaEffect extends ManaEffect {
public SavageVentmawManaEffect() {
super();
this.mana = new Mana(3, 3, 0, 0, 0, 0, 0, 0);
this.mana = new Mana(0, 0, 0, 3, 3, 0, 0, 0);
this.staticText = "add " + mana.toString() + ". Until end of turn, you don't lose this mana as steps and phases end";
}

View file

@ -0,0 +1,67 @@
package mage.cards.s;
import mage.abilities.dynamicvalue.common.SnowManaSpentValue;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
import mage.watchers.common.ManaSpentToCastWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SearchForGlory extends CardImpl {
private static final FilterCard filter = new FilterCard(
"a snow permanent card, a legendary card, or a Saga card"
);
static {
filter.add(SearchForGloryPredicate.instance);
}
public SearchForGlory(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}");
this.addSuperType(SuperType.SNOW);
// Search your library for a snow permanent card, a legendary card, or a Saga card, reveal it, put it into your hand, then shuffle your library. You gain 1 life for each {S} spent to cast this spell.
this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(
new TargetCardInLibrary(filter), true
));
this.getSpellAbility().addEffect(new GainLifeEffect(
SnowManaSpentValue.instance
).setText("You gain 1 life for each {S} spent to cast this spell"));
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
}
private SearchForGlory(final SearchForGlory card) {
super(card);
}
@Override
public SearchForGlory copy() {
return new SearchForGlory(this);
}
}
enum SearchForGloryPredicate implements Predicate<Card> {
instance;
@Override
public boolean apply(Card input, Game game) {
return (input.isPermanent() && input.isSnow())
|| input.isLegendary()
|| input.hasSubtype(SubType.SAGA, game);
}
}

View file

@ -32,7 +32,7 @@ public final class SelesnyaSanctuary extends CardImpl {
// When Selesnya Sanctuary enters the battlefield, return a land you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
// {tap}: Add {G}{W}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost()));
}
public SelesnyaSanctuary(final SelesnyaSanctuary card) {

View file

@ -21,7 +21,7 @@ public final class SelesnyaSignet extends CardImpl {
public SelesnyaSignet (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -24,7 +24,7 @@ public final class ShadowbloodEgg extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
// {2}, {tap}, Sacrifice Shadowblood Egg: Add {B}{R}. Draw a card.
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{2}"));
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addEffect(new DrawCardSourceControllerEffect(1));

View file

@ -22,7 +22,7 @@ public final class ShadowbloodRidge extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
// {1}, {tap}: Add {B}{R}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -31,7 +31,7 @@ public final class SimicGrowthChamber extends CardImpl {
// When Simic Growth Chamber enters the battlefield, return a land you control to its owner's hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
// {tap}: Add {G}{U}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost()));
}
public SimicGrowthChamber(final SimicGrowthChamber card) {

View file

@ -22,7 +22,7 @@ public final class SimicSignet extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
// {1}, {tap}: Add {G}{U}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new GenericManaCost(1));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -48,11 +48,11 @@ public final class SithHolocron extends CardImpl {
// {T}, Remove two charge counters from Sith Holocron: Add UB or BR.
cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
}

View file

@ -24,7 +24,7 @@ public final class SkycloudEgg extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
// {2}, {tap}, Sacrifice Skycloud Egg: Add {W}{U}. Draw a card.
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{2}"));
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addEffect(new DrawCardSourceControllerEffect(1));

View file

@ -22,7 +22,7 @@ public final class SkycloudExpanse extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
// {1}, {tap}: Add {W}{U}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -42,7 +42,7 @@ public final class SoldeviExcavations extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.ALL, new EnterBattlefieldPayCostOrPutGraveyardEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter)))));
// {tap}: Add {C}{U}.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 0, 0, 0, 1), new TapSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost()));
// {1}, {tap}: Scry 1.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(1), new GenericManaCost(1));

View file

@ -81,14 +81,14 @@ class SoulBurnEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
// Get the colors we care about. (This isn't racist, honestly.)
int amountBlack = source.getManaCostsToPay().getPayment().getBlack();
int amountRed = source.getManaCostsToPay().getPayment().getRed();
int amountBlack = source.getManaCostsToPay().getUsedManaToPay().getBlack();
int amountRed = source.getManaCostsToPay().getUsedManaToPay().getRed();
// Get the colors we don't really care about. (See note above.)
int amountWhite = source.getManaCostsToPay().getPayment().getWhite();
int amountGreen = source.getManaCostsToPay().getPayment().getGreen();
int amountBlue = source.getManaCostsToPay().getPayment().getBlue();
int amountColorless = source.getManaCostsToPay().getPayment().getColorless();
int amountWhite = source.getManaCostsToPay().getUsedManaToPay().getWhite();
int amountGreen = source.getManaCostsToPay().getUsedManaToPay().getGreen();
int amountBlue = source.getManaCostsToPay().getUsedManaToPay().getBlue();
int amountColorless = source.getManaCostsToPay().getUsedManaToPay().getColorless();
// Figure out what was spent on the spell in total, determine proper values for
// black and red, minus initial casting cost.

View file

@ -47,7 +47,7 @@ public final class SpringjackPasture extends CardImpl {
// {tap}, Sacrifice X Goats: Add X mana of any one color. You gain X life.
ability = new DynamicManaAbility(
new Mana(0,0,0,0,0,0,1,0),
new Mana(0, 0, 0, 0,0, 0,1,0),
GetXValue.instance,
new TapSourceCost(),
"Add X mana of any one color",

View file

@ -28,7 +28,7 @@ public final class SulfurVent extends CardImpl {
// {tap}: Add {B}.
this.addAbility(new BlackManaAbility());
// {tap}, Sacrifice Sulfur Vent: Add {U}{R}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost());
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -51,6 +51,6 @@ enum SunderingStrokeCondtition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return source.getManaCostsToPay().getPayment().getColor(ColoredManaSymbol.R) >= 6;
return source.getManaCostsToPay().getUsedManaToPay().getColor(ColoredManaSymbol.R) >= 6;
}
}

View file

@ -24,7 +24,7 @@ public final class SungrassEgg extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
// {2}, {tap}, Sacrifice Sungrass Egg: Add {G}{W}. Draw a card.
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{2}"));
ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addEffect(new DrawCardSourceControllerEffect(1));

View file

@ -22,7 +22,7 @@ public final class SungrassPrairie extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
// {1}, {tap}: Add {G}{W}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -28,7 +28,7 @@ public final class SunkenRuins extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{U/B}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{U/B}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -28,7 +28,7 @@ public final class TrevasAttendant extends CardImpl {
this.toughness = new MageInt(3);
// {1}, Sacrifice Treva's Attendant: Add {G}{W}{U}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}"));
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}"));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -30,7 +30,7 @@ public final class TwilightMire extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{B/G}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{B/G}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -48,11 +48,11 @@ public final class WildHolocron extends CardImpl {
// {T}, Remove two charge counters from Wild Holocron: Add RG or GW.
cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost());
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost());
ability.addCost(cost);
this.addAbility(ability);
}

View file

@ -34,7 +34,7 @@ public final class WirewoodChanneler extends CardImpl {
this.toughness = new MageInt(2);
// {T}: Add X mana of any one color, where X is the number of Elves on the battlefield.
DynamicManaAbility ability = new DynamicManaAbility(new Mana(0,0,0,0,0,0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(),
DynamicManaAbility ability = new DynamicManaAbility(new Mana(0, 0, 0, 0,0, 0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(),
"Add X mana of any one color, where X is the number of Elves on the battlefield", true);
this.addAbility(ability);
}

View file

@ -28,7 +28,7 @@ public final class WoodedBastion extends CardImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{G/W}"));
ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{G/W}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -127,12 +127,12 @@ class YurlokOfScorchThrashManaEffect extends ManaEffect {
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> netMana = new ArrayList<>();
netMana.add(new Mana(1, 1, 0, 0, 1, 0, 0, 0));
netMana.add(new Mana(0, 0, 1, 1, 1, 0, 0, 0));
return netMana;
}
@Override
public Mana produceMana(Game game, Ability source) {
return new Mana(1, 1, 0, 0, 1, 0, 0, 0);
return new Mana(0, 0, 1, 1, 1, 0, 0, 0);
}
}

View file

@ -272,6 +272,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Saw It Coming", 76, Rarity.UNCOMMON, mage.cards.s.SawItComing.class));
cards.add(new SetCardInfo("Scorn Effigy", 246, Rarity.COMMON, mage.cards.s.ScornEffigy.class));
cards.add(new SetCardInfo("Sculptor of Winter", 193, Rarity.COMMON, mage.cards.s.SculptorOfWinter.class));
cards.add(new SetCardInfo("Search for Glory", 27, Rarity.RARE, mage.cards.s.SearchForGlory.class));
cards.add(new SetCardInfo("Seize the Spoils", 149, Rarity.COMMON, mage.cards.s.SeizeTheSpoils.class));
cards.add(new SetCardInfo("Shackles of Treachery", 150, Rarity.COMMON, mage.cards.s.ShacklesOfTreachery.class));
cards.add(new SetCardInfo("Shepherd of the Cosmos", 28, Rarity.UNCOMMON, mage.cards.s.ShepherdOfTheCosmos.class));

View file

@ -7,12 +7,11 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class ManaWasSpentToCastTest extends CardTestPlayerBase {
@Test
public void testArtifactWillBeDestroyed() {
// Tin Street Hooligan - Creature 2/1 {1}{R}
@ -20,9 +19,9 @@ public class ManaWasSpentToCastTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Tin Street Hooligan");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerB, "Abzan Banner");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tin Street Hooligan");
addTarget(playerA, "Abzan Banner");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
@ -38,9 +37,9 @@ public class ManaWasSpentToCastTest extends CardTestPlayerBase {
// When Tin Street Hooligan enters the battlefield, if {G} was spent to cast Tin Street Hooligan, destroy target artifact.
addCard(Zone.HAND, playerA, "Tin Street Hooligan");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerB, "Abzan Banner");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tin Street Hooligan");
addTarget(playerA, "Abzan Banner");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
@ -49,5 +48,42 @@ public class ManaWasSpentToCastTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Tin Street Hooligan", 1);
assertPermanentCount(playerB, "Abzan Banner", 1);
}
}
@Test
public void testSnowMana() {
addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Plains");
addCard(Zone.BATTLEFIELD, playerA, "Boreal Druid");
addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.HAND, playerA, "Search for Glory");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Search for Glory");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Search for Glory", 1);
assertLife(playerA, 22);
}
@Test
public void testSnowMana2() {
addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.BATTLEFIELD, playerA, "Island");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Vodalian Arcanist");
addCard(Zone.BATTLEFIELD, playerA, "Rimefeather Owl");
addCard(Zone.HAND, playerA, "Search for Glory");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {U}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{S}", "Vodalian Arcanist");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Search for Glory");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Search for Glory", 1);
assertLife(playerA, 21);
}
}

View file

@ -113,25 +113,25 @@ public class ConditionalMana extends Mana implements Serializable {
return;
}
if (filter.isBlack()) {
black = 0;
black.clear();
}
if (filter.isBlue()) {
blue = 0;
blue.clear();
}
if (filter.isWhite()) {
white = 0;
white.clear();
}
if (filter.isGreen()) {
green = 0;
green.clear();
}
if (filter.isRed()) {
red = 0;
red.clear();
}
if (filter.isColorless()) {
colorless = 0;
colorless.clear();
}
if (filter.isGeneric()) {
generic = 0;
generic.clear();
}
}
@ -154,25 +154,25 @@ public class ConditionalMana extends Mana implements Serializable {
public void clear(ManaType manaType) {
switch (manaType) {
case BLACK:
black = 0;
black.clear();
break;
case BLUE:
blue = 0;
blue.clear();
break;
case GREEN:
green = 0;
green.clear();
break;
case RED:
red = 0;
red.clear();
break;
case WHITE:
white = 0;
white.clear();
break;
case GENERIC:
generic = 0;
generic.clear();
break;
case COLORLESS:
colorless = 0;
colorless.clear();
break;
}
}
@ -186,7 +186,7 @@ public class ConditionalMana extends Mana implements Serializable {
}
super.add(mana);
}
public String getConditionString() {
String condStr = "[";
for (Condition condition : conditions) {
@ -198,25 +198,25 @@ public class ConditionalMana extends Mana implements Serializable {
public void add(ManaType manaType, int amount) {
switch (manaType) {
case BLACK:
black += amount;
black.incrementAmount(amount, false);
break;
case BLUE:
blue += amount;
blue.incrementAmount(amount, false);
break;
case GREEN:
green += amount;
green.incrementAmount(amount, false);
break;
case RED:
red += amount;
red.incrementAmount(amount, false);
break;
case WHITE:
white += amount;
white.incrementAmount(amount, false);
break;
case COLORLESS:
colorless += amount;
colorless.incrementAmount(amount, false);
break;
case GENERIC:
generic += amount;
generic.incrementAmount(amount, false);
break;
}
}

File diff suppressed because it is too large Load diff

View file

@ -33,10 +33,10 @@ public enum AdamantCondition implements Condition {
if (coloredManaSymbol == null) {
return Arrays
.stream(ColoredManaSymbol.values())
.map(source.getManaCostsToPay().getPayment()::getColor)
.map(source.getManaCostsToPay().getUsedManaToPay()::getColor)
.anyMatch(i -> i > 2);
}
return source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 2;
return source.getManaCostsToPay().getUsedManaToPay().getColor(coloredManaSymbol) > 2;
}
ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class, source.getSourceId());
if (watcher == null) {

View file

@ -28,7 +28,7 @@ public class ManaWasSpentCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (source.getAbilityType() == AbilityType.SPELL) {
return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0);
return (source.getManaCostsToPay().getUsedManaToPay().getColor(coloredManaSymbol) > 0);
}
ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class, source.getSourceId());
if (watcher != null) {

View file

@ -73,6 +73,7 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
@Override
public void clearPaid() {
payment.clear();
usedManaToPay.clear();
super.clearPaid();
}
@ -100,33 +101,33 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
protected boolean assignColored(Ability ability, Game game, ManaPool pool, ColoredManaSymbol mana, Cost costToPay) {
// first check special mana
switch (mana) {
case B:
if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseBlack();
case W:
if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseWhite(1, pool.getLastPaymentWasSnow());
return true;
}
break;
case U:
if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseBlue();
this.payment.increaseBlue(1, pool.getLastPaymentWasSnow());
return true;
}
break;
case W:
if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseWhite();
return true;
}
break;
case G:
if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseGreen();
case B:
if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseBlack(1, pool.getLastPaymentWasSnow());
return true;
}
break;
case R:
if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseRed();
this.payment.increaseRed(1, pool.getLastPaymentWasSnow());
return true;
}
break;
case G:
if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseGreen(1, pool.getLastPaymentWasSnow());
return true;
}
break;
@ -138,7 +139,7 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
int conditionalCount = pool.getConditionalCount(ability, game, null, costToPay);
while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) {
if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseColorless();
this.payment.increaseColorless(1, pool.getLastPaymentWasSnow());
}
break;
}
@ -151,38 +152,50 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
// filterMana can be null, uses for spells like "spend only black mana on X"
// {C}
if ((filterMana == null || filterMana.isColorless()) && pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseColorless();
if ((filterMana == null || filterMana.isColorless()) && pool.pay(
ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay
)) {
this.payment.increaseColorless(1, pool.getLastPaymentWasSnow());
continue;
}
// {B}
if ((filterMana == null || filterMana.isBlack()) && pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseBlack();
if ((filterMana == null || filterMana.isBlack()) && pool.pay(
ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay
)) {
this.payment.increaseBlack(1, pool.getLastPaymentWasSnow());
continue;
}
// {U}
if ((filterMana == null || filterMana.isBlue()) && pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseBlue();
if ((filterMana == null || filterMana.isBlue()) && pool.pay(
ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay
)) {
this.payment.increaseBlue(1, pool.getLastPaymentWasSnow());
continue;
}
// {W}
if ((filterMana == null || filterMana.isWhite()) && pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseWhite();
if ((filterMana == null || filterMana.isWhite()) && pool.pay(
ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay
)) {
this.payment.increaseWhite(1, pool.getLastPaymentWasSnow());
continue;
}
// {G}
if ((filterMana == null || filterMana.isGreen()) && pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseGreen();
if ((filterMana == null || filterMana.isGreen()) && pool.pay(
ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay
)) {
this.payment.increaseGreen(1, pool.getLastPaymentWasSnow());
continue;
}
// {R}
if ((filterMana == null || filterMana.isRed()) && pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay)) {
this.payment.increaseRed();
if ((filterMana == null || filterMana.isRed()) && pool.pay(
ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay
)) {
this.payment.increaseRed(1, pool.getLastPaymentWasSnow());
continue;
}

View file

@ -0,0 +1,49 @@
package mage.abilities.dynamicvalue.common;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.AbilityType;
import mage.game.Game;
import mage.watchers.common.ManaSpentToCastWatcher;
/**
* @author TheElk801
*/
public enum SnowManaSpentValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
if (sourceAbility.getAbilityType() == AbilityType.SPELL) {
return sourceAbility.getManaCostsToPay().getUsedManaToPay().getSnow();
}
ManaSpentToCastWatcher watcher = game.getState().getWatcher(
ManaSpentToCastWatcher.class, sourceAbility.getSourceId()
);
if (watcher == null) {
return 0;
}
Mana payment = watcher.getAndResetLastPayment();
if (payment == null) {
return 0;
}
return payment.getSnow();
}
@Override
public SnowManaSpentValue copy() {
return instance;
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "{S} spent to cast this spell";
}
}

View file

@ -21,7 +21,7 @@ public enum SunburstCount implements DynamicValue {
if (!game.getStack().isEmpty()) {
StackObject spell = game.getStack().getFirst();
if (spell instanceof Spell && ((Spell) spell).getSourceId().equals(sourceAbility.getSourceId())) {
Mana mana = ((Spell) spell).getSpellAbility().getManaCostsToPay().getPayment();
Mana mana = ((Spell) spell).getSpellAbility().getManaCostsToPay().getUsedManaToPay();
if (mana.getBlack() > 0) {
count++;
}

View file

@ -1,8 +1,7 @@
package mage.players;
import java.io.Serializable;
import java.util.*;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
@ -18,6 +17,9 @@ import mage.game.events.ManaEvent;
import mage.game.events.ManaPaidEvent;
import mage.game.stack.Spell;
import java.io.Serializable;
import java.util.*;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -35,12 +37,25 @@ public class ManaPool implements Serializable {
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>();
private static final class ConditionalManaInfo {
private final ManaType manaType;
private final MageObject sourceObject;
private ConditionalManaInfo(ManaType conditionalMana, MageObject sourceObject) {
this.manaType = conditionalMana;
this.sourceObject = sourceObject;
}
}
private boolean lastPaymentWasSnow;
public ManaPool(UUID playerId) {
this.playerId = playerId;
autoPayment = true;
autoPaymentRestricted = true;
unlockedManaType = null;
forcedToPay = false;
lastPaymentWasSnow = false;
}
public ManaPool(final ManaPool pool) {
@ -56,6 +71,7 @@ public class ManaPool implements Serializable {
poolBookmark.add(item.copy());
}
this.doNotEmptyManaTypes.addAll(pool.doNotEmptyManaTypes);
this.lastPaymentWasSnow = pool.lastPaymentWasSnow;
}
public int getRed() {
@ -89,6 +105,7 @@ public class ManaPool implements Serializable {
* @return
*/
public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, Mana usedManaToPay) {
lastPaymentWasSnow = false;
if (!isAutoPayment() && manaType != unlockedManaType) {
// if manual payment and the needed mana type was not unlocked, nothing will be paid
return false;
@ -112,12 +129,13 @@ public class ManaPool implements Serializable {
}
}
// first try to pay from conditional mana (the returned manaType can be changed if AsThoughEffects are active)
ManaType conditionalManaType = getConditional(manaType, ability, filter, game, costToPay, possibleAsThoughPoolManaType);
if (conditionalManaType != null) {
removeConditional(conditionalManaType, ability, game, costToPay, usedManaToPay);
ConditionalManaInfo manaInfo = getConditional(manaType, ability, filter, game, costToPay, possibleAsThoughPoolManaType);
if (manaInfo != null) {
removeConditional(manaInfo, ability, game, costToPay, usedManaToPay);
lockManaType(); // pay only one mana if mana payment is set to manually
return true;
}
lastPaymentWasSnow = false;
for (ManaPoolItem mana : manaItems) {
if (filter != null) {
@ -144,8 +162,9 @@ public class ManaPool implements Serializable {
if (mana.get(usableManaType) > 0) {
GameEvent event = new ManaPaidEvent(ability, mana.getSourceId(), mana.getFlag(), mana.getOriginalId());
game.fireEvent(event);
usedManaToPay.increase(usableManaType);
usedManaToPay.increase(usableManaType, mana.getSourceObject().isSnow());
mana.remove(usableManaType);
lastPaymentWasSnow |= mana.getSourceObject().isSnow();
if (mana.count() == 0) { // so no items with count 0 stay in list
manaItems.remove(mana);
}
@ -160,7 +179,7 @@ public class ManaPool implements Serializable {
return getMana().get(manaType);
}
private ManaType getConditional(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, ManaType possibleAsThoughPoolManaType) {
private ConditionalManaInfo getConditional(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, ManaType possibleAsThoughPoolManaType) {
if (ability == null || getConditionalMana().isEmpty()) {
return null;
}
@ -180,7 +199,7 @@ public class ManaPool implements Serializable {
if (manaTypeToUse != null && mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) {
if (filter == null
|| filter.match(mana.getSourceObject(), game)) {
return manaTypeToUse;
return new ConditionalManaInfo(manaTypeToUse, mana.getSourceObject());
}
}
}
@ -313,7 +332,7 @@ public class ManaPool implements Serializable {
if (mana instanceof ConditionalMana) {
ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game),
((ConditionalMana) mana).getManaProducerOriginalId() != null
? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId());
? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId());
if (emptyOnTurnsEnd) {
item.setDuration(Duration.EndOfTurn);
}
@ -365,11 +384,11 @@ public class ManaPool implements Serializable {
return new ManaPool(this);
}
private void removeConditional(ManaType manaType, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) {
private void removeConditional(ConditionalManaInfo manaInfo, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) {
for (ConditionalMana mana : getConditionalMana()) {
if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
mana.set(manaType, mana.get(manaType) - 1);
usedManaToPay.increase(manaType);
if (mana.get(manaInfo.manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
mana.set(manaInfo.manaType, mana.get(manaInfo.manaType) - 1);
usedManaToPay.increase(manaInfo.manaType, manaInfo.sourceObject.isSnow());
GameEvent event = new ManaPaidEvent(ability, mana.getManaProducerId(), mana.getFlag(), mana.getManaProducerOriginalId());
game.fireEvent(event);
break;
@ -486,4 +505,8 @@ public class ManaPool implements Serializable {
throw new IllegalArgumentException("Wrong mana type " + manaType);
}
}
public boolean getLastPaymentWasSnow() {
return lastPaymentWasSnow;
}
}

View file

@ -162,7 +162,7 @@ public class ManaPoolItem implements Serializable {
}
public Mana getMana() {
return new Mana(red, green, blue, white, black, 0, 0, colorless);
return new Mana(white, blue, black, red, green, 0, 0, colorless);
}
public int count() {

View file

@ -28,7 +28,7 @@ public class ManaSpentToCastWatcher extends Watcher {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = (Spell) game.getObject(event.getTargetId());
if (spell != null && this.getSourceId().equals(spell.getSourceId())) {
payment = spell.getSpellAbility().getManaCostsToPay().getPayment();
payment = spell.getSpellAbility().getManaCostsToPay().getUsedManaToPay();
}
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE

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();