Restructured Mage module

This commit is contained in:
poixen 2015-11-29 21:56:49 +01:00
parent 727d62babb
commit 46eb6c0525
1502 changed files with 11 additions and 9 deletions

View file

@ -0,0 +1,36 @@
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 permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
permanent = game.getPermanentEntering(source.getSourceId());
}
if (permanent != null) {
Watcher watcher = game.getState().getWatchers().get("CastFromHand", source.getSourceId());
if (watcher != null && watcher.conditionMet()) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "you cast it from your hand";
}
}