mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
* Splice on Arcane - Fixed that if a player used an alternate cost to cast the arcane spell (e.g. Nourishing Shoal) splice mana costs were also removed.
This commit is contained in:
parent
2a253baddf
commit
9882948a06
3 changed files with 148 additions and 13 deletions
|
@ -507,7 +507,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
||||||
if (target instanceof TargetDiscard || target instanceof TargetCardInHand) {
|
if (target instanceof TargetDiscard || target instanceof TargetCardInHand) {
|
||||||
if (outcome.isGood()) {
|
if (outcome.isGood()) {
|
||||||
ArrayList<Card> cardsInHand = new ArrayList<>(hand.getCards(game));
|
ArrayList<Card> cardsInHand = new ArrayList<>(hand.getCards(game));
|
||||||
while (!target.isChosen() && !cardsInHand.isEmpty() && target.getMaxNumberOfTargets() < target.getTargets().size()) {
|
while (!target.isChosen() && !cardsInHand.isEmpty() && target.getMaxNumberOfTargets() > target.getTargets().size()) {
|
||||||
Card card = pickBestCard(cardsInHand, null, target, source, game);
|
Card card = pickBestCard(cardsInHand, null, target, source, game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
if (target.canTarget(card.getId(), source, game)) {
|
if (target.canTarget(card.getId(), source, game)) {
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package org.mage.test.cards.abilities.keywords;
|
||||||
|
|
||||||
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SpliceOnArcaneTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that it works to cast Through the Breach
|
||||||
|
* by slicing it on an arcane spell
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSpliceThroughTheBreach() {
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||||
|
// Sorcery - Arcane {R}
|
||||||
|
// Lava Spike deals 3 damage to target player.
|
||||||
|
addCard(Zone.HAND, playerA, "Lava Spike",1);
|
||||||
|
// You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice that creature at the beginning of the next end step.
|
||||||
|
// Splice onto Arcane {2}{R}{R} (As you cast an Arcane spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell.)
|
||||||
|
addCard(Zone.HAND, playerA, "Through the Breach",1);
|
||||||
|
addCard(Zone.HAND, playerA, "Silvercoat Lion",1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lava Spike", playerB);
|
||||||
|
setChoice(playerA, "Silvercoat Lion");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertLife(playerB, 17);
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Lava Spike", 1);
|
||||||
|
assertHandCount(playerA, "Through the Breach", 1);
|
||||||
|
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||||
|
assertAbility(playerA, "Silvercoat Lion", HasteAbility.getInstance(), true);
|
||||||
|
Assert.assertEquals("All available mana has to be used", 0, playerA.getManaAvailable(currentGame).size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSpliceTorrentOfStone() {
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
// Sorcery - Arcane {R}
|
||||||
|
// Lava Spike deals 3 damage to target player.
|
||||||
|
addCard(Zone.HAND, playerA, "Lava Spike",1);
|
||||||
|
// Torrent of Stone deals 4 damage to target creature.
|
||||||
|
// Splice onto Arcane-Sacrifice two Mountains. (As you cast an Arcane spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell.)
|
||||||
|
addCard(Zone.HAND, playerA, "Torrent of Stone",1);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion",1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lava Spike", playerB);
|
||||||
|
addTarget(playerA, "Silvercoat Lion");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertLife(playerB, 17);
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Lava Spike", 1);
|
||||||
|
assertHandCount(playerA, "Torrent of Stone", 1);
|
||||||
|
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||||
|
assertPermanentCount(playerA, "Mountain", 0);
|
||||||
|
Assert.assertEquals("No more mana available", "[]", playerA.getManaAvailable(currentGame).toString());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Nourishing Shoal's interaction with Splicing Through the Breach is
|
||||||
|
* bugged. You should still need to pay 2RR as an additional cost, which is
|
||||||
|
* not affected by the alternate casting method of Shoal, but you are able
|
||||||
|
* to Splice it for free. This is a very relevant bug right now due to the
|
||||||
|
* appearance of the deck over the weekend, and it makes the deck absurdly
|
||||||
|
* powerful.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSpliceThroughTheBreach2() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||||
|
// You may exile a green card with converted mana cost X from your hand rather than pay Nourishing Shoal's mana cost.
|
||||||
|
// You gain X life.
|
||||||
|
addCard(Zone.HAND, playerA, "Nourishing Shoal",1);
|
||||||
|
addCard(Zone.HAND, playerA, "Giant Growth",1);
|
||||||
|
// You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice that creature at the beginning of the next end step.
|
||||||
|
// Splice onto Arcane {2}{R}{R} (As you cast an Arcane spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell.)
|
||||||
|
addCard(Zone.HAND, playerA, "Through the Breach",1);
|
||||||
|
addCard(Zone.HAND, playerA, "Silvercoat Lion",1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nourishing Shoal");
|
||||||
|
setChoice(playerA, "Yes");
|
||||||
|
setChoice(playerA, "Silvercoat Lion");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 21);
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Nourishing Shoal", 1);
|
||||||
|
assertHandCount(playerA, "Through the Breach", 1);
|
||||||
|
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||||
|
assertAbility(playerA, "Silvercoat Lion", HasteAbility.getInstance(), true);
|
||||||
|
|
||||||
|
Assert.assertEquals("All available mana has to be used","[]", playerA.getManaAvailable(currentGame).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -38,7 +38,6 @@ import mage.abilities.costs.CostsImpl;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.SpliceCardEffectImpl;
|
import mage.abilities.effects.SpliceCardEffectImpl;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SpellAbilityType;
|
import mage.constants.SpellAbilityType;
|
||||||
|
@ -105,12 +104,12 @@ import mage.players.Player;
|
||||||
public class SpliceOntoArcaneAbility extends SimpleStaticAbility {
|
public class SpliceOntoArcaneAbility extends SimpleStaticAbility {
|
||||||
|
|
||||||
private static final String KEYWORD_TEXT = "Splice onto Arcane";
|
private static final String KEYWORD_TEXT = "Splice onto Arcane";
|
||||||
private Costs spliceCosts = new CostsImpl();
|
private Costs<Cost> spliceCosts = new CostsImpl<>();
|
||||||
private boolean nonManaCosts = false;
|
private boolean nonManaCosts = false;
|
||||||
|
|
||||||
public SpliceOntoArcaneAbility(String manaString) {
|
public SpliceOntoArcaneAbility(String manaString) {
|
||||||
super(Zone.HAND, new SpliceOntoArcaneEffect());
|
super(Zone.HAND, new SpliceOntoArcaneEffect());
|
||||||
spliceCosts.add(new ManaCostsImpl(manaString));
|
spliceCosts.add(new ManaCostsImpl<>(manaString));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpliceOntoArcaneAbility(Cost cost) {
|
public SpliceOntoArcaneAbility(Cost cost) {
|
||||||
|
@ -144,7 +143,6 @@ public class SpliceOntoArcaneAbility extends SimpleStaticAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class SpliceOntoArcaneEffect extends SpliceCardEffectImpl {
|
class SpliceOntoArcaneEffect extends SpliceCardEffectImpl {
|
||||||
|
|
||||||
public SpliceOntoArcaneEffect() {
|
public SpliceOntoArcaneEffect() {
|
||||||
|
@ -156,8 +154,6 @@ class SpliceOntoArcaneEffect extends SpliceCardEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpliceOntoArcaneEffect copy() {
|
public SpliceOntoArcaneEffect copy() {
|
||||||
return new SpliceOntoArcaneEffect(this);
|
return new SpliceOntoArcaneEffect(this);
|
||||||
|
@ -175,12 +171,7 @@ class SpliceOntoArcaneEffect extends SpliceCardEffectImpl {
|
||||||
splicedAbility.setSourceId(abilityToModify.getSourceId());
|
splicedAbility.setSourceId(abilityToModify.getSourceId());
|
||||||
spell.addSpellAbility(splicedAbility);
|
spell.addSpellAbility(splicedAbility);
|
||||||
for (Iterator it = ((SpliceOntoArcaneAbility) source).getSpliceCosts().iterator(); it.hasNext();) {
|
for (Iterator it = ((SpliceOntoArcaneAbility) source).getSpliceCosts().iterator(); it.hasNext();) {
|
||||||
Cost cost = (Cost) it.next();
|
spell.getSpellAbility().getCosts().add(((Cost) it.next()).copy());
|
||||||
if (cost instanceof ManaCostsImpl) {
|
|
||||||
spell.getSpellAbility().getManaCostsToPay().add((ManaCostsImpl) cost.copy());
|
|
||||||
} else {
|
|
||||||
spell.getSpellAbility().getCosts().add(cost.copy());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue