mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Bestow - Fixed that the converted mana costs were calculated from the bestow costs instead of the base cost of the spell.
This commit is contained in:
parent
0a9c49b1e1
commit
091fa9a528
3 changed files with 60 additions and 8 deletions
|
@ -231,5 +231,45 @@ public class BestowTest extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerA, "Nyxborn Rollicker", 0);
|
assertPermanentCount(playerA, "Nyxborn Rollicker", 0);
|
||||||
assertGraveyardCount(playerA, "Nyxborn Rollicker", 1);
|
assertGraveyardCount(playerA, "Nyxborn Rollicker", 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that CMC of a spell cast with bestowed is correct
|
||||||
|
* Disdainful Stroke doesn't check converted mana cost correctly. Opponent was
|
||||||
|
* able to use it to counter a Hypnotic Siren cast with Bestow.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void bestowCheckForCorrectCMC() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 7);
|
||||||
|
// Enchantment Creature — Siren
|
||||||
|
// 1/1
|
||||||
|
// Bestow {5}{U}{U} (If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)
|
||||||
|
// Flying
|
||||||
|
// You control enchanted creature.
|
||||||
|
// Enchanted creature gets +1/+1 and has flying.
|
||||||
|
addCard(Zone.HAND, playerA, "Hypnotic Siren");
|
||||||
|
// Instant {1}{U}
|
||||||
|
// Counter target spell with converted mana cost 4 or greater.
|
||||||
|
addCard(Zone.HAND, playerB, "Disdainful Stroke");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hypnotic Siren using bestow", "Silvercoat Lion");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Disdainful Stroke", "Hypnotic Siren");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
//
|
||||||
|
assertHandCount(playerA, "Hypnotic Siren", 0);
|
||||||
|
assertGraveyardCount(playerA, "Hypnotic Siren", 0);
|
||||||
|
assertHandCount(playerB, "Disdainful Stroke", 1);
|
||||||
|
assertPermanentCount(playerA, "Hypnotic Siren", 1);
|
||||||
|
|
||||||
|
// because cast with bestow, Boon Satyr may not be tapped
|
||||||
|
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||||
|
assertPowerToughness(playerA, "Silvercoat Lion", 3,3);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import static mage.constants.Layer.TypeChangingEffects_4;
|
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SpellAbilityType;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.constants.TimingRule;
|
import mage.constants.TimingRule;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
@ -108,6 +109,7 @@ public class BestowAbility extends SpellAbility {
|
||||||
|
|
||||||
public BestowAbility(Card card, String manaString) {
|
public BestowAbility(Card card, String manaString) {
|
||||||
super(new ManaCostsImpl(manaString), card.getName() + " using bestow");
|
super(new ManaCostsImpl(manaString), card.getName() + " using bestow");
|
||||||
|
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||||
this.timing = TimingRule.SORCERY;
|
this.timing = TimingRule.SORCERY;
|
||||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||||
this.addTarget(auraTarget);
|
this.addTarget(auraTarget);
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
package mage.game.stack;
|
package mage.game.stack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
|
@ -47,7 +50,11 @@ import mage.abilities.keyword.BestowAbility;
|
||||||
import mage.abilities.keyword.MorphAbility;
|
import mage.abilities.keyword.MorphAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.SplitCard;
|
import mage.cards.SplitCard;
|
||||||
import mage.constants.*;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.SpellAbilityType;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.counters.Counter;
|
import mage.counters.Counter;
|
||||||
import mage.counters.Counters;
|
import mage.counters.Counters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -59,10 +66,6 @@ import mage.target.Target;
|
||||||
import mage.target.TargetAmount;
|
import mage.target.TargetAmount;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -181,7 +184,7 @@ public class Spell implements StackObject, Card {
|
||||||
// if muliple modes are selected, and there are modes with targets, then at least one mode has to have a legal target or
|
// if muliple modes are selected, and there are modes with targets, then at least one mode has to have a legal target or
|
||||||
// When resolving a fused split spell with multiple targets, treat it as you would any spell with multiple targets.
|
// When resolving a fused split spell with multiple targets, treat it as you would any spell with multiple targets.
|
||||||
// If all targets are illegal when the spell tries to resolve, the spell is countered and none of its effects happen.
|
// If all targets are illegal when the spell tries to resolve, the spell is countered and none of its effects happen.
|
||||||
// If at least one target is still legal at that time, the spell resolves, but an illegal target can’t perform any actions
|
// If at least one target is still legal at that time, the spell resolves, but an illegal target can't perform any actions
|
||||||
// or have any actions performed on it.
|
// or have any actions performed on it.
|
||||||
legalParts |= spellAbilityHasLegalParts(spellAbility, game);
|
legalParts |= spellAbilityHasLegalParts(spellAbility, game);
|
||||||
}
|
}
|
||||||
|
@ -635,7 +638,14 @@ public class Spell implements StackObject, Card {
|
||||||
index = symbolString.indexOf("{X}");
|
index = symbolString.indexOf("{X}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmc += spellAbility.getManaCosts().convertedManaCost() + spellAbility.getManaCostsToPay().getX() * xMultiplier;
|
if (this.getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||||
|
cmc += spellAbility.getManaCostsToPay().getX() * xMultiplier;
|
||||||
|
} else {
|
||||||
|
cmc += spellAbility.getManaCosts().convertedManaCost() + spellAbility.getManaCostsToPay().getX() * xMultiplier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||||
|
cmc += getCard().getManaCost().convertedManaCost();
|
||||||
}
|
}
|
||||||
return cmc;
|
return cmc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue