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.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
/**
@ -96,14 +97,17 @@ public class ReturnToHandTargetEffect extends OneShotEffect<ReturnToHandTargetEf
if (mode.getTargets().size() < 1) {
return "";
}
if (mode.getTargets().get(0).getNumberOfTargets() == 0 && mode.getTargets().get(0).getMaxNumberOfTargets() > 0) {
return "Return up to " + mode.getTargets().get(0).getMaxNumberOfTargets() +" target " + mode.getTargets().get(0).getTargetName() + " to their owners' hand";
Target target = mode.getTargets().get(0);
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 {
StringBuilder sb = new StringBuilder("Return ");
if (!mode.getTargets().get(0).getTargetName().startsWith("another")) {
if (!target.getTargetName().startsWith("another")) {
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) {
permanent.untap(game);
}
else {
return false;
}
}
return true;
}

View file

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

View file

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