mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
* Chorid - Fixed handling of cost to pay.
This commit is contained in:
parent
53964ee80c
commit
87e21dadaa
4 changed files with 49 additions and 78 deletions
|
@ -29,18 +29,13 @@
|
||||||
package mage.sets.darksteel;
|
package mage.sets.darksteel;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.effects.common.DestroyAllEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
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.FilterPermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
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 {
|
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) {
|
public Soulscour (UUID ownerId) {
|
||||||
super(ownerId, 14, "Soulscour", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{7}{W}{W}{W}");
|
super(ownerId, 14, "Soulscour", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{7}{W}{W}{W}");
|
||||||
this.expansionSetCode = "DST";
|
this.expansionSetCode = "DST";
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
this.getSpellAbility().addEffect(new SoulscourEffect());
|
|
||||||
|
// Destroy all nonartifact permanents.
|
||||||
|
this.getSpellAbility().addEffect(new DestroyAllEffect(filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Soulscour (final Soulscour card) {
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ package mage.sets.theros;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -108,14 +109,16 @@ class DaxosOfMeletisEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
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));
|
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||||
if (damagedPlayer != null) {
|
if (damagedPlayer != null) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||||
Card card = damagedPlayer.getLibrary().getFromTop(game);
|
Card card = damagedPlayer.getLibrary().getFromTop(game);
|
||||||
if (card != null && controller != null) {
|
if (card != null) {
|
||||||
// move card to exile
|
// 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
|
// player gains life
|
||||||
int cmc = card.getManaCost().convertedManaCost();
|
int cmc = card.getManaCost().convertedManaCost();
|
||||||
if (cmc > 0) {
|
if (cmc > 0) {
|
||||||
|
@ -131,6 +134,7 @@ class DaxosOfMeletisEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
|
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
|
||||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||||
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
|
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
|
||||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
@ -71,13 +72,10 @@ public class Ichorid extends CardImpl {
|
||||||
// At the beginning of the end step, sacrifice Ichorid.
|
// At the beginning of the end step, sacrifice Ichorid.
|
||||||
this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new SacrificeSourceEffect(), false));
|
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.
|
// 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("a black creature card other than Ichorid from your graveyard");
|
||||||
FilterCard filter = new FilterCreatureCard("an other black creature card from your graveyard");
|
|
||||||
filter.add(Predicates.not(new CardIdPredicate(this.getId())));
|
filter.add(Predicates.not(new CardIdPredicate(this.getId())));
|
||||||
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
||||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
|
Ability ability = new IchoridTriggerdAbility(filter);
|
||||||
target.setRequired(false);
|
|
||||||
ability.addCost(new ExileFromGraveCost(target));
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -94,8 +92,10 @@ public class Ichorid extends CardImpl {
|
||||||
|
|
||||||
class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
|
class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
|
||||||
|
|
||||||
public IchoridTriggerdAbility(){
|
public IchoridTriggerdAbility(FilterCard filter){
|
||||||
super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), TargetController.YOU, false);
|
super(Zone.GRAVEYARD,
|
||||||
|
new DoIfCostPaid(new ReturnSourceFromGraveyardToBattlefieldEffect(), new ExileFromGraveCost(new TargetCardInYourGraveyard(filter))),
|
||||||
|
TargetController.YOU, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IchoridTriggerdAbility(IchoridTriggerdAbility ability) {
|
public IchoridTriggerdAbility(IchoridTriggerdAbility ability) {
|
||||||
|
@ -107,7 +107,6 @@ class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
|
||||||
return new IchoridTriggerdAbility(this);
|
return new IchoridTriggerdAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInterveningIfClause(Game game) {
|
public boolean checkInterveningIfClause(Game game) {
|
||||||
Player controller = game.getPlayer(controllerId);
|
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";
|
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue