mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
* Emerge Ability - Fixed that the creature to sacrifice had to be selcted twice.
This commit is contained in:
parent
42ed2f64e7
commit
9933420f57
1 changed files with 10 additions and 7 deletions
|
@ -2,7 +2,6 @@ package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
|
||||||
import mage.abilities.costs.mana.ManaCost;
|
import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.mana.ManaOptions;
|
import mage.abilities.mana.ManaOptions;
|
||||||
|
@ -11,7 +10,6 @@ import mage.constants.Outcome;
|
||||||
import mage.constants.SpellAbilityType;
|
import mage.constants.SpellAbilityType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.CardIdPredicate;
|
|
||||||
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;
|
||||||
|
@ -92,11 +90,16 @@ public class EmergeAbility extends SpellAbility {
|
||||||
TargetPermanent target = new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("creature to sacrifice for emerge"));
|
TargetPermanent target = new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("creature to sacrifice for emerge"));
|
||||||
if (controller.choose(Outcome.Sacrifice, target, this.getSourceId(), game)) {
|
if (controller.choose(Outcome.Sacrifice, target, this.getSourceId(), game)) {
|
||||||
Permanent creature = game.getPermanent(target.getFirstTarget());
|
Permanent creature = game.getPermanent(target.getFirstTarget());
|
||||||
|
if (creature != null) {
|
||||||
CardUtil.reduceCost(this, creature.getConvertedManaCost());
|
CardUtil.reduceCost(this, creature.getConvertedManaCost());
|
||||||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(creature.getLogName());
|
if (super.activate(game, false)) {
|
||||||
filter.add(new CardIdPredicate(creature.getId()));
|
if (creature.sacrifice(getSourceId(), game)) {
|
||||||
this.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter)));
|
return true;
|
||||||
return super.activate(game, false);
|
} else {
|
||||||
|
activated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue