mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
refactoring
This commit is contained in:
parent
3c8e5d4ea2
commit
bc89714da0
2 changed files with 30 additions and 32 deletions
|
|
@ -0,0 +1,26 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue