diff --git a/Mage.Sets/src/mage/sets/worldwake/FeralContest.java b/Mage.Sets/src/mage/sets/worldwake/FeralContest.java index bcc875789e..7571d00d6c 100644 --- a/Mage.Sets/src/mage/sets/worldwake/FeralContest.java +++ b/Mage.Sets/src/mage/sets/worldwake/FeralContest.java @@ -55,15 +55,12 @@ public class FeralContest extends CardImpl { this.color.setGreen(true); - // Put a +1/+1 counter on target creature you control. Another target creature blocks it this turn if able. - TargetControlledCreaturePermanent target1 = new TargetControlledCreaturePermanent(); - TargetCreaturePermanent target2 = new TargetCreaturePermanent(); - Effect effect1 = new AddCountersTargetEffect(CounterType.P1P1.createInstance()); - RequirementEffect effect2 = new FeralContestEffect(); - this.getSpellAbility().addEffect(effect1); - this.getSpellAbility().addTarget(target1); - this.getSpellAbility().addEffect(effect2); - this.getSpellAbility().addTarget(target2); + // Put a +1/+1 counter on target creature you control. + this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance())); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); + // Another target creature blocks it this turn if able. + this.getSpellAbility().addEffect(new FeralContestEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } public FeralContest(final FeralContest card) { diff --git a/Mage/src/mage/abilities/ActivatedAbilityImpl.java b/Mage/src/mage/abilities/ActivatedAbilityImpl.java index 2d97e769d3..ef8783d5a1 100644 --- a/Mage/src/mage/abilities/ActivatedAbilityImpl.java +++ b/Mage/src/mage/abilities/ActivatedAbilityImpl.java @@ -172,7 +172,7 @@ public abstract class ActivatedAbilityImpl> ex break; case OPPONENT: - if(!game.getOpponents(controllerId).contains(playerId)){ + if (! game.getPlayer(controllerId).hasOpponent(playerId, game)){ return false; } break; diff --git a/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java index 01614484fb..9844e4b8f1 100644 --- a/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java @@ -49,7 +49,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl> } break; case OPPONENT: - if (game.getOpponents(playerId).contains(card.getOwnerId())) { + if (!card.getOwnerId().equals(playerId) && + game.getPlayer(playerId).hasOpponent(card.getOwnerId(), game)) { return true; } break; diff --git a/Mage/src/mage/filter/predicate/other/PlayerPredicate.java b/Mage/src/mage/filter/predicate/other/PlayerPredicate.java index 6945ead358..c4b498a568 100644 --- a/Mage/src/mage/filter/predicate/other/PlayerPredicate.java +++ b/Mage/src/mage/filter/predicate/other/PlayerPredicate.java @@ -61,7 +61,8 @@ public class PlayerPredicate implements ObjectSourcePlayerPredicate> { - private TargetController controller; + private final TargetController controller; public DamagedPlayerThisTurnPredicate(TargetController controller) { this.controller = controller; diff --git a/Mage/src/mage/players/Player.java b/Mage/src/mage/players/Player.java index 651a989f0b..d4fcee5d09 100644 --- a/Mage/src/mage/players/Player.java +++ b/Mage/src/mage/players/Player.java @@ -144,6 +144,7 @@ public interface Player extends MageItem, Copyable { /** * Defines player whose turn this player controls at the moment. + * @param game * @param playerId */ void controlPlayersTurn(Game game, UUID playerId); @@ -316,13 +317,15 @@ public interface Player extends MageItem, Copyable { /** * asThough effect to reveal faceDown cards * + * @param card + * @param game */ void revealFaceDownCard(Card card, Game game); /** * Set seconds left to play the game. * - * @return + * @param timeLeft */ void setPriorityTimeLeft(int timeLeft); @@ -344,14 +347,14 @@ public interface Player extends MageItem, Copyable { boolean canJoinTable(Table table); /** - * Get the commanderId of the player - * @param card + * Set the commanderId of the player + * @param commanderId */ void setCommanderId(UUID commanderId); /** - * Set the commanderId of the player - * @param card + * Get the commanderId of the player + * @return */ UUID getCommanderId(); @@ -374,9 +377,16 @@ public interface Player extends MageItem, Copyable { * @param game * @param fromZone * @param sourceId - * @param game * @return */ boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId); + /** + * Checks if the playerToCheckId is from an opponent in range + * + * @param playerToCheckId + * @param game + * @return true if playerToCheckId belongs to an opponent + */ + boolean hasOpponent(UUID playerToCheckId, Game game); } diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 5c8338cfc3..9758871669 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -492,7 +492,7 @@ public abstract class PlayerImpl> implements Player, Ser } else if (source instanceof StackObject) { controllerId = ((StackObject) source).getControllerId(); } - if (controllerId != null && game.getOpponents(this.playerId).contains(controllerId) && + if (controllerId != null && this.hasOpponent(controllerId, game) && !game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, game)) { return false; } @@ -1446,12 +1446,7 @@ public abstract class PlayerImpl> implements Player, Ser @Override public void resetPassed() { - if (!this.loses && !this.hasLeft()) { - this.passed = false; - } - else { - this.passed = true; - } + this.passed = this.loses || this.hasLeft(); } @Override @@ -2093,9 +2088,6 @@ public abstract class PlayerImpl> implements Player, Ser return this.commanderId; } - /** - * {@inheritDoc} - */ @Override public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { boolean result = false; @@ -2108,9 +2100,6 @@ public abstract class PlayerImpl> implements Player, Ser return result; } - /** - * {@inheritDoc} - */ @Override public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId) { boolean result = false; @@ -2123,5 +2112,10 @@ public abstract class PlayerImpl> implements Player, Ser return result; } + @Override + public boolean hasOpponent(UUID playerToCheckId, Game game) { + return game.isOpponent(this, playerToCheckId); + } + } diff --git a/Mage/src/mage/target/common/TargetCardInOpponentsGraveyard.java b/Mage/src/mage/target/common/TargetCardInOpponentsGraveyard.java index 7f4be51a35..705bbd0dff 100644 --- a/Mage/src/mage/target/common/TargetCardInOpponentsGraveyard.java +++ b/Mage/src/mage/target/common/TargetCardInOpponentsGraveyard.java @@ -37,7 +37,7 @@ public class TargetCardInOpponentsGraveyard extends TargetCard { return; if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - if (game.getOpponents(this.controllerId).contains(damageEvent.getPlayerId())) { + if (game.getPlayer(this.getControllerId()).hasOpponent(damageEvent.getPlayerId(), game)) { condition = true; } }