foul-magics/Mage/src/main/java/mage/abilities/hint/common/CovenHint.java
Evan Kranzler 80e11b2052
(WIP) Replacing blocking/blocked by predicates (#8729)
* replaced blocking/blocked by predicates

* added test for knight of dusk (currently fails)

* added source parameter to filters and everything else that needs it

* some changes to various predicates

* test fix

* small changes to filter code

* merge fix

* fixed a test failure

* small change to Karn, Scion of Urza

* removed sourceId from filter methods and other similar places

* added new getobject method to fix some test failures

* a few more fixes

* fixed merge conflicts

* merge fix
2022-03-23 18:45:02 -04:00

44 lines
1.2 KiB
Java

package mage.abilities.hint.common;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.hint.Hint;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author TheElk801
*/
public enum CovenHint implements Hint {
instance;
@Override
public String getText(Game game, Ability ability) {
List<String> powers = game
.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_CREATURE,
ability.getControllerId(), ability, game
)
.stream()
.filter(Objects::nonNull)
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.distinct()
.sorted()
.mapToObj(String::valueOf)
.collect(Collectors.toList());
return "Different powers among creatures you control: " + powers.size()
+ (powers.size() > 0 ? " (" + String.join(", ", powers) + ')' : "");
}
@Override
public Hint copy() {
return this;
}
}