use of mage.game.events.DrawCardEvent in project mage by magefree.
the class MageDrawAction method drawCard.
/**
* Draw a card if possible (there is no replacement effect that prevent us
* from drawing). Fire event about card drawn.
*
* @param source
* @param originalDrawEvent original draw event for replacement effects, can be null for normal calls
* @param game
* @return
*/
protected int drawCard(Ability source, GameEvent originalDrawEvent, Game game) {
GameEvent event = new DrawCardEvent(this.player.getId(), source, originalDrawEvent);
if (!game.replaceEvent(event)) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
drawnCards.add(card);
// if you want to use event.getSourceId() here then thinks x10 times
card.moveToZone(Zone.HAND, source, game, false);
if (player.isTopCardRevealed()) {
game.fireInformEvent(player.getLogName() + " draws a revealed card (" + card.getLogName() + ')');
}
game.fireEvent(new DrewCardEvent(card.getId(), player.getId(), source, originalDrawEvent));
return ArtificialScoringSystem.inst.getCardScore(card);
}
}
return NEGATIVE_VALUE;
}
Aggregations