use of mage.game.events.MadnessCardExiledEvent in project mage by magefree.
the class MadnessCastEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Card card = game.getCard(event.getTargetId());
if (card == null) {
return false;
}
// TODO, deal with deprecated call
if (controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source, game, ((ZoneChangeEvent) event).getFromZone(), true)) {
// needed to add Madness ability to cards (e.g. by Falkenrath Gorger)
game.applyEffects();
GameEvent gameEvent = new MadnessCardExiledEvent(card.getId(), source, controller.getId());
game.fireEvent(gameEvent);
}
return true;
}
Aggregations