mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 05:52:06 -08:00
Add SourceHasSubtypeCondition
This commit is contained in:
parent
9c89b269a6
commit
28efe62339
2 changed files with 31 additions and 19 deletions
|
|
@ -0,0 +1,28 @@
|
|||
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 SourceHasSubtypeCondition implements Condition {
|
||||
|
||||
private final String subtype;
|
||||
|
||||
public SourceHasSubtypeCondition(String subtype) {
|
||||
this.subtype = subtype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
return permanent.hasSubtype(subtype);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue