mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Morselhoarder - Fixed calculation of available mana and some cleanup to other mana abilities (#6698).
This commit is contained in:
parent
98ebcc07ca
commit
4d43914673
8 changed files with 42 additions and 60 deletions
|
@ -1,7 +1,5 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mage.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -124,21 +122,6 @@ class GrandArchitectManaAbility extends ActivatedManaAbilityImpl {
|
|||
this.filter = ability.filter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
if (game != null && game.inCheckPlayableState()) {
|
||||
int count = game.getBattlefield().count(filter, getSourceId(), getControllerId(), game);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GrandArchitectManaAbility copy() {
|
||||
return new GrandArchitectManaAbility(this);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -7,8 +6,9 @@ import mage.Mana;
|
|||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
||||
import mage.abilities.dynamicvalue.common.CountersSourceCount;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -24,17 +24,17 @@ import mage.counters.CounterType;
|
|||
public final class Morselhoarder extends CardImpl {
|
||||
|
||||
public Morselhoarder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R/G}{R/G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R/G}{R/G}");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Morselhoarder enters the battlefield with two -1/-1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(2), false)));
|
||||
|
||||
|
||||
// Remove a -1/-1 counter from Morselhoarder: Add one mana of any color.
|
||||
this.addAbility(new MorselhoarderAbility());
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Morselhoarder(final Morselhoarder card) {
|
||||
|
@ -48,13 +48,14 @@ public final class Morselhoarder extends CardImpl {
|
|||
}
|
||||
|
||||
class MorselhoarderAbility extends ActivatedManaAbilityImpl {
|
||||
|
||||
public MorselhoarderAbility() {
|
||||
this(new RemoveCountersSourceCost(CounterType.M1M1.createInstance()));
|
||||
}
|
||||
|
||||
public MorselhoarderAbility(Cost cost) {
|
||||
super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), cost);
|
||||
this.netMana.add(new Mana(0,0,0,0,0,0,1, 0));
|
||||
super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(1, new CountersSourceCount(CounterType.M1M1), false), cost);
|
||||
this.netMana.add(new Mana(0, 0, 0, 0, 0, 0, 1, 0));
|
||||
}
|
||||
|
||||
public MorselhoarderAbility(final MorselhoarderAbility ability) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
|
@ -20,8 +21,6 @@ import mage.filter.FilterCard;
|
|||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
@ -36,10 +35,10 @@ public final class MyrReservoir extends CardImpl {
|
|||
public MyrReservoir(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// {tap}: Add {C}{C}. Spend this mana only to cast Myr spells or activate abilities of Myr.
|
||||
// {T}: Add {C}{C}. Spend this mana only to cast Myr spells or activate abilities of Myr.
|
||||
this.addAbility(new MyrReservoirManaAbility());
|
||||
|
||||
// {3}, {tap}: Return target Myr card from your graveyard to your hand.
|
||||
// {3}, {T}: Return target Myr card from your graveyard to your hand.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new GenericManaCost(3));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetCardInYourGraveyard(myrCardFilter));
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package mage.cards.n;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
@ -17,11 +21,6 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
@ -69,14 +68,6 @@ class NykthosShrineToNyxManaAbility extends ActivatedManaAbilityImpl {
|
|||
return new NykthosShrineToNyxManaAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
if (game != null) {
|
||||
netMana.addAll(((ManaEffect) this.getEffects().get(0)).getNetMana(game, this));
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
}
|
||||
|
||||
class NykthosDynamicManaEffect extends ManaEffect {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package mage.cards.n;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
|
@ -16,11 +20,6 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
@ -68,14 +67,6 @@ class NyxLotusManaAbility extends ActivatedManaAbilityImpl {
|
|||
return new NyxLotusManaAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
if (game != null) {
|
||||
netMana.addAll(((ManaEffect) this.getEffects().get(0)).getNetMana(game, this));
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
}
|
||||
|
||||
class NyxLotusDynamicManaEffect extends ManaEffect {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class AngelOfJubilationTest extends CardTestPlayerBase {
|
|||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{2}, Sacrifice a permanent you control: Return target creature to its owner's hand.");
|
||||
addTarget(playerB, "Angel of Jubilation"); // return to hand
|
||||
setChoice(playerB, "Food Chain"); // cacrifice cost
|
||||
setChoice(playerB, "Food Chain"); // sacrifice cost
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
|
|
|
@ -278,4 +278,22 @@ public class TappedForManaRelatedTest extends CardTestPlayerBase {
|
|||
assertManaOptions("{W}{B}{B}{B}", manaOptions);
|
||||
assertManaOptions("{B}{B}{B}{B}", manaOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestMorselhoarder() {
|
||||
setStrictChooseMode(true);
|
||||
// Morselhoarder enters the battlefield with two -1/-1 counters on it.
|
||||
// Remove a -1/-1 counter from Morselhoarder: Add one mana of any color.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Morselhoarder", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{B}{B}{Any}{Any}{Any}{Any}", manaOptions);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package mage.abilities.mana;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
@ -13,10 +16,6 @@ import mage.game.Game;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -87,7 +86,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl
|
|||
*/
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
if (netMana.isEmpty()) {
|
||||
if (netMana.isEmpty() || (game != null && game.inCheckPlayableState())) {
|
||||
List<Mana> dynamicNetMana = new ArrayList<>();
|
||||
for (Effect effect : getEffects()) {
|
||||
if (effect instanceof ManaEffect) {
|
||||
|
|
Loading…
Reference in a new issue