[SOI] refactor some TDFCs

This commit is contained in:
theelk801 2025-07-29 09:03:34 -04:00
parent 94b71e4c67
commit 668e2bfe22
14 changed files with 126 additions and 196 deletions

View file

@ -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();
}
}

View file

@ -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;
}
}