use of mage.watchers.common.CreatureWasCastWatcher in project mage by magefree.
the class UphillBattleTapEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
CreatureWasCastWatcher creatureSpellWatcher = game.getState().getWatcher(CreatureWasCastWatcher.class);
PlayCreatureLandWatcher landWatcher = game.getState().getWatcher(PlayCreatureLandWatcher.class);
if (target != null && ((creatureSpellWatcher != null && creatureSpellWatcher.wasCreatureCastThisTurn(target.getId())) || (landWatcher != null && landWatcher.wasLandPlayed(target.getId())))) {
target.setTapped(true);
}
return false;
}
use of mage.watchers.common.CreatureWasCastWatcher in project mage by magefree.
the class ContainmentPriestReplacementEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) {
Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId());
Card card = game.getCard(event.getTargetId());
if (card != null && entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) {
card = card.getSecondCardFace();
}
if (card != null && card.isCreature(game)) {
// TODO: Bestow Card cast as Enchantment probably not handled correctly
CreatureWasCastWatcher watcher = game.getState().getWatcher(CreatureWasCastWatcher.class);
return watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId());
}
}
return false;
}
Aggregations