Package mage.abilities.condition.common

Source Code of mage.abilities.condition.common.CastFromHandCondition

package mage.abilities.condition.common;

import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.Watcher;

/**
* Warning: CastFromHandWatcher must be installed to card for proper working.
*
* @author Loki
*/
public class CastFromHandCondition implements Condition {
    @Override
    public boolean apply(Game game, Ability source) {
        Permanent p = game.getPermanent(source.getSourceId());
        if (p != null) {
            Watcher watcher = game.getState().getWatchers().get("CastFromHand", source.getSourceId());
            if (watcher != null && watcher.conditionMet()) {
                return true;
            }
        }
        return false;
    }
}
TOP

Related Classes of mage.abilities.condition.common.CastFromHandCondition

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.