mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38: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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ import forge.gui.input.Input;
|
|||||||
import forge.gui.input.Input_PayManaCost_Ability;
|
import forge.gui.input.Input_PayManaCost_Ability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>MagicStack class.</p>
|
* <p>
|
||||||
|
* MagicStack class.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@@ -45,7 +47,9 @@ public class MagicStack extends MyObservable {
|
|||||||
private CardList lastTurnCast = new CardList();
|
private CardList lastTurnCast = new CardList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>isFrozen.</p>
|
* <p>
|
||||||
|
* isFrozen.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
@@ -54,16 +58,21 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Setter for the field <code>frozen</code>.</p>
|
* <p>
|
||||||
|
* Setter for the field <code>frozen</code>.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param frozen0 a boolean.
|
* @param frozen0
|
||||||
|
* a boolean.
|
||||||
*/
|
*/
|
||||||
public final void setFrozen(final boolean frozen0) {
|
public final void setFrozen(final boolean frozen0) {
|
||||||
this.frozen = frozen0;
|
this.frozen = frozen0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>reset.</p>
|
* <p>
|
||||||
|
* reset.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final void reset() {
|
public final void reset() {
|
||||||
getStack().clear();
|
getStack().clear();
|
||||||
@@ -74,7 +83,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>isSplitSecondOnStack.</p>
|
* <p>
|
||||||
|
* isSplitSecondOnStack.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
@@ -83,9 +94,12 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>incrementSplitSecond.</p>
|
* <p>
|
||||||
|
* incrementSplitSecond.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sp a {@link forge.card.spellability.SpellAbility} object.
|
* @param sp
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final void incrementSplitSecond(final SpellAbility sp) {
|
public final void incrementSplitSecond(final SpellAbility sp) {
|
||||||
if (sp.getSourceCard().hasKeyword("Split second")) {
|
if (sp.getSourceCard().hasKeyword("Split second")) {
|
||||||
@@ -94,9 +108,12 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>decrementSplitSecond.</p>
|
* <p>
|
||||||
|
* decrementSplitSecond.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sp a {@link forge.card.spellability.SpellAbility} object.
|
* @param sp
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final void decrementSplitSecond(final SpellAbility sp) {
|
public final void decrementSplitSecond(final SpellAbility sp) {
|
||||||
if (sp.getSourceCard().hasKeyword("Split second")) {
|
if (sp.getSourceCard().hasKeyword("Split second")) {
|
||||||
@@ -109,23 +126,27 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>freezeStack.</p>
|
* <p>
|
||||||
|
* freezeStack.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final void freezeStack() {
|
public final void freezeStack() {
|
||||||
frozen = true;
|
frozen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>addAndUnfreeze.</p>
|
* <p>
|
||||||
|
* addAndUnfreeze.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param ability a {@link forge.card.spellability.SpellAbility} object.
|
* @param ability
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final void addAndUnfreeze(final SpellAbility ability) {
|
public final void addAndUnfreeze(final SpellAbility ability) {
|
||||||
ability.getRestrictions().abilityActivated();
|
ability.getRestrictions().abilityActivated();
|
||||||
if (ability.getRestrictions().getActivationNumberSacrifice() != -1
|
if (ability.getRestrictions().getActivationNumberSacrifice() != -1
|
||||||
&& ability.getRestrictions().getNumberTurnActivations()
|
&& ability.getRestrictions().getNumberTurnActivations() >= ability.getRestrictions()
|
||||||
>= ability.getRestrictions().getActivationNumberSacrifice())
|
.getActivationNumberSacrifice()) {
|
||||||
{
|
|
||||||
ability.getSourceCard().addExtrinsicKeyword("At the beginning of the end step, sacrifice CARDNAME.");
|
ability.getSourceCard().addExtrinsicKeyword("At the beginning of the end step, sacrifice CARDNAME.");
|
||||||
}
|
}
|
||||||
// triggered abilities should go on the frozen stack
|
// triggered abilities should go on the frozen stack
|
||||||
@@ -135,7 +156,8 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
this.add(ability);
|
this.add(ability);
|
||||||
|
|
||||||
// if the ability is a spell, but not a copied spell and its not already on the stack zone, move there
|
// if the ability is a spell, but not a copied spell and its not already
|
||||||
|
// on the stack zone, move there
|
||||||
if (ability.isSpell()) {
|
if (ability.isSpell()) {
|
||||||
Card source = ability.getSourceCard();
|
Card source = ability.getSourceCard();
|
||||||
if (!source.isCopiedSpell() && !AllZone.getZoneOf(source).is(Constant.Zone.Stack)) {
|
if (!source.isCopiedSpell() && !AllZone.getZoneOf(source).is(Constant.Zone.Stack)) {
|
||||||
@@ -149,7 +171,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>unfreezeStack.</p>
|
* <p>
|
||||||
|
* unfreezeStack.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final void unfreezeStack() {
|
public final void unfreezeStack() {
|
||||||
frozen = false;
|
frozen = false;
|
||||||
@@ -164,18 +188,24 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>clearFrozen.</p>
|
* <p>
|
||||||
|
* clearFrozen.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final void clearFrozen() {
|
public final void clearFrozen() {
|
||||||
// TODO: frozen triggered abilities and undoable costs have nasty consequences
|
// TODO: frozen triggered abilities and undoable costs have nasty
|
||||||
|
// consequences
|
||||||
frozen = false;
|
frozen = false;
|
||||||
getFrozenStack().clear();
|
getFrozenStack().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>setResolving.</p>
|
* <p>
|
||||||
|
* setResolving.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param b a boolean.
|
* @param b
|
||||||
|
* a boolean.
|
||||||
*/
|
*/
|
||||||
public final void setResolving(final boolean b) {
|
public final void setResolving(final boolean b) {
|
||||||
bResolving = b;
|
bResolving = b;
|
||||||
@@ -185,7 +215,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getResolving.</p>
|
* <p>
|
||||||
|
* getResolving.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
@@ -194,33 +226,41 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>add.</p>
|
* <p>
|
||||||
|
* add.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sp a {@link forge.card.spellability.SpellAbility} object.
|
* @param sp
|
||||||
* @param useX a boolean.
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
|
* @param useX
|
||||||
|
* a boolean.
|
||||||
*/
|
*/
|
||||||
public final void add(final SpellAbility sp, final boolean useX) {
|
public final void add(final SpellAbility sp, final boolean useX) {
|
||||||
if (!useX) {
|
if (!useX) {
|
||||||
this.add(sp);
|
this.add(sp);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
// TODO: make working triggered abilities!
|
// TODO: make working triggered abilities!
|
||||||
if (sp instanceof Ability_Mana || sp instanceof Ability_Triggered) {
|
if (sp instanceof Ability_Mana || sp instanceof Ability_Triggered) {
|
||||||
sp.resolve();
|
sp.resolve();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
push(sp);
|
push(sp);
|
||||||
/*if (sp.getTargetCard() != null)
|
/*
|
||||||
CardFactoryUtil.checkTargetingEffects(sp, sp.getTargetCard());*/
|
* if (sp.getTargetCard() != null)
|
||||||
|
* CardFactoryUtil.checkTargetingEffects(sp,
|
||||||
|
* sp.getTargetCard());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getMultiKickerSpellCostChange.</p>
|
* <p>
|
||||||
|
* getMultiKickerSpellCostChange.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
* @return a {@link forge.card.mana.ManaCost} object.
|
* @return a {@link forge.card.mana.ManaCost} object.
|
||||||
*/
|
*/
|
||||||
public final ManaCost getMultiKickerSpellCostChange(final SpellAbility sa) {
|
public final ManaCost getMultiKickerSpellCostChange(final SpellAbility sa) {
|
||||||
@@ -239,11 +279,9 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
if (mana.toString().length() == 1) {
|
if (mana.toString().length() == 1) {
|
||||||
numberManaCost = mana.toString().substring(0, 1);
|
numberManaCost = mana.toString().substring(0, 1);
|
||||||
}
|
} else if (mana.toString().length() == 0) {
|
||||||
else if (mana.toString().length() == 0) {
|
|
||||||
numberManaCost = "0"; // Should Never Occur
|
numberManaCost = "0"; // Should Never Occur
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
numberManaCost = mana.toString().substring(0, 2);
|
numberManaCost = mana.toString().substring(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,12 +310,10 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
for (int colorCutIx = 0; colorCutIx < colorCut.length(); colorCutIx++) {
|
for (int colorCutIx = 0; colorCutIx < colorCut.length(); colorCutIx++) {
|
||||||
if ("WUGRB".contains(colorCut.substring(colorCutIx, colorCutIx + 1))
|
if ("WUGRB".contains(colorCut.substring(colorCutIx, colorCutIx + 1))
|
||||||
&& !mana.equals(mana.replaceFirst((colorCut.substring(colorCutIx, colorCutIx + 1)), "")))
|
&& !mana.equals(mana.replaceFirst((colorCut.substring(colorCutIx, colorCutIx + 1)), ""))) {
|
||||||
{
|
|
||||||
mana = mana.replaceFirst(colorCut.substring(colorCutIx, colorCutIx + 1), "");
|
mana = mana.replaceFirst(colorCut.substring(colorCutIx, colorCutIx + 1), "");
|
||||||
|
|
||||||
AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored =
|
AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored = AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||||
AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
|
||||||
.replaceFirst(colorCut.substring(colorCutIx, colorCutIx + 1), "");
|
.replaceFirst(colorCut.substring(colorCutIx, colorCutIx + 1), "");
|
||||||
|
|
||||||
mana = mana.trim();
|
mana = mana.trim();
|
||||||
@@ -293,9 +329,12 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
// TODO: this may be able to use a straight copy of MultiKicker cost change
|
// TODO: this may be able to use a straight copy of MultiKicker cost change
|
||||||
/**
|
/**
|
||||||
* <p>getReplicateSpellCostChange.</p>
|
* <p>
|
||||||
|
* getReplicateSpellCostChange.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
* @return a {@link forge.card.mana.ManaCost} object.
|
* @return a {@link forge.card.mana.ManaCost} object.
|
||||||
*/
|
*/
|
||||||
public final ManaCost getReplicateSpellCostChange(final SpellAbility sa) {
|
public final ManaCost getReplicateSpellCostChange(final SpellAbility sa) {
|
||||||
@@ -305,9 +344,12 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>add.</p>
|
* <p>
|
||||||
|
* add.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sp a {@link forge.card.spellability.SpellAbility} object.
|
* @param sp
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final void add(final SpellAbility sp) {
|
public final void add(final SpellAbility sp) {
|
||||||
ArrayList<Target_Choices> chosenTargets = sp.getAllTargetChoices();
|
ArrayList<Target_Choices> chosenTargets = sp.getAllTargetChoices();
|
||||||
@@ -331,7 +373,10 @@ public class MagicStack extends MyObservable {
|
|||||||
System.out.println(sp.getSourceCard().getName() + " - activatingPlayer not set before adding to stack.");
|
System.out.println(sp.getSourceCard().getName() + " - activatingPlayer not set before adding to stack.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllZone.getPhase().is(Constant.Phase.Cleanup)) { // If something triggers during Cleanup, need to repeat
|
if (AllZone.getPhase().is(Constant.Phase.Cleanup)) { // If something
|
||||||
|
// triggers during
|
||||||
|
// Cleanup, need to
|
||||||
|
// repeat
|
||||||
AllZone.getPhase().repeatPhase();
|
AllZone.getPhase().repeatPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,8 +389,7 @@ public class MagicStack extends MyObservable {
|
|||||||
if (sp instanceof Ability_Triggered || sp instanceof Ability_Static) {
|
if (sp instanceof Ability_Triggered || sp instanceof Ability_Static) {
|
||||||
// TODO: make working triggered ability
|
// TODO: make working triggered ability
|
||||||
sp.resolve();
|
sp.resolve();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (sp.isKickerAbility()) {
|
if (sp.isKickerAbility()) {
|
||||||
sp.getSourceCard().setKicked(true);
|
sp.getSourceCard().setKicked(true);
|
||||||
SpellAbility[] sa = sp.getSourceCard().getSpellAbility();
|
SpellAbility[] sa = sp.getSourceCard().getSpellAbility();
|
||||||
@@ -389,18 +433,19 @@ public class MagicStack extends MyObservable {
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
ability.resolve();
|
ability.resolve();
|
||||||
Card crd = sa.getSourceCard();
|
Card crd = sa.getSourceCard();
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability("Pay X cost for "
|
AllZone.getInputControl().setInput(
|
||||||
+ crd.getName()
|
new Input_PayManaCost_Ability("Pay X cost for " + crd.getName() + " (X="
|
||||||
+ " (X=" + crd.getXManaCostPaid() + ")\r\n",
|
+ crd.getXManaCostPaid() + ")\r\n", ability.getManaCost(), this, unpaidCommand,
|
||||||
ability.getManaCost(), this, unpaidCommand, true));
|
true));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Card crd = sa.getSourceCard();
|
Card crd = sa.getSourceCard();
|
||||||
if (sp.getSourceCard().getController().isHuman()) {
|
if (sp.getSourceCard().getController().isHuman()) {
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability("Pay X cost for "
|
AllZone.getInputControl().setInput(
|
||||||
+ sp.getSourceCard().getName() + " (X=" + crd.getXManaCostPaid() + ")\r\n",
|
new Input_PayManaCost_Ability("Pay X cost for " + sp.getSourceCard().getName() + " (X="
|
||||||
ability.getManaCost(), paidCommand, unpaidCommand, true));
|
+ crd.getXManaCostPaid() + ")\r\n", ability.getManaCost(), paidCommand,
|
||||||
|
unpaidCommand, true));
|
||||||
} else {
|
} else {
|
||||||
// computer
|
// computer
|
||||||
int neededDamage = CardFactoryUtil.getNeededXDamage(sa);
|
int neededDamage = CardFactoryUtil.getNeededXDamage(sa);
|
||||||
@@ -411,7 +456,8 @@ public class MagicStack extends MyObservable {
|
|||||||
push(sa);
|
push(sa);
|
||||||
}
|
}
|
||||||
} else if (sp.isMultiKicker()) {
|
} else if (sp.isMultiKicker()) {
|
||||||
// TODO: convert multikicker support in abCost so this doesn't happen here
|
// TODO: convert multikicker support in abCost so this doesn't
|
||||||
|
// happen here
|
||||||
// both X and multi is not supported yet
|
// both X and multi is not supported yet
|
||||||
|
|
||||||
final SpellAbility sa = sp;
|
final SpellAbility sa = sp;
|
||||||
@@ -440,23 +486,26 @@ public class MagicStack extends MyObservable {
|
|||||||
} else {
|
} else {
|
||||||
if (AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0
|
if (AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0
|
||||||
&& AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
&& AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||||
.equals(""))
|
.equals("")) {
|
||||||
{
|
|
||||||
|
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability(
|
AllZone.getInputControl().setInput(
|
||||||
"Multikicker for " + sa.getSourceCard() + "\r\n"
|
new Input_PayManaCost_Ability("Multikicker for " + sa.getSourceCard() + "\r\n"
|
||||||
+ "Times Kicked: " + sa.getSourceCard().getMultiKickerMagnitude()
|
+ "Times Kicked: " + sa.getSourceCard().getMultiKickerMagnitude()
|
||||||
+ "\r\n",
|
+ "\r\n", manaCost.toString(), this, unpaidCommand));
|
||||||
manaCost.toString(), this, unpaidCommand));
|
|
||||||
} else {
|
} else {
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability("Multikicker for "
|
AllZone.getInputControl()
|
||||||
+ sa.getSourceCard() + "\r\n" + "Mana in Reserve: "
|
.setInput(
|
||||||
+ ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid != 0)
|
new Input_PayManaCost_Ability(
|
||||||
? AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid
|
"Multikicker for "
|
||||||
|
+ sa.getSourceCard()
|
||||||
|
+ "\r\n"
|
||||||
|
+ "Mana in Reserve: "
|
||||||
|
+ ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid != 0) ? AllZone
|
||||||
|
.getGameAction().CostCutting_GetMultiMickerManaCostPaid
|
||||||
: "")
|
: "")
|
||||||
+ AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
+ AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||||
+ "\r\n"
|
+ "\r\n" + "Times Kicked: "
|
||||||
+ "Times Kicked: " + sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
+ sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
||||||
manaCost.toString(), this, unpaidCommand));
|
manaCost.toString(), this, unpaidCommand));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -470,20 +519,25 @@ public class MagicStack extends MyObservable {
|
|||||||
paidCommand.execute();
|
paidCommand.execute();
|
||||||
} else {
|
} else {
|
||||||
if (AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0
|
if (AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid == 0
|
||||||
&& AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored.equals(""))
|
&& AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored.equals("")) {
|
||||||
{
|
AllZone.getInputControl().setInput(
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability("Multikicker for "
|
new Input_PayManaCost_Ability("Multikicker for " + sa.getSourceCard() + "\r\n"
|
||||||
+ sa.getSourceCard() + "\r\n" + "Times Kicked: "
|
+ "Times Kicked: " + sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
||||||
+ sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
|
||||||
manaCost.toString(), paidCommand, unpaidCommand));
|
manaCost.toString(), paidCommand, unpaidCommand));
|
||||||
} else {
|
} else {
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability("Multikicker for "
|
AllZone.getInputControl()
|
||||||
+ sa.getSourceCard() + "\r\n" + "Mana in Reserve: "
|
.setInput(
|
||||||
+ ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid != 0)
|
new Input_PayManaCost_Ability(
|
||||||
? AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid
|
"Multikicker for "
|
||||||
|
+ sa.getSourceCard()
|
||||||
|
+ "\r\n"
|
||||||
|
+ "Mana in Reserve: "
|
||||||
|
+ ((AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid != 0) ? AllZone
|
||||||
|
.getGameAction().CostCutting_GetMultiMickerManaCostPaid
|
||||||
: "")
|
: "")
|
||||||
+ AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
+ AllZone.getGameAction().CostCutting_GetMultiMickerManaCostPaid_Colored
|
||||||
+ "\r\n" + "Times Kicked: " + sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
+ "\r\n" + "Times Kicked: "
|
||||||
|
+ sa.getSourceCard().getMultiKickerMagnitude() + "\r\n",
|
||||||
manaCost.toString(), paidCommand, unpaidCommand));
|
manaCost.toString(), paidCommand, unpaidCommand));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,7 +551,8 @@ public class MagicStack extends MyObservable {
|
|||||||
push(sa);
|
push(sa);
|
||||||
}
|
}
|
||||||
} else if (sp.isReplicate()) {
|
} else if (sp.isReplicate()) {
|
||||||
// TODO: convert multikicker/replicate support in abCost so this doesn't happen here
|
// TODO: convert multikicker/replicate support in abCost so this
|
||||||
|
// doesn't happen here
|
||||||
// X and multi and replicate are not supported yet
|
// X and multi and replicate are not supported yet
|
||||||
|
|
||||||
final SpellAbility sa = sp;
|
final SpellAbility sa = sp;
|
||||||
@@ -528,24 +583,22 @@ public class MagicStack extends MyObservable {
|
|||||||
this.execute();
|
this.execute();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability("Replicate for "
|
AllZone.getInputControl().setInput(
|
||||||
+ sa.getSourceCard() + "\r\n"
|
new Input_PayManaCost_Ability("Replicate for " + sa.getSourceCard() + "\r\n"
|
||||||
+ "Times Replicated: " + sa.getSourceCard().getReplicateMagnitude() + "\r\n",
|
+ "Times Replicated: " + sa.getSourceCard().getReplicateMagnitude()
|
||||||
manaCost.toString(), this, unpaidCommand));
|
+ "\r\n", manaCost.toString(), this, unpaidCommand));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (sp.getSourceCard().getController().equals(
|
if (sp.getSourceCard().getController().equals(AllZone.getHumanPlayer())) {
|
||||||
AllZone.getHumanPlayer()))
|
|
||||||
{
|
|
||||||
ManaCost manaCost = getMultiKickerSpellCostChange(ability);
|
ManaCost manaCost = getMultiKickerSpellCostChange(ability);
|
||||||
|
|
||||||
if (manaCost.isPaid()) {
|
if (manaCost.isPaid()) {
|
||||||
paidCommand.execute();
|
paidCommand.execute();
|
||||||
} else {
|
} else {
|
||||||
AllZone.getInputControl().setInput(new Input_PayManaCost_Ability("Replicate for "
|
AllZone.getInputControl().setInput(
|
||||||
+ sa.getSourceCard() + "\r\n"
|
new Input_PayManaCost_Ability("Replicate for " + sa.getSourceCard() + "\r\n"
|
||||||
+ "Times Replicated: " + sa.getSourceCard().getReplicateMagnitude() + "\r\n",
|
+ "Times Replicated: " + sa.getSourceCard().getReplicateMagnitude() + "\r\n",
|
||||||
manaCost.toString(), paidCommand, unpaidCommand));
|
manaCost.toString(), paidCommand, unpaidCommand));
|
||||||
}
|
}
|
||||||
@@ -561,7 +614,9 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sp.getSourceCard().isCopiedSpell()) //Copied spells aren't cast per se so triggers shouldn't run for them.
|
if (!sp.getSourceCard().isCopiedSpell()) // Copied spells aren't cast
|
||||||
|
// per se so triggers shouldn't
|
||||||
|
// run for them.
|
||||||
{
|
{
|
||||||
// Run SpellAbilityCast triggers
|
// Run SpellAbilityCast triggers
|
||||||
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||||
@@ -609,15 +664,13 @@ public class MagicStack extends MyObservable {
|
|||||||
runParams.put("Target", sp.getTargetCard());
|
runParams.put("Target", sp.getTargetCard());
|
||||||
|
|
||||||
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
||||||
}
|
} else if (sp.getTargetList() != null && sp.getTargetList().size() > 0) {
|
||||||
else if (sp.getTargetList() != null && sp.getTargetList().size() > 0) {
|
|
||||||
for (Card ctgt : sp.getTargetList()) {
|
for (Card ctgt : sp.getTargetList()) {
|
||||||
runParams.put("Target", ctgt);
|
runParams.put("Target", ctgt);
|
||||||
|
|
||||||
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
||||||
}
|
}
|
||||||
}
|
} else if (sp.getTargetPlayer() != null) {
|
||||||
else if (sp.getTargetPlayer() != null) {
|
|
||||||
runParams.put("Target", sp.getTargetPlayer());
|
runParams.put("Target", sp.getTargetPlayer());
|
||||||
|
|
||||||
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
AllZone.getTriggerHandler().runTrigger("BecomesTarget", runParams);
|
||||||
@@ -646,9 +699,7 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(final Card c, final PlayerZone zone) {
|
public void selectCard(final Card c, final PlayerZone zone) {
|
||||||
if (zone.is(Constant.Zone.Battlefield) && c.getController().isHuman()
|
if (zone.is(Constant.Zone.Battlefield) && c.getController().isHuman() && c.isLand()) {
|
||||||
&& c.isLand())
|
|
||||||
{
|
|
||||||
AllZone.getGameAction().sacrifice(c);
|
AllZone.getGameAction().sacrifice(c);
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
@@ -679,8 +730,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Whenever a player casts a spell, counter it if a card with the same name
|
* Whenever a player casts a spell, counter it if a card with the same
|
||||||
* is in a graveyard or a nontoken permanent with the same name is on the battlefield.
|
* name is in a graveyard or a nontoken permanent with the same name is
|
||||||
|
* on the battlefield.
|
||||||
*/
|
*/
|
||||||
if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) {
|
if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
@@ -696,7 +748,10 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
CardList bazaars = AllZoneUtil.getCardsIn(Zone.Battlefield, "Bazaar of Wonders"); //should only be 1...
|
CardList bazaars = AllZoneUtil.getCardsIn(Zone.Battlefield, "Bazaar of Wonders"); // should
|
||||||
|
// only
|
||||||
|
// be
|
||||||
|
// 1...
|
||||||
for (final Card bazaar : bazaars) {
|
for (final Card bazaar : bazaars) {
|
||||||
final SpellAbility counter = new Ability(bazaar, "0") {
|
final SpellAbility counter = new Ability(bazaar, "0") {
|
||||||
@Override
|
@Override
|
||||||
@@ -712,8 +767,10 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (sp.getTargetCard() != null)
|
/*
|
||||||
CardFactoryUtil.checkTargetingEffects(sp, sp.getTargetCard());*/
|
* if (sp.getTargetCard() != null)
|
||||||
|
* CardFactoryUtil.checkTargetingEffects(sp, sp.getTargetCard());
|
||||||
|
*/
|
||||||
|
|
||||||
if (getSimultaneousStackEntryList().size() > 0) {
|
if (getSimultaneousStackEntryList().size() > 0) {
|
||||||
AllZone.getPhase().passPriority();
|
AllZone.getPhase().passPriority();
|
||||||
@@ -721,7 +778,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>size.</p>
|
* <p>
|
||||||
|
* size.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
@@ -731,9 +790,12 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
// Push should only be used by add.
|
// Push should only be used by add.
|
||||||
/**
|
/**
|
||||||
* <p>push.</p>
|
* <p>
|
||||||
|
* push.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sp a {@link forge.card.spellability.SpellAbility} object.
|
* @param sp
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
private void push(final SpellAbility sp) {
|
private void push(final SpellAbility sp) {
|
||||||
if (null == sp.getActivatingPlayer()) {
|
if (null == sp.getActivatingPlayer()) {
|
||||||
@@ -756,7 +818,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>resolveStack.</p>
|
* <p>
|
||||||
|
* resolveStack.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final void resolveStack() {
|
public final void resolveStack() {
|
||||||
// Resolving the Stack
|
// Resolving the Stack
|
||||||
@@ -764,12 +828,14 @@ public class MagicStack extends MyObservable {
|
|||||||
// TODO: change to use forge.view.FView?
|
// TODO: change to use forge.view.FView?
|
||||||
GuiDisplayUtil.updateGUI();
|
GuiDisplayUtil.updateGUI();
|
||||||
|
|
||||||
this.freezeStack(); // freeze the stack while we're in the middle of resolving
|
this.freezeStack(); // freeze the stack while we're in the middle of
|
||||||
|
// resolving
|
||||||
setResolving(true);
|
setResolving(true);
|
||||||
|
|
||||||
SpellAbility sa = AllZone.getStack().pop();
|
SpellAbility sa = AllZone.getStack().pop();
|
||||||
|
|
||||||
AllZone.getPhase().resetPriority(); // ActivePlayer gains priority first after Resolve
|
AllZone.getPhase().resetPriority(); // ActivePlayer gains priority first
|
||||||
|
// after Resolve
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
if (hasFizzled(sa, source)) { // Fizzle
|
if (hasFizzled(sa, source)) { // Fizzle
|
||||||
@@ -784,7 +850,8 @@ public class MagicStack extends MyObservable {
|
|||||||
finishResolving(sa, false);
|
finishResolving(sa, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(source.hasStartOfKeyword("Haunt") && !source.isCreature() && AllZone.getZoneOf(source).is(Constant.Zone.Graveyard)) {
|
if (source.hasStartOfKeyword("Haunt") && !source.isCreature()
|
||||||
|
&& AllZone.getZoneOf(source).is(Constant.Zone.Graveyard)) {
|
||||||
CardList creats = AllZoneUtil.getCreaturesInPlay();
|
CardList creats = AllZoneUtil.getCreaturesInPlay();
|
||||||
for (int i = 0; i < creats.size(); i++) {
|
for (int i = 0; i < creats.size(); i++) {
|
||||||
if (!CardFactoryUtil.canTarget(source, creats.get(i))) {
|
if (!CardFactoryUtil.canTarget(source, creats.get(i))) {
|
||||||
@@ -792,8 +859,7 @@ public class MagicStack extends MyObservable {
|
|||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(creats.size() != 0)
|
if (creats.size() != 0) {
|
||||||
{
|
|
||||||
final Ability haunterDies_Work = new Ability(source, "0") {
|
final Ability haunterDies_Work = new Ability(source, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -817,33 +883,24 @@ public class MagicStack extends MyObservable {
|
|||||||
if (!zone.is(Constant.Zone.Battlefield) || !c.isCreature()) {
|
if (!zone.is(Constant.Zone.Battlefield) || !c.isCreature()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(CardFactoryUtil.canTarget(source,c))
|
if (CardFactoryUtil.canTarget(source, c)) {
|
||||||
{
|
|
||||||
haunterDies_Work.setTargetCard(c);
|
haunterDies_Work.setTargetCard(c);
|
||||||
add(haunterDies_Work);
|
add(haunterDies_Work);
|
||||||
stop();
|
stop();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
|
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(source.getController().isHuman())
|
if (source.getController().isHuman()) {
|
||||||
{
|
|
||||||
AllZone.getInputControl().setInput(target);
|
AllZone.getInputControl().setInput(target);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// AI choosing what to haunt
|
// AI choosing what to haunt
|
||||||
CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
|
CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
|
||||||
if(oppCreats.size() != 0)
|
if (oppCreats.size() != 0) {
|
||||||
{
|
|
||||||
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(oppCreats));
|
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(oppCreats));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(creats));
|
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(creats));
|
||||||
}
|
}
|
||||||
add(haunterDies_Work);
|
add(haunterDies_Work);
|
||||||
@@ -854,10 +911,14 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>removeCardFromStack.</p>
|
* <p>
|
||||||
|
* removeCardFromStack.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
* @param fizzle a boolean.
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
|
* @param fizzle
|
||||||
|
* a boolean.
|
||||||
* @since 1.0.15
|
* @since 1.0.15
|
||||||
*/
|
*/
|
||||||
public final void removeCardFromStack(final SpellAbility sa, final boolean fizzle) {
|
public final void removeCardFromStack(final SpellAbility sa, final boolean fizzle) {
|
||||||
@@ -874,7 +935,8 @@ public class MagicStack extends MyObservable {
|
|||||||
sa.setFlashBackAbility(false);
|
sa.setFlashBackAbility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If Spell and still on the Stack then let it goto the graveyard or replace its own movement
|
// If Spell and still on the Stack then let it goto the graveyard or
|
||||||
|
// replace its own movement
|
||||||
else if (!source.isCopiedSpell() && (source.isInstant() || source.isSorcery() || fizzle)
|
else if (!source.isCopiedSpell() && (source.isInstant() || source.isSorcery() || fizzle)
|
||||||
&& AllZone.getZoneOf(source).is(Constant.Zone.Stack)) {
|
&& AllZone.getZoneOf(source).is(Constant.Zone.Stack)) {
|
||||||
AllZone.getGameAction().moveToGraveyard(source);
|
AllZone.getGameAction().moveToGraveyard(source);
|
||||||
@@ -882,10 +944,14 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>finishResolving.</p>
|
* <p>
|
||||||
|
* finishResolving.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
* @param fizzle a boolean.
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
|
* @param fizzle
|
||||||
|
* a boolean.
|
||||||
* @since 1.0.15
|
* @since 1.0.15
|
||||||
*/
|
*/
|
||||||
public final void finishResolving(final SpellAbility sa, final boolean fizzle) {
|
public final void finishResolving(final SpellAbility sa, final boolean fizzle) {
|
||||||
@@ -924,10 +990,14 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>hasFizzled.</p>
|
* <p>
|
||||||
|
* hasFizzled.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
* @param source a {@link forge.Card} object.
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
|
* @param source
|
||||||
|
* a {@link forge.Card} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public final boolean hasFizzled(final SpellAbility sa, final Card source) {
|
public final boolean hasFizzled(final SpellAbility sa, final Card source) {
|
||||||
@@ -941,18 +1011,19 @@ public class MagicStack extends MyObservable {
|
|||||||
while (true) {
|
while (true) {
|
||||||
Target tgt = fizzSA.getTarget();
|
Target tgt = fizzSA.getTarget();
|
||||||
if (tgt != null && tgt.getMinTargets(source, fizzSA) == 0 && tgt.getNumTargeted() == 0) {
|
if (tgt != null && tgt.getMinTargets(source, fizzSA) == 0 && tgt.getNumTargeted() == 0) {
|
||||||
// Don't assume fizzled for minTargets == 0 and nothing is targeted
|
// Don't assume fizzled for minTargets == 0 and nothing is
|
||||||
}
|
// targeted
|
||||||
else if (firstTarget && (tgt != null || fizzSA.getTargetCard() != null
|
} else if (firstTarget
|
||||||
|| fizzSA.getTargetPlayer() != null))
|
&& (tgt != null || fizzSA.getTargetCard() != null || fizzSA.getTargetPlayer() != null)) {
|
||||||
{
|
// If there is at least 1 target, fizzle switches because ALL
|
||||||
// If there is at least 1 target, fizzle switches because ALL targets need to be invalid
|
// targets need to be invalid
|
||||||
fizzle = true;
|
fizzle = true;
|
||||||
firstTarget = false;
|
firstTarget = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
// With multi-targets, as long as one target is still legal, we'll try to go through as much as possible
|
// With multi-targets, as long as one target is still legal,
|
||||||
|
// we'll try to go through as much as possible
|
||||||
ArrayList<Object> tgts = tgt.getTargets();
|
ArrayList<Object> tgts = tgt.getTargets();
|
||||||
for (Object o : tgts) {
|
for (Object o : tgts) {
|
||||||
if (o instanceof Player) {
|
if (o instanceof Player) {
|
||||||
@@ -969,7 +1040,8 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fizzSA.getTargetCard() != null) {
|
} else if (fizzSA.getTargetCard() != null) {
|
||||||
// Fizzling will only work for Abilities that use the Target class,
|
// Fizzling will only work for Abilities that use the Target
|
||||||
|
// class,
|
||||||
// since the info isn't available otherwise
|
// since the info isn't available otherwise
|
||||||
fizzle &= !CardFactoryUtil.isTargetStillValid(fizzSA, fizzSA.getTargetCard());
|
fizzle &= !CardFactoryUtil.isTargetStillValid(fizzSA, fizzSA.getTargetCard());
|
||||||
} else if (fizzSA.getTargetPlayer() != null) {
|
} else if (fizzSA.getTargetPlayer() != null) {
|
||||||
@@ -978,8 +1050,7 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
if (fizzSA.getSubAbility() != null) {
|
if (fizzSA.getSubAbility() != null) {
|
||||||
fizzSA = fizzSA.getSubAbility();
|
fizzSA = fizzSA.getSubAbility();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -988,7 +1059,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>pop.</p>
|
* <p>
|
||||||
|
* pop.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
@@ -1002,19 +1075,26 @@ public class MagicStack extends MyObservable {
|
|||||||
// CAREFUL! Peeking while an SAs Targets are being choosen may cause issues
|
// CAREFUL! Peeking while an SAs Targets are being choosen may cause issues
|
||||||
// index = 0 is the top, index = 1 is the next to top, etc...
|
// index = 0 is the top, index = 1 is the next to top, etc...
|
||||||
/**
|
/**
|
||||||
* <p>peekInstance.</p>
|
* <p>
|
||||||
|
* peekInstance.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param index a int.
|
* @param index
|
||||||
* @return a {@link forge.card.spellability.SpellAbility_StackInstance} object.
|
* a int.
|
||||||
|
* @return a {@link forge.card.spellability.SpellAbility_StackInstance}
|
||||||
|
* object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility_StackInstance peekInstance(final int index) {
|
public final SpellAbility_StackInstance peekInstance(final int index) {
|
||||||
return getStack().get(index);
|
return getStack().get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>peekAbility.</p>
|
* <p>
|
||||||
|
* peekAbility.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param index a int.
|
* @param index
|
||||||
|
* a int.
|
||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility peekAbility(final int index) {
|
public final SpellAbility peekAbility(final int index) {
|
||||||
@@ -1022,16 +1102,21 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>peekInstance.</p>
|
* <p>
|
||||||
|
* peekInstance.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a {@link forge.card.spellability.SpellAbility_StackInstance} object.
|
* @return a {@link forge.card.spellability.SpellAbility_StackInstance}
|
||||||
|
* object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility_StackInstance peekInstance() {
|
public final SpellAbility_StackInstance peekInstance() {
|
||||||
return getStack().peek();
|
return getStack().peek();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>peekAbility.</p>
|
* <p>
|
||||||
|
* peekAbility.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
@@ -1040,9 +1125,12 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>remove.</p>
|
* <p>
|
||||||
|
* remove.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final void remove(final SpellAbility sa) {
|
public final void remove(final SpellAbility sa) {
|
||||||
SpellAbility_StackInstance si = getInstanceFromSpellAbility(sa);
|
SpellAbility_StackInstance si = getInstanceFromSpellAbility(sa);
|
||||||
@@ -1055,9 +1143,13 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>remove.</p>
|
* <p>
|
||||||
|
* remove.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param si a {@link forge.card.spellability.SpellAbility_StackInstance} object.
|
* @param si
|
||||||
|
* a {@link forge.card.spellability.SpellAbility_StackInstance}
|
||||||
|
* object.
|
||||||
*/
|
*/
|
||||||
public final void remove(final SpellAbility_StackInstance si) {
|
public final void remove(final SpellAbility_StackInstance si) {
|
||||||
if (getStack().remove(si)) {
|
if (getStack().remove(si)) {
|
||||||
@@ -1068,10 +1160,14 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getInstanceFromSpellAbility.</p>
|
* <p>
|
||||||
|
* getInstanceFromSpellAbility.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
* @return a {@link forge.card.spellability.SpellAbility_StackInstance} object.
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
|
* @return a {@link forge.card.spellability.SpellAbility_StackInstance}
|
||||||
|
* object.
|
||||||
*/
|
*/
|
||||||
public final SpellAbility_StackInstance getInstanceFromSpellAbility(final SpellAbility sa) {
|
public final SpellAbility_StackInstance getInstanceFromSpellAbility(final SpellAbility sa) {
|
||||||
// TODO: Confirm this works!
|
// TODO: Confirm this works!
|
||||||
@@ -1084,7 +1180,9 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>hasSimultaneousStackEntries.</p>
|
* <p>
|
||||||
|
* hasSimultaneousStackEntries.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
@@ -1093,16 +1191,21 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>addSimultaneousStackEntry.</p>
|
* <p>
|
||||||
|
* addSimultaneousStackEntry.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa
|
||||||
|
* a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public final void addSimultaneousStackEntry(final SpellAbility sa) {
|
public final void addSimultaneousStackEntry(final SpellAbility sa) {
|
||||||
getSimultaneousStackEntryList().add(sa);
|
getSimultaneousStackEntryList().add(sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>chooseOrderOfSimultaneousStackEntryAll.</p>
|
* <p>
|
||||||
|
* chooseOrderOfSimultaneousStackEntryAll.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final void chooseOrderOfSimultaneousStackEntryAll() {
|
public final void chooseOrderOfSimultaneousStackEntryAll() {
|
||||||
final Player playerTurn = AllZone.getPhase().getPlayerTurn();
|
final Player playerTurn = AllZone.getPhase().getPlayerTurn();
|
||||||
@@ -1115,9 +1218,12 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>chooseOrderOfSimultaneousStackEntry.</p>
|
* <p>
|
||||||
|
* chooseOrderOfSimultaneousStackEntry.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param activePlayer a {@link forge.Player} object.
|
* @param activePlayer
|
||||||
|
* a {@link forge.Player} object.
|
||||||
*/
|
*/
|
||||||
public final void chooseOrderOfSimultaneousStackEntry(final Player activePlayer) {
|
public final void chooseOrderOfSimultaneousStackEntry(final Player activePlayer) {
|
||||||
if (getSimultaneousStackEntryList().size() == 0) {
|
if (getSimultaneousStackEntryList().size() == 0) {
|
||||||
@@ -1152,9 +1258,8 @@ public class MagicStack extends MyObservable {
|
|||||||
} else {
|
} else {
|
||||||
while (activePlayerSAs.size() > 1) {
|
while (activePlayerSAs.size() > 1) {
|
||||||
|
|
||||||
SpellAbility next =
|
SpellAbility next = (SpellAbility) GuiUtils.getChoice(
|
||||||
(SpellAbility) GuiUtils.getChoice("Choose which spell or ability to put on the stack next.",
|
"Choose which spell or ability to put on the stack next.", activePlayerSAs.toArray());
|
||||||
activePlayerSAs.toArray());
|
|
||||||
|
|
||||||
activePlayerSAs.remove(next);
|
activePlayerSAs.remove(next);
|
||||||
|
|
||||||
@@ -1169,8 +1274,7 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
if (activePlayerSAs.get(0).isTrigger()) {
|
if (activePlayerSAs.get(0).isTrigger()) {
|
||||||
AllZone.getGameAction().playSpellAbility(activePlayerSAs.get(0));
|
AllZone.getGameAction().playSpellAbility(activePlayerSAs.get(0));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
add(activePlayerSAs.get(0));
|
add(activePlayerSAs.get(0));
|
||||||
}
|
}
|
||||||
// AllZone.getGameAction().playSpellAbility(activePlayerSAs.get(0));
|
// AllZone.getGameAction().playSpellAbility(activePlayerSAs.get(0));
|
||||||
@@ -1179,8 +1283,10 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
|
*
|
||||||
* @param triggerID
|
* @param triggerID
|
||||||
* @return
|
* the trigger id
|
||||||
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public final boolean hasStateTrigger(final int triggerID) {
|
public final boolean hasStateTrigger(final int triggerID) {
|
||||||
for (SpellAbility_StackInstance sasi : getStack()) {
|
for (SpellAbility_StackInstance sasi : getStack()) {
|
||||||
@@ -1193,6 +1299,8 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the simultaneous stack entry list.
|
||||||
|
*
|
||||||
* @return the simultaneousStackEntryList
|
* @return the simultaneousStackEntryList
|
||||||
*/
|
*/
|
||||||
public final List<SpellAbility> getSimultaneousStackEntryList() {
|
public final List<SpellAbility> getSimultaneousStackEntryList() {
|
||||||
@@ -1200,6 +1308,8 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the stack.
|
||||||
|
*
|
||||||
* @return the stack
|
* @return the stack
|
||||||
*/
|
*/
|
||||||
public final Stack<SpellAbility_StackInstance> getStack() {
|
public final Stack<SpellAbility_StackInstance> getStack() {
|
||||||
@@ -1207,6 +1317,8 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the frozen stack.
|
||||||
|
*
|
||||||
* @return the frozenStack
|
* @return the frozenStack
|
||||||
*/
|
*/
|
||||||
public final Stack<SpellAbility_StackInstance> getFrozenStack() {
|
public final Stack<SpellAbility_StackInstance> getFrozenStack() {
|
||||||
@@ -1215,6 +1327,7 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessor for the field thisTurnCast.
|
* Accessor for the field thisTurnCast.
|
||||||
|
*
|
||||||
* @return a CardList.
|
* @return a CardList.
|
||||||
*/
|
*/
|
||||||
public final CardList getCardsCastThisTurn() {
|
public final CardList getCardsCastThisTurn() {
|
||||||
@@ -1238,6 +1351,7 @@ public class MagicStack extends MyObservable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessor for the field lastTurnCast.
|
* Accessor for the field lastTurnCast.
|
||||||
|
*
|
||||||
* @return a CardList.
|
* @return a CardList.
|
||||||
*/
|
*/
|
||||||
public final CardList getCardsCastLastTurn() {
|
public final CardList getCardsCastLastTurn() {
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -41,130 +47,5 @@ public class MenuItem_HowToPlay extends JMenuItem implements NewConstants.LANG.H
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} // constructor
|
} // constructor
|
||||||
|
|
||||||
/**
|
|
||||||
* <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
|
} // 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) {
|
||||||
|
|||||||
@@ -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,7 +33,9 @@ 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();
|
||||||
@@ -41,7 +44,9 @@ public class NameChanger implements NewConstants {
|
|||||||
|
|
||||||
// should change card name?
|
// should change card name?
|
||||||
/**
|
/**
|
||||||
* <p>shouldChangeCardName.</p>
|
* <p>
|
||||||
|
* shouldChangeCardName.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
@@ -50,22 +55,26 @@ 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) {
|
||||||
@@ -82,11 +91,15 @@ public class NameChanger implements NewConstants {
|
|||||||
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) {
|
||||||
@@ -113,10 +126,14 @@ public class NameChanger implements NewConstants {
|
|||||||
} // 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) {
|
||||||
@@ -131,8 +148,8 @@ public class NameChanger implements NewConstants {
|
|||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -151,9 +168,12 @@ public class NameChanger implements NewConstants {
|
|||||||
// 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) {
|
||||||
@@ -169,9 +189,12 @@ public class NameChanger implements NewConstants {
|
|||||||
// 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) {
|
||||||
@@ -185,7 +208,9 @@ public class NameChanger implements NewConstants {
|
|||||||
} // getOriginalName()
|
} // getOriginalName()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>readFile.</p>
|
* <p>
|
||||||
|
* readFile.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void readFile() {
|
private void readFile() {
|
||||||
@@ -202,8 +227,8 @@ public class NameChanger implements NewConstants {
|
|||||||
} // 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 {
|
||||||
@@ -226,16 +251,19 @@ public class NameChanger implements NewConstants {
|
|||||||
|
|
||||||
// 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