* Log messages -Some more changes to handle message of targets without names (Morph) and targetlists that contain 0 targets.

This commit is contained in:
LevelX2 2014-06-10 17:51:21 +02:00
parent c077a17d86
commit 42a7da9132
7 changed files with 16 additions and 14 deletions

View file

@ -902,16 +902,18 @@ public abstract class AbilityImpl implements Ability {
if (targets.size() > 0) {
String usedVerb = null;
for (Target target : targets) {
if (!target.isNotTarget()) {
if (usedVerb == null || usedVerb.equals(" choosing ")) {
usedVerb = " targeting ";
if (!target.getTargets().isEmpty()) {
if (!target.isNotTarget()) {
if (usedVerb == null || usedVerb.equals(" choosing ")) {
usedVerb = " targeting ";
sb.append(usedVerb);
}
} else if (target.isNotTarget() && (usedVerb == null || usedVerb.equals(" targeting "))) {
usedVerb = " choosing ";
sb.append(usedVerb);
}
} else if (target.isNotTarget() && (usedVerb == null || usedVerb.equals(" targeting "))) {
usedVerb = " choosing ";
sb.append(usedVerb);
sb.append(target.getTargetedName(game));
}
sb.append(target.getTargetedName(game));
}
}
for (Choice choice :this.getChoices()) {
@ -922,7 +924,7 @@ public abstract class AbilityImpl implements Ability {
private String getOptionalTextSuffix(Game game, Spell spell) {
StringBuilder sb = new StringBuilder();
for (Ability ability : (Abilities<Ability>) spell.getAbilities()) {
for (Ability ability : spell.getAbilities()) {
if (ability instanceof OptionalAdditionalSourceCosts) {
sb.append(((OptionalAdditionalSourceCosts) ability).getCastMessageSuffix());
}

View file

@ -69,7 +69,7 @@ public abstract class TargetObject extends TargetImpl {
for (UUID targetId: getTargets()) {
MageObject object = game.getObject(targetId);
if (object != null) {
sb.append(object.getName()).append(" ");
sb.append(object.getLogName()).append(" ");
}
}
return sb.toString();

View file

@ -229,7 +229,7 @@ public class TargetCreatureOrPlayer extends TargetImpl {
for (UUID targetId: getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
sb.append(permanent.getName()).append(" ");
sb.append(permanent.getLogName()).append(" ");
}
else {
Player player = game.getPlayer(targetId);

View file

@ -203,7 +203,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount {
for (UUID targetId: getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
sb.append(permanent.getName()).append("(").append(getTargetAmount(targetId)).append(") ");
sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") ");
}
else {
Player player = game.getPlayer(targetId);

View file

@ -161,7 +161,7 @@ public class TargetCreaturePermanentAmount extends TargetAmount {
for (UUID targetId : getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
sb.append(permanent.getName()).append("(").append(getTargetAmount(targetId)).append(") ");
sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") ");
}
}
return sb.toString();

View file

@ -237,7 +237,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
for (UUID targetId: getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
sb.append(permanent.getName()).append(" ");
sb.append(permanent.getLogName()).append(" ");
}
else {
Player player = game.getPlayer(targetId);

View file

@ -240,7 +240,7 @@ public class TargetSpellOrPermanent extends TargetImpl {
}
else {
Spell spell = game.getStack().getSpell(targetId);
sb.append(spell.getName()).append(" ");
sb.append(spell.getLogName()).append(" ");
}
}
return sb.toString();