mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Gaining control of a creature equipped with Umezawa's Jitte and attacking with it shouldn't crash the game anymore. However, if you use this on the AI, you can use its abilities (gain life ability will give the AI life though).
- Added some kind of caching algorithm, hopefully it will actually make a difference. - Rebel / Merc searches shouldn't fetch non-permanents (with Changeling) anymore.
This commit is contained in:
@@ -219,7 +219,7 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>0</int>
|
<int>0</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>827</int>
|
<int>827</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -230,7 +230,7 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>0</int>
|
<int>0</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>147</int>
|
<int>147</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>147</int>
|
<int>147</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>10</int>
|
<int>10</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -266,7 +266,7 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>157</int>
|
<int>157</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>169</int>
|
<int>169</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -287,7 +287,7 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>326</int>
|
<int>326</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>10</int>
|
<int>10</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -302,8 +302,8 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>336</int>
|
<int>336</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>154</int>
|
<int>187</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
<void property="name">
|
<void property="name">
|
||||||
@@ -322,8 +322,8 @@
|
|||||||
<void property="bounds">
|
<void property="bounds">
|
||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>490</int>
|
<int>523</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>10</int>
|
<int>10</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -337,9 +337,9 @@
|
|||||||
<void property="bounds">
|
<void property="bounds">
|
||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>500</int>
|
<int>533</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>178</int>
|
<int>145</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
<void property="name">
|
<void property="name">
|
||||||
@@ -359,7 +359,7 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>678</int>
|
<int>678</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>10</int>
|
<int>10</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -374,7 +374,7 @@
|
|||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>254</int>
|
<int>254</int>
|
||||||
<int>688</int>
|
<int>688</int>
|
||||||
<int>902</int>
|
<int>926</int>
|
||||||
<int>139</int>
|
<int>139</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -408,7 +408,7 @@
|
|||||||
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
|
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
|
||||||
<void property="bounds">
|
<void property="bounds">
|
||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>1156</int>
|
<int>1180</int>
|
||||||
<int>0</int>
|
<int>0</int>
|
||||||
<int>10</int>
|
<int>10</int>
|
||||||
<int>827</int>
|
<int>827</int>
|
||||||
@@ -423,9 +423,9 @@
|
|||||||
<object id="MultiSplitLayout$Split3" class="org.jdesktop.swingx.MultiSplitLayout$Split">
|
<object id="MultiSplitLayout$Split3" class="org.jdesktop.swingx.MultiSplitLayout$Split">
|
||||||
<void property="bounds">
|
<void property="bounds">
|
||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>1166</int>
|
<int>1190</int>
|
||||||
<int>0</int>
|
<int>0</int>
|
||||||
<int>274</int>
|
<int>250</int>
|
||||||
<int>827</int>
|
<int>827</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -434,9 +434,9 @@
|
|||||||
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
|
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
|
||||||
<void property="bounds">
|
<void property="bounds">
|
||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>1166</int>
|
<int>1190</int>
|
||||||
<int>0</int>
|
<int>0</int>
|
||||||
<int>274</int>
|
<int>250</int>
|
||||||
<int>409</int>
|
<int>409</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -455,9 +455,9 @@
|
|||||||
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
|
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
|
||||||
<void property="bounds">
|
<void property="bounds">
|
||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>1166</int>
|
<int>1190</int>
|
||||||
<int>409</int>
|
<int>409</int>
|
||||||
<int>274</int>
|
<int>250</int>
|
||||||
<int>10</int>
|
<int>10</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
@@ -470,9 +470,9 @@
|
|||||||
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
|
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
|
||||||
<void property="bounds">
|
<void property="bounds">
|
||||||
<object class="java.awt.Rectangle">
|
<object class="java.awt.Rectangle">
|
||||||
<int>1166</int>
|
<int>1190</int>
|
||||||
<int>419</int>
|
<int>419</int>
|
||||||
<int>274</int>
|
<int>250</int>
|
||||||
<int>408</int>
|
<int>408</int>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
|
|||||||
@@ -978,7 +978,7 @@ public class CardFactoryUtil
|
|||||||
list = list.filter(new CardListFilter()
|
list = list.filter(new CardListFilter()
|
||||||
{
|
{
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return (c.getType().contains("Mercenary") || c.getKeyword().contains("Changeling")) && c.isPermanent() ;
|
return ( (c.getType().contains("Mercenary") || c.getKeyword().contains("Changeling")) ) && c.isPermanent() ;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1082,7 +1082,7 @@ public class CardFactoryUtil
|
|||||||
list = list.filter(new CardListFilter()
|
list = list.filter(new CardListFilter()
|
||||||
{
|
{
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return (c.getType().contains("Rebel") || c.getKeyword().contains("Changeling")) && c.isPermanent() ;
|
return ( (c.getType().contains("Rebel") || c.getKeyword().contains("Changeling"))) && c.isPermanent() ;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3749,10 +3749,8 @@ public class CardFactory_Creatures {
|
|||||||
//because this card has Flash
|
//because this card has Flash
|
||||||
public boolean canPlay()
|
public boolean canPlay()
|
||||||
{
|
{
|
||||||
if (!AllZone.GameAction.isCardInPlay(card))
|
return AllZone.GameAction.isCardInZone(card, AllZone.Human_Hand) ||
|
||||||
return true;
|
AllZone.GameAction.isCardInZone(card, AllZone.Computer_Hand);
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|||||||
@@ -1885,7 +1885,6 @@ class CardFactory_Equipment {
|
|||||||
boost.setDescription("Remove a charge counter from Umezawa's Jitte: Equipped creature gets +2/+2 until end of turn.");
|
boost.setDescription("Remove a charge counter from Umezawa's Jitte: Equipped creature gets +2/+2 until end of turn.");
|
||||||
boost.setStackDescription(cardName + " - Equipped creature gets +2/+2 untin end of turn.");
|
boost.setStackDescription(cardName + " - Equipped creature gets +2/+2 untin end of turn.");
|
||||||
|
|
||||||
|
|
||||||
equip.setBeforePayMana(runtime);
|
equip.setBeforePayMana(runtime);
|
||||||
equip.setDescription("Equip: 2");
|
equip.setDescription("Equip: 2");
|
||||||
card.addSpellAbility(equip);
|
card.addSpellAbility(equip);
|
||||||
@@ -1893,7 +1892,6 @@ class CardFactory_Equipment {
|
|||||||
card.addSpellAbility(negBoost);
|
card.addSpellAbility(negBoost);
|
||||||
card.addSpellAbility(gainLife);
|
card.addSpellAbility(gainLife);
|
||||||
|
|
||||||
|
|
||||||
} //*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3119,7 +3119,6 @@ class CardFactory_Lands {
|
|||||||
}//transmute
|
}//transmute
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,17 @@ public class CardList implements Iterable<Card>
|
|||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CardList getImageName(String name)
|
||||||
|
{
|
||||||
|
CardList c = new CardList();
|
||||||
|
|
||||||
|
for(int i = 0; i < size(); i++)
|
||||||
|
if(getCard(i).getImageName().equals(name))
|
||||||
|
c.add(getCard(i));
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
//cardType is like "Land" or "Goblin", returns a new CardList that is a subset of current CardList
|
//cardType is like "Land" or "Goblin", returns a new CardList that is a subset of current CardList
|
||||||
public CardList getType(String cardType)
|
public CardList getType(String cardType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -584,7 +584,17 @@ public class CombatUtil
|
|||||||
PlayerZone play = AllZone.getZone(c);
|
PlayerZone play = AllZone.getZone(c);
|
||||||
CardList clist = new CardList(play.getCards());
|
CardList clist = new CardList(play.getCards());
|
||||||
clist = clist.getName("Umezawa's Jitte");
|
clist = clist.getName("Umezawa's Jitte");
|
||||||
Card jitte = clist.get(0);
|
Card jitte;
|
||||||
|
if(clist.size() > 0)
|
||||||
|
jitte = clist.get(0);
|
||||||
|
else //jitte belongs to opponent
|
||||||
|
{
|
||||||
|
PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Play, AllZone.GameAction.getOpponent(c.getController()));
|
||||||
|
CardList crdList = new CardList(oppPlay.getCards());
|
||||||
|
crdList.getName("Umezawa's Jitte");
|
||||||
|
jitte = crdList.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
jitte.addCounter(Counters.CHARGE, 2);
|
jitte.addCounter(Counters.CHARGE, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import java.awt.Image;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -84,6 +85,20 @@ public class ImageCache implements NewConstants {
|
|||||||
/**
|
/**
|
||||||
* Put to cache.
|
* Put to cache.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (cache.size() >= 35) {
|
||||||
|
int count = 10;
|
||||||
|
ArrayList<String> imgNames = new ArrayList<String>(count);
|
||||||
|
for (String imgName : cache.keySet()) {
|
||||||
|
imgNames.add(imgName);
|
||||||
|
count--;
|
||||||
|
if (count == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (String imgName : imgNames)
|
||||||
|
cache.remove(imgName);
|
||||||
|
}
|
||||||
|
|
||||||
cache.put(name, resized);
|
cache.put(name, resized);
|
||||||
|
|
||||||
return resized;
|
return resized;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
//@SuppressWarnings("unused") // java.util.*
|
//@SuppressWarnings("unused") // java.util.*
|
||||||
@@ -182,6 +183,36 @@ package forge;
|
|||||||
}
|
}
|
||||||
else if(phase.equals(Constant.Phase.End_Of_Turn))
|
else if(phase.equals(Constant.Phase.End_Of_Turn))
|
||||||
{
|
{
|
||||||
|
System.out.println("Cache size: " + ImageCache.cache.size());
|
||||||
|
|
||||||
|
CardList visibleCards = new CardList();
|
||||||
|
PlayerZone hPlay = AllZone.Human_Play;
|
||||||
|
PlayerZone hand = AllZone.Human_Hand;
|
||||||
|
PlayerZone cPlay = AllZone.Computer_Play;
|
||||||
|
|
||||||
|
visibleCards.addAll(hPlay.getCards());
|
||||||
|
visibleCards.addAll(hand.getCards());
|
||||||
|
visibleCards.addAll(cPlay.getCards());
|
||||||
|
|
||||||
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
|
||||||
|
Iterator<String> iter = ImageCache.cache.keySet().iterator();
|
||||||
|
while(iter.hasNext()) {
|
||||||
|
String cardName = iter.next();
|
||||||
|
if ( !(cardName.startsWith("Swamp") || cardName.startsWith("Mountain") || cardName.startsWith("Island")
|
||||||
|
|| cardName.startsWith("Plains") || cardName.startsWith("Forest")) &&
|
||||||
|
visibleCards.getImageName(cardName).size() == 0 ) {
|
||||||
|
list.add(cardName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String s : list)
|
||||||
|
{
|
||||||
|
ImageCache.cache.remove(s);
|
||||||
|
System.out.println("Removing " + s + " from cache.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(AllZone.Display.stopEOT())
|
if(AllZone.Display.stopEOT())
|
||||||
return new Input_EOT();
|
return new Input_EOT();
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user