- AI shouldn't play a Planeswalker if it controls one with the same sybtype.

- Fixed a bug with the previously added combat code.
- Fixed an infinite loop bug with Ajani Vengeant controlled by the AI.
This commit is contained in:
jendave
2011-08-06 03:36:23 +00:00
parent ba6efd9c37
commit dd81320116
7 changed files with 55 additions and 19 deletions

View File

@@ -3066,13 +3066,9 @@ public class CardFactoryUtil {
public static void checkEquipmentOnControllerChange(PlayerZone from, PlayerZone to, Card c)
{
if (!c.isEquipped())
;
else if (!from.equals(to))
{
if (c.isEquipped() && !from.equals(to))
c.unEquipAllCards();
}
}
//may return null
static public Card getRandomCard(CardList list) {

View File

@@ -1942,6 +1942,11 @@ class CardFactory_Planeswalkers {
return CardFactoryUtil.canTarget(card2, c);
}
});
if (list.size() > 0) {
CardListUtil.sortCMC(list);
setTargetCard(list.get(0));
}
return card2.getCounters(Counters.LOYALTY) < 8 && list.size() > 0;
}
@@ -1961,13 +1966,9 @@ class CardFactory_Planeswalkers {
"Main2")) && AllZone.Stack.size() == 0;
}//canPlay()
@Override
public void chooseTargetAI() {
Card c = getPermanent();
if(getPermanent() != null) setTargetCard(c);
}//chooseTargetAI()
/*
Card getPermanent() {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
int highestCost = 0;
@@ -1975,7 +1976,7 @@ class CardFactory_Planeswalkers {
CardList perms = new CardList(play.getCards());
perms = perms.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardFactoryUtil.canTarget(card2, c) /* && c.isTapped()*/;
return CardFactoryUtil.canTarget(card2, c);
}
});
@@ -1993,6 +1994,8 @@ class CardFactory_Planeswalkers {
return null;
}
*/
};//SpellAbility ability1
/*

View File

@@ -294,19 +294,26 @@ public class ComputerAI_General implements Computer {
CardList attList = new CardList();
attList.addAll(AllZone.Combat.getAttackers());
attList.addAll(AllZone.pwCombat.getAttackers());
CardList pwAttList = new CardList();
pwAttList.addAll(AllZone.pwCombat.getAttackers());
for(Card c:list)
CombatUtil.checkDeclareBlockers(c);
for (Card a:attList){
CardList blockList = AllZone.Combat.getBlockers(a);
for (Card b:blockList)
CombatUtil.checkBlockedAttackers(a, b);
}
for (Card a:pwAttList){
CardList blockList = AllZone.pwCombat.getBlockers(a);
for (Card b:blockList)
CombatUtil.checkBlockedAttackers(a, b);
}
AllZone.Phase.setNeedToNextPhase(true);
}

View File

@@ -39,6 +39,7 @@ public class GUI_Filter extends javax.swing.JDialog {
private JTextField NameText;
private JLabel jLabel5;
private JTextField cardText;
private JTextField cardType;
private JPanel jPanel1;
private JCheckBox jCheckBoxColorless;
private JCheckBox jCheckBoxWhite;

View File

@@ -14071,7 +14071,7 @@ public class GameActionUtil {
for(int i = 0; i < creature.size(); i++) {
c = creature.get(i);
if((c.getText().equals("") && c.getKeyword().size() == 0)
if(((c.getText().equals("") || c.getText().trim().equals("Token")) && c.getKeyword().size() == 0)
|| c.isFaceDown()) {
c.addSemiPermanentAttackBoost(2);
c.addSemiPermanentDefenseBoost(2);

View File

@@ -365,6 +365,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
CardPanel cardPanel = (CardPanel) o;
CardList att = new CardList(AllZone.Combat.getAttackers());
//CardList block = AllZone.Combat.getAllBlockers();
if((cardPanel.getCard().isTapped() || cardPanel.getCard().hasSickness() || ((cardPanel.getCard().getKeyword().contains("Vigilance")) && att.contains(cardPanel.getCard())))
&& (inputControl.input instanceof Input_Attack)) {
@@ -377,10 +378,20 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
}
//right click:
if(e.isMetaDown()) {
if(att.contains(cardPanel.getCard())) {
if(att.contains(cardPanel.getCard()) && (inputControl.input instanceof Input_Attack)) {
cardPanel.getCard().untap();
AllZone.Combat.removeFromCombat(cardPanel.getCard());
}
/*
// won't work yet:
else if (block.contains(cardPanel.getCard()) && inputControl.input instanceof Input_Block)
{
Card crd = cardPanel.getCard();
AllZone.Combat.removeFromCombat(crd);
}
*/
}
else inputControl.selectCard(cardPanel.getCard(), AllZone.Human_Play);

View File

@@ -30,8 +30,26 @@ public class Spell_Permanent extends Spell {
//check on legendary crap
if(getSourceCard().getType().contains("Legendary")) {
CardList list = new CardList(AllZone.Computer_Play.getCards());
return !list.containsName(getSourceCard().getName());
if (list.containsName(getSourceCard().getName()) /*&&
!getSourceCard().getName().equals("Flagstones of Trokair")*/)
return false;
}
if(getSourceCard().getType().contains("Planeswalker")) {
CardList list = new CardList(AllZone.Computer_Play.getCards());
list = list.getType("Planeswalker");
Card c = getSourceCard();
for (int i=0;i<list.size();i++)
{
String subtype = c.getType().get(c.getType().size() - 1);
CardList cl = AllZone.GameAction.getPlaneswalkerSubtype(list, subtype, c);
if(cl.size() > 0) {
return false;
}
}
}
return true;
}//canPlayAI()