mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
checkstyle
This commit is contained in:
@@ -3,130 +3,208 @@ package forge;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>IPlayerZone interface.</p>
|
* <p>
|
||||||
|
* IPlayerZone interface.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
interface IPlayerZone {
|
interface IPlayerZone {
|
||||||
/**
|
/**
|
||||||
* <p>setUpdate.</p>
|
* <p>
|
||||||
|
* setUpdate.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b
|
||||||
|
* a boolean.
|
||||||
*/
|
*/
|
||||||
void setUpdate(boolean b);
|
void setUpdate(boolean b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getUpdate.</p>
|
* <p>
|
||||||
|
* getUpdate.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
boolean getUpdate();
|
boolean getUpdate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>size.</p>
|
* <p>
|
||||||
|
* size.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
int size();
|
int size();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>add.</p>
|
* <p>
|
||||||
|
* add.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param o a {@link java.lang.Object} object.
|
* @param o
|
||||||
|
* a {@link java.lang.Object} object.
|
||||||
*/
|
*/
|
||||||
void add(Object o);
|
void add(Object o);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>add.</p>
|
* <p>
|
||||||
|
* add.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param c a {@link forge.Card} object.
|
* @param c
|
||||||
* @param index a int.
|
* a {@link forge.Card} object.
|
||||||
|
* @param index
|
||||||
|
* a int.
|
||||||
*/
|
*/
|
||||||
void add(Card c, int index);
|
void add(Card c, int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>get.</p>
|
* <p>
|
||||||
|
* get.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param index a int.
|
* @param index
|
||||||
|
* a int.
|
||||||
* @return a {@link forge.Card} object.
|
* @return a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
Card get(int index);
|
Card get(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>remove.</p>
|
* <p>
|
||||||
|
* remove.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param o a {@link java.lang.Object} object.
|
* @param o
|
||||||
|
* a {@link java.lang.Object} object.
|
||||||
*/
|
*/
|
||||||
void remove(Object o);
|
void remove(Object o);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>setCards.</p>
|
* <p>
|
||||||
|
* setCards.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param c an array of {@link forge.Card} objects.
|
* @param c
|
||||||
|
* an array of {@link forge.Card} objects.
|
||||||
*/
|
*/
|
||||||
void setCards(Card[] c);
|
void setCards(Card[] c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getCards.</p>
|
* <p>
|
||||||
|
* getCards.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
|
* @param filter
|
||||||
|
* the filter
|
||||||
* @return an array of {@link forge.Card} objects.
|
* @return an array of {@link forge.Card} objects.
|
||||||
*/
|
*/
|
||||||
Card[] getCards(boolean filter);
|
Card[] getCards(boolean filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cards.
|
||||||
|
*
|
||||||
|
* @return the cards
|
||||||
|
*/
|
||||||
Card[] getCards();
|
Card[] getCards();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cards.
|
||||||
|
*
|
||||||
|
* @param n
|
||||||
|
* the n
|
||||||
|
* @return the cards
|
||||||
|
*/
|
||||||
Card[] getCards(int n);
|
Card[] getCards(int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains.
|
||||||
|
*
|
||||||
|
* @param c
|
||||||
|
* the c
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
boolean contains(Card c);
|
boolean contains(Card c);
|
||||||
|
|
||||||
/** isEmpty returns true if given zone contains no cards */
|
/**
|
||||||
|
* isEmpty returns true if given zone contains no cards.
|
||||||
|
*
|
||||||
|
* @return true, if is empty
|
||||||
|
*/
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
||||||
//removes all cards
|
// removes all cards
|
||||||
/**
|
/**
|
||||||
* <p>reset.</p>
|
* <p>
|
||||||
|
* reset.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>is.</p>
|
* <p>
|
||||||
|
* is.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param zone a {@link java.lang.String} object.
|
* @param zone
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
boolean is(Constant.Zone zone);
|
boolean is(Constant.Zone zone);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is.
|
||||||
|
*
|
||||||
|
* @param zones
|
||||||
|
* the zones
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
boolean is(List<Constant.Zone> zones);
|
boolean is(List<Constant.Zone> zones);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>is.</p>
|
* <p>
|
||||||
|
* is.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param zone a {@link java.lang.String} object.
|
* @param zone
|
||||||
* @param player a {@link forge.Player} object.
|
* a {@link java.lang.String} object.
|
||||||
|
* @param player
|
||||||
|
* a {@link forge.Player} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
boolean is(Constant.Zone zone, Player player);
|
boolean is(Constant.Zone zone, Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getPlayer.</p>
|
* <p>
|
||||||
|
* getPlayer.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a {@link forge.Player} object.
|
* @return a {@link forge.Player} object.
|
||||||
*/
|
*/
|
||||||
Player getPlayer(); //the Player that owns this zone
|
Player getPlayer(); // the Player that owns this zone
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getZoneName.</p>
|
* <p>
|
||||||
|
* getZoneName.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
Constant.Zone getZoneType(); //returns the Zone's name like Graveyard
|
Constant.Zone getZoneType(); // returns the Zone's name like Graveyard
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>toString.</p>
|
* <p>
|
||||||
|
* toString.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
String toString();
|
String toString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset cards added this turn.
|
||||||
|
*/
|
||||||
void resetCardsAddedThisTurn();
|
void resetCardsAddedThisTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,38 @@
|
|||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>MenuItem_HowToPlay class.</p>
|
* <p>
|
||||||
|
* MenuItem_HowToPlay class.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class MenuItem_HowToPlay extends JMenuItem implements NewConstants.LANG.HowTo {
|
public class MenuItem_HowToPlay extends JMenuItem implements NewConstants.LANG.HowTo {
|
||||||
/** Constant <code>serialVersionUID=5552000208438248428L</code> */
|
/** Constant <code>serialVersionUID=5552000208438248428L</code>. */
|
||||||
private static final long serialVersionUID = 5552000208438248428L;
|
private static final long serialVersionUID = 5552000208438248428L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Constructor for MenuItem_HowToPlay.</p>
|
* <p>
|
||||||
|
* Constructor for MenuItem_HowToPlay.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public MenuItem_HowToPlay() {
|
public MenuItem_HowToPlay() {
|
||||||
super(ForgeProps.getLocalized(TITLE));
|
super(ForgeProps.getLocalized(TITLE));
|
||||||
|
|
||||||
this.addActionListener(new ActionListener() {
|
this.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent a) {
|
public void actionPerformed(final ActionEvent a) {
|
||||||
String text = ForgeProps.getLocalized(MESSAGE);
|
String text = ForgeProps.getLocalized(MESSAGE);
|
||||||
|
|
||||||
JTextArea area = new JTextArea(text, 25, 40);
|
JTextArea area = new JTextArea(text, 25, 40);
|
||||||
@@ -40,131 +46,6 @@ public class MenuItem_HowToPlay extends JMenuItem implements NewConstants.LANG.H
|
|||||||
JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}//constructor
|
} // constructor
|
||||||
|
} // MenuItem_HowToPlay
|
||||||
/**
|
|
||||||
* <p>getString.</p>
|
|
||||||
*
|
|
||||||
* @return a {@link java.lang.String} object.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private String getString() {
|
|
||||||
String newLine = "\r\n\r\n";
|
|
||||||
StringBuffer s = new StringBuffer();
|
|
||||||
|
|
||||||
s.append("How to Play - (Revised: September 2009.)\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Introduction").append(newLine);
|
|
||||||
s.append("1. This game is similar to many other trading card games. You start out with 20 life and your goal is to reduce your opponents life to zero by attacking with your creatures. The game will end when your life or the computer's life is reduced to zero. You play \"matches\" against the computer as a set of \"best two out of three\" games.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("2. You use land to pay for spells. You can play one land a turn.").append(newLine);
|
|
||||||
s.append("3. Each land produces a different magical energy. This magical energy is shortened to one letter on cards.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append(" Forests make G\r\n");
|
|
||||||
s.append(" Swamps make B\r\n");
|
|
||||||
s.append(" Plains make W\r\n");
|
|
||||||
s.append(" Islands make U\r\n");
|
|
||||||
s.append(" Mountains make R").append(newLine);
|
|
||||||
s.append("4. Each nonland card has a name and a cost. The cost looks like this \"2GG\" A cost like that would require two Forest lands and two other lands. The number 2 can be paid for by any land. A cost like \"R\", would require a Mountain land.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("5. Creature cards stay in play and can attack on the turn AFTER they are played. A creature's attack and defense is shown like 2/4 meaning that the creature has an attack power of 2 and a defense of 4. If this creature receives 4 damage it is put into the graveyard.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("6. When you attack with your creatures the computer has a chance to block with his creatures. When you attack you \"tap\" your creatures by turning them sideways. Your creatures will untap during your next turn. When you block, only untapped creatures can block. Usually a creature cannot attack and block during the same turn.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("7. Sorcery and Instant cards have an effect on the game. After you play any card it goes on the stack to the left, click OK and the stack will clear. Sorcery cards can only be played during your turn and when the stack is empty. Instant cards can be played at any time and are more versatile.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("8. If a card has a target, you get to choose that target. If the target is a player, click on that player's life points.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("9. When you mulligan, the cards in your hand are shuffled into you deck and you are given 1 less card.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Legendary Cards").append(newLine);
|
|
||||||
s.append("Legendary cards are powerful cards that can be either creatures, enchantments, lands, artifacts or planeswalkers. These cards can only exist once in the battlefield, and if another copy of the legendary card is played, all copies of the card are destroyed and sent to the graveyard.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Planeswalkers").append(newLine);
|
|
||||||
s.append("There are 6 planeswalkers (Ajani Goldmane; Liliana Vess; Garruk Wildspeaker; Chandra Nalaar; Nicol Bolas; Elspeth, Knight-Errant) and they have specific rules for their special abilities.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("You can only use one ability a turn. A planeswalker can be attacked, but you can also block with your creatures. For each 1 damage a planeswalker receives, you remove 1 counter. When a planeswalker doesn't have any counters, it goes to the graveyard.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Hybrid Mana and Multicolored Cards").append(newLine);
|
|
||||||
s.append("1. Hybrid Mana Cards are unique in their casting cost as seen in the card. Instead of seeing a single color per mana symbol, these cards have 2 colors per mana symbol indicating that the player has the choice of playing either of the two. There are also cases where numbers and colors are combined together in one mana symbol, which indicates that either colorless or colored mana can be paid for each symbol. Hybrid cards are treated as two colors and as such can be said to be multicolored.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("2. Multicolored Cards are slightly different than hybrid mana cards, as they require two or more different colors of mana, which may or not be in a single mana symbol. An example would be a card like Lightning Helix which requires one red and one white mana to be played.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Game Types").append(newLine);
|
|
||||||
s.append("1. In Constructed Deck mode you can use any of the cards to make your deck. To make a constructed deck, from the Deck Editor select \"New Deck <20> Constructed\". A list of all the cards will be displayed.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("2. In Sealed Deck mode you are given 75 cards and you have to make your deck from just those cards.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("3. In Booster Draft mode you select 1 card at a time and then make your deck from just those cards. After you are done drafting you have to type in a filename, then go to the Deck Editor and from the menu select \"Open Deck - Draft\" and find the filename. This will allow you to construct your deck. You can then play against the other 7 computer opponents that were drafting with you.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("4. In Quest Mode you start out with 275 cards, 200 are Basic Lands. As you complete matches in your quest you will win more cards. In easy mode you get more cards after every game, whether you win or lose. Your goal is to become world champion. Once you reach the end of your quest you can continue to play additional matches and win even more cards or you can start a new quest at anytime.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("At the Quest Options screen you will be given a choice of four different difficulty levels. These difficulty levels control:")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("1) the length of the quest in matches,\r\n");
|
|
||||||
s.append("2) the hardness of the AI deck that you will face as an opponent,\r\n");
|
|
||||||
s.append("3) the number of wins or loses needed to get more cards,\r\n");
|
|
||||||
s.append("4) the number of wins needed to advance a player to the next rank.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Quick Games").append(newLine);
|
|
||||||
s.append("There may be occasions where you only have a few minutes to play a quick game or two. At the top of the New Game window you will see the three different game types with radio buttons. Click on the Constructed (Easy) button and it will become highlighted.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("In the middle area of the New Game window you will see two menus, one labeled \"Your Deck\" and the other \"Opponent\". For a quick game you should select the \"Generate Deck\" or the \"Random\" option for both you and the computer.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("1. The \"Generate Deck\" option creates a 2 color deck. This option randomly picks cards and sometimes your mana curve may be too high.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("2. The \"Random\" option will randomly select one of the constructed decks that appear in the two deck menus. You either construct these decks in the Deck Editor or you imported a .deck file from the Deck Editor.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("If you select the \"Random\" option and click on the \"Start Game\" button and the match fails to begin <20> well, this happens if you fail to have any constructed decks saved to your all-decks2 file. You should choose the \"Generate Deck\" option instead.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Resizable Game Area & Stack AI Land").append(newLine);
|
|
||||||
s.append("1. The \"Resizable Game Area\" check box should be set to on if your monitor will display more than 1024 x 768 pixels. The window containing the Battlefield and the informational displays will fill the entire screen.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("2. The \"Stack AI Land\" option will make the computer a more difficult opponent to beat. The computer will draw nonland cards from it's library after it has drawn enough lands to cover the cost of it's spells. Set the check box to on for a stronger opponent and set the check box to off for a weaker opponent.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("At times, you may notice that when you click the \"Start Game\" button that the match fails to begin. In this case you should turn the \"Stack AI Land\" option to off.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Abilities").append(newLine);
|
|
||||||
s.append("There are three kinds of abilities: Activated, Triggered, and Static.").append(newLine);
|
|
||||||
s.append("1. Activated abilities contain a colon that separates cost and effect, these can be played any time you could play an instant. An example is Elvish Piper's ability. That cost also contains the tap symbol. For creatures only, abilities containing the tap- or untap symbol can be played starting the turn after the creature entered the battlefield. Another common cost for an activated ability is sacrificing the card. You do that by putting it into your graveyard. Such abilities can only be played once.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("2. Triggered abilities aren't played, they simply trigger when their condition occurs. An example is Angel of Mercy: You don't play the ability, but gain 3 life when it enters the battlefield.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("3. Static abilities are neither played, nor do they trigger. They still have an effect for as long as they are in play. An example is Glorious Anthem. There is no condition or cost, your creatures are just stronger.\r\n\r\n\r\n");
|
|
||||||
|
|
||||||
s.append("Keyword Abilities").append(newLine);
|
|
||||||
s.append("1. Flying: Creatures with flying are harder to block. Only creatures with flying or reach can block other flyers.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("2. Haste: Haste lets a creature attack or use any abilities immediately during this turn.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("3. Fear: Creatures with fear can only be blocked by artifact or black creatures. Creatures with fear are harder to block.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("4. Cycling: When you cycle a card you pay some cost like 2 and then you discard that card, and then draw a new card. Cycling helps make your deck more versatile.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("5. Vigilance: This means that the creature will not tap when attacking. This creature can both attack and block during the same turn.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("6. Trample: If you use 2/1 creature to block an attacking 3/4 creature with trample, you will still receive 2 damage because the 3/4 trampled over your 2/1 creature. Trample damage is calculated by (attack - blocker's defense), in this case 3-1 which is 2.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("7. Deathtouch: When a creatures with deathtouch deals damage to a creature, that creature is destroyed.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("8. Defender: Creatures with defender can not attack, they can only block another attacker.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("9. First Strike and Double Strike: Creatures with first strike deals their combat damage first. Creatures with double strike deals their combat damage first, and then deals their combat damage a second time during the combat damage step.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("10. Flash: You can play a creature with flash anytime that you can play an Instant.").append(newLine);
|
|
||||||
s.append("11. Landwalk: Allows your creature to attack without being blocked if your opponent controls the appropriate land type.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("12. Lifelink: With lifeline you gain life equal to the amount of damage dealt.").append(newLine);
|
|
||||||
s.append("13. Protection: Can not be damaged, blocked or targeted by sources that match the protection type.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("14. Reach: Creatures with reach can block flying creatures.").append(newLine);
|
|
||||||
s.append("15. Shroud: Permanents with shroud can not be targeted by abilities or spells.").append(newLine);
|
|
||||||
s.append("16. Regenerate: Regenerate is an ability that some creatures have which prevents them from being destroyed and put into the graveyard. When you regenerate a creature, it acts like a shield until end of turn.")
|
|
||||||
.append(newLine);
|
|
||||||
s.append("17. Morph: A creature with morph can be played by usually paying 3 mana of any color and be treated as a 2/2 creature with no abilities rather than playing the creature's actual cost. This creature is placed face down in the battlefield and can be flipped face up anytime as long as you pay its morph cost which is indicated on the card. Once flipped face up the card is treated as the original card, the one that you would normally play with its original-full casting cost.");
|
|
||||||
|
|
||||||
|
|
||||||
return s.toString();
|
|
||||||
}
|
|
||||||
}//MenuItem_HowToPlay
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,47 @@
|
|||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Abstract Move class.</p>
|
* <p>
|
||||||
|
* Abstract Move class.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public abstract class Move {
|
public abstract class Move {
|
||||||
/**
|
/**
|
||||||
* <p>generateMoves.</p>
|
* <p>
|
||||||
|
* generateMoves.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return an array of {@link forge.Move} objects.
|
* @return an array of {@link forge.Move} objects.
|
||||||
*/
|
*/
|
||||||
public abstract Move[] generateMoves();
|
public abstract Move[] generateMoves();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getScore.</p>
|
* <p>
|
||||||
|
* getScore.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public abstract int getScore();
|
public abstract int getScore();
|
||||||
|
|
||||||
|
/** The best move. */
|
||||||
public Move bestMove = null;
|
public Move bestMove = null;
|
||||||
|
|
||||||
|
/** The best score. */
|
||||||
public int bestScore = Integer.MIN_VALUE;
|
public int bestScore = Integer.MIN_VALUE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>min.</p>
|
* <p>
|
||||||
|
* min.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param move a {@link forge.Move} object.
|
* @param move
|
||||||
* @param depth a int.
|
* a {@link forge.Move} object.
|
||||||
|
* @param depth
|
||||||
|
* a int.
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public final int min(final Move move, final int depth) {
|
public final int min(final Move move, final int depth) {
|
||||||
@@ -45,11 +58,16 @@ public abstract class Move {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>max.</p>
|
* <p>
|
||||||
|
* max.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param move a {@link forge.Move} object.
|
* @param move
|
||||||
* @param depth a int.
|
* a {@link forge.Move} object.
|
||||||
* @param first a boolean.
|
* @param depth
|
||||||
|
* a int.
|
||||||
|
* @param first
|
||||||
|
* a boolean.
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public final int max(final Move move, final int depth, final boolean first) {
|
public final int max(final Move move, final int depth, final boolean first) {
|
||||||
@@ -66,7 +84,7 @@ public abstract class Move {
|
|||||||
bestScore = score;
|
bestScore = score;
|
||||||
bestMove = v[i];
|
bestMove = v[i];
|
||||||
}
|
}
|
||||||
} //for
|
} // for
|
||||||
return score;
|
return score;
|
||||||
} //max()
|
} // max()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,18 @@ package forge;
|
|||||||
import java.util.Observable;
|
import java.util.Observable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>MyObservable class.</p>
|
* <p>
|
||||||
|
* MyObservable class.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class MyObservable extends Observable {
|
public class MyObservable extends Observable {
|
||||||
/**
|
/**
|
||||||
* <p>updateObservers.</p>
|
* <p>
|
||||||
|
* updateObservers.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final void updateObservers() {
|
public final void updateObservers() {
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
@@ -25,4 +29,3 @@ public class MyObservable extends Observable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ package forge;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>MyRandom class.<br>Preferably all Random numbers should be retrieved using this wrapper class</p>
|
* <p>
|
||||||
|
* MyRandom class.<br>
|
||||||
|
* Preferably all Random numbers should be retrieved using this wrapper class
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@@ -13,9 +16,13 @@ public class MyRandom {
|
|||||||
public static Random random = new Random();
|
public static Random random = new Random();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>percentTrue.<br>If percent is like 30, then 30% of the time it will be true.</p>
|
* <p>
|
||||||
|
* percentTrue.<br>
|
||||||
|
* If percent is like 30, then 30% of the time it will be true.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param percent a int.
|
* @param percent
|
||||||
|
* a int.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean percentTrue(final int percent) {
|
public static boolean percentTrue(final int percent) {
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
import forge.card.spellability.SpellAbility;
|
|
||||||
import forge.error.ErrorViewer;
|
|
||||||
import forge.properties.ForgeProps;
|
|
||||||
import forge.properties.NewConstants;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -18,9 +13,15 @@ import net.slightlymagic.braids.util.lambda.Lambda1;
|
|||||||
import com.google.code.jyield.Generator;
|
import com.google.code.jyield.Generator;
|
||||||
import com.google.code.jyield.YieldUtils;
|
import com.google.code.jyield.YieldUtils;
|
||||||
|
|
||||||
|
import forge.card.spellability.SpellAbility;
|
||||||
|
import forge.error.ErrorViewer;
|
||||||
|
import forge.properties.ForgeProps;
|
||||||
|
import forge.properties.NewConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>NameChanger class.</p>
|
* <p>
|
||||||
|
* NameChanger class.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@@ -32,16 +33,20 @@ public class NameChanger implements NewConstants {
|
|||||||
private boolean changeCardName;
|
private boolean changeCardName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Constructor for NameChanger.</p>
|
* <p>
|
||||||
|
* Constructor for NameChanger.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public NameChanger() {
|
public NameChanger() {
|
||||||
// readFile();
|
// readFile();
|
||||||
setShouldChangeCardName(false);
|
setShouldChangeCardName(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//should change card name?
|
// should change card name?
|
||||||
/**
|
/**
|
||||||
* <p>shouldChangeCardName.</p>
|
* <p>
|
||||||
|
* shouldChangeCardName.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
@@ -50,56 +55,64 @@ public class NameChanger implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>setShouldChangeCardName.</p>
|
* <p>
|
||||||
|
* setShouldChangeCardName.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b
|
||||||
|
* a boolean.
|
||||||
*/
|
*/
|
||||||
public final void setShouldChangeCardName(final boolean b) {
|
public final void setShouldChangeCardName(final boolean b) {
|
||||||
changeCardName = b;
|
changeCardName = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This change's the inputGenerator's Card instances in place,
|
* This change's the inputGenerator's Card instances in place, and returns a
|
||||||
* and returns a generator of those same changed instances.
|
* generator of those same changed instances.
|
||||||
*
|
*
|
||||||
* TODO Should this method return void, because it side effects
|
* TODO Should this method return void, because it side effects the contents
|
||||||
* the contents of its inputGenerator?
|
* of its inputGenerator?
|
||||||
*
|
*
|
||||||
* @param inputGenerator a Generator of Card objects
|
* @param inputGenerator
|
||||||
|
* a Generator of Card objects
|
||||||
* @return a Generator of side-effected Card objects
|
* @return a Generator of side-effected Card objects
|
||||||
*/
|
*/
|
||||||
public final Generator<Card> changeCard(final Generator<Card> inputGenerator) {
|
public final Generator<Card> changeCard(final Generator<Card> inputGenerator) {
|
||||||
|
|
||||||
// Create a new Generator by applying a transform to the
|
// Create a new Generator by applying a transform to the
|
||||||
// inputGenerator.
|
// inputGenerator.
|
||||||
|
|
||||||
Lambda1<Card, Card> transform = new Lambda1<Card, Card>() {
|
Lambda1<Card, Card> transform = new Lambda1<Card, Card>() {
|
||||||
public Card apply(final Card toChange) {
|
public Card apply(final Card toChange) {
|
||||||
return changeCard(toChange);
|
return changeCard(toChange);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return GeneratorFunctions.transformGenerator(transform, inputGenerator);
|
return GeneratorFunctions.transformGenerator(transform, inputGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
//changes card name, getText(), and all SpellAbility getStackDescription() and toString()
|
// changes card name, getText(), and all SpellAbility getStackDescription()
|
||||||
|
// and toString()
|
||||||
/**
|
/**
|
||||||
* <p>changeCard.</p>
|
* <p>
|
||||||
|
* changeCard.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param c a {@link forge.Card} object.
|
* @param c
|
||||||
|
* a {@link forge.Card} object.
|
||||||
* @return a {@link forge.Card} object.
|
* @return a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public final Card changeCard(final Card c) {
|
public final Card changeCard(final Card c) {
|
||||||
//change name
|
// change name
|
||||||
String newName = changeName(c.getName());
|
String newName = changeName(c.getName());
|
||||||
c.setName(newName);
|
c.setName(newName);
|
||||||
|
|
||||||
//change text
|
// change text
|
||||||
String s;
|
String s;
|
||||||
s = c.getSpellText();
|
s = c.getSpellText();
|
||||||
c.setText(changeString(c, s));
|
c.setText(changeString(c, s));
|
||||||
|
|
||||||
//change all SpellAbilities
|
// change all SpellAbilities
|
||||||
SpellAbility[] spell = c.getSpellAbility();
|
SpellAbility[] spell = c.getSpellAbility();
|
||||||
for (int i = 0; i < spell.length; i++) {
|
for (int i = 0; i < spell.length; i++) {
|
||||||
s = spell[i].getStackDescription();
|
s = spell[i].getStackDescription();
|
||||||
@@ -110,50 +123,57 @@ public class NameChanger implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
} //getMutatedCard()
|
} // getMutatedCard()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>changeString.</p>
|
* <p>
|
||||||
|
* changeString.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param c a {@link forge.Card} object.
|
* @param c
|
||||||
* @param in a {@link java.lang.String} object.
|
* a {@link forge.Card} object.
|
||||||
|
* @param in
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public final String changeString(final Card c, final String in) {
|
public final String changeString(final Card c, final String in) {
|
||||||
//String name = getOriginalName(c.getName()); // unused
|
// String name = getOriginalName(c.getName()); // unused
|
||||||
// in = in.replaceAll(name, changeName(name));
|
// in = in.replaceAll(name, changeName(name));
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes a list of cards if shouldChangeCardName() is true.
|
* Changes a list of cards if shouldChangeCardName() is true.
|
||||||
*
|
*
|
||||||
* If not, we just return list.
|
* If not, we just return list.
|
||||||
*
|
*
|
||||||
* TODO Should this method return void, because it side effects the
|
* TODO Should this method return void, because it side effects the contents
|
||||||
* contents of its input list?
|
* of its input list?
|
||||||
*
|
*
|
||||||
* @param list
|
* @param list
|
||||||
* the list of cards to possibly change; while this list is not
|
* the list of cards to possibly change; while this list is not
|
||||||
* affected, its contents might be
|
* affected, its contents might be
|
||||||
*
|
*
|
||||||
* @return either list itself or a new list (possibly wasteful) containing
|
* @return either list itself or a new list (possibly wasteful) containing
|
||||||
* the side effected cards
|
* the side effected cards
|
||||||
*/
|
*/
|
||||||
public final CardList changeCardsIfNeeded(CardList list) {
|
public final CardList changeCardsIfNeeded(CardList list) {
|
||||||
if (shouldChangeCardName()) {
|
if (shouldChangeCardName()) {
|
||||||
list = new CardList(changeCard(YieldUtils.toGenerator(list)));
|
list = new CardList(changeCard(YieldUtils.toGenerator(list)));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
//always returns mutated (alias) for the card name
|
// always returns mutated (alias) for the card name
|
||||||
//if argument is a mutated name, it returns the same mutated name
|
// if argument is a mutated name, it returns the same mutated name
|
||||||
/**
|
/**
|
||||||
* <p>changeName.</p>
|
* <p>
|
||||||
|
* changeName.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param originalName a {@link java.lang.String} object.
|
* @param originalName
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public final String changeName(final String originalName) {
|
public final String changeName(final String originalName) {
|
||||||
@@ -164,14 +184,17 @@ public class NameChanger implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return o.toString();
|
return o.toString();
|
||||||
} //getMutatedName()
|
} // getMutatedName()
|
||||||
|
|
||||||
//always returns the original cardname
|
// always returns the original cardname
|
||||||
//if argument is a original name, it returns the same original name
|
// if argument is a original name, it returns the same original name
|
||||||
/**
|
/**
|
||||||
* <p>getOriginalName.</p>
|
* <p>
|
||||||
|
* getOriginalName.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param mutatedName a {@link java.lang.String} object.
|
* @param mutatedName
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public final String getOriginalName(final String mutatedName) {
|
public final String getOriginalName(final String mutatedName) {
|
||||||
@@ -182,10 +205,12 @@ public class NameChanger implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return o.toString();
|
return o.toString();
|
||||||
} //getOriginalName()
|
} // getOriginalName()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>readFile.</p>
|
* <p>
|
||||||
|
* readFile.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void readFile() {
|
private void readFile() {
|
||||||
@@ -194,48 +219,51 @@ public class NameChanger implements NewConstants {
|
|||||||
|
|
||||||
String line = in.readLine();
|
String line = in.readLine();
|
||||||
|
|
||||||
//stop reading if end of file or blank line is read
|
// stop reading if end of file or blank line is read
|
||||||
while (line != null && (line.trim().length() != 0)) {
|
while (line != null && (line.trim().length() != 0)) {
|
||||||
processLine(line.trim());
|
processLine(line.trim());
|
||||||
|
|
||||||
line = in.readLine();
|
line = in.readLine();
|
||||||
} //while
|
} // while
|
||||||
} //try
|
} // try
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
//~ throw new RuntimeException("NameMutator : readFile() error, " +ex);
|
// ~ throw new RuntimeException("NameMutator : readFile() error, "
|
||||||
|
// +ex);
|
||||||
|
|
||||||
|
// ~ (could be cleaner...)
|
||||||
//~ (could be cleaner...)
|
|
||||||
try {
|
try {
|
||||||
BufferedReader in = new BufferedReader(new FileReader(ForgeProps.getFile(NAME_MUTATOR)));
|
BufferedReader in = new BufferedReader(new FileReader(ForgeProps.getFile(NAME_MUTATOR)));
|
||||||
|
|
||||||
String line;
|
String line;
|
||||||
|
|
||||||
//stop reading if end of file or blank line is read
|
// stop reading if end of file or blank line is read
|
||||||
while ((line = in.readLine()) != null && (line.trim().length() != 0)) {
|
while ((line = in.readLine()) != null && (line.trim().length() != 0)) {
|
||||||
processLine(line.trim());
|
processLine(line.trim());
|
||||||
} //while
|
} // while
|
||||||
} catch (Exception ex2) {
|
} catch (Exception ex2) {
|
||||||
// Show orig exception
|
// Show orig exception
|
||||||
ErrorViewer.showError(ex2);
|
ErrorViewer.showError(ex2);
|
||||||
throw new RuntimeException(String.format("NameMutator : readFile() error, %s", ex), ex);
|
throw new RuntimeException(String.format("NameMutator : readFile() error, %s", ex), ex);
|
||||||
}
|
}
|
||||||
//~
|
// ~
|
||||||
}
|
}
|
||||||
} //readFile()
|
} // readFile()
|
||||||
|
|
||||||
//line is formated "original card name : alias card name"
|
// line is formated "original card name : alias card name"
|
||||||
/**
|
/**
|
||||||
* <p>processLine.</p>
|
* <p>
|
||||||
|
* processLine.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param line a {@link java.lang.String} object.
|
* @param line
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
private void processLine(final String line) {
|
private void processLine(final String line) {
|
||||||
StringTokenizer tok = new StringTokenizer(line, ":");
|
StringTokenizer tok = new StringTokenizer(line, ":");
|
||||||
|
|
||||||
if (tok.countTokens() != 2) {
|
if (tok.countTokens() != 2) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException("NameMutator : processLine() error, invalid line in file name-mutator.txt - "
|
||||||
"NameMutator : processLine() error, invalid line in file name-mutator.txt - " + line);
|
+ line);
|
||||||
}
|
}
|
||||||
|
|
||||||
String original = tok.nextToken().trim();
|
String original = tok.nextToken().trim();
|
||||||
@@ -246,9 +274,12 @@ public class NameChanger implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>printMap.</p>
|
* <p>
|
||||||
|
* printMap.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param map a {@link java.util.Map} object.
|
* @param map
|
||||||
|
* a {@link java.util.Map} object.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
// printMap
|
// printMap
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
/** Forge Card Game */
|
/** Forge Card Game. */
|
||||||
package forge;
|
package forge;
|
||||||
|
|||||||
Reference in New Issue
Block a user