From 46da34da78ac00d27d3bdad6a0cdae26a758515b Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 3 Jun 2018 18:38:53 +0200 Subject: [PATCH] * Fixed a problem of Gideon Jura +2 ability introduced with 1be4379(fixes) #4994. --- Mage.Sets/src/mage/cards/g/GideonJura.java | 8 ++-- .../main/java/mage/game/combat/Combat.java | 39 +++++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GideonJura.java b/Mage.Sets/src/mage/cards/g/GideonJura.java index c51c2d864f..1e1c44adab 100644 --- a/Mage.Sets/src/mage/cards/g/GideonJura.java +++ b/Mage.Sets/src/mage/cards/g/GideonJura.java @@ -1,4 +1,3 @@ - package mage.cards.g; import java.util.UUID; @@ -15,8 +14,8 @@ import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubType; import mage.constants.SuperType; import mage.constants.TurnPhase; import mage.filter.common.FilterCreaturePermanent; @@ -24,7 +23,6 @@ import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.TokenImpl; -import mage.game.permanent.token.Token; import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetOpponent; @@ -41,7 +39,7 @@ public final class GideonJura extends CardImpl { } public GideonJura(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{W}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.GIDEON); @@ -86,10 +84,12 @@ class GideonJuraToken extends TokenImpl { power = new MageInt(6); toughness = new MageInt(6); } + public GideonJuraToken(final GideonJuraToken token) { super(token); } + @Override public GideonJuraToken copy() { return new GideonJuraToken(this); } diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index f15ff1298b..c6478382be 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -1,4 +1,3 @@ - package mage.game.combat; import java.io.Serializable; @@ -302,16 +301,16 @@ public class Combat implements Serializable, Copyable { target.setRequired(false); if (!target.canChoose(attackingPlayerId, game) || game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARING_ATTACKERS, attackingPlayerId, attackingPlayerId)) - || !player.chooseUse(Outcome.Benefit, "Do you wish to " + (isBanded ? "band " + attacker.getLogName() + " with another " : "form a band with " + attacker.getLogName() + " and an " ) + "attacking creature?", null, game)) { + || !player.chooseUse(Outcome.Benefit, "Do you wish to " + (isBanded ? "band " + attacker.getLogName() + " with another " : "form a band with " + attacker.getLogName() + " and an ") + "attacking creature?", null, game)) { break; } if (target.choose(Outcome.Benefit, attackingPlayerId, null, game)) { isBanded = true; - for (UUID targetId: target.getTargets()) { + for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { if (permanent != null) { - + for (UUID bandedId : attacker.getBandedCards()) { permanent.addBandedCard(bandedId); Permanent banded = game.getPermanent(bandedId); @@ -397,10 +396,10 @@ public class Combat implements Serializable, Copyable { } } } else { - if (defenders.size() == 1) { + if (defendersForcedToAttack.size() == 1) { player.declareAttacker(creature.getId(), defendersForcedToAttack.iterator().next(), game, false); } else { - TargetDefender target = new TargetDefender(defendersCostlessAttackable, creature.getId()); + TargetDefender target = new TargetDefender(defendersForcedToAttack, creature.getId()); target.setRequired(true); if (player.chooseTarget(Outcome.Damage, target, null, game)) { player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false); @@ -747,7 +746,7 @@ public class Combat implements Serializable, Copyable { // check if enough possible blockers are available, if true, mayBlock can be set to true if (attackingCreature.getMinBlockedBy() > 1) { - int alreadyBlockingCreatures = 0; + int alreadyBlockingCreatures = 0; for (CombatGroup group : getGroups()) { if (group.getAttackers().contains(attackingCreatureId)) { alreadyBlockingCreatures = group.getBlockers().size(); @@ -841,7 +840,7 @@ public class Combat implements Serializable, Copyable { // check if enough possible blockers are available, if true, mayBlock can be set to true if (attackingCreature.getMinBlockedBy() > 1) { - int alreadyBlockingCreatures = 0; + int alreadyBlockingCreatures = 0; for (CombatGroup group : getGroups()) { if (group.getAttackers().contains(attackingCreatureId)) { alreadyBlockingCreatures = group.getBlockers().size(); @@ -954,7 +953,6 @@ public class Combat implements Serializable, Copyable { continue; } - // // check if creature has to pay a cost to block so it's not mandatory to block // boolean removedAttacker = false; // for (Iterator iterator = entry.getValue().iterator(); iterator.hasNext();) { @@ -970,7 +968,6 @@ public class Combat implements Serializable, Copyable { // continue; // } // creature does not block -> not allowed - // Check if blocker is really able to block one or more attackers (maybe not if the attacker has menace) - if not continue with the next forced blocker // TODO: Probably there is some potential to abuse the check if forced blockers are assigned to differnt attackers with e.g. menace. // While if assigned all to one the block is possible @@ -1207,7 +1204,7 @@ public class Combat implements Serializable, Copyable { } } } - + @SuppressWarnings("deprecation") public boolean declareAttacker(UUID creatureId, UUID defenderId, UUID playerId, Game game) { Permanent attacker = game.getPermanent(creatureId); @@ -1280,7 +1277,8 @@ public class Combat implements Serializable, Copyable { } /** - * Add blocking group for creatures that already block more than one creature + * Add blocking group for creatures that already block more than one + * creature * * @param blockerId * @param attackerId @@ -1292,14 +1290,15 @@ public class Combat implements Serializable, Copyable { } /** - * Use the previous addBlockingGroup instead (solveBanding should always be true - * outside this method) + * Use the previous addBlockingGroup instead (solveBanding should always be + * true outside this method) * * @param blockerId * @param attackerId * @param playerId * @param game - * @param solveBanding check whether also add creatures banded with attackerId + * @param solveBanding check whether also add creatures banded with + * attackerId */ public void addBlockingGroup(UUID blockerId, UUID attackerId, UUID playerId, Game game, boolean solveBanding) { Permanent blocker = game.getPermanent(blockerId); @@ -1321,7 +1320,7 @@ public class Combat implements Serializable, Copyable { } // "blocker.setBlocking(blocker.getBlocking() + 1)" is handled by the attacking combat group (in addBlockerToGroup) } - if (solveBanding) { + if (solveBanding) { Permanent attacker = game.getPermanent(attackerId); if (attacker != null) { for (UUID bandedId : attacker.getBandedCards()) { @@ -1562,8 +1561,8 @@ public class Combat implements Serializable, Copyable { } /** - * Manual player action for undoing one declared blocker - * (used for multi-blocker creatures) + * Manual player action for undoing one declared blocker (used for + * multi-blocker creatures) * * @param blockerId * @param groupToUnblock @@ -1628,8 +1627,8 @@ public class Combat implements Serializable, Copyable { } /** - * Manual player action for undoing all declared blockers - * (used for single-blocker creatures and multi-blockers exceeding blocking limit) + * Manual player action for undoing all declared blockers (used for + * single-blocker creatures and multi-blockers exceeding blocking limit) * * @param blockerId * @param game