mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
fixed Evangelize not being castable when caster controls no creatures.
(fixes #4094)
This commit is contained in:
parent
d7a8e7c7e6
commit
0fc3afb235
1 changed files with 29 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue