* Attacking Planeswalker - Fixed a bug that it was not able to attack a planeswalker that had hexproof.

This commit is contained in:
LevelX2 2014-03-29 17:46:12 +01:00
parent 4e9bf6693a
commit b5ef4a7f45
2 changed files with 3 additions and 1 deletions

View file

@ -662,7 +662,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
} }
else { else {
TargetDefender target = new TargetDefender(possibleDefender, attackerId); TargetDefender target = new TargetDefender(possibleDefender, attackerId);
target.setNotTarget(true); // player hexproof does not prevent attacking a player target.setNotTarget(true); // player or planswalker hexproof does not prevent attacking a player
if (forcedToAttack) { if (forcedToAttack) {
StringBuilder sb = new StringBuilder(target.getTargetName()); StringBuilder sb = new StringBuilder(target.getTargetName());
Permanent attacker = game.getPermanent(attackerId); Permanent attacker = game.getPermanent(attackerId);

View file

@ -86,6 +86,7 @@ public class TargetDefender extends TargetImpl<TargetDefender> {
MageObject targetSource = game.getObject(sourceId); MageObject targetSource = game.getObject(sourceId);
for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) { for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
// removed canBeTargeted because it's not correct to check it for attacking target
if (player != null && player.canBeTargetedBy(targetSource, game) && filter.match(player, game)) { if (player != null && player.canBeTargetedBy(targetSource, game) && filter.match(player, game)) {
count++; count++;
if (count >= this.minNumberOfTargets) { if (count >= this.minNumberOfTargets) {
@ -94,6 +95,7 @@ public class TargetDefender extends TargetImpl<TargetDefender> {
} }
} }
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterPlaneswalkerPermanent(), sourceControllerId, game)) { for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterPlaneswalkerPermanent(), sourceControllerId, game)) {
// removed canBeTargeted because it's not correct to check for attacking target
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, game)) { if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, game)) {
count++; count++;
if (count >= this.minNumberOfTargets) { if (count >= this.minNumberOfTargets) {