- Little updates and cleanup in ComputerUtil_Attack2.

This commit is contained in:
jendave
2011-08-06 11:16:02 +00:00
parent 5d1b154d9f
commit a04a8946de
2 changed files with 22 additions and 34 deletions

View File

@@ -7,7 +7,6 @@ Guul Draz Specter
[/Group] [/Group]
[Group MaxCnt=4 Percentage=12] [Group MaxCnt=4 Percentage=12]
Gnat Miser
Corrupt Court Official Corrupt Court Official
Headhunter Headhunter
Hymn to Tourach Hymn to Tourach
@@ -25,8 +24,10 @@ Liliana's Specter
Liliana's Specter Liliana's Specter
Mind Rot Mind Rot
Mind Twist Mind Twist
Nyxathid
Unburden Unburden
Waking Nightmare Waking Nightmare
Chittering Rats
[/Group] [/Group]
[Group MaxCnt=3 Percentage=12] [Group MaxCnt=3 Percentage=12]
@@ -40,7 +41,6 @@ Wei Night Raiders
[Group MaxCnt=3 Percentage=8] [Group MaxCnt=3 Percentage=8]
Brutal Nightstalker Brutal Nightstalker
Locust Miser
Cao Cao, Lord of Wei Cao Cao, Lord of Wei
Fugue Fugue
Kemuri-Onna Kemuri-Onna

View File

@@ -23,22 +23,10 @@ import java.util.*;
public ComputerUtil_Attack2(CardList possibleAttackers, CardList possibleBlockers, int blockerLife) public ComputerUtil_Attack2(CardList possibleAttackers, CardList possibleBlockers, int blockerLife)
{ {
humanList = new CardList(possibleBlockers.toArray()); humanList = new CardList(possibleBlockers.toArray());
humanList = humanList.filter(new CardListFilter() humanList = humanList.getType("Creature");
{
public boolean addCard(Card c)
{
return c.isCreature();
}
});
computerList = new CardList(possibleAttackers.toArray()); computerList = new CardList(possibleAttackers.toArray());
computerList = computerList.filter(new CardListFilter() computerList = computerList.getType("Creature");
{
public boolean addCard(Card c)
{
return c.isCreature();
}
});
attackers = getUntappedCreatures(possibleAttackers, true); attackers = getUntappedCreatures(possibleAttackers, true);
blockers = getUntappedCreatures(possibleBlockers , false); blockers = getUntappedCreatures(possibleBlockers , false);
@@ -56,6 +44,7 @@ import java.util.*;
} }
}); });
}//constructor }//constructor
public CardList getUntappedCreatures(CardList in, final boolean checkCanAttack) public CardList getUntappedCreatures(CardList in, final boolean checkCanAttack)
{ {
CardList list = new CardList(in.toArray()); CardList list = new CardList(in.toArray());
@@ -65,14 +54,14 @@ import java.util.*;
{ {
boolean b = c.isCreature() && c.isUntapped(); boolean b = c.isCreature() && c.isUntapped();
if(checkCanAttack) if(checkCanAttack)
return b && CombatUtil.canAttack(c); return b && CombatUtil.canAttack(c);
return b; return b;
} }
}); });
return list; return list;
}//getUntappedCreatures() }//getUntappedCreatures()
//this checks to make sure that the computer player //this checks to make sure that the computer player
//doesn't lose when the human player attacks //doesn't lose when the human player attacks
@@ -172,9 +161,10 @@ import java.util.*;
for (int i=0; i<attackers.size();i++) for (int i=0; i<attackers.size();i++)
{ {
if ( (attackers.get(i).getKeyword().contains("CARDNAME attacks each turn if able.") if ( attackers.get(i).getKeyword().contains("CARDNAME attacks each turn if able.")
|| attackers.get(i).getKeyword().contains("At the beginning of the end step, sacrifice CARDNAME.")) || attackers.get(i).getKeyword().contains("At the beginning of the end step, destroy CARDNAME.")
/*&& CombatUtil.canAttack(attackers.get(i))*/ || attackers.get(i).getKeyword().contains("At the beginning of the end step, exile CARDNAME.")
|| attackers.get(i).getKeyword().contains("At the beginning of the end step, sacrifice CARDNAME.")
|| attackers.get(i).getSirenAttackOrDestroy()) || attackers.get(i).getSirenAttackOrDestroy())
combat.addAttacker(attackers.get(i)); combat.addAttacker(attackers.get(i));
} }
@@ -300,15 +290,13 @@ import java.util.*;
CardList list = new CardList(); CardList list = new CardList();
list.addAll(play.getCards()); list.addAll(play.getCards());
list = list.filter(new CardListFilter(){ list = list.filter(new CardListFilter(){
public boolean addCard(Card c) {
public boolean addCard(Card c) { return c.getKeyword().contains("Exalted");
return c.getKeyword().contains("Exalted"); }
} });
});
return list.size(); return list.size();
} }
public int getAttack(Card c) public int getAttack(Card c)
{ {