- New cards: Wasteland, Strip Mine, Stifle, Rebuild, Spell Pierce and Mystical Tutor

- Disabled blurred image and multipass resizing, should be faster to display images on slower computers
- Fix images download progress bar not updating
- Automatic date and revision in main.properties via SVN keywords $Date$ and $Revision$
This commit is contained in:
jendave
2011-08-06 03:19:08 +00:00
parent 35c06ce201
commit 310073fd48
9 changed files with 362 additions and 43 deletions

View File

@@ -2,5 +2,13 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="res/lib/google-collect-1.0.jar"/>
<classpathentry kind="lib" path="res/lib/jdom-1.0.jar"/>
<classpathentry kind="lib" path="res/lib/jl1.0.1.jar"/>
<classpathentry kind="lib" path="res/lib/jsr305.jar"/>
<classpathentry kind="lib" path="res/lib/napkinlaf-1.2.jar"/>
<classpathentry kind="lib" path="res/lib/napkinlaf-swingset-1.2.jar"/>
<classpathentry kind="lib" path="res/lib/nimrodlf.jar"/>
<classpathentry kind="lib" path="res/lib/substance.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1461,7 +1461,7 @@ no text
Timbermaw Larva
3 G
Creature Beast
Whenever Timbermaw Larva attacks, it gets +1/+1 until end of turn for each Forest you control.
Whenever Timbermaw Larva attacks, it gets +1/+1 until end of turn for each you control.
2/2
Ghastlord of Fugue
@@ -18007,4 +18007,37 @@ Warrior's Honor
Instant
Creatures you control get +1/+1 until end of turn.
Stifle
U
Instant
Counter target activated or triggered ability.
Spell Pierce
U
Instant
Counter target noncreature spell unless its controller pays 2.
Mystical Tutor
U
Instant
Search your library for an instant or sorcery card and reveal that card. Shuffle your library, then put the card on top of it.
Rebuild
2 U
Instant
no text
Cycling:2
Wasteland
no cost
Land
no text
tap: add 1
Strip Mine
no cost
Land
no text
tap: add 1
End

View File

@@ -1,6 +1,6 @@
program/mail=mtgerror@yahoo.com
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
program/version=Forge -- official beta: 10/01/17, SVN revision: 323
program/version=Forge -- official beta: $Date$, SVN revision: $Revision$
tokens--file=AllTokens.txt

View File

@@ -8910,16 +8910,79 @@ public class CardFactory implements NewConstants {
//is spell?, did opponent play it?, is this a creature spell?
return sa.isSpell() &&
opponent.equals(sa.getSourceCard().getController()) &&
sa.getSourceCard().getType().contains("Creature");
sa.getSourceCard().getType().contains("Creature") &&
CardFactoryUtil.isCounterable(sa.getSourceCard());
}//canPlay()
};
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Spell Pierce"))
{
SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = 4685055135070191326L;
public void resolve()
{
String manaCost = "2";
Ability ability = new Ability(card, manaCost){
public void resolve()
{
;
}
};
final Command unpaidCommand = new Command()
{
private static final long serialVersionUID = 8094833091127334678L;
public void execute()
{
SpellAbility sa = AllZone.Stack.pop();
AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
}
};
if (card.getController().equals(Constant.Player.Computer))
{
AllZone.InputControl.setInput(new Input_PayManaCost_Ability(card +"\r\n", ability.getManaCost(), Command.Blank, unpaidCommand));
}
else
{
if (ComputerUtil.canPayCost(ability))
ComputerUtil.playNoStack(ability);
else
{
SpellAbility sa = AllZone.Stack.pop();
AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
}
}
}
public boolean canPlay()
{
if(AllZone.Stack.size() == 0)
return false;
//see if spell is on stack and that opponent played it
String opponent = AllZone.GameAction.getOpponent(card.getController());
SpellAbility sa = AllZone.Stack.peek();
//is spell?, did opponent play it?, is this a creature spell?
return sa.isSpell() &&
opponent.equals(sa.getSourceCard().getController()) &&
!sa.getSourceCard().getType().contains("Creature") &&
CardFactoryUtil.isCounterable(sa.getSourceCard());
}//canPlay()
};
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Counterspell") || cardName.equals("Cancel") || cardName.equals("Last Word") || cardName.equals("Traumatic Visions"))
else if(cardName.equals("Counterspell") || cardName.equals("Cancel") || cardName.equals("Last Word") || cardName.equals("Traumatic Visions") || cardName.equals("Stifle"))
{
SpellAbility spell = new Spell(card)
{
@@ -8928,6 +8991,7 @@ public class CardFactory implements NewConstants {
public void resolve()
{
SpellAbility sa = AllZone.Stack.pop();
if(!cardName.equals("Stifle"))
AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
}
public boolean canPlay()
@@ -8939,6 +9003,10 @@ public class CardFactory implements NewConstants {
String opponent = AllZone.GameAction.getOpponent(card.getController());
SpellAbility sa = AllZone.Stack.peek();
if(cardName.equals("Stifle"))
return !sa.isSpell() && CardFactoryUtil.isCounterable(sa.getSourceCard());
return sa.isSpell() && opponent.equals(sa.getSourceCard().getController())
&& CardFactoryUtil.isCounterable(sa.getSourceCard());
}
@@ -8949,8 +9017,14 @@ public class CardFactory implements NewConstants {
{
desc = "Last Word can't be countered by spells or abilities.\r\n";
}
if(cardName.equals("Stifle")){
spell.setDescription(desc + "Counter target triggered or activated ability.");
spell.setStackDescription(card.getName() + " - Counters target triggered or activated ability.");
} else
{
spell.setDescription(desc + "Counter target spell.");
spell.setStackDescription(card.getName() + " - Counters target spell.");
}
card.addSpellAbility(spell);
}//*************** END ************ END **************************
@@ -9545,7 +9619,7 @@ public class CardFactory implements NewConstants {
//*************** START *********** START **************************
else if(cardName.equals("Evacuation"))
else if(cardName.equals("Evacuation") || cardName.equals("Rebuild"))
{
SpellAbility spell = new Spell(card)
{
@@ -9556,6 +9630,9 @@ public class CardFactory implements NewConstants {
CardList all = new CardList();
all.addAll(AllZone.Human_Play.getCards());
all.addAll(AllZone.Computer_Play.getCards());
if(cardName.equals("Rebuild"))
all = all.getType("Artifact");
else
all = all.getType("Creature");
for(int i = 0; i < all.size(); i++)
@@ -9577,6 +9654,11 @@ public class CardFactory implements NewConstants {
return AllZone.getZone(Constant.Zone.Hand, c.getOwner());
}
};
if(cardName.equals("Rebuild"))
{
spell.setDescription("Return all artifacts to their owners' hands.");
spell.setStackDescription(card.getName() + " - return all artifacts to their owners' hands.");
}
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
@@ -9915,6 +9997,83 @@ public class CardFactory implements NewConstants {
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Mystical Tutor"))
{
SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = 2281623056004772379L;
public boolean canPlayAI()
{
return 4 < AllZone.Phase.getTurn();
}
public void resolve()
{
String player = card.getController();
if(player.equals(Constant.Player.Human))
humanResolve();
else
computerResolve();
}
public void computerResolve()
{
CardList list = new CardList(AllZone.Computer_Library.getCards());
CardList instantsAndSorceries = new CardList();
for (int i=0;i<list.size();i++)
{
if (list.get(i).getType().contains("Instant") || list.get(i).getType().contains("Sorcery"))
instantsAndSorceries.add(list.get(i));
}
if(instantsAndSorceries.size() != 0)
{
//comp will just grab the first one it finds
Card c = instantsAndSorceries.get(0);
AllZone.GameAction.shuffle(card.getController());
//move to top of library
AllZone.Computer_Library.remove(c);
AllZone.Computer_Library.add(c, 0);
CardList l = new CardList();
l.add(c);
AllZone.Display.getChoiceOptional("Computer picked:", l.toArray());
}
}//computerResolve()
public void humanResolve()
{
PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
CardList list = new CardList(library.getCards());
CardList instantsAndSorceries = new CardList();
for (int i=0;i<list.size();i++)
{
if (list.get(i).getType().contains("Instant") || list.get(i).getType().contains("Sorcery"))
instantsAndSorceries.add(list.get(i));
}
if(instantsAndSorceries.size() != 0)
{
Object o = AllZone.Display.getChoiceOptional("Select an instant or sorcery", instantsAndSorceries.toArray());
AllZone.GameAction.shuffle(card.getController());
if(o != null)
{
//put card on top of library
library.remove(o);
library.add((Card)o, 0);
}
}//if
}//resolve()
};
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Pulse of the Tangle"))

View File

@@ -769,6 +769,110 @@ class CardFactory_Lands {
ability.setBeforePayMana(runtime);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Wasteland") || cardName.equals("Strip Mine"))
{
//tap sacrifice
final Ability_Tap ability = new Ability_Tap(card, "0")
{
private static final long serialVersionUID = 6865042319287843154L;
public boolean canPlayAI()
{
return false;
}
public void chooseTargetAI()
{
AllZone.GameAction.sacrifice(card);
}
public boolean canPlay()
{
PlayerZone compBattlezone = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
PlayerZone playerBattlezone = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
CardList list = new CardList(compBattlezone.getCards());
list.addAll(playerBattlezone.getCards());
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
if(card.getName().equals("Wasteland"))
return c.getType().contains("Land") && !c.getType().contains("Basic");
else
return c.getType().contains("Land");
}
});
if (super.canPlay() && list.size() > 0 && AllZone.GameAction.isCardInPlay(card))
return true;
else
return false;
}//canPlay()
public void resolve()
{
if(card.getOwner().equals(Constant.Player.Human))
humanResolve();
//else
// computerResolve();
}
public void humanResolve()
{
Card target = getTargetCard();
if(target != null)
AllZone.GameAction.destroy(target);
}//resolve()
};//SpellAbility
Input runtime = new Input()
{
private static final long serialVersionUID = -7328086812286814833L;
boolean once = true;
public void showMessage()
{
//this is necessary in order not to have a StackOverflowException
//because this updates a card, it creates a circular loop of observers
if(once)
{
once = false;
String player = card.getController();
PlayerZone compBattlezone = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
PlayerZone playerBattlezone = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
CardList list = new CardList(compBattlezone.getCards());
list.addAll(playerBattlezone.getCards());
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
if(card.getName().equals("Wasteland"))
return c.getType().contains("Land") && !c.getType().contains("Basic");
else
return c.getType().contains("Land");
}
});
Object o = AllZone.Display.getChoice("Choose a " + (card.getName().equals("Wasteland") ? "nonbasic" : "") + "land to destroy", list.toArray());
ability.setTargetCard((Card)o);
AllZone.GameAction.sacrifice(card);
//ability.setStackDescription(card.getController() +" - Destroy target " + (card.getName().equals("Wasteland") ? "nonbasic" : "") + "land.");
AllZone.Stack.add(ability);
stop();
}
}//showMessage()
};
card.addSpellAbility(ability);
ability.setDescription("Tap, Sacrifice " + card.getName() +": Destroy target " + (card.getName().equals("Wasteland") ? "nonbasic" : "") + "land.");
ability.setBeforePayMana(runtime);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Arid Mesa") || cardName.equals("Marsh Flats") || cardName.equals("Misty Rainforest") ||

View File

@@ -37,6 +37,10 @@ public class ComputerAI_counterSpells2 {
""
};
final String[] nonCreatureUnlessPay2 = {
"Spell Pierce"
};
final String[] unlessPay1 = {
"Force Spike", "Daze", "Runeboggle", "Spell Snip"
};
@@ -86,6 +90,11 @@ public class ComputerAI_counterSpells2 {
return true;
}
else if (!sa.getSourceCard().isCreature() && usableManaSources < 2) {
if (checkArray(c, nonCreatureUnlessPay2))
return true;
}
if (checkArray(c, basic))
return true;

View File

@@ -70,6 +70,7 @@ import com.google.common.collect.MapMaker;
//import org.omg.CORBA.portable.InputStream;
import arcane.ui.ScaledImagePanel;
import arcane.ui.ScaledImagePanel.MultipassType;
import arcane.ui.ScaledImagePanel.ScalingType;
import forge.error.ErrorViewer;
@@ -662,9 +663,8 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
else {
InputStream stream;
try {
//stream = new URL(GuiDisplayUtil.getURL(c)).openStream();
stream = GuiDisplayUtil.getURL(c).openStream();
srcImage = ImageIO.read(stream);
srcImage = arcane.ui.util.ImageUtil.getImage(stream);
imageCache.put(imageName, srcImage);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
@@ -675,26 +675,10 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
}
}
//BufferedImage srcImageBlurred = arcane.ui.util.ImageUtil.getBlurredImage(srcImage, 3, 1.0f); // get a blurred image
cardImagePanel.setImage(srcImage, srcImage);
cardImagePanel.setImage(srcImage, null);
cardImagePanel.repaint();
/*
BufferedInputStream stream = (BufferedInputStream) GuiDisplayUtil.getPictureStream(c);
BufferedImage srcImage;
try {
srcImage = arcane.ui.util.ImageUtil.getImage(stream);
BufferedImage srcImageBlurred = arcane.ui.util.ImageUtil.getBlurredImage(srcImage, 3, 1.0f); // get a blurred image
cardImagePanel.setImage(srcImage, srcImageBlurred);
cardImagePanel.repaint();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // only need stream
*/
//System.out.println(picturePanel.getComponentCount());
}//updateCardDetail()
@@ -1274,9 +1258,10 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
pane.add(new ExternalPanel(picturePanel), "picture");
*/
cardImagePanel.setScalingBlur(true); //use blured image if scaling down more than 50%
cardImagePanel.setScalingBlur(false); //use blured image if scaling down more than 50%
cardImagePanel.setScaleLarger(true); //upscale if needed true
cardImagePanel.setScalingType(ScalingType.bicubic); // type of scaling bicubic has good quality / speed ratio
cardImagePanel.setScalingMultiPassType(MultipassType.none);
cardImagePanel.setLayout(new BoxLayout(cardImagePanel, BoxLayout.Y_AXIS));
cardImagePanel.setBackground(c1);

View File

@@ -5,6 +5,7 @@ import static javax.swing.JOptionPane.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
@@ -181,11 +182,20 @@ public class Gui_DownloadPictures extends DefaultBoundedRangeModel implements Ru
private void update(int card) {
this.card = card;
final class Worker implements Runnable{
private int card;
Worker(int card){
this.card = card;
}
public void run() {
fireStateChanged();
bar.setString(String.format(ForgeProps.getLocalized(card == cards.length? BAR_CLOSE:BAR_WAIT), this.card,
bar.setString(String.format(ForgeProps.getLocalized(card == cards.length? BAR_CLOSE:BAR_WAIT), card,
cards.length));
System.out.println(card + "/" + cards.length);
}
};
EventQueue.invokeLater(new Worker(card));
}
public JDialog getDlg(JFrame frame) {

View File

@@ -4,6 +4,7 @@ import static java.lang.Integer.*;
import static javax.swing.JOptionPane.*;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
@@ -146,11 +147,21 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
private void update(int card) {
this.card = card;
final class Worker implements Runnable{
private int card;
Worker(int card){
this.card = card;
}
public void run() {
fireStateChanged();
bar.setString(String.format(ForgeProps.getLocalized(card == cards.length? BAR_CLOSE:BAR_WAIT), this.card,
bar.setString(String.format(ForgeProps.getLocalized(card == cards.length? BAR_CLOSE:BAR_WAIT), card,
cards.length));
System.out.println(card + "/" + cards.length);
}
};
EventQueue.invokeLater(new Worker(card));
}
public JDialog getDlg(JFrame frame) {
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(TITLE));