* Chorid - Fixed handling of cost to pay.

This commit is contained in:
LevelX2 2014-06-28 17:56:38 +02:00
parent 53964ee80c
commit 87e21dadaa
4 changed files with 49 additions and 78 deletions

View file

@ -29,18 +29,13 @@
package mage.sets.darksteel;
import java.util.UUID;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -48,11 +43,19 @@ import mage.game.permanent.Permanent;
*/
public class Soulscour extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("nonartifact permanents");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
}
public Soulscour (UUID ownerId) {
super(ownerId, 14, "Soulscour", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{7}{W}{W}{W}");
this.expansionSetCode = "DST";
this.color.setWhite(true);
this.getSpellAbility().addEffect(new SoulscourEffect());
// Destroy all nonartifact permanents.
this.getSpellAbility().addEffect(new DestroyAllEffect(filter));
}
public Soulscour (final Soulscour card) {
@ -65,36 +68,3 @@ public class Soulscour extends CardImpl {
}
}
class SoulscourEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent("");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
}
public SoulscourEffect() {
super(Outcome.DestroyPermanent);
staticText = "Destroy all nonartifact permanents";
}
public SoulscourEffect(final SoulscourEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.destroy(source.getId(), game, false);
}
return true;
}
@Override
public SoulscourEffect copy() {
return new SoulscourEffect(this);
}
}

View file

@ -29,6 +29,7 @@ package mage.sets.theros;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -108,14 +109,16 @@ class DaxosOfMeletisEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (damagedPlayer != null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
UUID exileId = CardUtil.getCardExileZoneId(game, source);
Card card = damagedPlayer.getLibrary().getFromTop(game);
if (card != null && controller != null) {
if (card != null) {
// move card to exile
card.moveToExile(exileId, "Daxos of Meletis", source.getSourceId(), game);
controller.moveCardToExileWithInfo(card, exileId, sourceObject.getLogName(), source.getSourceId(), game, Zone.LIBRARY);
// player gains life
int cmc = card.getManaCost().convertedManaCost();
if (cmc > 0) {
@ -131,6 +134,7 @@ class DaxosOfMeletisEffect extends OneShotEffect {
}
return true;
}
}
return false;
}
}

View file

@ -34,6 +34,7 @@ import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility;
@ -71,13 +72,10 @@ public class Ichorid extends CardImpl {
// At the beginning of the end step, sacrifice Ichorid.
this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new SacrificeSourceEffect(), false));
// At the beginning of your upkeep, if Ichorid is in your graveyard, you may exile a black creature card other than Ichorid from your graveyard. If you do, return Ichorid to the battlefield.
Ability ability = new IchoridTriggerdAbility();
FilterCard filter = new FilterCreatureCard("an other black creature card from your graveyard");
FilterCard filter = new FilterCreatureCard("a black creature card other than Ichorid from your graveyard");
filter.add(Predicates.not(new CardIdPredicate(this.getId())));
filter.add(new ColorPredicate(ObjectColor.BLACK));
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
target.setRequired(false);
ability.addCost(new ExileFromGraveCost(target));
Ability ability = new IchoridTriggerdAbility(filter);
this.addAbility(ability);
}
@ -94,8 +92,10 @@ public class Ichorid extends CardImpl {
class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
public IchoridTriggerdAbility(){
super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), TargetController.YOU, false);
public IchoridTriggerdAbility(FilterCard filter){
super(Zone.GRAVEYARD,
new DoIfCostPaid(new ReturnSourceFromGraveyardToBattlefieldEffect(), new ExileFromGraveCost(new TargetCardInYourGraveyard(filter))),
TargetController.YOU, false);
}
public IchoridTriggerdAbility(IchoridTriggerdAbility ability) {
@ -107,7 +107,6 @@ class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
return new IchoridTriggerdAbility(this);
}
@Override
public boolean checkInterveningIfClause(Game game) {
Player controller = game.getPlayer(controllerId);
@ -122,6 +121,4 @@ class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
return "At the beginning of your upkeep, if {source} is in your graveyard, you may exile a black creature card other than {source} from your graveyard. If you do, return {source} to the battlefield";
}
}