mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Fixed available mana generation of Druids Repository, Workhouse, Iceberg, Krak Clan Ironworks, Rasputin Dreamweaver and Sirk Prospector (#6698).
This commit is contained in:
parent
82a9726a35
commit
b5c93cf2da
9 changed files with 99 additions and 7 deletions
|
@ -2,9 +2,11 @@
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AttacksCreatureYouControlTriggeredAbility;
|
import mage.abilities.common.AttacksCreatureYouControlTriggeredAbility;
|
||||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||||
|
import mage.abilities.dynamicvalue.common.CountersSourceCount;
|
||||||
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.mana.SimpleManaAbility;
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
|
@ -29,7 +31,9 @@ public final class DruidsRepository extends CardImpl {
|
||||||
this.addAbility(new AttacksCreatureYouControlTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance())));
|
this.addAbility(new AttacksCreatureYouControlTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance())));
|
||||||
|
|
||||||
// Remove a charge counter from Druids' Repository: Add one mana of any color.
|
// Remove a charge counter from Druids' Repository: Add one mana of any color.
|
||||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
|
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, Mana.AnyMana(1),
|
||||||
|
new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()),
|
||||||
|
new CountersSourceCount(CounterType.CHARGE));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.dynamicvalue.common.CountersSourceCount;
|
||||||
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
|
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.mana.SimpleManaAbility;
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
|
@ -32,7 +33,9 @@ public final class Iceberg extends CardImpl {
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.ICE.createInstance(1)), new ManaCostsImpl("{3}")));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.ICE.createInstance(1)), new ManaCostsImpl("{3}")));
|
||||||
|
|
||||||
// Remove an ice counter from Iceberg: Add {C}.
|
// Remove an ice counter from Iceberg: Add {C}.
|
||||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new RemoveCountersSourceCost(CounterType.ICE.createInstance(1))));
|
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1),
|
||||||
|
new RemoveCountersSourceCost(CounterType.ICE.createInstance(1)),
|
||||||
|
new CountersSourceCount(CounterType.ICE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iceberg(final Iceberg card) {
|
public Iceberg(final Iceberg card) {
|
||||||
|
|
|
@ -5,11 +5,13 @@ import java.util.UUID;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
|
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||||
import mage.abilities.mana.SimpleManaAbility;
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
import mage.filter.common.FilterControlledArtifactPermanent;
|
import mage.filter.common.FilterControlledArtifactPermanent;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
|
@ -23,7 +25,9 @@ public final class KrarkClanIronworks extends CardImpl {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
|
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
|
||||||
|
|
||||||
// Sacrifice an artifact: Add {C}{C}.
|
// Sacrifice an artifact: Add {C}{C}.
|
||||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(2), new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact"))));
|
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(2),
|
||||||
|
new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact"))),
|
||||||
|
new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
|
import mage.abilities.dynamicvalue.common.CountersSourceCount;
|
||||||
import mage.abilities.effects.common.PreventDamageToSourceEffect;
|
import mage.abilities.effects.common.PreventDamageToSourceEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.mana.SimpleManaAbility;
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
|
@ -47,7 +48,9 @@ public final class RasputinDreamweaver extends CardImpl {
|
||||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.DREAM.createInstance(7)), "seven dream counters on it"));
|
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.DREAM.createInstance(7)), "seven dream counters on it"));
|
||||||
|
|
||||||
// Remove a dream counter from Rasputin: Add {C}.
|
// Remove a dream counter from Rasputin: Add {C}.
|
||||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new RemoveCountersSourceCost(CounterType.DREAM.createInstance())));
|
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1),
|
||||||
|
new RemoveCountersSourceCost(CounterType.DREAM.createInstance()),
|
||||||
|
new CountersSourceCount(CounterType.DREAM)));
|
||||||
|
|
||||||
// Remove a dream counter from Rasputin: Prevent the next 1 damage that would be dealt to Rasputin this turn.
|
// Remove a dream counter from Rasputin: Prevent the next 1 damage that would be dealt to Rasputin this turn.
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToSourceEffect(Duration.EndOfTurn, 1), new RemoveCountersSourceCost(CounterType.DREAM.createInstance())));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToSourceEffect(Duration.EndOfTurn, 1), new RemoveCountersSourceCost(CounterType.DREAM.createInstance())));
|
||||||
|
|
|
@ -5,12 +5,14 @@ import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
|
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||||
import mage.abilities.mana.SimpleManaAbility;
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
|
|
||||||
|
@ -34,7 +36,9 @@ public final class SkirkProspector extends CardImpl {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// Sacrifice a Goblin: Add {R}.
|
// Sacrifice a Goblin: Add {R}.
|
||||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.RedMana(1), new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,filter,true))));
|
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.RedMana(1),
|
||||||
|
new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,filter,true)),
|
||||||
|
new PermanentsOnBattlefieldCount(filter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkirkProspector(final SkirkProspector card) {
|
public SkirkProspector(final SkirkProspector card) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import mage.MageInt;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||||
|
import mage.abilities.dynamicvalue.common.CountersSourceCount;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.mana.SimpleManaAbility;
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -32,7 +33,8 @@ public final class Workhorse extends CardImpl {
|
||||||
|
|
||||||
// Remove a +1/+1 counter from Workhorse: Add {C}.
|
// Remove a +1/+1 counter from Workhorse: Add {C}.
|
||||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1),
|
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1),
|
||||||
new RemoveCountersSourceCost(CounterType.P1P1.createInstance())));
|
new RemoveCountersSourceCost(CounterType.P1P1.createInstance()),
|
||||||
|
new CountersSourceCount(CounterType.P1P1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Workhorse(final Workhorse card) {
|
public Workhorse(final Workhorse card) {
|
||||||
|
|
|
@ -343,4 +343,21 @@ public class TappedForManaRelatedTest extends CardTestPlayerBase {
|
||||||
assertManaOptions("{G}{G}{G}{G}{G}{G}{G}", manaOptions);
|
assertManaOptions("{G}{G}{G}{G}{G}{G}{G}", manaOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestWorkhorse() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
// Workhorse enters the battlefield with four +1/+1 counters on it.
|
||||||
|
// Remove a +1/+1 counter from Workhorse: Add {C}.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Workhorse", 1);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||||
|
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||||
|
assertManaOptions("{C}{C}{C}{C}", manaOptions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,74 @@
|
||||||
package mage.abilities.effects.mana;
|
package mage.abilities.effects.mana;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import mage.ConditionalMana;
|
import mage.ConditionalMana;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.common.ManaEffect;
|
import mage.abilities.effects.common.ManaEffect;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
public class BasicManaEffect extends ManaEffect {
|
public class BasicManaEffect extends ManaEffect {
|
||||||
|
|
||||||
protected Mana manaTemplate;
|
protected Mana manaTemplate;
|
||||||
|
private final DynamicValue netAmount;
|
||||||
|
|
||||||
public BasicManaEffect(Mana mana) {
|
public BasicManaEffect(Mana mana) {
|
||||||
|
this(mana, null);
|
||||||
|
this.manaTemplate = mana;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasicManaEffect(Mana mana, DynamicValue netAmount) {
|
||||||
super();
|
super();
|
||||||
this.manaTemplate = mana;
|
this.manaTemplate = mana;
|
||||||
staticText = "add " + mana.toString();
|
staticText = "add " + mana.toString();
|
||||||
|
this.netAmount = netAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasicManaEffect(ConditionalMana conditionalMana) {
|
public BasicManaEffect(ConditionalMana conditionalMana) {
|
||||||
super();
|
super();
|
||||||
this.manaTemplate = conditionalMana;
|
this.manaTemplate = conditionalMana;
|
||||||
staticText = "add " + manaTemplate.toString() + " " + conditionalMana.getDescription();
|
staticText = "add " + manaTemplate.toString() + " " + conditionalMana.getDescription();
|
||||||
|
this.netAmount = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasicManaEffect(final BasicManaEffect effect) {
|
public BasicManaEffect(final BasicManaEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.manaTemplate = effect.manaTemplate.copy();
|
this.manaTemplate = effect.manaTemplate.copy();
|
||||||
|
this.netAmount = effect.netAmount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Mana> getNetMana(Game game, Ability source) {
|
||||||
|
if (game != null && game.inCheckPlayableState() && netAmount != null) {
|
||||||
|
// calculate the maximum available mana
|
||||||
|
int count = netAmount.calculate(game, source, this);
|
||||||
|
Mana computedMana = new Mana();
|
||||||
|
if (manaTemplate.getBlack() > 0) {
|
||||||
|
computedMana.setBlack(count * manaTemplate.getBlack());
|
||||||
|
} else if (manaTemplate.getBlue() > 0) {
|
||||||
|
computedMana.setBlue(count * manaTemplate.getBlue());
|
||||||
|
} else if (manaTemplate.getGreen() > 0) {
|
||||||
|
computedMana.setGreen(count * manaTemplate.getGreen());
|
||||||
|
} else if (manaTemplate.getRed() > 0) {
|
||||||
|
computedMana.setRed(count * manaTemplate.getRed());
|
||||||
|
} else if (manaTemplate.getWhite() > 0) {
|
||||||
|
computedMana.setWhite(count * manaTemplate.getWhite());
|
||||||
|
} else if (manaTemplate.getColorless() > 0) {
|
||||||
|
computedMana.setColorless(count * manaTemplate.getColorless());
|
||||||
|
} else if (manaTemplate.getAny() > 0) {
|
||||||
|
computedMana.setAny(count * manaTemplate.getAny());
|
||||||
|
} else if (manaTemplate.getGeneric() > 0){
|
||||||
|
computedMana.setGeneric(count * manaTemplate.getGeneric());
|
||||||
|
}
|
||||||
|
return new ArrayList<>(Arrays.asList(computedMana));
|
||||||
|
}
|
||||||
|
return super.getNetMana(game, source);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BasicManaEffect copy() {
|
public BasicManaEffect copy() {
|
||||||
return new BasicManaEffect(this);
|
return new BasicManaEffect(this);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.common.ManaEffect;
|
import mage.abilities.effects.common.ManaEffect;
|
||||||
import mage.abilities.effects.mana.BasicManaEffect;
|
import mage.abilities.effects.mana.BasicManaEffect;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
@ -35,7 +36,20 @@ public class SimpleManaAbility extends ActivatedManaAbilityImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleManaAbility(Zone zone, Mana mana, Cost cost) {
|
public SimpleManaAbility(Zone zone, Mana mana, Cost cost) {
|
||||||
super(zone, new BasicManaEffect(mana), cost);
|
this(zone, mana, cost, null);
|
||||||
|
this.netMana.add(mana.copy());
|
||||||
|
this.predictable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param zone
|
||||||
|
* @param mana
|
||||||
|
* @param cost cost for one usage
|
||||||
|
* @param netAmount DynamicValu to calculate the max available mana if effect is repeatable
|
||||||
|
*/
|
||||||
|
public SimpleManaAbility(Zone zone, Mana mana, Cost cost, DynamicValue netAmount) {
|
||||||
|
super(zone, new BasicManaEffect(mana, netAmount), cost);
|
||||||
this.netMana.add(mana.copy());
|
this.netMana.add(mana.copy());
|
||||||
this.predictable = true;
|
this.predictable = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue