Some fixes/updates to tooltip generation (e.g. charms).

This commit is contained in:
LevelX2 2013-10-27 10:33:08 +01:00
parent 3d4bb90805
commit 03c032e3b0
9 changed files with 17 additions and 13 deletions

View file

@ -79,7 +79,7 @@ class DevastatingSummonsCost extends CostImpl<DevastatingSummonsCost> implements
protected int amountPaid = 0; protected int amountPaid = 0;
public DevastatingSummonsCost() { public DevastatingSummonsCost() {
this.text = "sacrifice X lands."; this.text = "sacrifice X lands";
} }
public DevastatingSummonsCost(final DevastatingSummonsCost cost) { public DevastatingSummonsCost(final DevastatingSummonsCost cost) {

View file

@ -57,7 +57,7 @@ public class DisasterRadius extends CardImpl<DisasterRadius> {
this.color.setRed(true); this.color.setRed(true);
// As an additional cost to cast Disaster Radius, reveal a creature card from your hand. // As an additional cost to cast Disaster Radius, reveal a creature card from your hand.
TargetCardInHand targetCard = new TargetCardInHand(new FilterCreatureCard("a creature card.")); TargetCardInHand targetCard = new TargetCardInHand(new FilterCreatureCard("a creature card"));
this.getSpellAbility().addCost(new RevealTargetFromHandCost(targetCard)); this.getSpellAbility().addCost(new RevealTargetFromHandCost(targetCard));
// Disaster Radius deals X damage to each creature your opponents control, where X is the revealed card's converted mana cost. // Disaster Radius deals X damage to each creature your opponents control, where X is the revealed card's converted mana cost.

View file

@ -48,7 +48,7 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class InduceDespair extends CardImpl<InduceDespair> { public class InduceDespair extends CardImpl<InduceDespair> {
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from your hand."); private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from your hand");
public InduceDespair(UUID ownerId) { public InduceDespair(UUID ownerId) {
super(ownerId, 114, "Induce Despair", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{B}"); super(ownerId, 114, "Induce Despair", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{B}");

View file

@ -45,7 +45,7 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class Tinker extends CardImpl<Tinker> { public class Tinker extends CardImpl<Tinker> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an artifact."); private static final FilterControlledPermanent filter = new FilterControlledPermanent("an artifact");
static { static {
filter.add(new CardTypePredicate(CardType.ARTIFACT)); filter.add(new CardTypePredicate(CardType.ARTIFACT));

View file

@ -128,7 +128,7 @@ class FirestormCost extends CostImpl<FirestormCost> implements VariableCost {
protected int amountPaid = 0; protected int amountPaid = 0;
public FirestormCost() { public FirestormCost() {
this.text = "discard X cards."; this.text = "discard X cards";
} }
public FirestormCost(final FirestormCost cost) { public FirestormCost(final FirestormCost cost) {

View file

@ -141,6 +141,6 @@ class CobraTrapAlternativeCost extends AlternativeCostImpl<CobraTrapAlternativeC
@Override @Override
public String getText() { public String getText() {
return "If a noncreature permanent under your control was destroyed this turn by a spell or ability an opponent controlled, you may pay {G} rather than pay Cobra Trap's mana cost."; return "If a noncreature permanent under your control was destroyed this turn by a spell or ability an opponent controlled, you may pay {G} rather than pay Cobra Trap's mana cost";
} }
} }

View file

@ -166,8 +166,8 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
for (Mode mode: this.values()) { for (Mode mode: this.values()) {
sb.append(mode.getEffects().getText(mode)); sb.append(mode.getEffects().getText(mode));
if (this.size() > 1) { if (this.size() > 1) {
if (sb.length() > 2 && sb.substring(sb.length()-2, sb.length()).equals(". ")) { if (sb.length() > 2 && sb.substring(sb.length()-1, sb.length()).equals(".")) {
sb.delete(sb.length()-2, sb.length()); sb.delete(sb.length()-1, sb.length());
} }
sb.append(andOr); sb.append(andOr);
} }

View file

@ -58,18 +58,18 @@ public class Effects extends ArrayList<Effect> {
String rule = null; String rule = null;
for (Effect effect: this) { for (Effect effect: this) {
String endString = ""; String endString = "";
if (rule != null && rule.length()> 3 && !rule.endsWith(". ")) { if (rule != null && rule.length()> 3 && !rule.endsWith(".")) {
endString = ". "; endString = ". ";
} }
rule = effect.getText(mode); rule = effect.getText(mode);
if (rule != null) { if (rule != null) {
if (rule.startsWith("and ")) { if (rule.startsWith("and ") || rule.startsWith(",")) {
endString = " "; endString = " ";
} }
sbText.append(endString).append(rule); sbText.append(endString).append(rule);
} }
} }
if (rule != null && rule.length()> 3 && !rule.endsWith(". ")) { if (rule != null && rule.length()> 3 && !rule.endsWith(".") && !rule.endsWith("\"")) {
sbText.append("."); sbText.append(".");
} }
return sbText.toString(); return sbText.toString();

View file

@ -70,7 +70,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl<GainAbilityA
setText(); setText();
} }
public GainAbilityAttachedEffect(Ability ability, AttachmentType attachmentType) { public GainAbilityAttachedEffect(Ability ability, AttachmentType attachmentType) {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability; this.ability = ability;
this.attachmentType = attachmentType; this.attachmentType = attachmentType;
@ -126,13 +126,17 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl<GainAbilityA
} }
sb.append(" creature "); sb.append(" creature ");
if (duration == Duration.WhileOnBattlefield) { if (duration == Duration.WhileOnBattlefield) {
sb.append("has "); sb.append("has \"");
} else { } else {
sb.append("gains "); sb.append("gains ");
} }
sb.append(ability.getRule()); sb.append(ability.getRule());
if (!duration.toString().isEmpty()) { if (!duration.toString().isEmpty()) {
sb.append(" ").append(duration.toString()); sb.append(" ").append(duration.toString());
} else {
if (duration == Duration.WhileOnBattlefield) {
sb.append("\"");
}
} }
staticText = sb.toString(); staticText = sb.toString();
} }