mirror of
https://github.com/magefree/mage.git
synced 2026-01-23 19:59:54 -08:00
* Rag Dealer / Serene Reembrance - Fixed target handling for AI.
This commit is contained in:
parent
f43b3d1ee2
commit
9d5327da7a
6 changed files with 98 additions and 67 deletions
|
|
@ -45,6 +45,7 @@ import mage.cards.CardImpl;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInASingleGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -65,7 +66,7 @@ public class RagDealer extends CardImpl<RagDealer> {
|
|||
// {2}{B}, {T}: Exile up to three target cards from a single graveyard.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RagDealerExileEffect(), new ManaCostsImpl("{2}{B}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new RagDealerTargetCardsInGraveyard(0, 3, new FilterCard()));
|
||||
ability.addTarget(new TargetCardInASingleGraveyard(0, 3, new FilterCard("up to three target cards from a single graveyard")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -80,38 +81,6 @@ public class RagDealer extends CardImpl<RagDealer> {
|
|||
|
||||
}
|
||||
|
||||
class RagDealerTargetCardsInGraveyard extends TargetCard<RagDealerTargetCardsInGraveyard> {
|
||||
|
||||
public RagDealerTargetCardsInGraveyard(int minNumTargets, int maxNumTargets, FilterCard filter) {
|
||||
super(minNumTargets, maxNumTargets, Zone.GRAVEYARD, filter);
|
||||
this.targetName = "up to three target cards from a single graveyard";
|
||||
}
|
||||
|
||||
public RagDealerTargetCardsInGraveyard(final RagDealerTargetCardsInGraveyard target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
UUID firstTarget = this.getFirstTarget();
|
||||
if (firstTarget != null) {
|
||||
Card card = game.getCard(firstTarget);
|
||||
Card targetCard = game.getCard(id);
|
||||
if (card == null || targetCard == null
|
||||
|| !card.getOwnerId().equals(targetCard.getOwnerId())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.canTarget(id, source, game);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RagDealerTargetCardsInGraveyard copy() {
|
||||
return new RagDealerTargetCardsInGraveyard(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RagDealerExileEffect extends OneShotEffect<RagDealerExileEffect> {
|
||||
|
||||
public RagDealerExileEffect() {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import mage.filter.FilterCard;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInASingleGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -56,7 +57,7 @@ public class SereneRemembrance extends CardImpl<SereneRemembrance> {
|
|||
|
||||
// Shuffle Serene Remembrance and up to three target cards from a single graveyard into their owners' libraries.
|
||||
this.getSpellAbility().addEffect(new SereneRemembranceEffect());
|
||||
this.getSpellAbility().addTarget(new SereneRemembranceTargetCardsInGraveyard(0,3,new FilterCard()));
|
||||
this.getSpellAbility().addTarget(new TargetCardInASingleGraveyard(0,3,new FilterCard("up to three target cards from a single graveyard")));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -114,35 +115,3 @@ class SereneRemembranceEffect extends OneShotEffect<SereneRemembranceEffect> {
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
class SereneRemembranceTargetCardsInGraveyard extends TargetCard<SereneRemembranceTargetCardsInGraveyard> {
|
||||
|
||||
public SereneRemembranceTargetCardsInGraveyard(int minNumTargets, int maxNumTargets, FilterCard filter) {
|
||||
super(minNumTargets, maxNumTargets, Zone.GRAVEYARD, filter);
|
||||
this.targetName = "up to three target cards from a single graveyard";
|
||||
}
|
||||
|
||||
public SereneRemembranceTargetCardsInGraveyard(final SereneRemembranceTargetCardsInGraveyard target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
UUID firstTarget = this.getFirstTarget();
|
||||
if (firstTarget != null) {
|
||||
Card card = game.getCard(firstTarget);
|
||||
Card targetCard = game.getCard(id);
|
||||
if (card == null || targetCard == null
|
||||
|| !card.getOwnerId().equals(targetCard.getOwnerId())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.canTarget(id, source, game);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SereneRemembranceTargetCardsInGraveyard copy() {
|
||||
return new SereneRemembranceTargetCardsInGraveyard(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,12 @@ public class SarkhanTheMad extends CardImpl<SarkhanTheMad> {
|
|||
this.color.setRed(true);
|
||||
|
||||
this.addAbility(new LoyaltyAbility(new SarkhanTheMadRevealAndDrawEffect(), 0));
|
||||
|
||||
Target targetCreature = new TargetCreaturePermanent();
|
||||
Ability sacAbility = new LoyaltyAbility(new SarkhanTheMadSacEffect(), -2);
|
||||
sacAbility.addTarget(targetCreature);
|
||||
this.addAbility(sacAbility);
|
||||
|
||||
Ability damageAbility = new LoyaltyAbility(new SarkhanTheMadDragonDamageEffect(), -4);
|
||||
damageAbility.addTarget(new TargetPlayer());
|
||||
this.addAbility(damageAbility);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue