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

@ -112,7 +112,7 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
}
}
if (!names.isEmpty()) {
abilityView.getRules().add("<i>Targets: " + names.toString() + "</i>");
abilityView.getRules().add("<i>Related to: " + names.toString() + "</i>");
}
}
}

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;

View file

@ -23,4 +23,11 @@ public class CastFromHandCondition implements Condition {
}
return false;
}
@Override
public String toString() {
return "you cast it from your hand";
}
}

View file

@ -93,7 +93,7 @@ public class ConditionalOneShotEffect extends OneShotEffect {
return staticText;
}
if (otherwiseEffect == null) {
return "If " + condition.toString() + ", " + effect.getText(mode);
return "if " + condition.toString() + ", " + effect.getText(mode);
}
return effect.getText(mode) + ". If " + condition.toString() + ", " + otherwiseEffect.getText(mode);
}

View file

@ -43,18 +43,21 @@ public class BushidoAbility extends BlocksOrBecomesBlockedTriggeredAbility {
public BushidoAbility(int value) {
this(new StaticValue(value));
rule = new StringBuilder("Bushido ").append(value).toString();
rule = "Bushido " + value + getReminder(Integer.toString(value));
}
public BushidoAbility(DynamicValue value) {
super(new BoostSourceEffect(value, value, Duration.EndOfTurn, true), false);
if (rule == null) {
rule = new StringBuilder("{this} has bushido X, where X is ").append(value.getMessage()).toString();
if (!(value instanceof StaticValue)) {
rule = "{this} has bushido X, where X is " + value.getMessage() + getReminder(value.toString());
}
rule = new StringBuilder(rule).append(" <i>(When this blocks or becomes blocked, it gets +").append(value.toString()).append("/+").append(value.toString()).append(" until end of turn.)</i>").toString();
this.value = value;
}
static String getReminder(String xValue) {
return " <i>(When this blocks or becomes blocked, it gets +" + xValue+ "/+" + xValue + " until end of turn.)</i>";
}
public BushidoAbility(final BushidoAbility ability) {
super(ability);
this.value = ability.value;

View file

@ -201,7 +201,11 @@ class SpliceOntoArcaneEffect extends SpliceCardEffectImpl {
// check if spell can be activated (protection problem not solved because effect will be used from the base spell?)
Card card = game.getCard(source.getSourceId());
if (card != null) {
return card.getSpellAbility().canActivate(source.getControllerId(), game);
if (card.getManaCost().isEmpty()) { // e.g. Evermind
return card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game);
} else {
return card.getSpellAbility().canActivate(source.getControllerId(), game);
}
}
return false;
}