fixed Evangelize not being castable when caster controls no creatures.
(fixes
package mage.target.common;
import java.util.UUID;
+import mage.MageObject;
import mage.abilities.Ability;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
@@ -70,6 +71,33 @@ public class TargetOpponentsChoicePermanent extends TargetPermanent {
return super.chooseTarget(outcome, getOpponentId(playerId, source, game), source, game);
}
+ @Override
+ public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
+ MageObject sourceObject = game.getObject(sourceId);
+ Player player = game.getPlayer(sourceControllerId);
+ if (sourceObject == null || player == null) {
+ return false;
+ }
+ int counter;
+ for (UUID oppId : game.getState().getPlayersInRange(player.getId(), game)) {
+ counter = 0;
+ Player opp = game.getPlayer(oppId);
+ if (opp != null && player.hasOpponent(opp.getId(), game)) {
+ for (Permanent perm : game.getBattlefield().getActivePermanents(opp.getId(), game)) {
+ if (!targets.containsKey(perm.getId())
+ && filter.match(perm, sourceId, opp.getId(), game)
+ && perm.canBeTargetedBy(sourceObject, sourceControllerId, game)) {
+ counter++;
+ if (counter >= minNumberOfTargets) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
@Override
public TargetOpponentsChoicePermanent copy() {
return new TargetOpponentsChoicePermanent(this);
