forked from External/mage
describe targets: look at hand; can't be blocked
This commit is contained in:
parent
4f44d29d32
commit
72be1856f7
2 changed files with 13 additions and 31 deletions
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
|
@ -15,7 +15,6 @@ public class LookAtTargetPlayerHandEffect extends OneShotEffect {
|
|||
|
||||
public LookAtTargetPlayerHandEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "look at target player's hand";
|
||||
}
|
||||
|
||||
protected LookAtTargetPlayerHandEffect(final LookAtTargetPlayerHandEffect effect) {
|
||||
|
|
@ -30,7 +29,7 @@ public class LookAtTargetPlayerHandEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
MageObject sourceObject = game.getObject(source);
|
||||
if (you != null && targetPlayer != null) {
|
||||
you.lookAtCards(sourceObject != null ? sourceObject.getIdName() : null, targetPlayer.getHand(), game);
|
||||
|
|
@ -39,4 +38,12 @@ public class LookAtTargetPlayerHandEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "look at " + getTargetPointer().describeTargets(mode.getTargets(), "that player") + "'s hand";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import mage.filter.StaticFilters;
|
|||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
|
|
@ -57,31 +55,8 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
if (target.getMaxNumberOfTargets() == 1) {
|
||||
sb.append("one ");
|
||||
}
|
||||
}
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append("s can't be blocked");
|
||||
} else {
|
||||
sb.append(" can't be blocked");
|
||||
}
|
||||
|
||||
if (Duration.EndOfTurn == this.duration) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
return sb.toString();
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "that creature")
|
||||
+ " can't be blocked"
|
||||
+ (duration == Duration.EndOfTurn ? " this turn" : "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue