mirror of
https://github.com/correl/mage.git
synced 2025-04-06 09:13:45 -09:00
* Daretti, Scrap Savant - Fixed that the triggered emblem effect did also move the artifact if it already left the graveyard meanwhile.
This commit is contained in:
parent
25ade412f4
commit
1a722267be
1 changed files with 13 additions and 12 deletions
|
@ -75,7 +75,6 @@ public class DarettiScrapSavant extends CardImpl {
|
||||||
this.expansionSetCode = "C14";
|
this.expansionSetCode = "C14";
|
||||||
this.subtype.add("Daretti");
|
this.subtype.add("Daretti");
|
||||||
|
|
||||||
|
|
||||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
|
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
|
||||||
|
|
||||||
// +2: Discard up to two cards, then draw that many cards.
|
// +2: Discard up to two cards, then draw that many cards.
|
||||||
|
@ -126,7 +125,7 @@ class DarettiDiscardDrawEffect extends OneShotEffect {
|
||||||
TargetDiscard target = new TargetDiscard(0, 2, new FilterCard(), controller.getId());
|
TargetDiscard target = new TargetDiscard(0, 2, new FilterCard(), controller.getId());
|
||||||
target.choose(outcome, controller.getId(), source.getSourceId(), game);
|
target.choose(outcome, controller.getId(), source.getSourceId(), game);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (UUID cardId: target.getTargets()) {
|
for (UUID cardId : target.getTargets()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
controller.discard(card, source, game);
|
controller.discard(card, source, game);
|
||||||
|
@ -160,9 +159,9 @@ class DarettiSacrificeEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Target target = new TargetControlledPermanent(1,1,new FilterControlledArtifactPermanent(), true);
|
Target target = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);
|
||||||
if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
|
if (target.canChoose(source.getSourceId(), controller.getId(), game)
|
||||||
controller.chooseTarget(outcome, target, source, game)) {
|
&& controller.chooseTarget(outcome, target, source, game)) {
|
||||||
Permanent artifact = game.getPermanent(target.getFirstTarget());
|
Permanent artifact = game.getPermanent(target.getFirstTarget());
|
||||||
if (artifact != null && artifact.sacrifice(source.getSourceId(), game)) {
|
if (artifact != null && artifact.sacrifice(source.getSourceId(), game)) {
|
||||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
|
@ -178,7 +177,9 @@ class DarettiSacrificeEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DarettiScrapSavantEmblem extends Emblem {
|
class DarettiScrapSavantEmblem extends Emblem {
|
||||||
|
|
||||||
// You get an emblem with "Whenever an artifact is put into your graveyard from the battlefield, return that card to the battlefield at the beginning of the next end step."
|
// You get an emblem with "Whenever an artifact is put into your graveyard from the battlefield, return that card to the battlefield at the beginning of the next end step."
|
||||||
|
|
||||||
public DarettiScrapSavantEmblem() {
|
public DarettiScrapSavantEmblem() {
|
||||||
this.setName("Emblem - Daretti");
|
this.setName("Emblem - Daretti");
|
||||||
this.getAbilities().add(new DarettiScrapSavantTriggeredAbility());
|
this.getAbilities().add(new DarettiScrapSavantTriggeredAbility());
|
||||||
|
@ -208,10 +209,10 @@ class DarettiScrapSavantTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
if (zEvent.getToZone() == Zone.GRAVEYARD &&
|
if (zEvent.getToZone() == Zone.GRAVEYARD
|
||||||
zEvent.getFromZone() == Zone.BATTLEFIELD &&
|
&& zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||||
zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) &&
|
&& zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)
|
||||||
zEvent.getTarget().getOwnerId().equals(this.controllerId)) {
|
&& zEvent.getTarget().getOwnerId().equals(this.controllerId)) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
|
||||||
}
|
}
|
||||||
|
@ -245,9 +246,9 @@ class DarettiScrapSavantEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (card != null) {
|
if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) {
|
||||||
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||||
effect.setText("return that card to the battlefield at the beginning of the next end step");
|
effect.setText("return that card to the battlefield at the beginning of the next end step");
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY);
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY);
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
|
Loading…
Add table
Reference in a new issue