* Highcliff Felidar - Fixed a problem that not always all players were handled (fixes #6826).

This commit is contained in:
LevelX2 2020-07-30 10:29:13 +02:00
parent 0824d2901a
commit 8f2c08efd3

View file

@ -60,8 +60,8 @@ class HighcliffFelidarEffect extends OneShotEffect {
HighcliffFelidarEffect() { HighcliffFelidarEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "for each opponent, choose a creature with the greatest power " + staticText = "for each opponent, choose a creature with the greatest power "
"among creatures that player controls. Destroy those creatures."; + "among creatures that player controls. Destroy those creatures.";
} }
private HighcliffFelidarEffect(final HighcliffFelidarEffect effect) { private HighcliffFelidarEffect(final HighcliffFelidarEffect effect) {
@ -75,8 +75,8 @@ class HighcliffFelidarEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (player == null) { if (controller == null) {
return false; return false;
} }
Set<UUID> toDestroy = new HashSet(); Set<UUID> toDestroy = new HashSet();
@ -93,18 +93,17 @@ class HighcliffFelidarEffect extends OneShotEffect {
.mapToInt(MageInt::getValue) .mapToInt(MageInt::getValue)
.max() .max()
.orElse(Integer.MIN_VALUE); .orElse(Integer.MIN_VALUE);
if (maxPower == Integer.MIN_VALUE) { if (maxPower > Integer.MIN_VALUE) {
return; FilterPermanent filter = new FilterCreaturePermanent(
} "creature with the greatest power controlled by " + opponent.getName()
FilterPermanent filter = new FilterCreaturePermanent( );
"creature with the greatest power controlled by " + opponent.getName() filter.add(new ControllerIdPredicate(opponent.getId()));
); filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, maxPower));
filter.add(new ControllerIdPredicate(opponent.getId())); TargetPermanent target = new TargetPermanent(filter);
filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, maxPower)); target.setNotTarget(true);
TargetPermanent target = new TargetPermanent(filter); if (controller.choose(outcome, target, source.getSourceId(), game)) {
target.setNotTarget(true); toDestroy.add(target.getFirstTarget());
if (player.choose(outcome, target, source.getSourceId(), game)) { }
toDestroy.add(target.getFirstTarget());
} }
}); });
toDestroy.stream() toDestroy.stream()
@ -116,7 +115,6 @@ class HighcliffFelidarEffect extends OneShotEffect {
} }
// I realized after writing all this that the ability doesn't target but I like this code too much to erase it // I realized after writing all this that the ability doesn't target but I like this code too much to erase it
//enum HighcliffFelidarAdjuster implements TargetAdjuster { //enum HighcliffFelidarAdjuster implements TargetAdjuster {
// instance; // instance;
// //