getAttackerList was duplicate of getAttackers - has been replaced.

This commit is contained in:
Maxmtg
2013-04-09 15:34:51 +00:00
parent d1e9367a65
commit fc91229e95
9 changed files with 23 additions and 41 deletions

View File

@@ -63,7 +63,7 @@ public class EffectAi extends SpellAbilityAi {
final Target tgt = sa.getTarget();
if (tgt != null) {
tgt.resetTargets();
List<Card> list = game.getCombat().getAttackerList();
List<Card> list = game.getCombat().getAttackers();
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
list = CardLists.getTargetableCards(list, sa);
Card target = ComputerUtilCard.getBestCreatureAI(list);

View File

@@ -179,7 +179,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
} else if (keyword.endsWith("Flying")) {
if (ph.isPlayerTurn(opp)
&& ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
&& !CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackerList(), "Flying").isEmpty()
&& !CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackers(), "Flying").isEmpty()
&& !card.hasKeyword("Reach")
&& CombatUtil.canBlock(card)
&& ComputerUtilCombat.lifeInDanger(ai, Singletons.getModel().getGame().getCombat())) {
@@ -196,7 +196,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
} else if (keyword.endsWith("Horsemanship")) {
if (ph.isPlayerTurn(opp)
&& ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
&& !CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackerList(), "Horsemanship").isEmpty()
&& !CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackers(), "Horsemanship").isEmpty()
&& CombatUtil.canBlock(card)
&& ComputerUtilCombat.lifeInDanger(ai, Singletons.getModel().getGame().getCombat())) {
return true;
@@ -312,7 +312,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
} else if (keyword.equals("Reach")) {
if (ph.isPlayerTurn(ai)
|| !ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackerList(), "Flying").isEmpty()
|| CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackers(), "Flying").isEmpty()
|| card.hasKeyword("Flying")
|| !CombatUtil.canBlock(card)) {
return false;
@@ -324,7 +324,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
}
int canBlockNum = 1 + card.getKeywordAmount("CARDNAME can block an additional creature.");
int possibleBlockNum = 0;
for (Card attacker : Singletons.getModel().getGame().getCombat().getAttackerList()) {
for (Card attacker : Singletons.getModel().getGame().getCombat().getAttackers()) {
if (CombatUtil.canBlock(attacker, card)) {
possibleBlockNum++;
if (possibleBlockNum > canBlockNum) {

View File

@@ -167,7 +167,7 @@ public abstract class TapAiBase extends SpellAbilityAi {
List<Card> attackers;
if (phase.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
//Combat has already started
attackers = Singletons.getModel().getGame().getCombat().getAttackerList();
attackers = Singletons.getModel().getGame().getCombat().getAttackers();
} else {
attackers = CardLists.filter(ai.getCreaturesInPlay(), new Predicate<Card>() {
@Override

View File

@@ -100,8 +100,7 @@ public class ChooseColorEffect extends SpellAbilityEffect {
chosen.add(ComputerUtilCard.getMostProminentColor(list));
}
else if (logic.equals("MostProminentAttackers")) {
chosen.add(ComputerUtilCard.getMostProminentColor(Singletons.getModel().getGame().getCombat()
.getAttackerList()));
chosen.add(ComputerUtilCard.getMostProminentColor(Singletons.getModel().getGame().getCombat().getAttackers()));
}
else if (logic.equals("MostProminentKeywordInComputerDeck")) {
List<Card> list = ai.getAllCards();

View File

@@ -65,18 +65,12 @@ public class InputAttack extends InputBase {
return;
}
final StringBuilder sb = new StringBuilder();
sb.append("Declare Attackers: Select Creatures to Attack ");
sb.append(o.toString());
showMessage("Declare Attackers: Select Creatures to Attack " + o.toString());
CMatchUI.SINGLETON_INSTANCE.showMessage(sb.toString());
if (game.getCombat().getRemainingDefenders() == 0) {
// Nothing left to attack, has to attack this defender
List<Card> possibleAttackers = Singletons.getControl().getPlayer().getCardsIn(ZoneType.Battlefield);
if (game.getCombat().getRemainingDefenders() == 0) { // last Target
List<Card> possibleAttackers = player.getCardsIn(ZoneType.Battlefield);
for (Card c : Iterables.filter(possibleAttackers, CardPredicates.Presets.CREATURES)) {
if (c.hasKeyword("CARDNAME attacks each turn if able.") && CombatUtil.canAttack(c, game.getCombat())
&& !c.isAttacking()) {
if (c.hasKeyword("CARDNAME attacks each turn if able.") && CombatUtil.canAttack(c, game.getCombat()) && !c.isAttacking()) {
game.getCombat().addAttacker(c);
}
}

View File

@@ -429,17 +429,6 @@ public class Combat {
return new ArrayList<Card>(this.attackerMap.keySet());
} // getAttackers()
/**
* <p>
* getAttackerList.
* </p>
*
* @return an array of {@link forge.Card} objects.
*/
public final List<Card> getAttackerList() {
return new ArrayList<Card>(this.attackerMap.keySet());
} // getAttackers()
/**
* <p>
* isBlocked.
@@ -642,7 +631,7 @@ public class Combat {
* a {@link forge.Card} object.
*/
public final void undoBlockingAssignment(final Card blocker) {
final List<Card> att = this.getAttackerList();
final List<Card> att = this.getAttackers();
for (final Card attacker : att) {
if (this.getBlockers(attacker).contains(blocker)) {
this.getBlockingAttackerList(attacker).remove(blocker);
@@ -677,7 +666,7 @@ public class Combat {
* </p>
*/
public final void setUnblocked() {
final List<Card> attacking = this.getAttackerList();
final List<Card> attacking = this.getAttackers();
for (final Card attacker : attacking) {
final List<Card> block = this.getBlockers(attacker);
@@ -723,7 +712,7 @@ public class Combat {
private final boolean assignAttackersDamage(boolean firstStrikeDamage) {
this.defendingDamageMap.clear(); // this should really happen in deal damage
List<Card> blockers = null;
final List<Card> attackers = this.getAttackerList();
final List<Card> attackers = this.getAttackers();
boolean assignedDamage = false;
for (final Card attacker : attackers) {
// If attacker isn't in the right first/regular strike section, continue along

View File

@@ -385,7 +385,7 @@ public class CombatUtil {
public static boolean finishedMandatoryBlocks(final Combat combat, final Player defending) {
final List<Card> blockers = Singletons.getControl().getPlayer().getCreaturesInPlay();
final List<Card> attackers = combat.getAttackerList();
final List<Card> attackers = combat.getAttackers();
// if a creature does not block but should, return false
for (final Card blocker : blockers) {
@@ -433,7 +433,7 @@ public class CombatUtil {
private static void orderMultipleBlockers(final Combat combat) {
// If there are multiple blockers, the Attacker declares the Assignment Order
final Player player = combat.getAttackingPlayer();
final List<Card> attackers = combat.getAttackerList();
final List<Card> attackers = combat.getAttackers();
for (final Card attacker : attackers) {
List<Card> blockers = combat.getBlockers(attacker);
if (blockers.size() <= 1) {
@@ -484,7 +484,7 @@ public class CombatUtil {
return false;
}
final List<Card> attackers = combat.getAttackerList();
final List<Card> attackers = combat.getAttackers();
final List<Card> attackersWithLure = new ArrayList<Card>();
for (final Card attacker : attackers) {
if (attacker.hasStartOfKeyword("All creatures able to block CARDNAME do so.")
@@ -1194,7 +1194,7 @@ public class CombatUtil {
// Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Attacker", c);
final List<Card> otherAttackers = Singletons.getModel().getGame().getCombat().getAttackerList();
final List<Card> otherAttackers = Singletons.getModel().getGame().getCombat().getAttackers();
otherAttackers.remove(c);
runParams.put("OtherAttackers", otherAttackers);
runParams.put("Attacked", Singletons.getModel().getGame().getCombat().getDefenderByAttacker(c));

View File

@@ -126,7 +126,7 @@ public class PhaseUtil {
// Handles removing cards like Mogg Flunkies from combat if group attack
// didn't occur
final List<Card> filterList = combat.getAttackerList();
final List<Card> filterList = combat.getAttackers();
for (Card c : filterList) {
if (c.hasKeyword("CARDNAME can't attack or block alone.") && c.isAttacking()) {
if (combat.getAttackers().size() < 2) {
@@ -135,7 +135,7 @@ public class PhaseUtil {
}
}
final List<Card> list = combat.getAttackerList();
final List<Card> list = combat.getAttackers();
// TODO move propaganda to happen as the Attacker is Declared
// Remove illegal Propaganda attacks first only for attacking the Player
@@ -154,7 +154,7 @@ public class PhaseUtil {
* </p>
*/
public static void handleAttackingTriggers() {
final List<Card> list = Singletons.getModel().getGame().getCombat().getAttackerList();
final List<Card> list = Singletons.getModel().getGame().getCombat().getAttackers();
Singletons.getModel().getGame().getStack().freezeStack();
// Then run other Attacker bonuses
// check for exalted:
@@ -220,7 +220,7 @@ public class PhaseUtil {
}
});
final List<Card> attList = game.getCombat().getAttackerList();
final List<Card> attList = game.getCombat().getAttackers();
CombatUtil.checkDeclareBlockers(list);

View File

@@ -406,7 +406,7 @@ public class CField implements ICDoc {
}
}
final List<Card> att = Singletons.getModel().getGame().getCombat().getAttackerList();
final List<Card> att = Singletons.getModel().getGame().getCombat().getAttackers();
if ((c.isTapped() || c.hasSickness() || (c.hasKeyword("Vigilance") && att.contains(c))) && (input instanceof InputAttack)) {
final CardPanel cardPanel = CField.this.view.getTabletop().getCardPanel(c.getUniqueNumber());
for (final CardPanel cp : cardPanel.getAttachedPanels()) {