forked from External/mage
Reworked HiddenStrings.
This commit is contained in:
parent
d00e953ad9
commit
e904f9e6ff
1 changed files with 15 additions and 29 deletions
|
|
@ -37,6 +37,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CipherEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
|
@ -57,8 +58,8 @@ public class HiddenStrings extends CardImpl<HiddenStrings> {
|
|||
|
||||
// You may tap or untap target permanent, then you may tap or untap another target permanent
|
||||
this.getSpellAbility().addEffect(new HiddenStringsEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(0, 2, new FilterPermanent(), false));
|
||||
|
||||
// Cipher
|
||||
this.getSpellAbility().addEffect(new CipherEffect());
|
||||
}
|
||||
|
|
@ -92,35 +93,20 @@ class HiddenStringsEffect extends OneShotEffect<HiddenStringsEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean result = false;
|
||||
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
if (permanent.isTapped()) {
|
||||
if (player.chooseUse(Constants.Outcome.Untap, "Untap that permanent?", game)) {
|
||||
result |= permanent.untap(game);
|
||||
}
|
||||
} else {
|
||||
if (player.chooseUse(Constants.Outcome.Tap, "Tap that permanent?", game)) {
|
||||
result |= permanent.tap(game);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
if (player.chooseUse(Constants.Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append("?").toString(), game)) {
|
||||
permanent.tap(game);
|
||||
} else if (player.chooseUse(Constants.Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append("?").toString(), game)) {
|
||||
permanent.untap(game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (permanent != null) {
|
||||
if (permanent.isTapped()) {
|
||||
if (player.chooseUse(Constants.Outcome.Untap, "Untap that permanent?", game)) {
|
||||
result |= permanent.untap(game);
|
||||
}
|
||||
} else {
|
||||
if (player.chooseUse(Constants.Outcome.Tap, "Tap that permanent?", game)) {
|
||||
result |= permanent.tap(game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue