* Innane, Life Ascpect - Fixed the displayed up to number in tooltip text.

This commit is contained in:
LevelX2 2013-10-29 08:19:47 +01:00
parent 1cbe322da8
commit 4e35568bb5
3 changed files with 9 additions and 3 deletions

View file

@ -38,6 +38,7 @@ import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
import mage.util.CardUtil;
/** /**
@ -103,7 +104,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect<ReturnToHandTargetEf
Target target = mode.getTargets().get(0); Target target = mode.getTargets().get(0);
StringBuilder sb = new StringBuilder("Return "); StringBuilder sb = new StringBuilder("Return ");
if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) {
sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" to their owners' hand"); sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" to their owners' hand");
return sb.toString(); return sb.toString();
} else { } else {
if (!target.getTargetName().startsWith("another")) { if (!target.getTargetName().startsWith("another")) {

View file

@ -68,8 +68,9 @@ public abstract class TargetObject<T extends TargetObject<T>> extends TargetImpl
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (UUID targetId: getTargets()) { for (UUID targetId: getTargets()) {
MageObject object = game.getObject(targetId); MageObject object = game.getObject(targetId);
if (object != null) if (object != null) {
sb.append(object.getName()).append(" "); sb.append(object.getName()).append(" ");
}
} }
return sb.toString(); return sb.toString();
} }
@ -77,8 +78,9 @@ public abstract class TargetObject<T extends TargetObject<T>> extends TargetImpl
@Override @Override
public boolean canTarget(UUID id, Game game) { public boolean canTarget(UUID id, Game game) {
MageObject object = game.getObject(id); MageObject object = game.getObject(id);
if (object != null && game.getState().getZone(id).match(zone)) if (object != null && game.getState().getZone(id).match(zone)) {
return getFilter().match(object, game); return getFilter().match(object, game);
}
return false; return false;
} }

View file

@ -343,6 +343,9 @@ public class CardUtil {
if (number >= 0 && number < 21) { if (number >= 0 && number < 21) {
return numberStrings[number]; return numberStrings[number];
} }
if (number == Integer.MAX_VALUE) {
return "any number of";
}
return Integer.toString(number); return Integer.toString(number);
} }