use of mage.abilities.keyword.FlashbackAbility in project mage by magefree.
the class BosiumStripReplacementEffect method applies.
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (!(source instanceof FlashbackAbility) && affectedControllerId.equals(source.getControllerId())) {
Player player = game.getPlayer(affectedControllerId);
Card card = game.getCard(objectId);
if (card != null && player != null && card.equals(player.getGraveyard().getTopCard(game)) && StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY.match(card, game) && game.getState().getZone(objectId) == Zone.GRAVEYARD) {
game.getState().setValue("BosiumStrip", card);
return true;
}
}
return false;
}
use of mage.abilities.keyword.FlashbackAbility in project mage by magefree.
the class BackdraftHellkiteEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.getGraveyard().stream().filter(cardId -> affectedObjectList.contains(new MageObjectReference(cardId, game))).forEachOrdered(cardId -> {
Card card = game.getCard(cardId);
if (card == null) {
return;
}
FlashbackAbility ability = new FlashbackAbility(card, card.getManaCost());
ability.setSourceId(cardId);
ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability);
});
return true;
}
use of mage.abilities.keyword.FlashbackAbility in project mage by magefree.
the class PastInFlamesEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.getGraveyard().stream().filter((cardId) -> (affectedObjectList.contains(new MageObjectReference(cardId, game)))).forEachOrdered((cardId) -> {
Card card = game.getCard(cardId);
if (card != null) {
FlashbackAbility ability = new FlashbackAbility(card, card.getManaCost());
ability.setSourceId(cardId);
ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability);
}
});
return true;
}
use of mage.abilities.keyword.FlashbackAbility in project mage by magefree.
the class DralnuLichLordFlashbackEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
FlashbackAbility ability = new FlashbackAbility(card, card.getManaCost());
ability.setSourceId(card.getId());
ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability);
return true;
}
return false;
}
use of mage.abilities.keyword.FlashbackAbility in project mage by magefree.
the class KessDissidentMageWatcher method applies.
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (source instanceof FlashbackAbility || !affectedControllerId.equals(source.getControllerId()) || !game.isActivePlayer(source.getControllerId())) {
return false;
}
Card card = game.getCard(objectId);
if (card == null || !card.isInstantOrSorcery(game) || !game.getState().getZone(objectId).equals(Zone.GRAVEYARD) || !card.isOwnedBy(source.getControllerId())) {
return false;
}
// check if not already a card was cast this turn with this ability
KessDissidentMageWatcher watcher = game.getState().getWatcher(KessDissidentMageWatcher.class);
return watcher != null && !watcher.isAbilityUsed(new MageObjectReference(source.getSourceId(), game));
}
Aggregations