- InputAttack was not considering Bands with Others for the creation of bands

This commit is contained in:
Sol
2016-05-24 01:41:51 +00:00
parent 5b6fba4bda
commit 132dfed415

View File

@@ -54,12 +54,14 @@ public class InputAttack extends InputSyncronizedBase {
private GameEntity currentDefender; private GameEntity currentDefender;
private final Player playerAttacks; private final Player playerAttacks;
private AttackingBand activeBand = null; private AttackingBand activeBand = null;
private boolean potentialBanding;
public InputAttack(PlayerControllerHuman controller, Player attacks0, Combat combat0) { public InputAttack(PlayerControllerHuman controller, Player attacks0, Combat combat0) {
super(controller); super(controller);
playerAttacks = attacks0; playerAttacks = attacks0;
combat = combat0; combat = combat0;
defenders = combat.getDefenders(); defenders = combat.getDefenders();
potentialBanding = isBandingPossible();
} }
@Override @Override
@@ -161,7 +163,7 @@ public class InputAttack extends InputSyncronizedBase {
if (combat.isAttacking(card, currentDefender)) { if (combat.isAttacking(card, currentDefender)) {
boolean validAction = true; boolean validAction = true;
if (isBandingPossible()) { if (potentialBanding) {
// Activate band by selecting/deselecting a band member // Activate band by selecting/deselecting a band member
if (activeBand == null) { if (activeBand == null) {
activateBand(combat.getBandOfAttacker(card)); activateBand(combat.getBandOfAttacker(card));
@@ -232,7 +234,7 @@ public class InputAttack extends InputSyncronizedBase {
@Override @Override
public String getActivateAction(Card card) { public String getActivateAction(Card card) {
if (combat.isAttacking(card, currentDefender)) { if (combat.isAttacking(card, currentDefender)) {
if (isBandingPossible()) { if (potentialBanding) {
return "activate band with card"; return "activate band with card";
} }
return "remove card from combat"; return "remove card from combat";
@@ -302,8 +304,9 @@ public class InputAttack extends InputSyncronizedBase {
//only enable banding message and actions if a creature that can attack has banding //only enable banding message and actions if a creature that can attack has banding
private boolean isBandingPossible() { private boolean isBandingPossible() {
final CardCollectionView possibleAttackers = playerAttacks.getCardsIn(ZoneType.Battlefield); final CardCollectionView possibleAttackers = playerAttacks.getCardsIn(ZoneType.Battlefield);
for (final Card c : Iterables.filter(possibleAttackers, CardPredicates.hasKeyword("Banding"))) { for (final Card c : possibleAttackers) {
if (CombatUtil.canAttack(c, currentDefender)) { if ((c.hasKeyword("Banding") || c.hasStartOfKeyword("Bands with Other")) &&
CombatUtil.canAttack(c, currentDefender)) {
return true; return true;
} }
} }
@@ -312,7 +315,7 @@ public class InputAttack extends InputSyncronizedBase {
private void updateMessage() { private void updateMessage() {
String message = "Select creatures to attack " + currentDefender + " or select player/planeswalker you wish to attack."; String message = "Select creatures to attack " + currentDefender + " or select player/planeswalker you wish to attack.";
if (isBandingPossible()) { if (potentialBanding) {
message += " To attack as a band, select an attacking creature to activate its 'band' then select another to join it."; message += " To attack as a band, select an attacking creature to activate its 'band' then select another to join it.";
} }
showMessage(message); showMessage(message);