[AFR] Fixed Monk Class level 3 interaction with MDFCs and lands

This commit is contained in:
Daniel Bomar 2021-09-27 16:33:43 -05:00
parent 532f158ab4
commit f0ae098b2e
No known key found for this signature in database
GPG key ID: C86C8658F4023918

View file

@ -23,6 +23,7 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetNonlandPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import mage.watchers.common.SpellsCastWatcher;
import java.util.UUID;
@ -134,12 +135,13 @@ class MonkClassCastEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (!sourceId.equals(source.getSourceId()) || !source.isControlledBy(affectedControllerId)) {
UUID mainCardId = CardUtil.getMainCardId(game, sourceId);
if (!mainCardId.equals(source.getSourceId()) || !source.isControlledBy(affectedControllerId)) {
return false;
}
Card card = game.getCard(source.getSourceId());
Card card = game.getCard(sourceId);
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
return card != null && watcher != null
return card != null && watcher != null && !card.isLand(game)
&& watcher.getSpellsCastThisTurn(affectedControllerId).size() > 0;
}