mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* Disciple of Bolas - Fixed that the sacrifice was wrongly targeted and not during resolution.
This commit is contained in:
parent
97547e99a4
commit
3d00a00802
1 changed files with 25 additions and 23 deletions
|
|
@ -28,20 +28,24 @@
|
||||||
package mage.sets.magic2013;
|
package mage.sets.magic2013;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.*;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
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.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
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.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 {
|
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) {
|
public DiscipleOfBolas(UUID ownerId) {
|
||||||
super(ownerId, 88, "Disciple of Bolas", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}");
|
super(ownerId, 88, "Disciple of Bolas", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}");
|
||||||
this.expansionSetCode = "M13";
|
this.expansionSetCode = "M13";
|
||||||
|
|
@ -67,9 +64,7 @@ public class DiscipleOfBolas extends CardImpl {
|
||||||
this.toughness = new MageInt(1);
|
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.
|
// 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());
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new DiscipleOfBolasEffect()));
|
||||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
|
||||||
this.addAbility(ability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscipleOfBolas(final DiscipleOfBolas card) {
|
public DiscipleOfBolas(final DiscipleOfBolas card) {
|
||||||
|
|
@ -100,15 +95,22 @@ class DiscipleOfBolasEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent sacrificed = game.getPermanent(source.getFirstTarget());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
System.out.println("The target is " + sacrificed.getName());
|
if (controller != null) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature");
|
||||||
if (sacrificed != null && player != null) {
|
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);
|
sacrificed.sacrifice(source.getSourceId(), game);
|
||||||
Permanent lastKnownState = (Permanent) game.getLastKnownInformation(sacrificed.getId(), Zone.BATTLEFIELD);
|
int power = sacrificed.getPower().getValue();
|
||||||
int power = lastKnownState.getPower().getValue();
|
controller.gainLife(power, game);
|
||||||
player.gainLife(power, game);
|
controller.drawCards(power, game);
|
||||||
player.drawCards(power, game);
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue