forked from External/mage
[DSK] Implement Leyline of Hope
This commit is contained in:
parent
606a4a4e49
commit
f0a77a8551
7 changed files with 104 additions and 78 deletions
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue