mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Bestow - Fixed a bug that casting a bestow creature as enchantment aura triggered enteres the battlefield events as creatures (e.g. triggering evolve).
This commit is contained in:
parent
126d628d63
commit
38f922a200
3 changed files with 62 additions and 1 deletions
|
@ -86,4 +86,55 @@ public class BestowTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Hopeful Eidolon", 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that cast with bestow does not trigger evolve
|
||||
*/
|
||||
@Test
|
||||
public void bestowEnchantmentDoesNotTriggerEvolve() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silent Artisan");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Experiment One");
|
||||
addCard(Zone.HAND, playerA, "Boon Satyr");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Experiment One");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Boon Satyr using bestow", "Silent Artisan");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
// because Boon Satyr is no creature on the battlefield, evolve may not trigger
|
||||
assertPermanentCount(playerA, "Silent Artisan", 1);
|
||||
assertPowerToughness(playerA, "Silent Artisan", 7, 7);
|
||||
assertPermanentCount(playerA, "Experiment One", 1);
|
||||
assertPowerToughness(playerA, "Experiment One", 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the bestow enchantment becomes a creature if the enchanted creature dies
|
||||
*/
|
||||
@Test
|
||||
public void bestowEnchantmentBecomesCreature() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.HAND, playerA, "Hopeful Eidolon");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hopeful Eidolon using bestow", "Silvercoat Lion");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Silvercoat Lion");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
// because Boon Satyr is no creature on the battlefield, evolve may not trigger
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 0);
|
||||
assertPermanentCount(playerA, "Hopeful Eidolon", 1);
|
||||
assertPowerToughness(playerA, "Hopeful Eidolon", 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class EvolveAbility extends TriggeredAbilityImpl<EvolveAbility> {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && !event.getTargetId().equals(this.getSourceId())) {
|
||||
Permanent triggeringCreature = game.getPermanent(event.getTargetId());
|
||||
if (triggeringCreature != null
|
||||
&& triggeringCreature.getCardType().contains(CardType.CREATURE)
|
||||
|
|
|
@ -57,6 +57,7 @@ import mage.counters.Counter;
|
|||
import mage.counters.Counters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetAmount;
|
||||
|
@ -200,11 +201,20 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
if (ability.getTargets().stillLegal(ability, game)) {
|
||||
updateOptionalCosts(0);
|
||||
if (card.putOntoBattlefield(game, fromZone, ability.getId(), controllerId)) {
|
||||
if (this.getSpellAbility() instanceof BestowAbility) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
// Must be removed first time, after that will be removed by continous effect
|
||||
// Otherwise effects like evolve trigger from creature comes into play event
|
||||
permanent.getCardType().remove(CardType.CREATURE);
|
||||
}
|
||||
}
|
||||
game.getState().handleSimultaneousEvent(game);
|
||||
return ability.resolve(game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Aura has no legal target and its a bestow enchantment -> Add it to battlefield as creature
|
||||
if (this.getSpellAbility() instanceof BestowAbility) {
|
||||
updateOptionalCosts(0);
|
||||
result = card.putOntoBattlefield(game, fromZone, ability.getId(), controllerId);
|
||||
|
|
Loading…
Reference in a new issue