* cleanups

This commit is contained in:
jendave
2011-08-07 01:07:39 +00:00
parent d2ec6b767f
commit c79df0627d
7 changed files with 17 additions and 18 deletions

View File

@@ -127,8 +127,8 @@ public class BoosterDraftAI
} }
} }
else { else {
CardList typeList = new CardList(); CardList typeList;
CardList colorList = new CardList(); CardList colorList;
colorList = AIPlayables.getOnly2Colors(playerColors.get(player).Color1, playerColors.get(player).Color2); colorList = AIPlayables.getOnly2Colors(playerColors.get(player).Color1, playerColors.get(player).Color2);

View File

@@ -104,7 +104,7 @@ public class ComputerUtil_Block2
CardList blockers = getPossibleBlockers(attacker, blockersLeft, combat); CardList blockers = getPossibleBlockers(attacker, blockersLeft, combat);
CardList safeBlockers = getSafeBlockers(attacker, blockers, combat); CardList safeBlockers = getSafeBlockers(attacker, blockers, combat);
CardList killingBlockers = new CardList(); CardList killingBlockers;
if(safeBlockers.size() > 0) { if(safeBlockers.size() > 0) {
// 1.Blockers that can destroy the attacker but won't get destroyed // 1.Blockers that can destroy the attacker but won't get destroyed
@@ -143,7 +143,7 @@ public class ComputerUtil_Block2
CardList currentAttackers = new CardList(attackersLeft.toArray()); CardList currentAttackers = new CardList(attackersLeft.toArray());
currentAttackers = currentAttackers.getKeywordsDontContain("Rampage"); currentAttackers = currentAttackers.getKeywordsDontContain("Rampage");
CardList blockers = new CardList(); CardList blockers;
//Try to block an attacker without first strike with a gang of first strikers //Try to block an attacker without first strike with a gang of first strikers
for (Card attacker : attackersLeft) { for (Card attacker : attackersLeft) {
@@ -181,7 +181,7 @@ public class ComputerUtil_Block2
//Try to block an attacker with two blockers of which only one will die //Try to block an attacker with two blockers of which only one will die
for(final Card attacker : attackersLeft) { for(final Card attacker : attackersLeft) {
blockers = getPossibleBlockers(attacker, blockersLeft, combat); blockers = getPossibleBlockers(attacker, blockersLeft, combat);
CardList usableBlockers = new CardList(); CardList usableBlockers;
CardList blockGang = new CardList(); CardList blockGang = new CardList();
int absorbedDamage = 0; //The amount of damage needed to kill the first blocker int absorbedDamage = 0; //The amount of damage needed to kill the first blocker
int currentValue = 0; //The value of the creatures in the blockgang int currentValue = 0; //The value of the creatures in the blockgang
@@ -234,7 +234,7 @@ public class ComputerUtil_Block2
private static Combat makeTradeBlocks(Combat combat){ private static Combat makeTradeBlocks(Combat combat){
CardList currentAttackers = new CardList(attackersLeft.toArray()); CardList currentAttackers = new CardList(attackersLeft.toArray());
CardList killingBlockers = new CardList(); CardList killingBlockers;
for(Card attacker : attackersLeft) { for(Card attacker : attackersLeft) {
killingBlockers = killingBlockers =
@@ -254,7 +254,7 @@ public class ComputerUtil_Block2
private static Combat makeChumpBlocks(Combat combat){ private static Combat makeChumpBlocks(Combat combat){
CardList currentAttackers = new CardList(attackersLeft.toArray()); CardList currentAttackers = new CardList(attackersLeft.toArray());
CardList chumpBlockers = new CardList(); CardList chumpBlockers;
for(Card attacker : attackersLeft) { for(Card attacker : attackersLeft) {
chumpBlockers = getPossibleBlockers(attacker, blockersLeft, combat); chumpBlockers = getPossibleBlockers(attacker, blockersLeft, combat);
@@ -273,7 +273,7 @@ public class ComputerUtil_Block2
//Reinforce blockers blocking attackers with trample (should only be made if life is in danger) //Reinforce blockers blocking attackers with trample (should only be made if life is in danger)
private static Combat reinforceBlockersAgainstTrample(Combat combat){ private static Combat reinforceBlockersAgainstTrample(Combat combat){
CardList chumpBlockers = new CardList(); CardList chumpBlockers;
CardList tramplingAttackers = attackers.getKeyword("Trample"); CardList tramplingAttackers = attackers.getKeyword("Trample");
tramplingAttackers = tramplingAttackers.getKeywordsDontContain("Rampage"); //Don't make it worse tramplingAttackers = tramplingAttackers.getKeywordsDontContain("Rampage"); //Don't make it worse
@@ -299,8 +299,8 @@ public class ComputerUtil_Block2
//Support blockers not destroying the attacker with more blockers to try to kill the attacker //Support blockers not destroying the attacker with more blockers to try to kill the attacker
private static Combat reinforceBlockersToKill(Combat combat){ private static Combat reinforceBlockersToKill(Combat combat){
CardList safeBlockers = new CardList(); CardList safeBlockers;
CardList blockers = new CardList(); CardList blockers;
CardList targetAttackers = blockedButUnkilled.getKeywordsDontContain("Rampage"); //Don't make it worse CardList targetAttackers = blockedButUnkilled.getKeywordsDontContain("Rampage"); //Don't make it worse
//TODO - should check here for a "rampage-like" trigger that replaced the keyword: //TODO - should check here for a "rampage-like" trigger that replaced the keyword:
// "Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it." // "Whenever CARDNAME becomes blocked, it gets +1/+1 until end of turn for each creature blocking it."
@@ -372,8 +372,8 @@ public class ComputerUtil_Block2
attackersLeft = new CardList(attackers.toArray()); //keeps track of all currently unblocked attackers attackersLeft = new CardList(attackers.toArray()); //keeps track of all currently unblocked attackers
blockersLeft = new CardList(possibleBlockers.toArray()); //keeps track of all unassigned blockers blockersLeft = new CardList(possibleBlockers.toArray()); //keeps track of all unassigned blockers
blockedButUnkilled = new CardList(); //keeps track of all blocked attackers that currently wouldn't be destroyed blockedButUnkilled = new CardList(); //keeps track of all blocked attackers that currently wouldn't be destroyed
CardList blockers = new CardList(); CardList blockers;
CardList chumpBlockers = new CardList(); CardList chumpBlockers;
diff = AllZone.ComputerPlayer.getLife() * 2 - 5; //This is the minimal gain for an unnecessary trade diff = AllZone.ComputerPlayer.getLife() * 2 - 5; //This is the minimal gain for an unnecessary trade

View File

@@ -525,7 +525,7 @@ public class AbilityFactory_ChangeZone {
if (fetchList.size() == 0 || destination == null) if (fetchList.size() == 0 || destination == null)
break; break;
Object o = new Object(); Object o;
if (params.containsKey("Mandatory")) if (params.containsKey("Mandatory"))
o = GuiUtils.getChoice("Select a card", fetchList.toArray()); o = GuiUtils.getChoice("Select a card", fetchList.toArray());
else else

View File

@@ -509,7 +509,7 @@ public class AbilityFactory_Destroy {
if (tgt != null) if (tgt != null)
tgtCards = tgt.getTargetCards(); tgtCards = tgt.getTargetCards();
else{ else{
tgtCards = new ArrayList<Card>(); tgtCards = new ArrayList<Card>();
tgtCards.add(sa.getSourceCard()); tgtCards.add(sa.getSourceCard());
} }

View File

@@ -519,7 +519,6 @@ public class AbilityFactory_PermanentState {
if (tgt != null) if (tgt != null)
tgtCards = tgt.getTargetCards(); tgtCards = tgt.getTargetCards();
else{ else{
tgtCards = new ArrayList<Card>();
tgtCards = AbilityFactory.getDefinedCards(hostCard, params.get("Defined"), sa); tgtCards = AbilityFactory.getDefinedCards(hostCard, params.get("Defined"), sa);
} }

View File

@@ -905,7 +905,7 @@ public class AbilityFactory_Reveal {
private static String rearrangeTopOfLibraryStackDescription(final AbilityFactory AF, final SpellAbility sa) private static String rearrangeTopOfLibraryStackDescription(final AbilityFactory AF, final SpellAbility sa)
{ {
int numCards = 0; int numCards = 0;
ArrayList<Player> tgtPlayers = new ArrayList<Player>(); ArrayList<Player> tgtPlayers;
boolean shuffle = false; boolean shuffle = false;
Target tgt = AF.getAbTgt(); Target tgt = AF.getAbTgt();

View File

@@ -89,7 +89,7 @@ public class ManaPool extends Card {
else else
return ("|||||||||||"); return ("|||||||||||");
return sbNormal.toString() + sbSnow.toString(); return sbNormal.append(sbSnow).toString();
} }
@@ -132,7 +132,7 @@ public class ManaPool extends Card {
sbNormal.insert(0, "Mana Available:\n"); sbNormal.insert(0, "Mana Available:\n");
sbSnow.insert(0, "Snow Mana Available:\n"); sbSnow.insert(0, "Snow Mana Available:\n");
return sbNormal.toString() + "\n" + sbSnow.toString(); return sbNormal.append("\n").append(sbSnow).toString();
} }
public int getAmountOfColor(String color){ public int getAmountOfColor(String color){