* Fixed player Hexproof ThoughtAsIf handling (fixes #5796).

This commit is contained in:
LevelX2 2019-05-15 17:33:34 +02:00
parent 1dcdff58d2
commit bf8dd78b6e
2 changed files with 37 additions and 39 deletions

View file

@ -72,12 +72,12 @@ class DetectionTowerEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (affectedControllerId.equals(source.getControllerId())) {
if (game.getOpponents(source.getControllerId()).contains(sourceId)) {
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (affectedControllerId.equals(source.getControllerId())) { //
if (game.getOpponents(source.getControllerId()).contains(objectId)) {
return true;
}
Permanent creature = game.getPermanent(sourceId);
Permanent creature = game.getPermanent(objectId);
if (creature != null
&& game.getOpponents(source.getControllerId()).contains(creature.getControllerId())) {
return true;

View file

@ -1,6 +1,10 @@
package mage.players;
import com.google.common.collect.ImmutableMap;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Map.Entry;
import mage.ConditionalMana;
import mage.MageObject;
import mage.MageObjectReference;
@ -66,11 +70,6 @@ import mage.util.GameLog;
import mage.util.RandomUtil;
import org.apache.log4j.Logger;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Map.Entry;
public abstract class PlayerImpl implements Player, Serializable {
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
@ -182,7 +181,6 @@ public abstract class PlayerImpl implements Player, Serializable {
protected final Map<PhaseStep, Step.StepPart> silentPhaseSteps = ImmutableMap.<PhaseStep, Step.StepPart>builder().
put(PhaseStep.DECLARE_ATTACKERS, Step.StepPart.PRE).build();
public PlayerImpl(String name, RangeOfInfluence range) {
this(UUID.randomUUID());
this.name = name;
@ -611,7 +609,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
if (abilities.containsKey(HexproofAbility.getInstance().getId())) {
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
&& null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, this.getId(), game)) {
&& null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)) {
return false;
}
}