mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- 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:
@@ -3066,12 +3066,8 @@ 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
|
||||
|
||||
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -294,18 +294,25 @@ 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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -29,9 +29,27 @@ public class Spell_Permanent extends Spell {
|
||||
public boolean canPlayAI() {
|
||||
//check on legendary crap
|
||||
if(getSourceCard().getType().contains("Legendary")) {
|
||||
CardList list = new CardList(AllZone.Computer_Play.getCards());
|
||||
return !list.containsName(getSourceCard().getName());
|
||||
CardList list = new CardList(AllZone.Computer_Play.getCards());
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user