mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* Butcher of Malakir - Fixed that ability triggers for any dying creature instead of only controlled creatures.
This commit is contained in:
parent
ae697db2d8
commit
dec4794fbc
1 changed files with 9 additions and 19 deletions
|
|
@ -27,28 +27,24 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.worldwake;
|
package mage.sets.worldwake;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
|
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -57,6 +53,9 @@ import mage.target.common.TargetControlledPermanent;
|
||||||
public class ButcherOfMalakir extends CardImpl<ButcherOfMalakir> {
|
public class ButcherOfMalakir extends CardImpl<ButcherOfMalakir> {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
|
||||||
|
static {
|
||||||
|
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||||
|
}
|
||||||
|
|
||||||
public ButcherOfMalakir(UUID ownerId) {
|
public ButcherOfMalakir(UUID ownerId) {
|
||||||
super(ownerId, 53, "Butcher of Malakir", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
|
super(ownerId, 53, "Butcher of Malakir", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
|
||||||
|
|
@ -102,22 +101,13 @@ class ButcherOfMalakirEffect extends OneShotEffect<ButcherOfMalakirEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
FilterControlledPermanent filter = new FilterControlledPermanent("creature you control");
|
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
|
||||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
|
||||||
|
|
||||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
|
||||||
for (UUID opponentId : opponents) {
|
|
||||||
Player player = game.getPlayer(opponentId);
|
Player player = game.getPlayer(opponentId);
|
||||||
Target target = new TargetControlledPermanent(filter);
|
Target target = new TargetControlledCreaturePermanent(true);
|
||||||
|
|
||||||
if (target.canChoose(player.getId(), game)) {
|
if (target.canChoose(player.getId(), game)) {
|
||||||
while (!target.isChosen() && target.canChoose(player.getId(), game)) {
|
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||||
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
|
||||||
}
|
|
||||||
|
|
||||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||||
|
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue