mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Fix Goad + Planeswalker interaction. Fix #9148
This commit is contained in:
parent
a7a51b4117
commit
1e4c64aacd
1 changed files with 7 additions and 6 deletions
|
@ -35,6 +35,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -459,7 +460,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
} else {
|
||||
// if creature is goaded then we start with assumption that it needs to attack any player
|
||||
mustAttack = true;
|
||||
defendersForcedToAttack.addAll(defenders);
|
||||
// Filter out the planeswalkers
|
||||
defendersForcedToAttack.addAll(defenders.stream().map(game::getPlayer).filter(Objects::nonNull).map(Player::getId).collect(Collectors.toSet()));
|
||||
// defendersForcedToAttack.addAll(defenders);
|
||||
}
|
||||
if (!mustAttack) {
|
||||
continue;
|
||||
|
@ -488,11 +491,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// if creature can attack someone other than a player that goaded them
|
||||
// then they attack one of those players, otherwise they attack any player
|
||||
if (!defendersForcedToAttack.stream().allMatch(creature.getGoadingPlayers()::contains)) {
|
||||
defendersForcedToAttack.removeAll(creature.getGoadingPlayers());
|
||||
}
|
||||
// Remove all the players which have goaded the attacker
|
||||
defendersForcedToAttack.removeAll(creature.getGoadingPlayers());
|
||||
|
||||
// force attack only if a defender can be attacked without paying a cost
|
||||
if (defendersCostlessAttackable.isEmpty()) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue