Some minor changes to cards.

This commit is contained in:
LevelX2 2014-08-20 17:09:19 +02:00
parent 8af2b78f3c
commit 4665348ca7
6 changed files with 23 additions and 82 deletions

View file

@ -30,6 +30,7 @@ package mage.sets.magic2015;
import java.util.LinkedList;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -211,13 +212,13 @@ class ConstrictingSliverReturnExiledCreatureEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
ExileZone exile = game.getExile().getExileZone(source.getSourceId());
Card sourceCard = game.getCard(source.getSourceId());
if (exile != null && sourceCard != null) {
MageObject sourceObject = game.getObject(source.getSourceId());
if (exile != null && sourceObject != null) {
LinkedList<UUID> cards = new LinkedList<>(exile);
for (UUID cardId : cards) {
Card card = game.getCard(cardId);
card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": ").append(card.getName()).append(" returns to battlefield from exile").toString());
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ").append(card.getName()).append(" returns to battlefield from exile").toString());
}
exile.clear();
return true;

View file

@ -95,7 +95,7 @@ class HushwingGryffEffect extends ContinuousRuleModifiyingEffectImpl {
MageObject mageObject = game.getObject(event.getSourceId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (mageObject != null && sourceObject != null) {
return sourceObject + " prevented ability of " + mageObject + " to trigger";
return sourceObject.getLogName() + " prevented ability of " + mageObject.getLogName() + " to trigger";
}
return null;
}

View file

@ -35,6 +35,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.OpponentControllsMoreCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
@ -67,7 +68,7 @@ public class WeatheredWayfarer extends CardImpl {
Zone.BATTLEFIELD,
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterLandCard()), true, true),
new ManaCostsImpl("{W}"),
new OpponentControllsMoreLandCondition());
new OpponentControllsMoreCondition(new FilterLandPermanent("lands")));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
@ -81,24 +82,3 @@ public class WeatheredWayfarer extends CardImpl {
return new WeatheredWayfarer(this);
}
}
class OpponentControllsMoreLandCondition implements Condition {
private static final FilterPermanent filter = new FilterLandPermanent();
@Override
public boolean apply(Game game, Ability source) {
int numLands = game.getBattlefield().countAll(filter, source.getControllerId(), game);
for (UUID opponentId: game.getOpponents(source.getControllerId())) {
if (numLands < game.getBattlefield().countAll(filter, opponentId, game)) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "an opponent controls more lands than you";
}
}

View file

@ -30,18 +30,16 @@ package mage.sets.shardsofalara;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.ZoneChangeTriggeredAbility;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.OpponentControllsMoreCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.common.FilterBySubtypeCard;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
/**
@ -59,8 +57,15 @@ public class KnightOfTheWhiteOrchid extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new KnightOfTheWhiteOrchidAbility());
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// When Knight of the White Orchid enters the battlefield, if an opponent controls more lands than you, you may search your library for a Plains card, put it onto the battlefield, then shuffle your library.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, new FilterBySubtypeCard("Plains")), true), true),
new OpponentControllsMoreCondition(new FilterLandPermanent("lands")),
"When {this} enters the battlefield, if an opponent controls more lands than you, you may search your library for a Plains card, put it onto the battlefield, then shuffle your library"));
}
public KnightOfTheWhiteOrchid(final KnightOfTheWhiteOrchid card) {
@ -73,40 +78,3 @@ public class KnightOfTheWhiteOrchid extends CardImpl {
}
}
class KnightOfTheWhiteOrchidAbility extends ZoneChangeTriggeredAbility {
private static final FilterCard filter1 = new FilterCard("Plains");
private static final FilterLandPermanent filter2 = new FilterLandPermanent();
static {
filter1.add(new SubtypePredicate("Plains"));
}
public KnightOfTheWhiteOrchidAbility() {
super(Zone.BATTLEFIELD, null, "When {this} enters the battlefield, if an opponent controls more lands than you, you may ", true);
TargetCardInLibrary target = new TargetCardInLibrary(filter1);
addEffect(new SearchLibraryPutInPlayEffect(target, false, Outcome.PutLandInPlay));
}
public KnightOfTheWhiteOrchidAbility(final KnightOfTheWhiteOrchidAbility ability) {
super(ability);
}
@Override
public KnightOfTheWhiteOrchidAbility copy() {
return new KnightOfTheWhiteOrchidAbility(this);
}
@Override
public boolean checkInterveningIfClause(Game game) {
int numLands = game.getBattlefield().countAll(filter2, this.controllerId, game);
for (UUID opponentId: game.getOpponents(this.controllerId)) {
if (numLands < game.getBattlefield().countAll(filter2, opponentId, game)) {
return true;
}
}
return false;
}
}

View file

@ -29,7 +29,6 @@ package mage.sets.tempest;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -46,7 +45,6 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.permanent.token.SaprolingToken;
import mage.game.permanent.token.Token;
import mage.target.TargetPermanent;

View file

@ -34,8 +34,7 @@ import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.common.FilterBySubtypeCard;
import mage.target.common.TargetCardInLibrary;
/**
@ -44,12 +43,6 @@ import mage.target.common.TargetCardInLibrary;
*/
public class KorCartographer extends CardImpl {
private static final FilterCard filter = new FilterCard("Plains card");
static {
filter.add(new SubtypePredicate("Plains"));
}
public KorCartographer(UUID ownerId) {
super(ownerId, 18, "Kor Cartographer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "ZEN";
@ -60,7 +53,8 @@ public class KorCartographer extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), true));
// When Kor Cartographer enters the battlefield, you may search your library for a Plains card, put it onto the battlefield tapped, then shuffle your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterBySubtypeCard("Plains")), true), true));
}
public KorCartographer(final KorCartographer card) {