Refactored method in NaturesWill to not always return same value.

This commit is contained in:
Danny Plenge 2018-03-20 12:13:11 +01:00
parent 3ab65c1d86
commit 22d8a4ab36

View file

@ -84,19 +84,16 @@ class NaturesWillEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Set<UUID> damagedPlayers = (HashSet<UUID>) this.getValue("damagedPlayers");
if (damagedPlayers == null) {
return false;
}
List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source.getSourceId(), game);
for (Permanent land : lands) {
if (damagedPlayers.contains(land.getControllerId())) {
land.tap(game);
} else if (land.getControllerId().equals(source.getControllerId())) {
land.untap(game);
if (damagedPlayers != null) {
List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source.getSourceId(), game);
for (Permanent land : lands) {
if (damagedPlayers.contains(land.getControllerId())) {
land.tap(game);
} else if (land.getControllerId().equals(source.getControllerId())) {
land.untap(game);
}
}
}
return false;
}
}