Some changes to framework functions, some minor changes to existing cards.

This commit is contained in:
LevelX2 2014-12-20 18:17:12 +01:00
parent 0ef340d108
commit e4dbb3c9fc
9 changed files with 76 additions and 20 deletions

View file

@ -31,14 +31,21 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileSourceEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
/**
@ -63,7 +70,7 @@ public class InameLifeAspect extends CardImpl {
this.toughness = new MageInt(4);
// When Iname, Life Aspect dies, you may exile it. If you do, return any number of target Spirit cards from your graveyard to your hand.
Ability ability = new DiesTriggeredAbility(new DoIfCostPaid(new ReturnToHandTargetEffect(), new ExileSourceFromGraveCost(), "Exile to return Spirit cards?"), false);
Ability ability = new DiesTriggeredAbility(new InameLifeAspectEffect(), false);
ability.addTarget(new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, filter));
this.addAbility(ability);
}
@ -77,3 +84,34 @@ public class InameLifeAspect extends CardImpl {
return new InameLifeAspect(this);
}
}
class InameLifeAspectEffect extends OneShotEffect {
public InameLifeAspectEffect() {
super(Outcome.Benefit);
this.staticText = "you may exile it. If you do, return any number of target Spirit cards from your graveyard to your hand";
}
public InameLifeAspectEffect(final InameLifeAspectEffect effect) {
super(effect);
}
@Override
public InameLifeAspectEffect copy() {
return new InameLifeAspectEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return Spirit cards?", game)) {
new ExileSourceEffect(Zone.GRAVEYARD).apply(game, source);
return new ReturnToHandTargetEffect().apply(game, source);
}
return true;
}
return false;
}
}

View file

@ -58,7 +58,7 @@ public class OgreBattledriver extends CardImpl {
filter.add(new AnotherPredicate());
}
private String rule = "Whenever another creature enters the battlefield under your control, that creature gets +2/+0 and gains haste until end of turn.";
private final String rule = "Whenever another creature enters the battlefield under your control, that creature gets +2/+0 and gains haste until end of turn.";
public OgreBattledriver(UUID ownerId) {
super(ownerId, 148, "Ogre Battledriver", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");

View file

@ -35,7 +35,6 @@ import mage.MageInt;
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.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;

View file

@ -29,12 +29,13 @@ package mage.sets.urzasdestiny;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -88,7 +89,7 @@ class AcademyRectorEffect extends OneShotEffect {
public AcademyRectorEffect() {
super(Outcome.Benefit);
staticText = "search your library for an enchantment card and put it onto the battlefield. Then shuffle your library";
staticText = "you may exile it. If you do, search your library for an enchantment card and put it onto the battlefield. Then shuffle your library";
}
public AcademyRectorEffect(final AcademyRectorEffect effect) {
@ -98,15 +99,19 @@ class AcademyRectorEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(filter);
target.setNotTarget(true);
controller.searchLibrary(target, game);
Card targetCard = game.getCard(target.getFirstTarget());
if (targetCard != null) {
controller.putOntoBattlefieldWithInfo(targetCard, game, Zone.LIBRARY, source.getSourceId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return Spirit card?", game)) {
new ExileSourceEffect(Zone.GRAVEYARD).apply(game, source);
TargetCardInLibrary target = new TargetCardInLibrary(filter);
target.setNotTarget(true);
controller.searchLibrary(target, game);
Card targetCard = game.getCard(target.getFirstTarget());
if (targetCard != null) {
controller.putOntoBattlefieldWithInfo(targetCard, game, Zone.LIBRARY, source.getSourceId());
}
controller.shuffleLibrary(game);
}
controller.shuffleLibrary(game);
return true;
}
return false;