mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
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.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CipherEffect;
|
import mage.abilities.effects.common.CipherEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
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
|
// You may tap or untap target permanent, then you may tap or untap another target permanent
|
||||||
this.getSpellAbility().addEffect(new HiddenStringsEffect());
|
this.getSpellAbility().addEffect(new HiddenStringsEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetPermanent());
|
this.getSpellAbility().addTarget(new TargetPermanent(0, 2, new FilterPermanent(), false));
|
||||||
this.getSpellAbility().addTarget(new TargetPermanent());
|
|
||||||
// Cipher
|
// Cipher
|
||||||
this.getSpellAbility().addEffect(new CipherEffect());
|
this.getSpellAbility().addEffect(new CipherEffect());
|
||||||
}
|
}
|
||||||
|
|
@ -92,35 +93,20 @@ class HiddenStringsEffect extends OneShotEffect<HiddenStringsEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
boolean result = false;
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player != null) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
||||||
if (player != null) {
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
if (permanent != null) {
|
||||||
if (permanent != null) {
|
if (player.chooseUse(Constants.Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append("?").toString(), game)) {
|
||||||
if (permanent.isTapped()) {
|
permanent.tap(game);
|
||||||
if (player.chooseUse(Constants.Outcome.Untap, "Untap that permanent?", game)) {
|
} else if (player.chooseUse(Constants.Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append("?").toString(), game)) {
|
||||||
result |= permanent.untap(game);
|
permanent.untap(game);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (player.chooseUse(Constants.Outcome.Tap, "Tap that permanent?", game)) {
|
|
||||||
result |= permanent.tap(game);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
return false;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue