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

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

View file

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

View file

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