mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28: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,13 +3066,9 @@ public class CardFactoryUtil {
|
|||||||
|
|
||||||
public static void checkEquipmentOnControllerChange(PlayerZone from, PlayerZone to, Card c)
|
public static void checkEquipmentOnControllerChange(PlayerZone from, PlayerZone to, Card c)
|
||||||
{
|
{
|
||||||
if (!c.isEquipped())
|
if (c.isEquipped() && !from.equals(to))
|
||||||
;
|
|
||||||
else if (!from.equals(to))
|
|
||||||
{
|
|
||||||
c.unEquipAllCards();
|
c.unEquipAllCards();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//may return null
|
//may return null
|
||||||
static public Card getRandomCard(CardList list) {
|
static public Card getRandomCard(CardList list) {
|
||||||
|
|||||||
@@ -1942,6 +1942,11 @@ class CardFactory_Planeswalkers {
|
|||||||
return CardFactoryUtil.canTarget(card2, c);
|
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;
|
return card2.getCounters(Counters.LOYALTY) < 8 && list.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1961,13 +1966,9 @@ class CardFactory_Planeswalkers {
|
|||||||
"Main2")) && AllZone.Stack.size() == 0;
|
"Main2")) && AllZone.Stack.size() == 0;
|
||||||
}//canPlay()
|
}//canPlay()
|
||||||
|
|
||||||
@Override
|
|
||||||
public void chooseTargetAI() {
|
|
||||||
Card c = getPermanent();
|
|
||||||
|
|
||||||
if(getPermanent() != null) setTargetCard(c);
|
|
||||||
}//chooseTargetAI()
|
|
||||||
|
|
||||||
|
/*
|
||||||
Card getPermanent() {
|
Card getPermanent() {
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
|
||||||
int highestCost = 0;
|
int highestCost = 0;
|
||||||
@@ -1975,7 +1976,7 @@ class CardFactory_Planeswalkers {
|
|||||||
CardList perms = new CardList(play.getCards());
|
CardList perms = new CardList(play.getCards());
|
||||||
perms = perms.filter(new CardListFilter() {
|
perms = perms.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
};//SpellAbility ability1
|
};//SpellAbility ability1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -294,19 +294,26 @@ public class ComputerAI_General implements Computer {
|
|||||||
|
|
||||||
CardList attList = new CardList();
|
CardList attList = new CardList();
|
||||||
attList.addAll(AllZone.Combat.getAttackers());
|
attList.addAll(AllZone.Combat.getAttackers());
|
||||||
attList.addAll(AllZone.pwCombat.getAttackers());
|
|
||||||
|
|
||||||
|
CardList pwAttList = new CardList();
|
||||||
|
pwAttList.addAll(AllZone.pwCombat.getAttackers());
|
||||||
|
|
||||||
for(Card c:list)
|
for(Card c:list)
|
||||||
CombatUtil.checkDeclareBlockers(c);
|
CombatUtil.checkDeclareBlockers(c);
|
||||||
|
|
||||||
|
|
||||||
for (Card a:attList){
|
for (Card a:attList){
|
||||||
CardList blockList = AllZone.Combat.getBlockers(a);
|
CardList blockList = AllZone.Combat.getBlockers(a);
|
||||||
for (Card b:blockList)
|
for (Card b:blockList)
|
||||||
CombatUtil.checkBlockedAttackers(a, b);
|
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);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public class GUI_Filter extends javax.swing.JDialog {
|
|||||||
private JTextField NameText;
|
private JTextField NameText;
|
||||||
private JLabel jLabel5;
|
private JLabel jLabel5;
|
||||||
private JTextField cardText;
|
private JTextField cardText;
|
||||||
|
private JTextField cardType;
|
||||||
private JPanel jPanel1;
|
private JPanel jPanel1;
|
||||||
private JCheckBox jCheckBoxColorless;
|
private JCheckBox jCheckBoxColorless;
|
||||||
private JCheckBox jCheckBoxWhite;
|
private JCheckBox jCheckBoxWhite;
|
||||||
|
|||||||
@@ -14071,7 +14071,7 @@ public class GameActionUtil {
|
|||||||
|
|
||||||
for(int i = 0; i < creature.size(); i++) {
|
for(int i = 0; i < creature.size(); i++) {
|
||||||
c = creature.get(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.isFaceDown()) {
|
||||||
c.addSemiPermanentAttackBoost(2);
|
c.addSemiPermanentAttackBoost(2);
|
||||||
c.addSemiPermanentDefenseBoost(2);
|
c.addSemiPermanentDefenseBoost(2);
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
CardPanel cardPanel = (CardPanel) o;
|
CardPanel cardPanel = (CardPanel) o;
|
||||||
|
|
||||||
CardList att = new CardList(AllZone.Combat.getAttackers());
|
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())))
|
if((cardPanel.getCard().isTapped() || cardPanel.getCard().hasSickness() || ((cardPanel.getCard().getKeyword().contains("Vigilance")) && att.contains(cardPanel.getCard())))
|
||||||
&& (inputControl.input instanceof Input_Attack)) {
|
&& (inputControl.input instanceof Input_Attack)) {
|
||||||
@@ -377,10 +378,20 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
}
|
}
|
||||||
//right click:
|
//right click:
|
||||||
if(e.isMetaDown()) {
|
if(e.isMetaDown()) {
|
||||||
if(att.contains(cardPanel.getCard())) {
|
if(att.contains(cardPanel.getCard()) && (inputControl.input instanceof Input_Attack)) {
|
||||||
cardPanel.getCard().untap();
|
cardPanel.getCard().untap();
|
||||||
AllZone.Combat.removeFromCombat(cardPanel.getCard());
|
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);
|
else inputControl.selectCard(cardPanel.getCard(), AllZone.Human_Play);
|
||||||
|
|||||||
@@ -30,8 +30,26 @@ public class Spell_Permanent extends Spell {
|
|||||||
//check on legendary crap
|
//check on legendary crap
|
||||||
if(getSourceCard().getType().contains("Legendary")) {
|
if(getSourceCard().getType().contains("Legendary")) {
|
||||||
CardList list = new CardList(AllZone.Computer_Play.getCards());
|
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;
|
return true;
|
||||||
}//canPlayAI()
|
}//canPlayAI()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user