* Helm of Obedience - Fixed that the Helm of Obedience was always sacrified also if no creature was put to battlefield (fixes #6862).

This commit is contained in:
LevelX2 2020-07-20 10:37:03 +02:00
parent 5cb950e53f
commit 6fd304ec5f
2 changed files with 13 additions and 11 deletions

View file

@ -1,5 +1,9 @@
package mage.cards.h;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -19,11 +23,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetOpponent;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author Plopman
*/
@ -57,10 +56,10 @@ class HelmOfObedienceEffect extends OneShotEffect {
HelmOfObedienceEffect() {
super(Outcome.Detriment);
staticText = "Target opponent mills a card, then repeats this process until a creature card " +
"or X cards have been put into their graveyard this way, whichever comes first. " +
"If one or more creature cards were put into that graveyard this way, " +
"sacrifice {this} and put one of them onto the battlefield under your control. X can't be 0";
staticText = "Target opponent mills a card, then repeats this process until a creature card "
+ "or X cards have been put into their graveyard this way, whichever comes first. "
+ "If one or more creature cards were put into that graveyard this way, "
+ "sacrifice {this} and put one of them onto the battlefield under your control. X can't be 0";
}
private HelmOfObedienceEffect(final HelmOfObedienceEffect effect) {
@ -94,13 +93,16 @@ class HelmOfObedienceEffect extends OneShotEffect {
if (!creatures.isEmpty()) {
controller.moveCards(creatures, Zone.BATTLEFIELD, source, game);
}
if (!creatures.isEmpty() || numberOfCard >= max) {
if (!creatures.isEmpty()) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
}
break;
}
if (numberOfCard >= max) {
break;
}
}
return true;
}

View file

@ -1,4 +1,3 @@
package mage.cards.k;
import java.util.UUID;
@ -40,6 +39,7 @@ public final class KalastriaHighborn extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Kalastria Highborn or another Vampire you control dies, you may pay {B}. If you do, target player loses 2 life and you gain 2 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new DoIfCostPaid(new LoseGainEffect(), new ManaCostsImpl("{B}")), false, filter);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);