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()) { 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.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.costs.common.ExileSourceFromGraveCost; import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileSourceEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
/** /**
@ -63,7 +70,7 @@ public class InameLifeAspect extends CardImpl {
this.toughness = new MageInt(4); 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. // 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)); ability.addTarget(new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, filter));
this.addAbility(ability); this.addAbility(ability);
} }
@ -77,3 +84,34 @@ public class InameLifeAspect extends CardImpl {
return new InameLifeAspect(this); 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()); 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) { public OgreBattledriver(UUID ownerId) {
super(ownerId, 148, "Ogre Battledriver", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); 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.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.OpponentControllsMoreCondition; import mage.abilities.condition.common.OpponentControllsMoreCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;

View file

@ -29,12 +29,13 @@ package mage.sets.urzasdestiny;
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.DiesTriggeredAbility; import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.costs.common.ExileSourceFromGraveCost; import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileSourceEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -88,7 +89,7 @@ class AcademyRectorEffect extends OneShotEffect {
public AcademyRectorEffect() { public AcademyRectorEffect() {
super(Outcome.Benefit); 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) { public AcademyRectorEffect(final AcademyRectorEffect effect) {
@ -98,15 +99,19 @@ class AcademyRectorEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { MageObject sourceObject = game.getObject(source.getSourceId());
TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller != null && sourceObject != null) {
target.setNotTarget(true); if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return Spirit card?", game)) {
controller.searchLibrary(target, game); new ExileSourceEffect(Zone.GRAVEYARD).apply(game, source);
Card targetCard = game.getCard(target.getFirstTarget()); TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (targetCard != null) { target.setNotTarget(true);
controller.putOntoBattlefieldWithInfo(targetCard, game, Zone.LIBRARY, source.getSourceId()); 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 true;
} }
return false; return false;

View file

@ -23,4 +23,11 @@ public class CastFromHandCondition implements Condition {
} }
return false; 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; return staticText;
} }
if (otherwiseEffect == null) { 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); 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) { public BushidoAbility(int value) {
this(new StaticValue(value)); this(new StaticValue(value));
rule = new StringBuilder("Bushido ").append(value).toString(); rule = "Bushido " + value + getReminder(Integer.toString(value));
} }
public BushidoAbility(DynamicValue value) { public BushidoAbility(DynamicValue value) {
super(new BoostSourceEffect(value, value, Duration.EndOfTurn, true), false); super(new BoostSourceEffect(value, value, Duration.EndOfTurn, true), false);
if (rule == null) { if (!(value instanceof StaticValue)) {
rule = new StringBuilder("{this} has bushido X, where X is ").append(value.getMessage()).toString(); 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; 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) { public BushidoAbility(final BushidoAbility ability) {
super(ability); super(ability);
this.value = ability.value; 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?) // 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()); Card card = game.getCard(source.getSourceId());
if (card != null) { 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; return false;
} }