use of mage.abilities.effects.keyword.ScryEffect in project mage by magefree.
the class StudyHallTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!getSourceId().equals(event.getSourceId())) {
return false;
}
Permanent sourcePermanent = getSourcePermanentOrLKI(game);
if (sourcePermanent == null || sourcePermanent.getAbilities(game).stream().map(Ability::getOriginalId).map(UUID::toString).noneMatch(event.getData()::equals)) {
return false;
}
Player player = game.getPlayer(getControllerId());
Spell spell = game.getStack().getSpell(event.getTargetId());
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
if (player == null || spell == null || watcher == null || !game.isCommanderObject(player, spell)) {
return false;
}
getEffects().clear();
addEffect(new ScryEffect(watcher.getPlaysCount(spell.getMainCard().getId())));
return true;
}
use of mage.abilities.effects.keyword.ScryEffect in project mage by magefree.
the class PutridCyclopEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
new ScryEffect(1).apply(game, source);
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
int unboost = card.getManaValue() * -1;
ContinuousEffect effect = new BoostSourceEffect(unboost, unboost, Duration.EndOfTurn);
game.addEffect(effect, source);
}
return true;
}
return false;
}
Aggregations