mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Implemented Flawless Maneuver
This commit is contained in:
parent
3019fb30d4
commit
5b58e6df0c
3 changed files with 76 additions and 0 deletions
|
|
@ -0,0 +1,35 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.CommanderCardType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum ControlACommanderCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return game.getPlayerList()
|
||||
.stream()
|
||||
.map(game::getPlayer)
|
||||
.filter(Objects::nonNull)
|
||||
.map(player -> game.getCommandersIds(player, CommanderCardType.COMMANDER_OR_OATHBREAKER))
|
||||
.flatMap(Collection::stream)
|
||||
.map(game::getPermanent)
|
||||
.map(Permanent::getControllerId)
|
||||
.anyMatch(source.getControllerId()::equals);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "If you control a commander";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue