Benthic Explorers - fixed that it doesn't allow to cast spells with opponent's mana (#6698);

This commit is contained in:
Oleg Agafonov 2020-07-05 06:25:07 +04:00
parent e2792881d5
commit 7b57865071
3 changed files with 55 additions and 12 deletions

View file

@ -21,6 +21,7 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -45,13 +46,12 @@ public final class BenthicExplorers extends CardImpl {
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// {tap}, Untap a tapped land an opponent controls: Add one mana of any type that land could produce. // {T}, Untap a tapped land an opponent controls: Add one mana of any type that land could produce.
Ability ability = new BenthicExplorersManaAbility(); Ability ability = new BenthicExplorersManaAbility();
TargetLandPermanent targetOpponentLand = new TargetLandPermanent(filter); ability.addCost(new BenthicExplorersCost(
targetOpponentLand.setNotTarget(true); // not a target, it is chosen new TargetLandPermanent(1, 1, filter, true)
ability.addCost(new BenthicExplorersCost(targetOpponentLand)); ));
this.addAbility(ability); this.addAbility(ability);
} }
private BenthicExplorers(final BenthicExplorers card) { private BenthicExplorers(final BenthicExplorers card) {
@ -136,7 +136,20 @@ class BenthicExplorersManaEffect extends ManaEffect {
@Override @Override
public List<Mana> getNetMana(Game game, Ability source) { public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> netManas = new ArrayList<>(); List<Mana> netManas = new ArrayList<>();
Mana types = getManaTypes(game, source);
Mana types = new Mana();
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(opponentId)) {
if (permanent.isLand() && permanent.isTapped()) {
for (ActivatedManaAbilityImpl ability : permanent.getAbilities(game).getActivatedManaAbilities(Zone.BATTLEFIELD)) {
for (Mana mana : ability.getNetMana(game)) {
types.add(mana);
}
}
}
}
}
if (types.getBlack() > 0) { if (types.getBlack() > 0) {
netManas.add(new Mana(ColoredManaSymbol.B)); netManas.add(new Mana(ColoredManaSymbol.B));
} }

View file

@ -1,7 +1,5 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -14,8 +12,9 @@ import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/** /**
*
* @author jonubuu * @author jonubuu
*/ */
public final class RishadanPort extends CardImpl { public final class RishadanPort extends CardImpl {
@ -23,9 +22,9 @@ public final class RishadanPort extends CardImpl {
public RishadanPort(UUID ownerId, CardSetInfo setInfo) { public RishadanPort(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null); super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
// {tap}: Add {C}. // {T}: Add {C}.
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {1}, {tap}: Tap target land. // {1}, {T}: Tap target land.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new GenericManaCost(1)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetLandPermanent()); ability.addTarget(new TargetLandPermanent());

View file

@ -182,4 +182,35 @@ public class CostReduceForEachTest extends CardTestPlayerBaseWithAIHelps {
assertGraveyardCount(playerA, "Shower of Coals", 1); assertGraveyardCount(playerA, "Shower of Coals", 1);
} }
@Test
public void test_BenthicExplorers_ManaAbilityFromOpponentCard() {
// {T}, Untap a tapped land an opponent controls: Add one mana of any type that land could produce.
addCard(Zone.BATTLEFIELD, playerA, "Benthic Explorers", 1);
//
addCard(Zone.HAND, playerA, "Balduvian Bears", 1); // {1}{G}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
addCard(Zone.BATTLEFIELD, playerB, "Forest", 1); // give 1 mana
//
// {1}, {T}: Tap target land.
addCard(Zone.BATTLEFIELD, playerA, "Rishadan Port", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
// prepare tapped land
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}, {T}: Tap target land", "Forest");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentTapped("must be tapped", 1, PhaseStep.PRECOMBAT_MAIN, playerA, playerB, "Forest", true, 1);
// cast with opponent's mana
checkPlayableAbility("must play", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Balduvian Bears", true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears");
setChoice(playerA, "Forest"); // mana from tapped
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Balduvian Bears", 1);
}
} }