Fixes and improvements to tooltip rule generation.

This commit is contained in:
LevelX2 2013-01-08 00:15:41 +01:00
parent c3412211d3
commit 8cef2df859
9 changed files with 34 additions and 21 deletions

View file

@ -51,7 +51,7 @@ import java.util.UUID;
*/ */
public class RestorationAngel extends CardImpl<RestorationAngel> { public class RestorationAngel extends CardImpl<RestorationAngel> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Angel"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Angel creature you control, then ");
static { static {
filter.add(Predicates.not(new SubtypePredicate("Angel"))); filter.add(Predicates.not(new SubtypePredicate("Angel")));

View file

@ -52,8 +52,8 @@ import mage.target.common.TargetCardInLibrary;
*/ */
public class BloodSpeaker extends CardImpl<BloodSpeaker> { public class BloodSpeaker extends CardImpl<BloodSpeaker> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Demon"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Demon under your control");
private static final FilterCard filterCard = new FilterCard("Demon"); private static final FilterCard filterCard = new FilterCard("Demon card");
static { static {
filter.add(new SubtypePredicate("Demon")); filter.add(new SubtypePredicate("Demon"));
filterCard.add(new SubtypePredicate("Demon")); filterCard.add(new SubtypePredicate("Demon"));

View file

@ -60,7 +60,7 @@ public class CruelUltimatum extends CardImpl<CruelUltimatum> {
// Target opponent sacrifices a creature, discards three cards, then loses 5 life. You return a creature card from your graveyard to your hand, draw three cards, then gain 5 life. // Target opponent sacrifices a creature, discards three cards, then loses 5 life. You return a creature card from your graveyard to your hand, draw three cards, then gain 5 life.
this.getSpellAbility().addTarget(new TargetOpponent()); this.getSpellAbility().addTarget(new TargetOpponent());
this.getSpellAbility().addEffect(new SacrificeEffect(new FilterCreaturePermanent(), 1, "Target opponent sacrifices a creature")); this.getSpellAbility().addEffect(new SacrificeEffect(new FilterCreaturePermanent(), 1, "Target opponent"));
this.getSpellAbility().addEffect(new DiscardTargetEffect(3)); this.getSpellAbility().addEffect(new DiscardTargetEffect(3));
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(5)); this.getSpellAbility().addEffect(new LoseLifeTargetEffect(5));
@ -83,7 +83,7 @@ class CruelUltimatumEffect extends OneShotEffect<CruelUltimatumEffect> {
public CruelUltimatumEffect() { public CruelUltimatumEffect() {
super(Outcome.ReturnToHand); super(Outcome.ReturnToHand);
this.staticText = "return a creature card from your graveyard to your hand"; this.staticText = "Return a creature card from your graveyard to your hand";
} }
public CruelUltimatumEffect(final CruelUltimatumEffect effect) { public CruelUltimatumEffect(final CruelUltimatumEffect effect) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.filter.common.FilterArtifactCard; import mage.filter.common.FilterArtifactCard;
import mage.filter.common.FilterArtifactPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -65,7 +66,7 @@ public class GoblinWelder extends CardImpl<GoblinWelder> {
// {tap}: Choose target artifact a player controls and target artifact card in that player's graveyard. If both targets are still legal as this ability resolves, that player simultaneously sacrifices the artifact and returns the artifact card to the battlefield. // {tap}: Choose target artifact a player controls and target artifact card in that player's graveyard. If both targets are still legal as this ability resolves, that player simultaneously sacrifices the artifact and returns the artifact card to the battlefield.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GoblinWelderEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GoblinWelderEffect(), new TapSourceCost());
ability.addTarget(new TargetArtifactPermanent()); ability.addTarget(new TargetArtifactPermanent(new FilterArtifactPermanent("artifact a player controls")));
ability.addTarget(new GoblinWelderTarget()); ability.addTarget(new GoblinWelderTarget());
this.addAbility(ability); this.addAbility(ability);
} }
@ -119,9 +120,8 @@ public class GoblinWelder extends CardImpl<GoblinWelder> {
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
return "Sacrifices " + mode.getTargets().get(0).getTargetName() + " and returns " + mode.getTargets().get(1).getTargetName() + " to the battlefield"; return "Choose " + mode.getTargets().get(0).getTargetName() + " and " + mode.getTargets().get(1).getTargetName() + ". If both targets are still legal as this ability resolves, that player simultaneously sacrifices the artifact and returns the artifact card to the battlefield";
} }
} }
class GoblinWelderTarget extends TargetCard<TargetCardInYourGraveyard> { class GoblinWelderTarget extends TargetCard<TargetCardInYourGraveyard> {

View file

@ -50,8 +50,9 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
public TriggeredAbilityImpl(Zone zone, Effect effect, boolean optional) { public TriggeredAbilityImpl(Zone zone, Effect effect, boolean optional) {
super(AbilityType.TRIGGERED, zone); super(AbilityType.TRIGGERED, zone);
if (effect != null) if (effect != null) {
addEffect(effect); addEffect(effect);
}
this.optional = optional; this.optional = optional;
} }
@ -92,8 +93,9 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
} }
} }
//20091005 - 603.4 //20091005 - 603.4
if (checkInterveningIfClause(game)) if (checkInterveningIfClause(game)) {
return super.resolve(game); return super.resolve(game);
}
return false; return false;
} }
@ -101,11 +103,19 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
public String getRule() { public String getRule() {
String superRule = super.getRule(true); String superRule = super.getRule(true);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (optional && !superRule.toLowerCase().startsWith("you may")) { String ruleLow = superRule.toLowerCase();
sb.append("you may "); if (optional && !ruleLow.startsWith("you ")) {
if (!this.getTargets().isEmpty()) { if (this.getTargets().isEmpty()
sb.append("have "); || ruleLow.startsWith("exile")
|| ruleLow.startsWith("destroy")
|| ruleLow.startsWith("return")
|| ruleLow.startsWith("tap")
|| ruleLow.startsWith("untap")) {
sb.append("you may ");
} else {
sb.append("you may have ");
} }
} }
sb.append(superRule.substring(0, 1).toLowerCase()); sb.append(superRule.substring(0, 1).toLowerCase());
sb.append(superRule.substring(1)); sb.append(superRule.substring(1));

View file

@ -68,7 +68,7 @@ public class EntersBattlefieldAbility extends StaticAbility<EntersBattlefieldAbi
*/ */
public EntersBattlefieldAbility(Effect effect, Condition condition, Boolean showRule, String abilityRule, String effectText) { public EntersBattlefieldAbility(Effect effect, Condition condition, Boolean showRule, String abilityRule, String effectText) {
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, condition, effectText)); super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, condition, effectText));
this.showRule = true; this.showRule = showRule;
this.abilityRule = abilityRule; this.abilityRule = abilityRule;
} }

View file

@ -74,8 +74,9 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect<
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) { if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
if (tapped) { if (tapped) {
Permanent permanent = game.getPermanent(card.getId()); Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) if (permanent != null) {
permanent.setTapped(true); permanent.setTapped(true);
}
} }
return true; return true;
} }
@ -87,11 +88,11 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect<
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Put target ").append(mode.getTargets().get(0).getTargetName()).append(" onto the battlefield"); sb.append("Return target ").append(mode.getTargets().get(0).getTargetName()).append(" to the battlefield");
if (tapped) if (tapped) {
sb.append(" tapped"); sb.append(" tapped");
}
sb.append(" under your control"); sb.append(" under your control");
return sb.toString(); return sb.toString();
} }
} }

View file

@ -72,7 +72,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect<ReturnF
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Put target ").append(mode.getTargets().get(0).getTargetName()).append(" into your hand"); sb.append("Return target ").append(mode.getTargets().get(0).getTargetName()).append(" to your hand");
return sb.toString(); return sb.toString();
} }

View file

@ -122,13 +122,15 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
private void setText() { private void setText() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(preText); sb.append(preText);
if (preText.contains("player")) { if (preText.endsWith("player") || preText.endsWith("opponent")) {
sb.append(" sacrifices "); sb.append(" sacrifices ");
} else { } else {
sb.append(" sacrifice "); sb.append(" sacrifice ");
} }
if (!count.toString().equals("1")) { if (!count.toString().equals("1")) {
sb.append(count).append(" "); sb.append(count).append(" ");
} else {
sb.append("a ");
} }
sb.append(filter.getMessage()); sb.append(filter.getMessage());
staticText = sb.toString(); staticText = sb.toString();