public static boolean cardCanBePlayedNow(Card card, UUID playerId, Game game) { if (card.isLand()) { return game.canPlaySorcery(playerId) && game.getPlayer(playerId).canPlayLand(); } else { return card.getSpellAbility() != null && card.getSpellAbility().spellCanBeActivatedRegularlyNow(playerId, game); } }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (affectedControllerId.equals(source.getControllerId())) { Card objectCard = game.getCard(objectId); if (objectCard != null) { Player controller = game.getPlayer(affectedControllerId); if (controller != null && game.getState().getZone(objectId) == Zone.LIBRARY) { if (controller.getLibrary().getFromTop(game).equals(card)) { if (objectCard == card && objectCard.getSpellAbility() != null && objectCard.getSpellAbility().spellCanBeActivatedRegularlyNow(controller.getId(), game)) { controller.setCastSourceIdWithAlternateMana(objectId, null, null); return true; } } } } } return false; } }
private boolean spliceSpellCanBeActivated(Ability source, Game game) { // check if spell can be activated (protection problem not solved because effect will be used from the base spell?) Card card = game.getCard(source.getSourceId()); if (card != null) { if (card.getManaCost().isEmpty()) { // e.g. Evermind return card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game); } else { return card.getSpellAbility().canActivate(source.getControllerId(), game).canActivate(); } } return false; } }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (affectedControllerId.equals(source.getControllerId())) { Card card = game.getCard(objectId); if (card != null) { Player controller = game.getPlayer(affectedControllerId); if (controller != null) { Card topCard = controller.getLibrary().getFromTop(game); MageObject vizierOfTheMenagerie = game.getObject(source.getSourceId()); if (vizierOfTheMenagerie != null && topCard != null) { if (topCard == card && topCard.isCreature() && topCard.getSpellAbility() != null && topCard.getSpellAbility().spellCanBeActivatedRegularlyNow(controller.getId(), game)) { return true; } } } } } return false; } }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (affectedControllerId.equals(source.getControllerId())) { Card card = game.getCard(objectId); if (card != null) { Player controller = game.getPlayer(affectedControllerId); if (controller != null) { Card topCard = controller.getLibrary().getFromTop(game); MageObject precognitionField = game.getObject(source.getSourceId()); if (precognitionField != null && topCard != null) { return topCard == card && (topCard.isInstant() || topCard.isSorcery()) && topCard.getSpellAbility() != null && topCard.getSpellAbility().spellCanBeActivatedRegularlyNow(controller.getId(), game); } } } } return false; } }
@Override public ActivationStatus canActivate(UUID playerId, Game game) { if (null != game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.CAST_AS_INSTANT, this, playerId, game) // check this first to allow Offering in main phase || this.spellCanBeActivatedRegularlyNow(playerId, game)) { if (spellAbilityType == SpellAbilityType.SPLIT || spellAbilityType == SpellAbilityType.SPLIT_AFTERMATH) { return ActivationStatus.getFalse();