mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
* Goblin Clearcutter - fixed that tapped for mana replacement effects ignore his mana;
This commit is contained in:
parent
860c57d9d9
commit
fe0717cbc7
3 changed files with 73 additions and 25 deletions
|
|
@ -1,16 +1,12 @@
|
||||||
|
|
||||||
package mage.cards.g;
|
package mage.cards.g;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.ManaEffect;
|
||||||
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.choices.Choice;
|
import mage.choices.Choice;
|
||||||
|
|
@ -24,6 +20,8 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BursegSardaukar
|
* @author BursegSardaukar
|
||||||
*/
|
*/
|
||||||
|
|
@ -43,7 +41,7 @@ public final class GoblinClearcutter extends CardImpl {
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
// {T}, Sacrifice a Forest: Add three mana in any combination of {R} and/or {G}.
|
// {T}, Sacrifice a Forest: Add three mana in any combination of {R} and/or {G}.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GoblinClearCutterEffect(), new TapSourceCost());
|
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new GoblinClearCutterManaEffect(), new TapSourceCost());
|
||||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
@ -58,24 +56,37 @@ public final class GoblinClearcutter extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GoblinClearCutterEffect extends OneShotEffect {
|
// TODO: replace by mana effect to use with mana reflection
|
||||||
|
class GoblinClearCutterManaEffect extends ManaEffect {
|
||||||
|
|
||||||
public GoblinClearCutterEffect() {
|
private List<Mana> netMana = new ArrayList<>();
|
||||||
super(Outcome.PutManaInPool);
|
|
||||||
|
public GoblinClearCutterManaEffect() {
|
||||||
|
super();
|
||||||
this.staticText = "Add 3 mana in any combination of {R} and/or {G}";
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GoblinClearCutterEffect(final GoblinClearCutterEffect effect) {
|
public GoblinClearCutterManaEffect(final GoblinClearCutterManaEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
netMana.addAll(effect.netMana);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GoblinClearCutterEffect copy() {
|
public GoblinClearCutterManaEffect copy() {
|
||||||
return new GoblinClearCutterEffect(this);
|
return new GoblinClearCutterManaEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public List<Mana> getNetMana(Game game, Ability source) {
|
||||||
|
return netMana;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mana produceMana(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
Choice manaChoice = new ChoiceImpl();
|
Choice manaChoice = new ChoiceImpl();
|
||||||
|
|
@ -85,10 +96,10 @@ class GoblinClearCutterEffect extends OneShotEffect {
|
||||||
manaChoice.setChoices(choices);
|
manaChoice.setChoices(choices);
|
||||||
manaChoice.setMessage("Select color of mana to add");
|
manaChoice.setMessage("Select color of mana to add");
|
||||||
|
|
||||||
|
Mana mana = new Mana();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
Mana mana = new Mana();
|
|
||||||
if (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
if (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
switch (manaChoice.getChoice()) {
|
switch (manaChoice.getChoice()) {
|
||||||
case "Green":
|
case "Green":
|
||||||
|
|
@ -98,10 +109,9 @@ class GoblinClearCutterEffect extends OneShotEffect {
|
||||||
mana.increaseRed();
|
mana.increaseRed();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
player.getManaPool().addMana(mana, game, source);
|
|
||||||
}
|
}
|
||||||
return true;
|
return mana;
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,5 @@
|
||||||
package mage.cards.o;
|
package mage.cards.o;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -25,8 +20,9 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class OrcishLumberjack extends CardImpl {
|
public final class OrcishLumberjack extends CardImpl {
|
||||||
|
|
@ -76,6 +72,7 @@ class OrcishLumberjackManaEffect extends ManaEffect {
|
||||||
|
|
||||||
public OrcishLumberjackManaEffect(final OrcishLumberjackManaEffect effect) {
|
public OrcishLumberjackManaEffect(final OrcishLumberjackManaEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
netMana.addAll(effect.netMana);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -133,4 +133,45 @@ public class TappedForManaFromMultipleEffects extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerA, "Chrome Mox", 1);
|
assertPermanentCount(playerA, "Chrome Mox", 1);
|
||||||
assertExileCount(playerA, "Balduvian Bears", 1);
|
assertExileCount(playerA, "Balduvian Bears", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_GoblinClearcutter_Direct() {
|
||||||
|
// {T}, Sacrifice a Forest: Add three mana in any combination of {R} and/or {G}.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Goblin Clearcutter", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||||
|
|
||||||
|
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}, Sacrifice a Fo");
|
||||||
|
setChoice(playerA, "Forest"); // sacrifice
|
||||||
|
setChoice(playerA, "Green");
|
||||||
|
setChoice(playerA, "Green");
|
||||||
|
setChoice(playerA, "Green");
|
||||||
|
checkManaPool("must produce green", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "G", 3);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_GoblinClearcutter_WithManaReflect() {
|
||||||
|
// {T}, Sacrifice a Forest: Add three mana in any combination of {R} and/or {G}.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Goblin Clearcutter", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||||
|
//
|
||||||
|
// If you tap a permanent for mana, it produces twice as much of that mana instead.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mana Reflection", 1);
|
||||||
|
|
||||||
|
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}, Sacrifice a Fo");
|
||||||
|
setChoice(playerA, "Forest"); // sacrifice
|
||||||
|
setChoice(playerA, "Green");
|
||||||
|
setChoice(playerA, "Green");
|
||||||
|
setChoice(playerA, "Green");
|
||||||
|
checkManaPool("must produce green", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "G", 3 * 2); // double by mana reflect
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue