mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 20:59:14 -08:00
[SOI] refactor some TDFCs
This commit is contained in:
parent
94b71e4c67
commit
668e2bfe22
14 changed files with 126 additions and 196 deletions
|
|
@ -0,0 +1,19 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public enum NotTransformedCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
return permanent != null && !permanent.isTransformed();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class TransformedCondition implements Condition {
|
||||
|
||||
protected boolean notCondition;
|
||||
|
||||
public TransformedCondition() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The condition checks whether a permanent is transformed or not.
|
||||
*
|
||||
* @param notCondition if true the condition is true when the permanent is not transformed
|
||||
* @return true if the condition is true, false if the condition is false
|
||||
*/
|
||||
public TransformedCondition(boolean notCondition) {
|
||||
this.notCondition = notCondition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
if (notCondition) {
|
||||
return !permanent.isTransformed();
|
||||
} else {
|
||||
return permanent.isTransformed();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue