Some minor changes to tooltip generation.

This commit is contained in:
LevelX2 2014-11-16 09:16:37 +01:00
parent 2c6c3e0311
commit a75dda1464
8 changed files with 72 additions and 27 deletions

View file

@ -29,10 +29,10 @@ package mage.sets.odyssey;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.keyword.ProtectionAbility;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -42,7 +42,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
*/
public class BelovedChaplain extends CardImpl {
public static final FilterCard filter = new FilterCard("creature");
public static final FilterCard filter = new FilterCard("creatures");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));

View file

@ -35,7 +35,6 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInControllerGraveCondition;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.ExileCardFromOwnGraveyardControllerEffect;
@ -49,8 +48,6 @@ import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.target.common.TargetCardInYourGraveyard;
/**
*

View file

@ -68,8 +68,8 @@ public class CabalInquisitor extends CardImpl {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Threshold - {1}{B}, {tap}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard.
Ability ability = new ActivateAsSorceryConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{1}{B}"), new CardsInControllerGraveCondition(7), "<br/><br/><i>Threshold</i> - {1}{B}, {tap}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard.");
// Threshold - {1}{B}, {T}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard.
Ability ability = new ActivateAsSorceryConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{1}{B}"), new CardsInControllerGraveCondition(7), "<br/><br/><i>Threshold</i> - {1}{B}, {T}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard.");
ability.addTarget(new TargetPlayer());
ability.addCost(new TapSourceCost());
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(2, new FilterCard("cards from your graveyard"))));

View file

@ -29,13 +29,20 @@ package mage.sets.planechase;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -53,7 +60,7 @@ public class IvyElemental extends CardImpl {
this.toughness = new MageInt(0);
// Ivy Elemental enters the battlefield with X +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(), new ManacostVariableValue(), true), "with X +1/+1 counters on it"));
this.addAbility(new EntersBattlefieldAbility(new IvyElementalEntersBattlefieldEffect() ,"with X +1/+1 counters on it"));
}
public IvyElemental(final IvyElemental card) {
@ -65,3 +72,41 @@ public class IvyElemental extends CardImpl {
return new IvyElemental(this);
}
}
class IvyElementalEntersBattlefieldEffect extends OneShotEffect {
public IvyElementalEntersBattlefieldEffect() {
super(Outcome.BoostCreature);
staticText = "{this} enters the battlefield with X +1/+1 counters on it";
}
public IvyElementalEntersBattlefieldEffect(final IvyElementalEntersBattlefieldEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
if (obj != null && obj instanceof SpellAbility) {
// delete to prevent using it again if put into battlefield from other effect
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
SpellAbility spellAbility = (SpellAbility) obj;
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
int amount = spellAbility.getManaCostsToPay().getX();
if (amount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
}
}
}
}
return true;
}
@Override
public IvyElementalEntersBattlefieldEffect copy() {
return new IvyElementalEntersBattlefieldEffect(this);
}
}

View file

@ -28,6 +28,7 @@
package mage.sets.returntoravnica;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.constants.CardType;
import mage.constants.Rarity;
@ -52,7 +53,9 @@ public class SavageSurge extends CardImpl {
// Target creature gets +2/+2 until end of turn. Untap that creature.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new UntapTargetEffect());
Effect effect = new UntapTargetEffect();
effect.setText("Untap that creature");
this.getSpellAbility().addEffect(effect);
}
public SavageSurge(final SavageSurge card) {

View file

@ -68,29 +68,26 @@ public class DiscardTargetCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.cards.clear();
Player player = game.getPlayer(controllerId);
if (player == null) {
return false;
}
int amount = this.getTargets().get(0).getNumberOfTargets();
if (randomDiscard) {
int amount = this.getTargets().get(0).getMaxNumberOfTargets();
int maxAmount = Math.min(amount, player.getHand().size());
for (int i = 0; i < maxAmount; i++) {
Card card = player.getHand().getRandom(game);
if (card != null) {
paid |= player.discard(card, null, game);
}
}
this.cards.addAll(player.discard(amount, true, ability, game).getCards(game));
} else {
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
for (UUID targetId: targets.get(0).getTargets()) {
Card card = player.getHand().get(targetId, game);
if (card == null) {
return false;
}
this.cards.add(card.copy());
paid |= player.discard(card, ability, game);
}
}
}
paid = cards.size() >= amount;
return paid;
}

View file

@ -81,7 +81,7 @@ public class ExileCardFromOwnGraveyardControllerEffect extends OneShotEffect {
}
private String setText() {
StringBuilder sb = new StringBuilder("Exile ");
StringBuilder sb = new StringBuilder("exile ");
if (amount == 1) {
sb.append(" a card ");
} else {

View file

@ -73,6 +73,9 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl {
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (amountToPrevent == Integer.MAX_VALUE) {
sb.append("Prevent all damage that would be dealt to target ");