Some minor fixes and formatting to framework classes.

This commit is contained in:
LevelX2 2013-09-15 11:38:51 +02:00
parent 6b504e9601
commit 8b312450d5
4 changed files with 19 additions and 18 deletions

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; 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;
/** /**
@ -96,14 +97,17 @@ public class ReturnToHandTargetEffect extends OneShotEffect<ReturnToHandTargetEf
if (mode.getTargets().size() < 1) { if (mode.getTargets().size() < 1) {
return ""; return "";
} }
if (mode.getTargets().get(0).getNumberOfTargets() == 0 && mode.getTargets().get(0).getMaxNumberOfTargets() > 0) { Target target = mode.getTargets().get(0);
return "Return up to " + mode.getTargets().get(0).getMaxNumberOfTargets() +" target " + mode.getTargets().get(0).getTargetName() + " to their owners' hand"; StringBuilder sb = new StringBuilder("Return ");
if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) {
sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" to their owners' hand");
return sb.toString();
} else { } else {
StringBuilder sb = new StringBuilder("Return "); if (!target.getTargetName().startsWith("another")) {
if (!mode.getTargets().get(0).getTargetName().startsWith("another")) {
sb.append(" target "); sb.append(" target ");
} }
return sb.append(mode.getTargets().get(0).getTargetName()).append(" to it's owner's hand").toString(); sb.append(target.getTargetName()).append(" to it's owner's hand").toString();
return sb.toString();
} }
} }

View file

@ -63,9 +63,6 @@ public class UntapTargetEffect extends OneShotEffect<UntapTargetEffect> {
if (permanent != null) { if (permanent != null) {
permanent.untap(game); permanent.untap(game);
} }
else {
return false;
}
} }
return true; return true;
} }

View file

@ -27,14 +27,15 @@
*/ */
package mage.abilities.effects.common.continious; package mage.abilities.effects.common.continious;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Layer; import mage.constants.Layer;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubLayer; import mage.constants.SubLayer;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.util.CardUtil;
/** /**
* *
@ -82,7 +83,7 @@ public class CanBlockAdditionalCreatureEffect extends ContinuousEffectImpl<CanBl
case RulesEffects: case RulesEffects:
// maxBlocks = 0 equals to "can block any number of creatures" // maxBlocks = 0 equals to "can block any number of creatures"
if (perm.getMaxBlocks() > 0) { if (perm.getMaxBlocks() > 0) {
perm.setMaxBlocks(perm.getMaxBlocks() + 1); perm.setMaxBlocks(perm.getMaxBlocks() + amount);
} else { } else {
perm.setMaxBlocks(0); perm.setMaxBlocks(0);
} }
@ -108,7 +109,7 @@ public class CanBlockAdditionalCreatureEffect extends ContinuousEffectImpl<CanBl
sb.append("an additional creature"); sb.append("an additional creature");
break; break;
default: default:
sb.append(amount).append(" additional creatures"); sb.append(CardUtil.numberToText(amount)).append(" additional creatures");
} }
return sb.toString(); return sb.toString();
} }

View file

@ -397,14 +397,13 @@ public class CardUtil {
*/ */
public static String getCardZoneString(String text, UUID cardId, Game game) { public static String getCardZoneString(String text, UUID cardId, Game game) {
StringBuilder uniqueString = new StringBuilder(); StringBuilder uniqueString = new StringBuilder();
if (text != null) {
uniqueString.append(text);
}
uniqueString.append(cardId);
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
if (card != null) { if (card != null) {
if (text != null) {
uniqueString.append(text);
}
uniqueString.append(card.getZoneChangeCounter()); uniqueString.append(card.getZoneChangeCounter());
} else {
uniqueString.append(cardId);
} }
return uniqueString.toString(); return uniqueString.toString();
} }