Added new AsThoughtEffectType to reveal face down cards (not a perfect solution I know, but better as using the cast type. If someone has a better idea to handle this, I'm open).

This commit is contained in:
LevelX2 2013-04-06 00:04:21 +02:00
parent cb6ac8e619
commit 48f1560cb8
5 changed files with 23 additions and 1 deletions

View file

@ -426,6 +426,9 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
if (object != null) {
Zone zone = game.getState().getZone(object.getId());
if (zone != null) {
if (object instanceof Card && ((Card) object).isFaceDown()) {
revealFaceDownCard((Card) object, game);
}
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = getUseableActivatedAbilities(object, zone, game);
if (useableAbilities != null && useableAbilities.size() > 0) {
activateAbility(useableAbilities, game);
@ -838,4 +841,6 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
log.debug("Setting game priority to " + getId() + " [" + methodName + "]");
game.getState().setPriorityPlayerId(getId());
}
}

View file

@ -93,6 +93,7 @@ public class TableController {
match = GameFactory.getInstance().createMatch(options.getGameType(), options);
if (userId != null) {
User user = UserManager.getInstance().getUser(userId);
// TODO: Handle if user == null
controllerName = user.getName();
}
else {

View file

@ -186,7 +186,8 @@ public final class Constants {
TARGET,
PAY,
DAMAGE,
HEXPROOF
HEXPROOF,
REVEAL_FACE_DOWN
}
public enum Duration {

View file

@ -271,4 +271,10 @@ public interface Player extends MageItem, Copyable<Player> {
void becomesActivePlayer();
int getTurns();
/**
* asThough effect to reveal faceDown cards
*
*/
void revealFaceDownCard(Card card, Game game);
}

View file

@ -1629,4 +1629,13 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
}
setStoredBookmark(-1);
}
@Override
public void revealFaceDownCard(Card card, Game game) {
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.REVEAL_FACE_DOWN, game)) {
Cards cards = new CardsImpl(card);
this.revealCards(name, cards, game);
}
}
}