new common class: SourceEnteredThisTurnCondition (#10415)

* Create new common condition class

* Use common condition on nine cards where appropriate
This commit is contained in:
xenohedron 2023-05-29 19:13:21 -04:00 committed by GitHub
parent 749f2e3991
commit 50105c0372
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 55 additions and 142 deletions

View file

@ -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 xenohedron
*/
public enum SourceEnteredThisTurnCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentOrLKI(game);
return permanent != null && permanent.getTurnsOnBattlefield() == 0;
}
@Override
public String toString() {
return "{this} entered the battlefield this turn";
}
}