mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
[EMN] Added Thirsting Axe.
This commit is contained in:
parent
de0b66240f
commit
712316d8ff
3 changed files with 201 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Quercitron
|
||||
*/
|
||||
public class AttachedCondition implements Condition {
|
||||
|
||||
private static final AttachedCondition fInstance = new AttachedCondition();
|
||||
|
||||
public static AttachedCondition getInstance() {
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent attachment = game.getPermanent(source.getSourceId());
|
||||
if (attachment == null || attachment.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
||||
return (attachedTo != null);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Quercitron
|
||||
*/
|
||||
public class WatcherCondition implements Condition {
|
||||
|
||||
private final String watcherKey;
|
||||
private final WatcherScope watcherScope;
|
||||
private final String text;
|
||||
|
||||
public WatcherCondition(String watcherKey, WatcherScope watcherScope) {
|
||||
this(watcherKey, watcherScope, "");
|
||||
}
|
||||
|
||||
public WatcherCondition(String watcherKey, WatcherScope watcherScope, String text) {
|
||||
this.watcherKey = watcherKey;
|
||||
this.watcherScope = watcherScope;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Watcher watcher = null;
|
||||
switch (watcherScope) {
|
||||
case GAME:
|
||||
watcher = game.getState().getWatchers().get(watcherKey);
|
||||
break;
|
||||
case PLAYER:
|
||||
watcher = game.getState().getWatchers().get(watcherKey, source.getControllerId());
|
||||
break;
|
||||
case CARD:
|
||||
watcher = game.getState().getWatchers().get(watcherKey, source.getSourceId());
|
||||
break;
|
||||
}
|
||||
return watcher != null && watcher.conditionMet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue