From 8cef2df859def6f17fc2b7597fba5abad110ba1e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 8 Jan 2013 00:15:41 +0100 Subject: [PATCH] Fixes and improvements to tooltip rule generation. --- .../sets/avacynrestored/RestorationAngel.java | 2 +- .../championsofkamigawa/BloodSpeaker.java | 4 ++-- .../sets/shardsofalara/CruelUltimatum.java | 4 ++-- .../mage/sets/urzaslegacy/GoblinWelder.java | 6 ++--- .../mage/abilities/TriggeredAbilityImpl.java | 22 ++++++++++++++----- .../common/EntersBattlefieldAbility.java | 2 +- ...romGraveyardToBattlefieldTargetEffect.java | 9 ++++---- ...ReturnFromGraveyardToHandTargetEffect.java | 2 +- .../effects/common/SacrificeEffect.java | 4 +++- 9 files changed, 34 insertions(+), 21 deletions(-) diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RestorationAngel.java b/Mage.Sets/src/mage/sets/avacynrestored/RestorationAngel.java index 549c0a6b3e..7acd6dd213 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/RestorationAngel.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/RestorationAngel.java @@ -51,7 +51,7 @@ import java.util.UUID; */ public class RestorationAngel extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Angel"); + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Angel creature you control, then "); static { filter.add(Predicates.not(new SubtypePredicate("Angel"))); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/BloodSpeaker.java b/Mage.Sets/src/mage/sets/championsofkamigawa/BloodSpeaker.java index c9cacd25eb..d947561624 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/BloodSpeaker.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/BloodSpeaker.java @@ -52,8 +52,8 @@ import mage.target.common.TargetCardInLibrary; */ public class BloodSpeaker extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Demon"); - private static final FilterCard filterCard = new FilterCard("Demon"); + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Demon under your control"); + private static final FilterCard filterCard = new FilterCard("Demon card"); static { filter.add(new SubtypePredicate("Demon")); filterCard.add(new SubtypePredicate("Demon")); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/CruelUltimatum.java b/Mage.Sets/src/mage/sets/shardsofalara/CruelUltimatum.java index a2f508bdfe..f20b0f5a27 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/CruelUltimatum.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/CruelUltimatum.java @@ -60,7 +60,7 @@ public class CruelUltimatum extends CardImpl { // 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().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 LoseLifeTargetEffect(5)); @@ -83,7 +83,7 @@ class CruelUltimatumEffect extends OneShotEffect { public CruelUltimatumEffect() { 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) { diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java b/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java index 9cadb7eb34..74f26d3c8f 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java @@ -40,6 +40,7 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.filter.common.FilterArtifactCard; +import mage.filter.common.FilterArtifactPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -65,7 +66,7 @@ public class GoblinWelder extends CardImpl { // {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.addTarget(new TargetArtifactPermanent()); + ability.addTarget(new TargetArtifactPermanent(new FilterArtifactPermanent("artifact a player controls"))); ability.addTarget(new GoblinWelderTarget()); this.addAbility(ability); } @@ -119,9 +120,8 @@ public class GoblinWelder extends CardImpl { @Override 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 { diff --git a/Mage/src/mage/abilities/TriggeredAbilityImpl.java b/Mage/src/mage/abilities/TriggeredAbilityImpl.java index bf6cb9e04f..77d66b6ee5 100644 --- a/Mage/src/mage/abilities/TriggeredAbilityImpl.java +++ b/Mage/src/mage/abilities/TriggeredAbilityImpl.java @@ -50,8 +50,9 @@ public abstract class TriggeredAbilityImpl> ex public TriggeredAbilityImpl(Zone zone, Effect effect, boolean optional) { super(AbilityType.TRIGGERED, zone); - if (effect != null) + if (effect != null) { addEffect(effect); + } this.optional = optional; } @@ -92,8 +93,9 @@ public abstract class TriggeredAbilityImpl> ex } } //20091005 - 603.4 - if (checkInterveningIfClause(game)) + if (checkInterveningIfClause(game)) { return super.resolve(game); + } return false; } @@ -101,11 +103,19 @@ public abstract class TriggeredAbilityImpl> ex public String getRule() { String superRule = super.getRule(true); StringBuilder sb = new StringBuilder(); - if (optional && !superRule.toLowerCase().startsWith("you may")) { - sb.append("you may "); - if (!this.getTargets().isEmpty()) { - sb.append("have "); + String ruleLow = superRule.toLowerCase(); + if (optional && !ruleLow.startsWith("you ")) { + if (this.getTargets().isEmpty() + || 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(1)); diff --git a/Mage/src/mage/abilities/common/EntersBattlefieldAbility.java b/Mage/src/mage/abilities/common/EntersBattlefieldAbility.java index 7019262a84..09b1135be9 100644 --- a/Mage/src/mage/abilities/common/EntersBattlefieldAbility.java +++ b/Mage/src/mage/abilities/common/EntersBattlefieldAbility.java @@ -68,7 +68,7 @@ public class EntersBattlefieldAbility extends StaticAbility{ private void setText() { StringBuilder sb = new StringBuilder(); sb.append(preText); - if (preText.contains("player")) { + if (preText.endsWith("player") || preText.endsWith("opponent")) { sb.append(" sacrifices "); } else { sb.append(" sacrifice "); } if (!count.toString().equals("1")) { sb.append(count).append(" "); + } else { + sb.append("a "); } sb.append(filter.getMessage()); staticText = sb.toString();