mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
cards
This commit is contained in:
parent
e5e9b04917
commit
2da11a0c8e
6 changed files with 360 additions and 40 deletions
|
|
@ -0,0 +1,55 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
*/
|
||||
public class MayTapOrUntapTargetEffect extends OneShotEffect<MayTapOrUntapTargetEffect> {
|
||||
public MayTapOrUntapTargetEffect() {
|
||||
super(Constants.Outcome.Benefit);
|
||||
}
|
||||
|
||||
public MayTapOrUntapTargetEffect(final MayTapOrUntapTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent target = game.getPermanent(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (target != null && player != null) {
|
||||
if (target.isTapped()) {
|
||||
if (player.chooseUse(Constants.Outcome.Untap, "Untap that creature?", game)) {
|
||||
target.untap(game);
|
||||
}
|
||||
} else {
|
||||
if (player.chooseUse(Constants.Outcome.Tap, "Tap that creature?", game)) {
|
||||
target.tap(game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MayTapOrUntapTargetEffect copy() {
|
||||
return new MayTapOrUntapTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
return "You may tap or untap it";
|
||||
} else {
|
||||
return "You may tap or untap target " + mode.getTargets().get(0).getTargetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue