* Disciple of Bolas - Fixed that the sacrifice was wrongly targeted and not during resolution.

This commit is contained in:
LevelX2 2014-12-02 17:54:09 +01:00
parent 97547e99a4
commit 3d00a00802

View file

@ -28,20 +28,24 @@
package mage.sets.magic2013;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.Target;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
@ -49,13 +53,6 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class DiscipleOfBolas extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(" another creature");
static {
filter.add(new AnotherPredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
}
public DiscipleOfBolas(UUID ownerId) {
super(ownerId, 88, "Disciple of Bolas", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.expansionSetCode = "M13";
@ -67,9 +64,7 @@ public class DiscipleOfBolas extends CardImpl {
this.toughness = new MageInt(1);
// When Disciple of Bolas enters the battlefield, sacrifice another creature. You gain X life and draw X cards, where X is that creature's power.
Ability ability = new EntersBattlefieldTriggeredAbility(new DiscipleOfBolasEffect());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
this.addAbility(new EntersBattlefieldTriggeredAbility(new DiscipleOfBolasEffect()));
}
public DiscipleOfBolas(final DiscipleOfBolas card) {
@ -100,15 +95,22 @@ class DiscipleOfBolasEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent sacrificed = game.getPermanent(source.getFirstTarget());
System.out.println("The target is " + sacrificed.getName());
Player player = game.getPlayer(source.getControllerId());
if (sacrificed != null && player != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature");
filter.add(new AnotherPredicate());
Target target = new TargetControlledCreaturePermanent(1,1, filter, true);
target.setRequired(true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
controller.chooseTarget(outcome, target, source, game);
Permanent sacrificed = game.getPermanent(target.getFirstTarget());
if (sacrificed != null) {
sacrificed.sacrifice(source.getSourceId(), game);
Permanent lastKnownState = (Permanent) game.getLastKnownInformation(sacrificed.getId(), Zone.BATTLEFIELD);
int power = lastKnownState.getPower().getValue();
player.gainLife(power, game);
player.drawCards(power, game);
int power = sacrificed.getPower().getValue();
controller.gainLife(power, game);
controller.drawCards(power, game);
}
}
return true;
}
return false;