mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +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;
|
||||
|
@ -49,7 +50,7 @@ public class TargetOpponentsChoicePermanent extends TargetPermanent {
|
|||
if (opponentId != null) {
|
||||
if (permanent != null) {
|
||||
if (source != null) {
|
||||
boolean canSourceControllerTarget = true;
|
||||
boolean canSourceControllerTarget = true;
|
||||
if (!isNotTarget()) {
|
||||
if (!permanent.canBeTargetedBy(game.getObject(source.getId()), controllerId, game)
|
||||
|| !permanent.canBeTargetedBy(game.getObject(source.getSourceId()), controllerId, game)) {
|
||||
|
@ -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