[DSK] Implement Leyline of Hope

This commit is contained in:
theelk801 2024-06-28 15:12:14 -04:00
parent 606a4a4e49
commit f0a77a8551
7 changed files with 104 additions and 78 deletions

View file

@ -0,0 +1,39 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Controllable;
import mage.game.Game;
import mage.players.Player;
import java.util.Optional;
/**
* @author TheElk801
*/
public enum MoreThanStartingLifeTotalCondition implements Condition {
SEVEN(7),
TEN(10),
FIFTEEN(10);
private final int amount;
MoreThanStartingLifeTotalCondition(int amount) {
this.amount = amount;
}
@Override
public boolean apply(Game game, Ability source) {
return Optional
.ofNullable(source)
.map(Controllable::getControllerId)
.map(game::getPlayer)
.map(Player::getLife)
.map(life -> life >= game.getStartingLife() + amount)
.orElse(false);
}
@Override
public String toString() {
return "you have at least " + amount + " life more than your starting life total";
}
}