mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
[DSK] Implement Abandoned Campground
This commit is contained in:
parent
8266d2788b
commit
343e0d5179
3 changed files with 70 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum APlayerHas13LifeCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return game
|
||||
.getState()
|
||||
.getPlayersInRange(source.getControllerId(), game)
|
||||
.stream()
|
||||
.map(game::getPlayer)
|
||||
.filter(Objects::nonNull)
|
||||
.mapToInt(Player::getLife)
|
||||
.anyMatch(x -> x <= 13);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "a player has 13 or less life";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue