checkstyle and refactoring

This commit is contained in:
jendave
2011-11-01 22:11:41 +00:00
parent 23f57be6fa
commit 6120b99ace
53 changed files with 1405 additions and 1144 deletions

View File

@@ -2117,7 +2117,7 @@ public class CombatUtil {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
ComputerUtil.sacrificePermanents(a, list);
} else {
AllZone.getInputControl().setInput(PlayerUtil.input_sacrificePermanents(a));
AllZone.getInputControl().setInput(PlayerUtil.inputSacrificePermanents(a));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -136,7 +136,7 @@ public class HumanPlayer extends Player {
/** {@inheritDoc} */
public final CardList discard(final int num, final SpellAbility sa, final boolean duringResolution) {
AllZone.getInputControl().setInput(PlayerUtil.input_discard(num, sa), duringResolution);
AllZone.getInputControl().setInput(PlayerUtil.inputDiscard(num, sa), duringResolution);
// why is CardList returned?
return new CardList();
@@ -144,7 +144,7 @@ public class HumanPlayer extends Player {
/** {@inheritDoc} */
public final void discardUnless(final int num, final String uType, final SpellAbility sa) {
AllZone.getInputControl().setInput(PlayerUtil.input_discardNumUnless(num, uType, sa));
AllZone.getInputControl().setInput(PlayerUtil.inputDiscardNumUnless(num, uType, sa));
}
/*
@@ -156,7 +156,7 @@ public class HumanPlayer extends Player {
*
*/
protected final void discardChainsOfMephistopheles() {
AllZone.getInputControl().setInput(PlayerUtil.input_chainsDiscard(), true);
AllZone.getInputControl().setInput(PlayerUtil.inputChainsDiscard(), true);
}
/** {@inheritDoc} */
@@ -173,7 +173,7 @@ public class HumanPlayer extends Player {
new Object[] { "top", "bottom" });
libPos = o.toString();
}
AllZone.getInputControl().setInput(PlayerUtil.input_putFromHandToLibrary(libPos, numToLibrary));
AllZone.getInputControl().setInput(PlayerUtil.inputPutFromHandToLibrary(libPos, numToLibrary));
}
/** {@inheritDoc} */
@@ -205,7 +205,7 @@ public class HumanPlayer extends Player {
/** {@inheritDoc} */
public final void sacrificePermanent(final String prompt, final CardList choices) {
Input in = PlayerUtil.input_sacrificePermanent(choices, prompt);
Input in = PlayerUtil.inputSacrificePermanent(choices, prompt);
AllZone.getInputControl().setInput(in);
}

View File

@@ -54,12 +54,12 @@ public final class PlayerUtil {
* @return a {@link forge.gui.input.Input} object.
* @since 1.0.15
*/
public static Input input_discardNumUnless(final int nCards, final String uType, final SpellAbility sa) {
public static Input inputDiscardNumUnless(final int nCards, final String uType, final SpellAbility sa) {
final SpellAbility sp = sa;
Input target = new Input() {
private static final long serialVersionUID = 8822292413831640944L;
int n = 0;
private int n = 0;
@Override
public void showMessage() {
@@ -110,12 +110,12 @@ public final class PlayerUtil {
* @return a {@link forge.gui.input.Input} object.
* @since 1.0.15
*/
public static Input input_discard(final int nCards, final SpellAbility sa) {
public static Input inputDiscard(final int nCards, final SpellAbility sa) {
final SpellAbility sp = sa;
Input target = new Input() {
private static final long serialVersionUID = -329993322080934435L;
int n = 0;
private int n = 0;
@Override
public void showMessage() {
@@ -155,7 +155,7 @@ public final class PlayerUtil {
*
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_chainsDiscard() {
public static Input inputChainsDiscard() {
Input target = new Input() {
private static final long serialVersionUID = 2856894846224546303L;
@@ -198,8 +198,8 @@ public final class PlayerUtil {
* @return a {@link forge.gui.input.Input} object.
* @since 1.0.15
*/
public static Input input_sacrificePermanent(final CardList choices, final String message) {
return input_sacrificePermanentsFromList(1, choices, message);
public static Input inputSacrificePermanent(final CardList choices, final String message) {
return inputSacrificePermanentsFromList(1, choices, message);
} // input_sacrifice()
/**
@@ -212,10 +212,10 @@ public final class PlayerUtil {
* @return a {@link forge.gui.input.Input} object.
* @since 1.0.15
*/
public static Input input_sacrificePermanents(final int nCards) {
public static Input inputSacrificePermanents(final int nCards) {
CardList list = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
list.remove("Mana Pool"); // is this needed?
return input_sacrificePermanentsFromList(nCards, list, "Select a permanent to sacrifice");
return inputSacrificePermanentsFromList(nCards, list, "Select a permanent to sacrifice");
} // input_sacrificePermanents()
/**
@@ -230,12 +230,12 @@ public final class PlayerUtil {
* @return a {@link forge.gui.input.Input} object.
* @since 1.0.15
*/
public static Input input_sacrificePermanents(final int nCards, final String type) {
public static Input inputSacrificePermanents(final int nCards, final String type) {
CardList list = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
list.remove("Mana Pool"); // is this needed?
list = list.getType(type);
return input_sacrificePermanentsFromList(nCards, list, "Select a " + type + " to sacrifice");
return inputSacrificePermanentsFromList(nCards, list, "Select a " + type + " to sacrifice");
} // input_sacrificePermanents()
/**
@@ -252,10 +252,10 @@ public final class PlayerUtil {
* @return a {@link forge.gui.input.Input} object.
* @since 1.0.15
*/
public static Input input_sacrificePermanentsFromList(final int nCards, final CardList list, final String message) {
public static Input inputSacrificePermanentsFromList(final int nCards, final CardList list, final String message) {
Input target = new Input() {
private static final long serialVersionUID = 1981791992623774490L;
int n = 0;
private int n = 0;
@Override
public void showMessage() {
@@ -294,21 +294,21 @@ public final class PlayerUtil {
* input_putFromHandToLibrary.
* </p>
*
* @param TopOrBottom
* @param topOrBottom
* a {@link java.lang.String} object.
* @param num
* a int.
* @return a {@link forge.gui.input.Input} object.
* @since 1.0.15
*/
public static Input input_putFromHandToLibrary(final String TopOrBottom, final int num) {
public static Input inputPutFromHandToLibrary(final String topOrBottom, final int num) {
Input target = new Input() {
private static final long serialVersionUID = 5178077952030689103L;
public int n = 0;
private int n = 0;
@Override
public void showMessage() {
AllZone.getDisplay().showMessage("Select a card to put on the " + TopOrBottom + " of your library.");
AllZone.getDisplay().showMessage("Select a card to put on the " + topOrBottom + " of your library.");
ButtonUtil.disableAll();
if (n == num || AllZone.getHumanPlayer().getZone(Zone.Hand).size() == 0) {
@@ -325,7 +325,7 @@ public final class PlayerUtil {
public void selectCard(final Card card, final PlayerZone zone) {
if (zone.is(Constant.Zone.Hand)) {
int position = 0;
if (TopOrBottom.equalsIgnoreCase("bottom")) {
if (topOrBottom.equalsIgnoreCase("bottom")) {
position = -1;
}

View File

@@ -680,7 +680,7 @@ public class Upkeep implements java.io.Serializable {
creatures.remove(c);
if (player.isHuman()) {
AllZone.getInputControl().setInput(
PlayerUtil.input_sacrificePermanent(creatures, c.getName()
PlayerUtil.inputSacrificePermanent(creatures, c.getName()
+ " - Select a creature to sacrifice."));
} else { // computer
final Card target = CardFactoryUtil.getWorstCreatureAI(creatures);
@@ -823,7 +823,7 @@ public class Upkeep implements java.io.Serializable {
if (c.getController().isComputer()) {
if (playerLand.size() > 0) {
AllZone.getInputControl().setInput(
PlayerUtil.input_sacrificePermanent(playerLand, c.getName()
PlayerUtil.inputSacrificePermanent(playerLand, c.getName()
+ " - Select a land to sacrifice."));
}
} else {

View File

@@ -534,7 +534,7 @@ public class AbilityFactory_Sacrifice {
// TODO: Wait for Input to finish before moving on with the rest of
// Resolution
AllZone.getInputControl().setInput(PlayerUtil.input_sacrificePermanentsFromList(amount, list, message), true);
AllZone.getInputControl().setInput(PlayerUtil.inputSacrificePermanentsFromList(amount, list, message), true);
}
// **************************************************************

View File

@@ -1424,7 +1424,7 @@ public class CardFactory_Sorceries {
}
} else if (humLand.size() > compLand.size()) {
final int diff = humLand.size() - compLand.size();
AllZone.getInputControl().setInput(PlayerUtil.input_sacrificePermanents(diff, "Land"));
AllZone.getInputControl().setInput(PlayerUtil.inputSacrificePermanents(diff, "Land"));
}
// Hand
@@ -1451,7 +1451,7 @@ public class CardFactory_Sorceries {
}
} else if (humCreats.size() > compCreats.size()) {
final int diff = humCreats.size() - compCreats.size();
AllZone.getInputControl().setInput(PlayerUtil.input_sacrificePermanents(diff, "Creature"));
AllZone.getInputControl().setInput(PlayerUtil.inputSacrificePermanents(diff, "Creature"));
}
}

View File

@@ -154,7 +154,7 @@ public class CostDiscard extends CostPartWithList {
payment.setPaidManaPart(this, true);
this.addToList(source);
} else if (discType.equals("Hand")) {
this.list = handList;
this.setList(handList);
activator.discardHand(ability);
payment.setPaidManaPart(this, true);
} else if (discType.equals("LastDrawn")) {
@@ -179,7 +179,7 @@ public class CostDiscard extends CostPartWithList {
}
}
this.list = activator.discardRandom(c, ability);
this.setList(activator.discardRandom(c, ability));
payment.setPaidManaPart(this, true);
} else {
final String[] validType = discType.split(";");
@@ -232,7 +232,7 @@ public class CostDiscard extends CostPartWithList {
}
else if (type.equals("Hand")) {
this.list.addAll(hand);
this.getList().addAll(hand);
}
else {
@@ -246,12 +246,12 @@ public class CostDiscard extends CostPartWithList {
}
if (type.equals("Random")) {
this.list = CardListUtil.getRandomSubList(hand, c);
this.setList(CardListUtil.getRandomSubList(hand, c));
} else {
this.list = ComputerUtil.discardNumTypeAI(c, type.split(";"), ability);
this.setList(ComputerUtil.discardNumTypeAI(c, type.split(";"), ability));
}
}
return this.list != null;
return this.getList() != null;
}
// Inputs

View File

@@ -147,7 +147,7 @@ public class CostExile extends CostPartWithList {
*/
@Override
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
for (final Card c : this.list) {
for (final Card c : this.getList()) {
AllZone.getGameAction().exile(c);
}
}
@@ -198,7 +198,7 @@ public class CostExile extends CostPartWithList {
public final boolean decideAIPayment(final SpellAbility ability, final Card source, final Cost_Payment payment) {
this.resetList();
if (this.getThis()) {
this.list.add(source);
this.getList().add(source);
} else {
Integer c = this.convertAmount();
if (c == null) {
@@ -212,12 +212,12 @@ public class CostExile extends CostPartWithList {
}
if (this.from.equals(Constant.Zone.Library)) {
this.list = AllZone.getComputerPlayer().getCardsIn(Zone.Library, c);
this.setList(AllZone.getComputerPlayer().getCardsIn(Zone.Library, c));
} else {
this.list = ComputerUtil.chooseExileFrom(this.getFrom(), this.getType(), source,
ability.getTargetCard(), c);
this.setList(ComputerUtil.chooseExileFrom(this.getFrom(), this.getType(), source,
ability.getTargetCard(), c));
}
if ((this.list == null) || (this.list.size() < c)) {
if ((this.getList() == null) || (this.getList().size() < c)) {
return false;
}
}

View File

@@ -77,9 +77,9 @@ public class CostMill extends CostPartWithList {
c = AbilityFactory.calculateAmount(source, this.getAmount(), ability);
}
this.list = AllZone.getComputerPlayer().getCardsIn(Zone.Library, c);
this.setList(AllZone.getComputerPlayer().getCardsIn(Zone.Library, c));
if ((this.list == null) || (this.list.size() < c)) {
if ((this.getList() == null) || (this.getList().size() < c)) {
return false;
}
@@ -94,7 +94,7 @@ public class CostMill extends CostPartWithList {
*/
@Override
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
for (final Card c : this.list) {
for (final Card c : this.getList()) {
AllZone.getGameAction().moveToGraveyard(c);
}
}
@@ -116,7 +116,7 @@ public class CostMill extends CostPartWithList {
final String sVar = source.getSVar(amount);
// Generalize this
if (sVar.equals("XChoice")) {
c = CostUtil.chooseXValue(source, this.list.size());
c = CostUtil.chooseXValue(source, this.getList().size());
} else {
c = AbilityFactory.calculateAmount(source, amount, ability);
}

View File

@@ -10,7 +10,7 @@ import forge.card.spellability.SpellAbility;
public abstract class CostPartWithList extends CostPart {
/** The list. */
protected CardList list = null;
private CardList list = null;
/**
* Gets the list.
@@ -35,7 +35,7 @@ public abstract class CostPartWithList extends CostPart {
* Reset list.
*/
public final void resetList() {
this.list = new CardList();
this.setList(new CardList());
}
/**
@@ -45,10 +45,10 @@ public abstract class CostPartWithList extends CostPart {
* the c
*/
public final void addToList(final Card c) {
if (this.list == null) {
if (this.getList() == null) {
this.resetList();
}
this.list.add(c);
this.getList().add(c);
}
/**
@@ -60,7 +60,7 @@ public abstract class CostPartWithList extends CostPart {
* the hash
*/
public final void addListToHash(final SpellAbility sa, final String hash) {
for (final Card card : this.list) {
for (final Card card : this.getList()) {
sa.addCostToHashList(card, hash);
}
}

View File

@@ -94,7 +94,7 @@ public class CostPutCounter extends CostPartWithList {
*/
@Override
public final void refund(final Card source) {
for (final Card c : this.list) {
for (final Card c : this.getList()) {
c.subtractCounter(this.counter, this.lastPaidAmount);
}
}
@@ -146,7 +146,7 @@ public class CostPutCounter extends CostPartWithList {
source.addCounterFromNonEffect(this.getCounter(), c);
} else {
// Put counter on chosen card
for (final Card card : this.list) {
for (final Card card : this.getList()) {
card.addCounterFromNonEffect(this.getCounter(), 1);
}
}

View File

@@ -110,7 +110,7 @@ public class CostReturn extends CostPartWithList {
*/
@Override
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
for (final Card c : this.list) {
for (final Card c : this.getList()) {
AllZone.getGameAction().moveToHand(c);
}
}
@@ -156,15 +156,15 @@ public class CostReturn extends CostPartWithList {
public final boolean decideAIPayment(final SpellAbility ability, final Card source, final Cost_Payment payment) {
this.resetList();
if (this.getThis()) {
this.list.add(source);
this.getList().add(source);
} else {
Integer c = this.convertAmount();
if (c == null) {
c = AbilityFactory.calculateAmount(source, this.getAmount(), ability);
}
this.list = ComputerUtil.chooseReturnType(this.getType(), source, ability.getTargetCard(), c);
if (this.list == null) {
this.setList(ComputerUtil.chooseReturnType(this.getType(), source, ability.getTargetCard(), c));
if (this.getList() == null) {
return false;
}
}

View File

@@ -81,7 +81,7 @@ public class CostReveal extends CostPartWithList {
return false;
}
this.list.add(source);
this.getList().add(source);
} else {
hand = hand.getValidCards(type.split(";"), activator, source);
Integer c = this.convertAmount();
@@ -94,9 +94,9 @@ public class CostReveal extends CostPartWithList {
}
}
this.list = ComputerUtil.discardNumTypeAI(c, type.split(";"), ability);
this.setList(ComputerUtil.discardNumTypeAI(c, type.split(";"), ability));
}
return this.list != null;
return this.getList() != null;
}
/*
@@ -107,7 +107,7 @@ public class CostReveal extends CostPartWithList {
*/
@Override
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
GuiUtils.getChoiceOptional("Revealed cards:", this.list.toArray());
GuiUtils.getChoiceOptional("Revealed cards:", this.getList().toArray());
}
/*

View File

@@ -108,7 +108,7 @@ public class CostSacrifice extends CostPartWithList {
*/
@Override
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
for (final Card c : this.list) {
for (final Card c : this.getList()) {
AllZone.getGameAction().sacrifice(c);
}
}
@@ -131,7 +131,7 @@ public class CostSacrifice extends CostPartWithList {
if (this.getThis()) {
CostUtil.setInput(CostSacrifice.sacrificeThis(ability, payment, this));
} else if (amount.equals("All")) {
this.list = list;
this.setList(list);
CostSacrifice.sacrificeAll(ability, payment, this, list);
this.addListToHash(ability, "Sacrificed");
return true;
@@ -165,7 +165,7 @@ public class CostSacrifice extends CostPartWithList {
this.resetList();
final Player activator = ability.getActivatingPlayer();
if (this.getThis()) {
this.list.add(source);
this.getList().add(source);
} else if (this.getAmount().equals("All")) {
CardList typeList = activator.getCardsIn(Zone.Battlefield);
typeList = typeList.getValidCards(this.getType().split(","), activator, source);
@@ -180,8 +180,8 @@ public class CostSacrifice extends CostPartWithList {
c = AbilityFactory.calculateAmount(source, this.getAmount(), ability);
}
this.list = ComputerUtil.chooseSacrificeType(this.getType(), source, ability.getTargetCard(), c);
if (this.list == null) {
this.setList(ComputerUtil.chooseSacrificeType(this.getType(), source, ability.getTargetCard(), c));
if (this.getList() == null) {
return false;
}
}

View File

@@ -70,7 +70,7 @@ public class CostTapType extends CostPartWithList {
* the c
*/
public final void addToTappedList(final Card c) {
this.list.add(c);
this.getList().add(c);
}
/*
@@ -80,11 +80,11 @@ public class CostTapType extends CostPartWithList {
*/
@Override
public final void refund(final Card source) {
for (final Card c : this.list) {
for (final Card c : this.getList()) {
c.untap();
}
this.list.clear();
this.getList().clear();
}
/*
@@ -121,7 +121,7 @@ public class CostTapType extends CostPartWithList {
*/
@Override
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
for (final Card c : this.list) {
for (final Card c : this.getList()) {
c.tap();
}
}
@@ -170,9 +170,9 @@ public class CostTapType extends CostPartWithList {
// Determine Amount
}
this.list = ComputerUtil.chooseTapType(this.getType(), source, tap, c);
this.setList(ComputerUtil.chooseTapType(this.getType(), source, tap, c));
if (this.list == null) {
if (this.getList() == null) {
System.out.println("Couldn't find a valid card to tap for: " + source.getName());
return false;
}

View File

@@ -36,14 +36,14 @@ public abstract class Trigger {
* </p>
*/
public static void resetIDs() {
nextID = 50000;
Trigger.nextID = 50000;
}
/** The ID. */
protected int ID = nextID++;
private int id = Trigger.nextID++;
/** The name. */
protected String name;
private String name;
/**
* <p>
@@ -53,7 +53,7 @@ public abstract class Trigger {
* @return a {@link java.lang.String} object.
*/
public final String getName() {
return name;
return this.name;
}
/**
@@ -65,7 +65,7 @@ public abstract class Trigger {
* a {@link java.lang.String} object.
*/
public final void setName(final String n) {
name = n;
this.name = n;
}
/**
@@ -77,11 +77,11 @@ public abstract class Trigger {
* a int.
*/
public final void setID(final int id) {
ID = id;
this.id = id;
}
/** The map params. */
protected HashMap<String, String> mapParams = new HashMap<String, String>();
private HashMap<String, String> mapParams = new HashMap<String, String>();
/**
* <p>
@@ -91,60 +91,23 @@ public abstract class Trigger {
* @return a {@link java.util.HashMap} object.
*/
public final HashMap<String, String> getMapParams() {
return mapParams;
return this.mapParams;
}
/**
* Sets the map params.
*
* @param mapParams the mapParams to set
*/
public final void setMapParams(final HashMap<String, String> mapParams) {
this.mapParams = mapParams; // TODO: Add 0 to parameter's name.
}
/** The run params. */
protected Map<String, Object> runParams;
/**
* <p>
* Setter for the field <code>runParams</code>.
* </p>
*
* @param runParams2
* a {@link java.util.Map} object.
*/
public final void setRunParams(final Map<String, Object> runParams2) {
runParams = runParams2;
}
/**
* <p>
* Getter for the field <code>runParams</code>.
* </p>
*
* @return a {@link java.util.Map} object.
*/
public final Map<String, Object> getRunParams() {
return runParams;
}
private Map<String, Object> runParams;
/** The overriding ability. */
protected SpellAbility overridingAbility = null;
/**
* <p>
* Getter for the field <code>overridingAbility</code>.
* </p>
*
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public final SpellAbility getOverridingAbility() {
return overridingAbility;
}
/**
* <p>
* Setter for the field <code>overridingAbility</code>.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
*/
public final void setOverridingAbility(final SpellAbility sa) {
overridingAbility = sa;
}
private SpellAbility overridingAbility = null;
private HashMap<String, Object> storedTriggeredObjects = null;
@@ -170,11 +133,11 @@ public abstract class Trigger {
* @since 1.0.15
*/
public final HashMap<String, Object> getStoredTriggeredObjects() {
return storedTriggeredObjects;
return this.storedTriggeredObjects;
}
/** The host card. */
protected Card hostCard;
private Card hostCard;
/**
* <p>
@@ -184,7 +147,7 @@ public abstract class Trigger {
* @return a {@link forge.Card} object.
*/
public final Card getHostCard() {
return hostCard;
return this.hostCard;
}
/**
@@ -196,11 +159,11 @@ public abstract class Trigger {
* a {@link forge.Card} object.
*/
public final void setHostCard(final Card c) {
hostCard = c;
this.hostCard = c;
}
/** The is intrinsic. */
protected boolean isIntrinsic;
private boolean isIntrinsic;
/**
* Gets the checks if is intrinsic.
@@ -208,7 +171,7 @@ public abstract class Trigger {
* @return the checks if is intrinsic
*/
public final boolean getIsIntrinsic() {
return isIntrinsic;
return this.isIntrinsic();
}
/**
@@ -218,7 +181,7 @@ public abstract class Trigger {
* the new checks if is intrinsic
*/
public final void setIsIntrinsic(final boolean b) {
isIntrinsic = b;
this.setIntrinsic(b);
}
/**
@@ -236,14 +199,14 @@ public abstract class Trigger {
* the intrinsic
*/
public Trigger(final String n, final HashMap<String, String> params, final Card host, final boolean intrinsic) {
name = n;
mapParams = new HashMap<String, String>();
for (Map.Entry<String, String> entry : params.entrySet()) {
mapParams.put(entry.getKey(), entry.getValue());
this.name = n;
this.setRunParams(new HashMap<String, Object>());
for (final Map.Entry<String, String> entry : params.entrySet()) {
this.getMapParams().put(entry.getKey(), entry.getValue());
}
hostCard = host;
this.setHostCard(host);
isIntrinsic = intrinsic;
this.setIntrinsic(intrinsic);
}
/**
@@ -259,13 +222,13 @@ public abstract class Trigger {
* the intrinsic
*/
public Trigger(final HashMap<String, String> params, final Card host, final boolean intrinsic) {
mapParams = new HashMap<String, String>();
for (Map.Entry<String, String> entry : params.entrySet()) {
mapParams.put(entry.getKey(), entry.getValue());
this.setRunParams(new HashMap<String, Object>());
for (final Map.Entry<String, String> entry : params.entrySet()) {
this.getMapParams().put(entry.getKey(), entry.getValue());
}
hostCard = host;
this.setHostCard(host);
isIntrinsic = intrinsic;
this.setIntrinsic(intrinsic);
}
/**
@@ -275,9 +238,10 @@ public abstract class Trigger {
*
* @return a {@link java.lang.String} object.
*/
@Override
public final String toString() {
if (mapParams.containsKey("TriggerDescription") && !isSuppressed()) {
return mapParams.get("TriggerDescription").replace("CARDNAME", hostCard.getName());
if (this.getMapParams().containsKey("TriggerDescription") && !this.isSuppressed()) {
return this.getMapParams().get("TriggerDescription").replace("CARDNAME", this.getHostCard().getName());
} else {
return "";
}
@@ -291,16 +255,16 @@ public abstract class Trigger {
* @return a boolean.
*/
public final boolean zonesCheck() {
if (mapParams.containsKey("TriggerZones")) {
List<Zone> triggerZones = new ArrayList<Zone>();
PlayerZone zone = AllZone.getZoneOf(hostCard);
for (String s : mapParams.get("TriggerZones").split(",")) {
if (this.getMapParams().containsKey("TriggerZones")) {
final List<Zone> triggerZones = new ArrayList<Zone>();
final PlayerZone zone = AllZone.getZoneOf(this.getHostCard());
for (final String s : this.getMapParams().get("TriggerZones").split(",")) {
triggerZones.add(Zone.smartValueOf(s));
}
if (zone == null) {
return false;
}
if (!triggerZones.contains(zone.getZoneType()) || hostCard.isPhasedOut()) {
if (!triggerZones.contains(zone.getZoneType()) || this.getHostCard().isPhasedOut()) {
return false;
}
}
@@ -316,8 +280,8 @@ public abstract class Trigger {
* @return a boolean.
*/
public final boolean phasesCheck() {
if (mapParams.containsKey("TriggerPhases")) {
String phases = mapParams.get("TriggerPhases");
if (this.getMapParams().containsKey("TriggerPhases")) {
String phases = this.getMapParams().get("TriggerPhases");
if (phases.contains("->")) {
// If phases lists a Range, split and Build Activate String
@@ -325,11 +289,11 @@ public abstract class Trigger {
// Draw-> (After Upkeep)
// Upkeep->Combat_Begin (Before Declare Attackers)
String[] split = phases.split("->", 2);
final String[] split = phases.split("->", 2);
phases = AllZone.getPhase().buildActivateString(split[0], split[1]);
}
ArrayList<String> triggerPhases = new ArrayList<String>();
for (String s : phases.split(",")) {
final ArrayList<String> triggerPhases = new ArrayList<String>();
for (final String s : phases.split(",")) {
triggerPhases.add(s);
}
if (!triggerPhases.contains(AllZone.getPhase().getPhase())) {
@@ -337,14 +301,14 @@ public abstract class Trigger {
}
}
if (mapParams.containsKey("PlayerTurn")) {
if (!AllZone.getPhase().isPlayerTurn(hostCard.getController())) {
if (this.getMapParams().containsKey("PlayerTurn")) {
if (!AllZone.getPhase().isPlayerTurn(this.getHostCard().getController())) {
return false;
}
}
if (mapParams.containsKey("OpponentTurn")) {
if (AllZone.getPhase().isPlayerTurn(hostCard.getController())) {
if (this.getMapParams().containsKey("OpponentTurn")) {
if (AllZone.getPhase().isPlayerTurn(this.getHostCard().getController())) {
return false;
}
}
@@ -360,59 +324,62 @@ public abstract class Trigger {
* @return a boolean.
*/
public final boolean requirementsCheck() {
if (mapParams.containsKey("Metalcraft")) {
if (mapParams.get("Metalcraft").equals("True") && !hostCard.getController().hasMetalcraft()) {
if (this.getMapParams().containsKey("Metalcraft")) {
if (this.getMapParams().get("Metalcraft").equals("True")
&& !this.getHostCard().getController().hasMetalcraft()) {
return false;
}
}
if (mapParams.containsKey("Threshold")) {
if (mapParams.get("Threshold").equals("True") && !hostCard.getController().hasThreshold()) {
if (this.getMapParams().containsKey("Threshold")) {
if (this.getMapParams().get("Threshold").equals("True")
&& !this.getHostCard().getController().hasThreshold()) {
return false;
}
}
if (mapParams.containsKey("Hellbent")) {
if (mapParams.get("Hellbent").equals("True") && !hostCard.getController().hasHellbent()) {
if (this.getMapParams().containsKey("Hellbent")) {
if (this.getMapParams().get("Hellbent").equals("True") && !this.getHostCard().getController().hasHellbent()) {
return false;
}
}
if (mapParams.containsKey("PlayersPoisoned")) {
if (mapParams.get("PlayersPoisoned").equals("You") && hostCard.getController().getPoisonCounters() == 0) {
if (this.getMapParams().containsKey("PlayersPoisoned")) {
if (this.getMapParams().get("PlayersPoisoned").equals("You")
&& (this.getHostCard().getController().getPoisonCounters() == 0)) {
return false;
} else if (mapParams.get("PlayersPoisoned").equals("Opponent")
&& hostCard.getController().getOpponent().getPoisonCounters() == 0) {
} else if (this.getMapParams().get("PlayersPoisoned").equals("Opponent")
&& (this.getHostCard().getController().getOpponent().getPoisonCounters() == 0)) {
return false;
} else if (mapParams.get("PlayersPoisoned").equals("Each")
&& !(hostCard.getController().getPoisonCounters() != 0 && hostCard.getController()
.getPoisonCounters() != 0)) {
} else if (this.getMapParams().get("PlayersPoisoned").equals("Each")
&& !((this.getHostCard().getController().getPoisonCounters() != 0) && (this.getHostCard()
.getController().getPoisonCounters() != 0))) {
return false;
}
}
if (mapParams.containsKey("LifeTotal")) {
String player = mapParams.get("LifeTotal");
if (this.getMapParams().containsKey("LifeTotal")) {
final String player = this.getMapParams().get("LifeTotal");
String lifeCompare = "GE1";
int life = 1;
if (player.equals("You")) {
life = hostCard.getController().getLife();
life = this.getHostCard().getController().getLife();
}
if (player.equals("Opponent")) {
life = hostCard.getController().getOpponent().getLife();
life = this.getHostCard().getController().getOpponent().getLife();
}
if (mapParams.containsKey("LifeAmount")) {
lifeCompare = mapParams.get("LifeAmount");
if (this.getMapParams().containsKey("LifeAmount")) {
lifeCompare = this.getMapParams().get("LifeAmount");
}
int right = 1;
String rightString = lifeCompare.substring(2);
final String rightString = lifeCompare.substring(2);
try {
right = Integer.parseInt(rightString);
} catch (NumberFormatException nfe) {
right = CardFactoryUtil.xCount(hostCard, hostCard.getSVar(rightString));
} catch (final NumberFormatException nfe) {
right = CardFactoryUtil.xCount(this.getHostCard(), this.getHostCard().getSVar(rightString));
}
if (!AllZoneUtil.compare(life, lifeCompare, right)) {
@@ -421,38 +388,38 @@ public abstract class Trigger {
}
if (mapParams.containsKey("IsPresent")) {
String sIsPresent = mapParams.get("IsPresent");
if (this.getMapParams().containsKey("IsPresent")) {
final String sIsPresent = this.getMapParams().get("IsPresent");
String presentCompare = "GE1";
Zone presentZone = Zone.Battlefield;
String presentPlayer = "Any";
if (mapParams.containsKey("PresentCompare")) {
presentCompare = mapParams.get("PresentCompare");
if (this.getMapParams().containsKey("PresentCompare")) {
presentCompare = this.getMapParams().get("PresentCompare");
}
if (mapParams.containsKey("PresentZone")) {
presentZone = Zone.smartValueOf(mapParams.get("PresentZone"));
if (this.getMapParams().containsKey("PresentZone")) {
presentZone = Zone.smartValueOf(this.getMapParams().get("PresentZone"));
}
if (mapParams.containsKey("PresentPlayer")) {
presentPlayer = mapParams.get("PresentPlayer");
if (this.getMapParams().containsKey("PresentPlayer")) {
presentPlayer = this.getMapParams().get("PresentPlayer");
}
CardList list = new CardList();
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
list.addAll(hostCard.getController().getCardsIn(presentZone));
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
}
if (presentPlayer.equals("Opponent") || presentPlayer.equals("Any")) {
list.addAll(hostCard.getController().getOpponent().getCardsIn(presentZone));
list.addAll(this.getHostCard().getController().getOpponent().getCardsIn(presentZone));
}
list = list.getValidCards(sIsPresent.split(","), hostCard.getController(), hostCard);
list = list.getValidCards(sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard());
int right = 1;
String rightString = presentCompare.substring(2);
final String rightString = presentCompare.substring(2);
if (rightString.equals("X")) {
right = CardFactoryUtil.xCount(hostCard, hostCard.getSVar("X"));
right = CardFactoryUtil.xCount(this.getHostCard(), this.getHostCard().getSVar("X"));
} else {
right = Integer.parseInt(presentCompare.substring(2));
}
int left = list.size();
final int left = list.size();
if (!AllZoneUtil.compare(left, presentCompare, right)) {
return false;
@@ -460,38 +427,38 @@ public abstract class Trigger {
}
if (mapParams.containsKey("IsPresent2")) {
String sIsPresent = mapParams.get("IsPresent2");
if (this.getMapParams().containsKey("IsPresent2")) {
final String sIsPresent = this.getMapParams().get("IsPresent2");
String presentCompare = "GE1";
Zone presentZone = Zone.Battlefield;
String presentPlayer = "Any";
if (mapParams.containsKey("PresentCompare2")) {
presentCompare = mapParams.get("PresentCompare2");
if (this.getMapParams().containsKey("PresentCompare2")) {
presentCompare = this.getMapParams().get("PresentCompare2");
}
if (mapParams.containsKey("PresentZone2")) {
presentZone = Zone.smartValueOf(mapParams.get("PresentZone2"));
if (this.getMapParams().containsKey("PresentZone2")) {
presentZone = Zone.smartValueOf(this.getMapParams().get("PresentZone2"));
}
if (mapParams.containsKey("PresentPlayer2")) {
presentPlayer = mapParams.get("PresentPlayer2");
if (this.getMapParams().containsKey("PresentPlayer2")) {
presentPlayer = this.getMapParams().get("PresentPlayer2");
}
CardList list = new CardList();
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
list.addAll(hostCard.getController().getCardsIn(presentZone));
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
}
if (presentPlayer.equals("Opponent") || presentPlayer.equals("Any")) {
list.addAll(hostCard.getController().getOpponent().getCardsIn(presentZone));
list.addAll(this.getHostCard().getController().getOpponent().getCardsIn(presentZone));
}
list = list.getValidCards(sIsPresent.split(","), hostCard.getController(), hostCard);
list = list.getValidCards(sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard());
int right = 1;
String rightString = presentCompare.substring(2);
final String rightString = presentCompare.substring(2);
if (rightString.equals("X")) {
right = CardFactoryUtil.xCount(hostCard, hostCard.getSVar("X"));
right = CardFactoryUtil.xCount(this.getHostCard(), this.getHostCard().getSVar("X"));
} else {
right = Integer.parseInt(presentCompare.substring(2));
}
int left = list.size();
final int left = list.size();
if (!AllZoneUtil.compare(left, presentCompare, right)) {
return false;
@@ -499,43 +466,44 @@ public abstract class Trigger {
}
if (mapParams.containsKey("CheckSVar")) {
int sVar = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(hostCard), mapParams.get("CheckSVar"),
null);
if (this.getMapParams().containsKey("CheckSVar")) {
final int sVar = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(this.getHostCard()), this
.getMapParams().get("CheckSVar"), null);
String comparator = "GE1";
if (mapParams.containsKey("SVarCompare")) {
comparator = mapParams.get("SVarCompare");
if (this.getMapParams().containsKey("SVarCompare")) {
comparator = this.getMapParams().get("SVarCompare");
}
String svarOperator = comparator.substring(0, 2);
String svarOperand = comparator.substring(2);
int operandValue = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(hostCard), svarOperand, null);
final String svarOperator = comparator.substring(0, 2);
final String svarOperand = comparator.substring(2);
final int operandValue = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(this.getHostCard()),
svarOperand, null);
if (!AllZoneUtil.compare(sVar, svarOperator, operandValue)) {
return false;
}
}
if (mapParams.containsKey("ManaSpent")) {
if (!hostCard.getColorsPaid().contains(mapParams.get("ManaSpent"))) {
if (this.getMapParams().containsKey("ManaSpent")) {
if (!this.getHostCard().getColorsPaid().contains(this.getMapParams().get("ManaSpent"))) {
return false;
}
}
if (mapParams.containsKey("ManaNotSpent")) {
if (hostCard.getColorsPaid().contains(mapParams.get("ManaNotSpent"))) {
if (this.getMapParams().containsKey("ManaNotSpent")) {
if (this.getHostCard().getColorsPaid().contains(this.getMapParams().get("ManaNotSpent"))) {
return false;
}
}
if (mapParams.containsKey("WerewolfTransformCondition")) {
if (CardUtil.getLastTurnCast("Card", hostCard).size() > 0) {
if (this.getMapParams().containsKey("WerewolfTransformCondition")) {
if (CardUtil.getLastTurnCast("Card", this.getHostCard()).size() > 0) {
return false;
}
}
if (mapParams.containsKey("WerewolfUntransformCondition")) {
CardList you = CardUtil.getLastTurnCast("Card.YouCtrl", hostCard);
CardList opp = CardUtil.getLastTurnCast("Card.YouDontCtrl", hostCard);
if (!(you.size() > 1 || opp.size() > 1)) {
if (this.getMapParams().containsKey("WerewolfUntransformCondition")) {
final CardList you = CardUtil.getLastTurnCast("Card.YouCtrl", this.getHostCard());
final CardList opp = CardUtil.getLastTurnCast("Card.YouDontCtrl", this.getHostCard());
if (!((you.size() > 1) || (opp.size() > 1))) {
return false;
}
}
@@ -558,12 +526,12 @@ public abstract class Trigger {
*/
public final boolean matchesValid(final Object o, final String[] valids, final Card srcCard) {
if (o instanceof Card) {
Card c = (Card) o;
final Card c = (Card) o;
return c.isValid(valids, srcCard.getController(), srcCard);
}
if (o instanceof Player) {
for (String v : valids) {
for (final String v : valids) {
if (v.equalsIgnoreCase("Player") || v.equalsIgnoreCase("Each")) {
return true;
}
@@ -595,8 +563,8 @@ public abstract class Trigger {
* @return a boolean.
*/
public final boolean isSecondary() {
if (mapParams.containsKey("Secondary")) {
if (mapParams.get("Secondary").equals("True")) {
if (this.getMapParams().containsKey("Secondary")) {
if (this.getMapParams().get("Secondary").equals("True")) {
return true;
}
}
@@ -610,7 +578,7 @@ public abstract class Trigger {
return false;
}
return this.ID == ((Trigger) o).ID;
return this.getId() == ((Trigger) o).getId();
}
/**
@@ -644,7 +612,7 @@ public abstract class Trigger {
public abstract void setTriggeringObjects(SpellAbility sa);
/** The temporary. */
protected boolean temporary = false;
private boolean temporary = false;
/**
* Sets the temporary.
@@ -653,7 +621,7 @@ public abstract class Trigger {
* the new temporary
*/
public final void setTemporary(final boolean temp) {
temporary = temp;
this.temporary = temp;
}
/**
@@ -662,14 +630,14 @@ public abstract class Trigger {
* @return true, if is temporary
*/
public final boolean isTemporary() {
return temporary;
return this.temporary;
}
/** The suppressed. */
protected boolean suppressed = false;
private boolean suppressed = false;
/** The temporarily suppressed. */
protected boolean temporarilySuppressed = false;
private boolean temporarilySuppressed = false;
/**
* Sets the suppressed.
@@ -678,7 +646,7 @@ public abstract class Trigger {
* the new suppressed
*/
public final void setSuppressed(final boolean supp) {
suppressed = supp;
this.suppressed = supp;
}
/**
@@ -688,7 +656,7 @@ public abstract class Trigger {
* the new temporarily suppressed
*/
public final void setTemporarilySuppressed(final boolean supp) {
temporarilySuppressed = supp;
this.temporarilySuppressed = supp;
}
/**
@@ -697,6 +665,79 @@ public abstract class Trigger {
* @return true, if is suppressed
*/
public final boolean isSuppressed() {
return (suppressed || temporarilySuppressed);
return (this.suppressed || this.temporarilySuppressed);
}
/**
* Checks if is intrinsic.
*
* @return the isIntrinsic
*/
public boolean isIntrinsic() {
return this.isIntrinsic;
}
/**
* Sets the intrinsic.
*
* @param isIntrinsic the isIntrinsic to set
*/
public void setIntrinsic(final boolean isIntrinsic) {
this.isIntrinsic = isIntrinsic; // TODO: Add 0 to parameter's name.
}
/**
* Gets the run params.
*
* @return the runParams
*/
public Map<String, Object> getRunParams() {
return this.runParams;
}
/**
* Sets the run params.
*
* @param runParams the runParams to set
*/
public void setRunParams(final Map<String, Object> runParams) {
this.runParams = runParams; // TODO: Add 0 to parameter's name.
}
/**
* Gets the overriding ability.
*
* @return the overridingAbility
*/
public SpellAbility getOverridingAbility() {
return this.overridingAbility;
}
/**
* Sets the overriding ability.
*
* @param overridingAbility the overridingAbility to set
*/
public void setOverridingAbility(final SpellAbility overridingAbility) {
this.overridingAbility = overridingAbility; // TODO: Add 0 to
// parameter's name.
}
/**
* Gets the id.
*
* @return the id
*/
public int getId() {
return this.id;
}
/**
* Sets the id.
*
* @param id the id to set
*/
public void setId(final int id) {
this.id = id; // TODO: Add 0 to parameter's name.
}
}

View File

@@ -36,19 +36,19 @@ import forge.gui.input.Input;
*/
public class TriggerHandler {
private ArrayList<String> suppressedModes = new ArrayList<String>();
private final ArrayList<String> suppressedModes = new ArrayList<String>();
private ArrayList<Trigger> delayedTriggers = new ArrayList<Trigger>();
private final ArrayList<Trigger> delayedTriggers = new ArrayList<Trigger>();
/**
* Clean up temporary triggers.
*/
public final void cleanUpTemporaryTriggers() {
CardList absolutelyAllCards = new CardList();
final CardList absolutelyAllCards = new CardList();
absolutelyAllCards.addAll(AllZone.getHumanPlayer().getAllCards());
absolutelyAllCards.addAll(AllZone.getComputerPlayer().getAllCards());
for (Card c : absolutelyAllCards) {
for (final Card c : absolutelyAllCards) {
for (int i = 0; i < c.getTriggers().size(); i++) {
if (c.getTriggers().get(i).isTemporary()) {
c.getTriggers().remove(i);
@@ -56,7 +56,7 @@ public class TriggerHandler {
}
}
}
for (Card c : absolutelyAllCards) {
for (final Card c : absolutelyAllCards) {
for (int i = 0; i < c.getTriggers().size(); i++) {
c.getTriggers().get(i).setTemporarilySuppressed(false);
}
@@ -73,7 +73,7 @@ public class TriggerHandler {
* a {@link forge.card.trigger.Trigger} object.
*/
public final void registerDelayedTrigger(final Trigger trig) {
delayedTriggers.add(trig);
this.delayedTriggers.add(trig);
}
/**
@@ -85,7 +85,7 @@ public class TriggerHandler {
* a {@link java.lang.String} object.
*/
public final void suppressMode(final String mode) {
suppressedModes.add(mode);
this.suppressedModes.add(mode);
}
/**
@@ -97,7 +97,7 @@ public class TriggerHandler {
* a {@link java.lang.String} object.
*/
public final void clearSuppression(final String mode) {
suppressedModes.remove(mode);
this.suppressedModes.remove(mode);
}
/**
@@ -117,7 +117,7 @@ public class TriggerHandler {
*/
public static Trigger parseTrigger(final String name, final String trigParse, final Card host,
final boolean intrinsic) {
Trigger ret = TriggerHandler.parseTrigger(trigParse, host, intrinsic);
final Trigger ret = TriggerHandler.parseTrigger(trigParse, host, intrinsic);
ret.setName(name);
return ret;
}
@@ -136,8 +136,8 @@ public class TriggerHandler {
* @return a {@link forge.card.trigger.Trigger} object.
*/
public static Trigger parseTrigger(final String trigParse, final Card host, final boolean intrinsic) {
HashMap<String, String> mapParams = parseParams(trigParse);
return parseTrigger(mapParams, host, intrinsic);
final HashMap<String, String> mapParams = TriggerHandler.parseParams(trigParse);
return TriggerHandler.parseTrigger(mapParams, host, intrinsic);
}
/**
@@ -153,11 +153,10 @@ public class TriggerHandler {
* a boolean.
* @return a {@link forge.card.trigger.Trigger} object.
*/
public static Trigger parseTrigger(final HashMap<String, String> mapParams,
final Card host, final boolean intrinsic) {
public static Trigger parseTrigger(final HashMap<String, String> mapParams, final Card host, final boolean intrinsic) {
Trigger ret = null;
String mode = mapParams.get("Mode");
final String mode = mapParams.get("Mode");
if (mode.equals("AbilityCast")) {
ret = new Trigger_SpellAbilityCast(mapParams, host, intrinsic);
} else if (mode.equals("Always")) {
@@ -231,26 +230,26 @@ public class TriggerHandler {
* @return a {@link java.util.HashMap} object.
*/
private static HashMap<String, String> parseParams(final String trigParse) {
HashMap<String, String> mapParams = new HashMap<String, String>();
final HashMap<String, String> mapParams = new HashMap<String, String>();
if (trigParse.length() == 0) {
throw new RuntimeException("TriggerFactory : registerTrigger -- trigParse too short");
}
String[] params = trigParse.split("\\|");
final String[] params = trigParse.split("\\|");
for (int i = 0; i < params.length; i++) {
params[i] = params[i].trim();
}
for (String param : params) {
String[] splitParam = param.split("\\$");
for (final String param : params) {
final String[] splitParam = param.split("\\$");
for (int i = 0; i < splitParam.length; i++) {
splitParam[i] = splitParam[i].trim();
}
if (splitParam.length != 2) {
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
sb.append("TriggerFactory Parsing Error in registerTrigger() : Split length of ");
sb.append(param).append(" is not 2.");
throw new RuntimeException(sb.toString());
@@ -273,31 +272,31 @@ public class TriggerHandler {
* a {@link java.util.Map} object.
*/
public final void runTrigger(final String mode, final Map<String, Object> runParams) {
if (suppressedModes.contains(mode)) {
if (this.suppressedModes.contains(mode)) {
return;
}
Player playerAP = AllZone.getPhase().getPlayerTurn();
final Player playerAP = AllZone.getPhase().getPlayerTurn();
// This is done to allow the list of triggers to be modified while
// triggers are running.
ArrayList<Trigger> delayedTriggersWorkingCopy = new ArrayList<Trigger>(delayedTriggers);
final ArrayList<Trigger> delayedTriggersWorkingCopy = new ArrayList<Trigger>(this.delayedTriggers);
CardList allCards;
// AP
allCards = playerAP.getAllCards();
allCards.addAll(AllZoneUtil.getCardsIn(Constant.Zone.Stack).getController(playerAP));
for (Card c : allCards) {
for (Trigger t : c.getTriggers()) {
runSingleTrigger(t, mode, runParams);
for (final Card c : allCards) {
for (final Trigger t : c.getTriggers()) {
this.runSingleTrigger(t, mode, runParams);
}
}
for (int i = 0; i < delayedTriggersWorkingCopy.size(); i++) {
Trigger deltrig = delayedTriggersWorkingCopy.get(i);
final Trigger deltrig = delayedTriggersWorkingCopy.get(i);
if (deltrig.getHostCard().getController().equals(playerAP)) {
if (runSingleTrigger(deltrig, mode, runParams)) {
if (this.runSingleTrigger(deltrig, mode, runParams)) {
delayedTriggersWorkingCopy.remove(deltrig);
delayedTriggers.remove(deltrig);
this.delayedTriggers.remove(deltrig);
i--;
}
}
@@ -306,17 +305,17 @@ public class TriggerHandler {
// NAP
allCards = playerAP.getOpponent().getAllCards();
allCards.addAll(AllZoneUtil.getCardsIn(Constant.Zone.Stack).getController(playerAP.getOpponent()));
for (Card c : allCards) {
for (Trigger t : c.getTriggers()) {
runSingleTrigger(t, mode, runParams);
for (final Card c : allCards) {
for (final Trigger t : c.getTriggers()) {
this.runSingleTrigger(t, mode, runParams);
}
}
for (int i = 0; i < delayedTriggersWorkingCopy.size(); i++) {
Trigger deltrig = delayedTriggersWorkingCopy.get(i);
final Trigger deltrig = delayedTriggersWorkingCopy.get(i);
if (deltrig.getHostCard().getController().equals(playerAP.getOpponent())) {
if (runSingleTrigger(deltrig, mode, runParams)) {
if (this.runSingleTrigger(deltrig, mode, runParams)) {
delayedTriggersWorkingCopy.remove(deltrig);
delayedTriggers.remove(deltrig);
this.delayedTriggers.remove(deltrig);
i--;
}
}
@@ -339,8 +338,7 @@ public class TriggerHandler {
* a {@link java.util.HashMap} object.
* @return a boolean.
*/
private boolean runSingleTrigger(final Trigger regtrig,
final String mode, final Map<String, Object> runParams) {
private boolean runSingleTrigger(final Trigger regtrig, final String mode, final Map<String, Object> runParams) {
final Map<String, String> params = regtrig.getMapParams();
if (!params.get("Mode").equals(mode)) {
@@ -359,7 +357,7 @@ public class TriggerHandler {
return false; // Morphed cards only have pumped triggers go off.
}
if (regtrig instanceof Trigger_Always) {
if (AllZone.getStack().hasStateTrigger(regtrig.ID)) {
if (AllZone.getStack().hasStateTrigger(regtrig.getId())) {
return false; // State triggers that are already on the stack
// don't trigger again.
}
@@ -372,21 +370,19 @@ public class TriggerHandler {
}
// Torpor Orb check
CardList torporOrbs = AllZoneUtil.getCardsIn(Zone.Battlefield, "Torpor Orb");
final CardList torporOrbs = AllZoneUtil.getCardsIn(Zone.Battlefield, "Torpor Orb");
if (torporOrbs.size() != 0) {
if (params.containsKey("Destination")) {
if ((params.get("Destination").equals("Battlefield") || params.get("Destination").equals("Any"))
&& mode.equals("ChangesZone")
&& ((params.get("ValidCard").contains("Creature"))
|| (params.get("ValidCard").contains("Self") && regtrig
&& ((params.get("ValidCard").contains("Creature")) || (params.get("ValidCard").contains("Self") && regtrig
.getHostCard().isCreature()))) {
return false;
}
} else {
if (mode.equals("ChangesZone")
&& ((params.get("ValidCard").contains("Creature"))
|| (params.get("ValidCard").contains("Self") && regtrig
&& ((params.get("ValidCard").contains("Creature")) || (params.get("ValidCard").contains("Self") && regtrig
.getHostCard().isCreature()))) {
return false;
}
@@ -403,13 +399,13 @@ public class TriggerHandler {
// All tests passed, execute ability.
if (regtrig instanceof Trigger_TapsForMana) {
Ability_Mana abMana = (Ability_Mana) runParams.get("Ability_Mana");
final Ability_Mana abMana = (Ability_Mana) runParams.get("Ability_Mana");
if (null != abMana) {
abMana.setUndoable(false);
}
}
AbilityFactory abilityFactory = new AbilityFactory();
final AbilityFactory abilityFactory = new AbilityFactory();
final SpellAbility[] sa = new SpellAbility[1];
Card host = AllZoneUtil.getCardState(regtrig.getHostCard());
@@ -431,7 +427,7 @@ public class TriggerHandler {
}
}
sa[0].setTrigger(true);
sa[0].setSourceTrigger(regtrig.ID);
sa[0].setSourceTrigger(regtrig.getId());
regtrig.setTriggeringObjects(sa[0]);
if (regtrig.getStoredTriggeredObjects() != null) {
sa[0].setAllTriggeringObjects(regtrig.getStoredTriggeredObjects());
@@ -453,7 +449,7 @@ public class TriggerHandler {
SpellAbility ability = sa[0];
while (ability != null) {
Target tgt = ability.getTarget();
final Target tgt = ability.getTarget();
if (tgt != null) {
tgt.setMandatory(true);
@@ -628,10 +624,10 @@ public class TriggerHandler {
@Override
public String getStackDescription() {
StringBuilder sb = new StringBuilder(regtrig.toString());
if (getTarget() != null) {
final StringBuilder sb = new StringBuilder(regtrig.toString());
if (this.getTarget() != null) {
sb.append(" (Targeting ");
for (Object o : getTarget().getTargets()) {
for (final Object o : this.getTarget().getTargets()) {
sb.append(o.toString());
sb.append(", ");
}
@@ -908,8 +904,8 @@ public class TriggerHandler {
}
@Override
public void setSourceTrigger(final int ID) {
sa[0].setSourceTrigger(ID);
public void setSourceTrigger(final int id) {
sa[0].setSourceTrigger(id);
}
@Override
@@ -944,12 +940,12 @@ public class TriggerHandler {
if (decider[0] != null) {
if (decider[0].isHuman()) {
if (triggersAlwaysAccept.contains(getSourceTrigger())) {
if (TriggerHandler.this.triggersAlwaysAccept.contains(this.getSourceTrigger())) {
// No need to do anything.
} else if (triggersAlwaysDecline.contains(getSourceTrigger())) {
} else if (TriggerHandler.this.triggersAlwaysDecline.contains(this.getSourceTrigger())) {
return;
} else {
StringBuilder buildQuestion = new StringBuilder("Use triggered ability of ");
final StringBuilder buildQuestion = new StringBuilder("Use triggered ability of ");
buildQuestion.append(regtrig.getHostCard().getName()).append("(")
.append(regtrig.getHostCard().getUniqueNumber()).append(")?");
buildQuestion.append("\r\n(");
@@ -982,11 +978,11 @@ public class TriggerHandler {
// Add eventual delayed trigger.
if (params.containsKey("DelayedTrigger")) {
String sVarName = params.get("DelayedTrigger");
Trigger deltrig = parseTrigger(regtrig.getHostCard().getSVar(sVarName),
final String sVarName = params.get("DelayedTrigger");
final Trigger deltrig = TriggerHandler.parseTrigger(regtrig.getHostCard().getSVar(sVarName),
regtrig.getHostCard(), true);
deltrig.setStoredTriggeredObjects(this.getTriggeringObjects());
registerDelayedTrigger(deltrig);
TriggerHandler.this.registerDelayedTrigger(deltrig);
}
}
};
@@ -1021,12 +1017,12 @@ public class TriggerHandler {
* the new always accept trigger
*/
public final void setAlwaysAcceptTrigger(final int trigID) {
if (triggersAlwaysDecline.contains(trigID)) {
triggersAlwaysDecline.remove((Object) trigID);
if (this.triggersAlwaysDecline.contains(trigID)) {
this.triggersAlwaysDecline.remove((Object) trigID);
}
if (!triggersAlwaysAccept.contains(trigID)) {
triggersAlwaysAccept.add(trigID);
if (!this.triggersAlwaysAccept.contains(trigID)) {
this.triggersAlwaysAccept.add(trigID);
}
}
@@ -1037,12 +1033,12 @@ public class TriggerHandler {
* the new always decline trigger
*/
public final void setAlwaysDeclineTrigger(final int trigID) {
if (triggersAlwaysAccept.contains(trigID)) {
triggersAlwaysAccept.remove((Object) trigID);
if (this.triggersAlwaysAccept.contains(trigID)) {
this.triggersAlwaysAccept.remove((Object) trigID);
}
if (!triggersAlwaysDecline.contains(trigID)) {
triggersAlwaysDecline.add(trigID);
if (!this.triggersAlwaysDecline.contains(trigID)) {
this.triggersAlwaysDecline.add(trigID);
}
}
@@ -1053,8 +1049,8 @@ public class TriggerHandler {
* the new always ask trigger
*/
public final void setAlwaysAskTrigger(final int trigID) {
triggersAlwaysAccept.remove((Object) trigID);
triggersAlwaysDecline.remove((Object) trigID);
this.triggersAlwaysAccept.remove((Object) trigID);
this.triggersAlwaysDecline.remove((Object) trigID);
}
/**
@@ -1065,7 +1061,7 @@ public class TriggerHandler {
* @return true, if is always accepted
*/
public final boolean isAlwaysAccepted(final int trigID) {
return triggersAlwaysAccept.contains(trigID);
return this.triggersAlwaysAccept.contains(trigID);
}
/**
@@ -1076,14 +1072,14 @@ public class TriggerHandler {
* @return true, if is always declined
*/
public final boolean isAlwaysDeclined(final int trigID) {
return triggersAlwaysDecline.contains(trigID);
return this.triggersAlwaysDecline.contains(trigID);
}
/**
* Clear trigger settings.
*/
public final void clearTriggerSettings() {
triggersAlwaysAccept.clear();
triggersAlwaysDecline.clear();
this.triggersAlwaysAccept.clear();
this.triggersAlwaysDecline.clear();
}
}

View File

@@ -41,12 +41,12 @@ public class Trigger_Always extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Always(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Always(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}

View File

@@ -35,13 +35,15 @@ public class Trigger_AttackerBlocked extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Attacker"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Attacker"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidBlocker")) {
if (!matchesValid(runParams2.get("Blocker"), mapParams.get("ValidBlocker").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidBlocker")) {
if (!this.matchesValid(runParams2.get("Blocker"), this.getMapParams().get("ValidBlocker").split(","),
this.getHostCard())) {
return false;
}
}
@@ -52,12 +54,12 @@ public class Trigger_AttackerBlocked extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_AttackerBlocked(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_AttackerBlocked(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -65,8 +67,8 @@ public class Trigger_AttackerBlocked extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Attacker", runParams.get("Attacker"));
sa.setTriggeringObject("Blocker", runParams.get("Blocker"));
sa.setTriggeringObject("NumBlockers", runParams.get("NumBlockers"));
sa.setTriggeringObject("Attacker", this.getRunParams().get("Attacker"));
sa.setTriggeringObject("Blocker", this.getRunParams().get("Blocker"));
sa.setTriggeringObject("NumBlockers", this.getRunParams().get("NumBlockers"));
}
}

View File

@@ -35,8 +35,9 @@ public class Trigger_AttackerUnblocked extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Attacker"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Attacker"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}
@@ -47,12 +48,12 @@ public class Trigger_AttackerUnblocked extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_AttackerUnblocked(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_AttackerUnblocked(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -60,6 +61,6 @@ public class Trigger_AttackerUnblocked extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Attacker", runParams.get("Attacker"));
sa.setTriggeringObject("Attacker", this.getRunParams().get("Attacker"));
}
}

View File

@@ -30,15 +30,15 @@ public class Trigger_AttackersDeclared extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final Map<String, Object> runParams2) {
if (mapParams.containsKey("SingleAttacker")) {
CardList attackers = (CardList) runParams2.get("Attackers");
if (this.getMapParams().containsKey("SingleAttacker")) {
final CardList attackers = (CardList) runParams2.get("Attackers");
if (attackers.size() != 1) {
return false;
}
}
if (mapParams.containsKey("AttackingPlayer")) {
if (!matchesValid(runParams2.get("AttackingPlayer"),
mapParams.get("AttackingPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("AttackingPlayer")) {
if (!this.matchesValid(runParams2.get("AttackingPlayer"),
this.getMapParams().get("AttackingPlayer").split(","), this.getHostCard())) {
return false;
}
}
@@ -48,13 +48,13 @@ public class Trigger_AttackersDeclared extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_AttackersDeclared(this.mapParams, this.hostCard, this.isIntrinsic);
final Trigger copy = new Trigger_AttackersDeclared(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -62,6 +62,6 @@ public class Trigger_AttackersDeclared extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Attackers", runParams.get("Attackers"));
sa.setTriggeringObject("Attackers", this.getRunParams().get("Attackers"));
}
}

View File

@@ -38,26 +38,27 @@ public class Trigger_Attacks extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Attacker"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Attacker"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("Attacked")) {
if (mapParams.get("Attacked").equals("Player")
if (this.getMapParams().containsKey("Attacked")) {
if (this.getMapParams().get("Attacked").equals("Player")
&& StringUtils.isNumeric(runParams2.get("Attacked").toString())
&& Integer.parseInt(runParams2.get("Attacked").toString()) > 0) {
&& (Integer.parseInt(runParams2.get("Attacked").toString()) > 0)) {
return false;
}
}
if (mapParams.containsKey("Alone")) {
CardList otherAttackers = (CardList) runParams2.get("OtherAttackers");
if (this.getMapParams().containsKey("Alone")) {
final CardList otherAttackers = (CardList) runParams2.get("OtherAttackers");
if (otherAttackers == null) {
return false;
}
if (mapParams.get("Alone").equals("True")) {
if (this.getMapParams().get("Alone").equals("True")) {
if (otherAttackers.size() != 0) {
return false;
}
@@ -74,12 +75,12 @@ public class Trigger_Attacks extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Attacks(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Attacks(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -87,6 +88,6 @@ public class Trigger_Attacks extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Attacker", runParams.get("Attacker"));
sa.setTriggeringObject("Attacker", this.getRunParams().get("Attacker"));
}
}

View File

@@ -36,26 +36,27 @@ public class Trigger_BecomesTarget extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final Map<String, Object> runParams2) {
if (mapParams.containsKey("SourceType")) {
SpellAbility sa = (SpellAbility) runParams2.get("SourceSA");
if (mapParams.get("SourceType").equalsIgnoreCase("spell")) {
if (this.getMapParams().containsKey("SourceType")) {
final SpellAbility sa = (SpellAbility) runParams2.get("SourceSA");
if (this.getMapParams().get("SourceType").equalsIgnoreCase("spell")) {
if (!sa.isSpell()) {
return false;
}
} else if (mapParams.get("SourceType").equalsIgnoreCase("ability")) {
} else if (this.getMapParams().get("SourceType").equalsIgnoreCase("ability")) {
if (!sa.isAbility()) {
return false;
}
}
}
if (mapParams.containsKey("ValidSource")) {
if (!matchesValid(((SpellAbility) runParams2.get("SourceSA")).getSourceCard(), mapParams.get("ValidSource")
.split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidSource")) {
if (!this.matchesValid(((SpellAbility) runParams2.get("SourceSA")).getSourceCard(), this.getMapParams()
.get("ValidSource").split(","), this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidTarget")) {
if (!matchesValid(runParams2.get("Target"), mapParams.get("ValidTarget").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidTarget")) {
if (!this.matchesValid(runParams2.get("Target"), this.getMapParams().get("ValidTarget").split(","),
this.getHostCard())) {
return false;
}
}
@@ -66,12 +67,12 @@ public class Trigger_BecomesTarget extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_BecomesTarget(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_BecomesTarget(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -79,8 +80,8 @@ public class Trigger_BecomesTarget extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("SourceSA", runParams.get("SourceSA"));
sa.setTriggeringObject("Source", ((SpellAbility) runParams.get("SourceSA")).getSourceCard());
sa.setTriggeringObject("Target", runParams.get("Target"));
sa.setTriggeringObject("SourceSA", this.getRunParams().get("SourceSA"));
sa.setTriggeringObject("Source", ((SpellAbility) this.getRunParams().get("SourceSA")).getSourceCard());
sa.setTriggeringObject("Target", this.getRunParams().get("Target"));
}
}

View File

@@ -35,13 +35,15 @@ public class Trigger_Blocks extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Blocker"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Blocker"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidBlocked")) {
if (!matchesValid(runParams2.get("Attacker"), mapParams.get("ValidBlocked").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidBlocked")) {
if (!this.matchesValid(runParams2.get("Attacker"), this.getMapParams().get("ValidBlocked").split(","),
this.getHostCard())) {
return false;
}
}
@@ -52,12 +54,12 @@ public class Trigger_Blocks extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Blocks(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Blocks(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -65,7 +67,7 @@ public class Trigger_Blocks extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Blocker", runParams.get("Blocker"));
sa.setTriggeringObject("Attacker", runParams.get("Attacker"));
sa.setTriggeringObject("Blocker", this.getRunParams().get("Blocker"));
sa.setTriggeringObject("Attacker", this.getRunParams().get("Attacker"));
}
}

View File

@@ -35,10 +35,11 @@ public class Trigger_Championed extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card championed = (Card) runParams2.get("Championed");
final Card championed = (Card) runParams2.get("Championed");
if (mapParams.containsKey("ValidCard")) {
if (!championed.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!championed.isValid(this.getMapParams().get("ValidCard").split(","),
this.getHostCard().getController(), this.getHostCard())) {
return false;
}
}
@@ -49,12 +50,12 @@ public class Trigger_Championed extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Championed(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Championed(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -62,7 +63,7 @@ public class Trigger_Championed extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Championed", runParams.get("Championed"));
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Championed", this.getRunParams().get("Championed"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -34,28 +34,29 @@ public class Trigger_ChangesZone extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("Origin")) {
if (!mapParams.get("Origin").equals("Any")) {
if (mapParams.get("Origin") == null) {
if (this.getMapParams().containsKey("Origin")) {
if (!this.getMapParams().get("Origin").equals("Any")) {
if (this.getMapParams().get("Origin") == null) {
return false;
}
if (!mapParams.get("Origin").equals((String) runParams2.get("Origin"))) {
if (!this.getMapParams().get("Origin").equals(runParams2.get("Origin"))) {
return false;
}
}
}
if (mapParams.containsKey("Destination")) {
if (!mapParams.get("Destination").equals("Any")) {
if (!mapParams.get("Destination").equals((String) runParams2.get("Destination"))) {
if (this.getMapParams().containsKey("Destination")) {
if (!this.getMapParams().get("Destination").equals("Any")) {
if (!this.getMapParams().get("Destination").equals(runParams2.get("Destination"))) {
return false;
}
}
}
if (mapParams.containsKey("ValidCard")) {
Card moved = (Card) runParams2.get("Card");
if (!moved.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
final Card moved = (Card) runParams2.get("Card");
if (!moved.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
@@ -66,12 +67,12 @@ public class Trigger_ChangesZone extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_ChangesZone(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_ChangesZone(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -79,6 +80,6 @@ public class Trigger_ChangesZone extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -34,14 +34,15 @@ public class Trigger_Clashed extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidPlayer")) {
if (!matchesValid(runParams2.get("Player"), mapParams.get("ValidPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidPlayer")) {
if (!this.matchesValid(runParams2.get("Player"), this.getMapParams().get("ValidPlayer").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("Won")) {
if (!mapParams.get("Won").equals(runParams2.get("Won"))) {
if (this.getMapParams().containsKey("Won")) {
if (!this.getMapParams().get("Won").equals(runParams2.get("Won"))) {
return false;
}
}
@@ -52,12 +53,12 @@ public class Trigger_Clashed extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Clashed(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Clashed(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}

View File

@@ -35,17 +35,18 @@ public class Trigger_CounterAdded extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card addedTo = (Card) runParams2.get("Card");
Counters addedType = (Counters) runParams2.get("CounterType");
final Card addedTo = (Card) runParams2.get("Card");
final Counters addedType = (Counters) runParams2.get("CounterType");
if (mapParams.containsKey("ValidCard")) {
if (!addedTo.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!addedTo.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("CounterType")) {
String type = mapParams.get("CounterType");
if (this.getMapParams().containsKey("CounterType")) {
final String type = this.getMapParams().get("CounterType");
if (!type.equals(addedType.toString())) {
return false;
}
@@ -57,12 +58,12 @@ public class Trigger_CounterAdded extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_CounterAdded(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_CounterAdded(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -70,6 +71,6 @@ public class Trigger_CounterAdded extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -34,12 +34,12 @@ public class Trigger_Cycled extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Cycled(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Cycled(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -47,14 +47,15 @@ public class Trigger_Cycled extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Card"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Card"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}

View File

@@ -35,39 +35,40 @@ public class Trigger_DamageDone extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card src = (Card) runParams2.get("DamageSource");
Object tgt = runParams2.get("DamageTarget");
final Card src = (Card) runParams2.get("DamageSource");
final Object tgt = runParams2.get("DamageTarget");
if (mapParams.containsKey("ValidSource")) {
if (!src.isValid(mapParams.get("ValidSource").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidSource")) {
if (!src.isValid(this.getMapParams().get("ValidSource").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidTarget")) {
if (!matchesValid(tgt, mapParams.get("ValidTarget").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidTarget")) {
if (!this.matchesValid(tgt, this.getMapParams().get("ValidTarget").split(","), this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("CombatDamage")) {
if (mapParams.get("CombatDamage").equals("True")) {
if (this.getMapParams().containsKey("CombatDamage")) {
if (this.getMapParams().get("CombatDamage").equals("True")) {
if (!((Boolean) runParams2.get("IsCombatDamage"))) {
return false;
}
} else if (mapParams.get("CombatDamage").equals("False")) {
} else if (this.getMapParams().get("CombatDamage").equals("False")) {
if (((Boolean) runParams2.get("IsCombatDamage"))) {
return false;
}
}
}
if (mapParams.containsKey("DamageAmount")) {
String fullParam = mapParams.get("DamageAmount");
if (this.getMapParams().containsKey("DamageAmount")) {
final String fullParam = this.getMapParams().get("DamageAmount");
String operator = fullParam.substring(0, 2);
int operand = Integer.parseInt(fullParam.substring(2));
int actualAmount = (Integer) runParams2.get("DamageAmount");
final String operator = fullParam.substring(0, 2);
final int operand = Integer.parseInt(fullParam.substring(2));
final int actualAmount = (Integer) runParams2.get("DamageAmount");
if (!AllZoneUtil.compare(actualAmount, operator, operand)) {
return false;
@@ -85,12 +86,12 @@ public class Trigger_DamageDone extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_DamageDone(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_DamageDone(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -98,8 +99,8 @@ public class Trigger_DamageDone extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Source", runParams.get("DamageSource"));
sa.setTriggeringObject("Target", runParams.get("DamageTarget"));
sa.setTriggeringObject("DamageAmount", runParams.get("DamageAmount"));
sa.setTriggeringObject("Source", this.getRunParams().get("DamageSource"));
sa.setTriggeringObject("Target", this.getRunParams().get("DamageTarget"));
sa.setTriggeringObject("DamageAmount", this.getRunParams().get("DamageAmount"));
}
}

View File

@@ -34,23 +34,26 @@ public class Trigger_Discarded extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Card"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Card"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidPlayer")) {
if (!matchesValid(runParams2.get("Player"), mapParams.get("ValidPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidPlayer")) {
if (!this.matchesValid(runParams2.get("Player"), this.getMapParams().get("ValidPlayer").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidCause")) {
if (this.getMapParams().containsKey("ValidCause")) {
if (runParams2.get("Cause") == null) {
return false;
}
if (!matchesValid(runParams2.get("Cause"), mapParams.get("ValidCause").split(","), hostCard)) {
if (!this.matchesValid(runParams2.get("Cause"), this.getMapParams().get("ValidCause").split(","),
this.getHostCard())) {
return false;
}
}
@@ -60,12 +63,12 @@ public class Trigger_Discarded extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Discarded(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Discarded(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -73,6 +76,6 @@ public class Trigger_Discarded extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -34,10 +34,11 @@ public class Trigger_Drawn extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card draw = ((Card) runParams2.get("Card"));
final Card draw = ((Card) runParams2.get("Card"));
if (mapParams.containsKey("ValidCard")) {
if (!draw.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!draw.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
@@ -47,12 +48,12 @@ public class Trigger_Drawn extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Drawn(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Drawn(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -60,6 +61,6 @@ public class Trigger_Drawn extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -29,8 +29,8 @@ public class Trigger_LandPlayed extends Trigger {
* @param intrinsic
* the intrinsic
*/
public Trigger_LandPlayed(final String n,
final HashMap<String, String> params, final Card host, final boolean intrinsic) {
public Trigger_LandPlayed(final String n, final HashMap<String, String> params, final Card host,
final boolean intrinsic) {
super(n, params, host, intrinsic);
}
@@ -53,11 +53,12 @@ public class Trigger_LandPlayed extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_LandPlayed(name, mapParams, hostCard, isIntrinsic);
copy.setID(ID);
final Trigger copy = new Trigger_LandPlayed(this.getName(), this.getMapParams(), this.getHostCard(),
this.isIntrinsic());
copy.setID(this.getId());
if (this.overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
return copy;
@@ -66,14 +67,15 @@ public class Trigger_LandPlayed extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Card"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Card"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}

View File

@@ -34,8 +34,9 @@ public class Trigger_LifeGained extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidPlayer")) {
if (!matchesValid(runParams2.get("Player"), mapParams.get("ValidPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidPlayer")) {
if (!this.matchesValid(runParams2.get("Player"), this.getMapParams().get("ValidPlayer").split(","),
this.getHostCard())) {
return false;
}
}
@@ -46,12 +47,12 @@ public class Trigger_LifeGained extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_LifeGained(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_LifeGained(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -59,7 +60,7 @@ public class Trigger_LifeGained extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("LifeAmount", runParams.get("LifeAmount"));
sa.setTriggeringObject("Player", runParams.get("Player"));
sa.setTriggeringObject("LifeAmount", this.getRunParams().get("LifeAmount"));
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
}
}

View File

@@ -34,8 +34,9 @@ public class Trigger_LifeLost extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidPlayer")) {
if (!matchesValid(runParams2.get("Player"), mapParams.get("ValidPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidPlayer")) {
if (!this.matchesValid(runParams2.get("Player"), this.getMapParams().get("ValidPlayer").split(","),
this.getHostCard())) {
return false;
}
}
@@ -46,12 +47,12 @@ public class Trigger_LifeLost extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_LifeLost(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_LifeLost(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -59,7 +60,7 @@ public class Trigger_LifeLost extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("LifeAmount", runParams.get("LifeAmount"));
sa.setTriggeringObject("Player", runParams.get("Player"));
sa.setTriggeringObject("LifeAmount", this.getRunParams().get("LifeAmount"));
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
}
}

View File

@@ -34,10 +34,10 @@ public class Trigger_Phase extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("Phase")) {
if (mapParams.get("Phase").contains(",")) {
if (this.getMapParams().containsKey("Phase")) {
if (this.getMapParams().get("Phase").contains(",")) {
boolean found = false;
for (String s : mapParams.get("Phase").split(",")) {
for (final String s : this.getMapParams().get("Phase").split(",")) {
if (s.equals(runParams2.get("Phase"))) {
found = true;
break;
@@ -48,13 +48,14 @@ public class Trigger_Phase extends Trigger {
return false;
}
} else {
if (!mapParams.get("Phase").equals(runParams2.get("Phase"))) {
if (!this.getMapParams().get("Phase").equals(runParams2.get("Phase"))) {
return false;
}
}
}
if (mapParams.containsKey("ValidPlayer")) {
if (!matchesValid(runParams2.get("Player"), mapParams.get("ValidPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidPlayer")) {
if (!this.matchesValid(runParams2.get("Player"), this.getMapParams().get("ValidPlayer").split(","),
this.getHostCard())) {
return false;
}
}
@@ -64,12 +65,12 @@ public class Trigger_Phase extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Phase(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Phase(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -77,6 +78,6 @@ public class Trigger_Phase extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Player", runParams.get("Player"));
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
}
}

View File

@@ -34,14 +34,16 @@ public class Trigger_Sacrificed extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card sac = (Card) runParams2.get("Card");
if (mapParams.containsKey("ValidPlayer")) {
if (!matchesValid(sac.getController(), mapParams.get("ValidPlayer").split(","), hostCard)) {
final Card sac = (Card) runParams2.get("Card");
if (this.getMapParams().containsKey("ValidPlayer")) {
if (!this.matchesValid(sac.getController(), this.getMapParams().get("ValidPlayer").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidCard")) {
if (!sac.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!sac.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
@@ -51,12 +53,12 @@ public class Trigger_Sacrificed extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Sacrificed(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Sacrificed(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -64,6 +66,6 @@ public class Trigger_Sacrificed extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -34,8 +34,9 @@ public class Trigger_Shuffled extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidPlayer")) {
if (!matchesValid(runParams2.get("Player"), mapParams.get("ValidPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidPlayer")) {
if (!this.matchesValid(runParams2.get("Player"), this.getMapParams().get("ValidPlayer").split(","),
this.getHostCard())) {
return false;
}
}
@@ -46,12 +47,12 @@ public class Trigger_Shuffled extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Shuffled(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Shuffled(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -59,6 +60,6 @@ public class Trigger_Shuffled extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Player", runParams.get("Player"));
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
}
}

View File

@@ -38,62 +38,66 @@ public class Trigger_SpellAbilityCast extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
SpellAbility SA = (SpellAbility) runParams2.get("CastSA");
Card cast = SA.getSourceCard();
SpellAbility_StackInstance si = AllZone.getStack().getInstanceFromSpellAbility(SA);
final SpellAbility spellAbility = (SpellAbility) runParams2.get("CastSA");
final Card cast = spellAbility.getSourceCard();
final SpellAbility_StackInstance si = AllZone.getStack().getInstanceFromSpellAbility(spellAbility);
if (mapParams.get("Mode").equals("SpellCast")) {
if (!SA.isSpell()) {
if (this.getMapParams().get("Mode").equals("SpellCast")) {
if (!spellAbility.isSpell()) {
return false;
}
} else if (mapParams.get("Mode").equals("AbilityCast")) {
if (!SA.isAbility()) {
} else if (this.getMapParams().get("Mode").equals("AbilityCast")) {
if (!spellAbility.isAbility()) {
return false;
}
} else if (mapParams.get("Mode").equals("SpellAbilityCast")) {
} else if (this.getMapParams().get("Mode").equals("SpellAbilityCast")) {
// Empty block for readability.
}
if (mapParams.containsKey("ActivatedOnly")) {
if (SA.isTrigger()) {
if (this.getMapParams().containsKey("ActivatedOnly")) {
if (spellAbility.isTrigger()) {
return false;
}
}
if (mapParams.containsKey("ValidControllingPlayer")) {
if (!matchesValid(cast.getController(), mapParams.get("ValidControllingPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidControllingPlayer")) {
if (!this.matchesValid(cast.getController(), this.getMapParams().get("ValidControllingPlayer").split(","),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidActivatingPlayer")) {
if (!matchesValid(si.getActivatingPlayer(), mapParams.get("ValidActivatingPlayer").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidActivatingPlayer")) {
if (!this.matchesValid(si.getActivatingPlayer(), this.getMapParams().get("ValidActivatingPlayer")
.split(","), this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(cast, mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(cast, this.getMapParams().get("ValidCard").split(","), this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("TargetsValid")) {
SpellAbility sa = si.getSpellAbility();
if (this.getMapParams().containsKey("TargetsValid")) {
final SpellAbility sa = si.getSpellAbility();
if (sa.getTarget() == null) {
if (sa.getTargetCard() == null) {
if (sa.getTargetList() == null) {
if (sa.getTargetPlayer() == null) {
return false;
} else {
if (!matchesValid(sa.getTargetPlayer(), mapParams.get("TargetsValid").split(","), hostCard)) {
if (!this.matchesValid(sa.getTargetPlayer(),
this.getMapParams().get("TargetsValid").split(","), this.getHostCard())) {
return false;
}
}
} else {
boolean validTgtFound = false;
for (Card tgt : sa.getTargetList()) {
if (matchesValid(tgt, mapParams.get("TargetsValid").split(","), hostCard)) {
for (final Card tgt : sa.getTargetList()) {
if (this.matchesValid(tgt, this.getMapParams().get("TargetsValid").split(","),
this.getHostCard())) {
validTgtFound = true;
break;
}
@@ -103,22 +107,24 @@ public class Trigger_SpellAbilityCast extends Trigger {
}
}
} else {
if (!matchesValid(sa.getTargetCard(), mapParams.get("TargetsValid").split(","), hostCard)) {
if (!this.matchesValid(sa.getTargetCard(), this.getMapParams().get("TargetsValid").split(","),
this.getHostCard())) {
return false;
}
}
} else {
if (sa.getTarget().doesTarget()) {
boolean validTgtFound = false;
for (Card tgt : sa.getTarget().getTargetCards()) {
if (tgt.isValid(mapParams.get("TargetsValid").split(","), hostCard.getController(), hostCard)) {
for (final Card tgt : sa.getTarget().getTargetCards()) {
if (tgt.isValid(this.getMapParams().get("TargetsValid").split(","), this.getHostCard()
.getController(), this.getHostCard())) {
validTgtFound = true;
break;
}
}
for (Player p : sa.getTarget().getTargetPlayers()) {
if (matchesValid(p, mapParams.get("TargetsValid").split(","), hostCard)) {
for (final Player p : sa.getTarget().getTargetPlayers()) {
if (this.matchesValid(p, this.getMapParams().get("TargetsValid").split(","), this.getHostCard())) {
validTgtFound = true;
break;
}
@@ -133,8 +139,8 @@ public class Trigger_SpellAbilityCast extends Trigger {
}
}
if (mapParams.containsKey("NonTapCost")) {
Cost cost = (Cost) (runParams2.get("Cost"));
if (this.getMapParams().containsKey("NonTapCost")) {
final Cost cost = (Cost) (runParams2.get("Cost"));
if (cost.getTap()) {
return false;
}
@@ -146,12 +152,12 @@ public class Trigger_SpellAbilityCast extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_SpellAbilityCast(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_SpellAbilityCast(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -159,9 +165,9 @@ public class Trigger_SpellAbilityCast extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", ((SpellAbility) runParams.get("CastSA")).getSourceCard());
sa.setTriggeringObject("SpellAbility", runParams.get("CastSA"));
sa.setTriggeringObject("Player", runParams.get("Player"));
sa.setTriggeringObject("Activator", runParams.get("Activator"));
sa.setTriggeringObject("Card", ((SpellAbility) this.getRunParams().get("CastSA")).getSourceCard());
sa.setTriggeringObject("SpellAbility", this.getRunParams().get("CastSA"));
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
sa.setTriggeringObject("Activator", this.getRunParams().get("Activator"));
}
}

View File

@@ -34,10 +34,11 @@ public class Trigger_Taps extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card tapper = (Card) runParams2.get("Card");
final Card tapper = (Card) runParams2.get("Card");
if (mapParams.containsKey("ValidCard")) {
if (!tapper.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!tapper.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
@@ -48,12 +49,12 @@ public class Trigger_Taps extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Taps(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Taps(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -61,6 +62,6 @@ public class Trigger_Taps extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -34,10 +34,11 @@ public class Trigger_TapsForMana extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card tapper = (Card) runParams2.get("Card");
final Card tapper = (Card) runParams2.get("Card");
if (mapParams.containsKey("ValidCard")) {
if (!tapper.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!tapper.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
@@ -48,12 +49,12 @@ public class Trigger_TapsForMana extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_TapsForMana(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_TapsForMana(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -61,8 +62,8 @@ public class Trigger_TapsForMana extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Player", runParams.get("Player"));
sa.setTriggeringObject("Produced", runParams.get("Produced"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
sa.setTriggeringObject("Produced", this.getRunParams().get("Produced"));
}
}

View File

@@ -34,8 +34,9 @@ public class Trigger_TurnFaceUp extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
if (mapParams.containsKey("ValidCard")) {
if (!matchesValid(runParams2.get("Card"), mapParams.get("ValidCard").split(","), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!this.matchesValid(runParams2.get("Card"), this.getMapParams().get("ValidCard").split(","),
this.getHostCard())) {
return false;
}
}
@@ -46,12 +47,12 @@ public class Trigger_TurnFaceUp extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_TurnFaceUp(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_TurnFaceUp(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -59,6 +60,6 @@ public class Trigger_TurnFaceUp extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -34,17 +34,19 @@ public class Trigger_Unequip extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card equipped = (Card) runParams2.get("Card");
Card equipment = (Card) runParams2.get("Equipment");
final Card equipped = (Card) runParams2.get("Card");
final Card equipment = (Card) runParams2.get("Equipment");
if (mapParams.containsKey("ValidCard")) {
if (!equipped.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!equipped.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
if (mapParams.containsKey("ValidEquipment")) {
if (!equipment.isValid(mapParams.get("ValidEquipment").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidEquipment")) {
if (!equipment.isValid(this.getMapParams().get("ValidEquipment").split(","), this.getHostCard()
.getController(), this.getHostCard())) {
return false;
}
}
@@ -55,12 +57,12 @@ public class Trigger_Unequip extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Unequip(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Unequip(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -68,7 +70,7 @@ public class Trigger_Unequip extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Equipment", runParams.get("Equipment"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
sa.setTriggeringObject("Equipment", this.getRunParams().get("Equipment"));
}
}

View File

@@ -34,10 +34,11 @@ public class Trigger_Untaps extends Trigger {
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
Card untapper = (Card) runParams2.get("Card");
final Card untapper = (Card) runParams2.get("Card");
if (mapParams.containsKey("ValidCard")) {
if (!untapper.isValid(mapParams.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
if (this.getMapParams().containsKey("ValidCard")) {
if (!untapper.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
@@ -48,12 +49,12 @@ public class Trigger_Untaps extends Trigger {
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
Trigger copy = new Trigger_Untaps(mapParams, hostCard, isIntrinsic);
if (overridingAbility != null) {
copy.setOverridingAbility(overridingAbility);
final Trigger copy = new Trigger_Untaps(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copy.setName(name);
copy.setID(ID);
copy.setName(this.getName());
copy.setID(this.getId());
return copy;
}
@@ -61,7 +62,7 @@ public class Trigger_Untaps extends Trigger {
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", runParams.get("Card"));
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
}
}

View File

@@ -85,7 +85,7 @@ public class BoosterDraftAI {
}
});
if (this.playerColors.get(player).Color1.equals("none") && this.playerColors.get(player).Color2.equals("none")) {
if (this.playerColors.get(player).getColor1().equals("none") && this.playerColors.get(player).getColor2().equals("none")) {
//
final CardList creatures = aiPlayables.getType("Creature").getColored();
creatures.sort(this.bestCreature);
@@ -95,30 +95,30 @@ public class BoosterDraftAI {
if (creatures.size() > 0) {
pickedCard = creatures.get(creatures.size() - 1);
this.playerColors.get(player).Color1 = pickedCard.getColor().get(0).toStringArray().get(0);
this.playerColors.get(player).setColor1(pickedCard.getColor().get(0).toStringArray().get(0));
if (Constant.Runtime.DEV_MODE[0]) {
System.out.println("Player[" + player + "] Color1: " + this.playerColors.get(player).Color1);
System.out.println("Player[" + player + "] Color1: " + this.playerColors.get(player).getColor1());
}
this.playerColors.get(player).Mana1 = this.playerColors.get(player).ColorToMana(
this.playerColors.get(player).Color1);
this.playerColors.get(player).setMana1(this.playerColors.get(player).colorToMana(
this.playerColors.get(player).getColor1()));
// if the first pick has more than one color add the second as
// second color to draft
if (pickedCard.getColor().get(0).toStringArray().size() > 1) {
this.playerColors.get(player).Color2 = pickedCard.getColor().get(0).toStringArray().get(1);
this.playerColors.get(player).setColor2(pickedCard.getColor().get(0).toStringArray().get(1));
if (Constant.Runtime.DEV_MODE[0]) {
System.out.println("Player[" + player + "] Color2: " + this.playerColors.get(player).Color2);
System.out.println("Player[" + player + "] Color2: " + this.playerColors.get(player).getColor2());
}
this.playerColors.get(player).Mana2 = this.playerColors.get(player).ColorToMana(
this.playerColors.get(player).Color2);
this.playerColors.get(player).setMana2(this.playerColors.get(player).colorToMana(
this.playerColors.get(player).getColor2()));
}
hasPicked = true;
}
} else if (!this.playerColors.get(player).Color1.equals("none")
&& this.playerColors.get(player).Color2.equals("none")) {
} else if (!this.playerColors.get(player).getColor1().equals("none")
&& this.playerColors.get(player).getColor2().equals("none")) {
final CardList creatures = aiPlayables.getType("Creature").getColored();
creatures.sort(this.bestCreature);
// for (int i=0; i<creatures.size(); i++)
@@ -127,21 +127,21 @@ public class BoosterDraftAI {
if (creatures.size() > 0) {
pickedCard = creatures.get(creatures.size() - 1);
this.playerColors.get(player).Color2 = pickedCard.getColor().get(0).toStringArray().get(0);
this.playerColors.get(player).setColor2(pickedCard.getColor().get(0).toStringArray().get(0));
if (Constant.Runtime.DEV_MODE[0]) {
System.out.println("Player[" + player + "] Color2: " + this.playerColors.get(player).Color2);
System.out.println("Player[" + player + "] Color2: " + this.playerColors.get(player).getColor2());
}
this.playerColors.get(player).Mana2 = this.playerColors.get(player).ColorToMana(
this.playerColors.get(player).Color2);
this.playerColors.get(player).setMana2(this.playerColors.get(player).colorToMana(
this.playerColors.get(player).getColor2()));
hasPicked = true;
}
} else {
CardList typeList;
CardList colorList;
colorList = aiPlayables.getOnly2Colors(this.playerColors.get(player).Color1,
this.playerColors.get(player).Color2);
colorList = aiPlayables.getOnly2Colors(this.playerColors.get(player).getColor1(),
this.playerColors.get(player).getColor2());
if (colorList.size() > 0) {
typeList = colorList.getType("Creature");
@@ -211,8 +211,8 @@ public class BoosterDraftAI {
for (int i = 0; i < typeList.size(); i++) {
final ArrayList<Ability_Mana> maList = typeList.get(i).getManaAbility();
for (int j = 0; j < maList.size(); j++) {
if (maList.get(j).canProduce(this.playerColors.get(player).Mana1)
|| maList.get(j).canProduce(this.playerColors.get(player).Mana2)) {
if (maList.get(j).canProduce(this.playerColors.get(player).getMana1())
|| maList.get(j).canProduce(this.playerColors.get(player).getMana2())) {
wouldPick.add(typeList.get(i));
}
}
@@ -356,7 +356,7 @@ public class BoosterDraftAI {
dList.remove(aiPlayables.get(i));
}
final CardList creatures = aiPlayables.getType("Creature").getOnly2Colors(pClrs.Color1, pClrs.Color2);
final CardList creatures = aiPlayables.getType("Creature").getOnly2Colors(pClrs.getColor1(), pClrs.getColor2());
int nCreatures = 15;
@@ -395,7 +395,7 @@ public class BoosterDraftAI {
}
CardList others = aiPlayables.getNotType("Creature").getNotType("Land")
.getOnly2Colors(pClrs.Color1, pClrs.Color2);
.getOnly2Colors(pClrs.getColor1(), pClrs.getColor2());
int ii = 0;
while ((cardsNeeded > 0) && (others.size() > 1)) {
@@ -406,7 +406,7 @@ public class BoosterDraftAI {
cardsNeeded--;
aiPlayables.remove(c);
others = aiPlayables.getNotType("Creature").getNotType("Land").getOnly2Colors(pClrs.Color1, pClrs.Color2);
others = aiPlayables.getNotType("Creature").getNotType("Land").getOnly2Colors(pClrs.getColor1(), pClrs.getColor2());
if (Constant.Runtime.DEV_MODE[0]) {
System.out.println("Others[" + ii++ + "]:" + c.getName() + " (" + c.getManaCost() + ")");

View File

@@ -9,16 +9,16 @@ import forge.Constant;
class DeckColors {
/** The Color1. */
public String Color1 = "none";
private String color1 = "none";
/** The Color2. */
public String Color2 = "none";
private String color2 = "none";
// public String Splash = "none";
/** The Mana1. */
public String Mana1 = "";
private String mana1 = "";
/** The Mana2. */
public String Mana2 = "";
private String mana2 = "";
// public String ManaS = "";
@@ -35,8 +35,8 @@ class DeckColors {
* a {@link java.lang.String} object.
*/
public DeckColors(final String c1, final String c2, final String sp) {
this.Color1 = c1;
this.Color2 = c2;
this.setColor1(c1);
this.setColor2(c2);
// Splash = sp;
}
@@ -58,16 +58,72 @@ class DeckColors {
* a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
public String ColorToMana(final String color) {
final String Mana[] = { "W", "U", "B", "R", "G" };
public String colorToMana(final String color) {
final String[] mana = { "W", "U", "B", "R", "G" };
for (int i = 0; i < Constant.Color.ONLY_COLORS.length; i++) {
if (Constant.Color.ONLY_COLORS[i].equals(color)) {
return Mana[i];
return mana[i];
}
}
return "";
}
/**
* @return the color1
*/
public String getColor1() {
return color1;
}
/**
* @param color1 the color1 to set
*/
public void setColor1(String color1) {
this.color1 = color1; // TODO: Add 0 to parameter's name.
}
/**
* @return the mana1
*/
public String getMana1() {
return mana1;
}
/**
* @param mana1 the mana1 to set
*/
public void setMana1(String mana1) {
this.mana1 = mana1; // TODO: Add 0 to parameter's name.
}
/**
* @return the mana2
*/
public String getMana2() {
return mana2;
}
/**
* @param mana2 the mana2 to set
*/
public void setMana2(String mana2) {
this.mana2 = mana2; // TODO: Add 0 to parameter's name.
}
/**
* @return the color2
*/
public String getColor2() {
return color2;
}
/**
* @param color2 the color2 to set
*/
public void setColor2(String color2) {
this.color2 = color2; // TODO: Add 0 to parameter's name.
}
}

View File

@@ -19,16 +19,16 @@ import java.util.TreeSet;
public class QuestPetManager {
/** The pets. */
public Map<String, QuestPetAbstract> pets = new HashMap<String, QuestPetAbstract>();
private Map<String, QuestPetAbstract> pets = new HashMap<String, QuestPetAbstract>();
/** The selected pet. */
public QuestPetAbstract selectedPet;
private QuestPetAbstract selectedPet;
/** The plant. */
public QuestPetAbstract plant;
private QuestPetAbstract plant;
/** The use plant. */
public boolean usePlant;
private boolean usePlant;
/**
* <p>
@@ -146,7 +146,7 @@ public class QuestPetManager {
* @return a boolean.
*/
public final boolean shouldPlantBeUsed() {
return this.usePlant;
return this.isUsePlant();
}
/**
@@ -225,4 +225,18 @@ public class QuestPetManager {
}
return this;
}
/**
* @return the usePlant
*/
public boolean isUsePlant() {
return usePlant;
}
/**
* @param usePlant the usePlant to set
*/
public void setUsePlant(boolean usePlant) {
this.usePlant = usePlant; // TODO: Add 0 to parameter's name.
}
}

View File

@@ -422,7 +422,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
this.plantBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent actionEvent) {
QuestMainPanel.this.questData.getPetManager().usePlant = QuestMainPanel.this.plantBox.isSelected();
QuestMainPanel.this.questData.getPetManager().setUsePlant(QuestMainPanel.this.plantBox.isSelected());
}
});

View File

@@ -117,18 +117,18 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
*/
@Override
public final boolean populateCustomPanel() {
this.getView().btnRestart.setVisible(false);
this.getView().getBtnRestart().setVisible(false);
this.model.qData.getCards().resetNewList();
if (!this.model.qMatchState.isMatchOver()) {
this.getView().btnQuit.setText("Quit (15 Credits)");
this.getView().getBtnQuit().setText("Quit (15 Credits)");
return false;
} else {
this.getView().btnContinue.setVisible(false);
this.getView().getBtnContinue().setVisible(false);
if (this.wonMatch) {
this.getView().btnQuit.setText("Great!");
this.getView().getBtnQuit().setText("Great!");
} else {
this.getView().btnQuit.setText("OK");
this.getView().getBtnQuit().setText("OK");
}
}
@@ -371,8 +371,8 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
this.lblTemp2.setIcon(this.icoTemp);
this.lblTemp2.setIconTextGap(50);
this.getView().pnlCustom.add(this.lblTemp1, "align center, width 95%!");
this.getView().pnlCustom.add(this.lblTemp2, "align center, width 95%!, gaptop 10");
this.getView().getPnlCustom().add(this.lblTemp1, "align center, width 95%!");
this.getView().getPnlCustom().add(this.lblTemp2, "align center, width 95%!, gaptop 10");
}
/**
@@ -392,9 +392,9 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cardsWon);
this.getView().pnlCustom.add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer
this.getView().getPnlCustom().add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer
+ ", gapbottom 10");
this.getView().pnlCustom.add(cv, "align center, width 95%!");
this.getView().getPnlCustom().add(cv, "align center, width 95%!");
}
/**
@@ -411,9 +411,9 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
this.lblTemp1 = new TitleLabel("You just won 10 random rares!");
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cardsWon);
this.getView().pnlCustom.add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer
this.getView().getPnlCustom().add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer
+ ", gapbottom 10");
this.getView().pnlCustom.add(cv, "align center, width 95%!");
this.getView().getPnlCustom().add(cv, "align center, width 95%!");
}
/**
@@ -436,9 +436,9 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
this.lblTemp1 = new TitleLabel("Bonus booster pack from the \"" + selected.getName() + "\" format!");
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cardsWon);
this.getView().pnlCustom.add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer
this.getView().getPnlCustom().add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer
+ ", gapbottom 10");
this.getView().pnlCustom.add(cv, "align center, width 95%!");
this.getView().getPnlCustom().add(cv, "align center, width 95%!");
}
/**
@@ -478,12 +478,12 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
this.lblTemp2.setIconTextGap(50);
this.lblTemp2.setIcon(this.icoTemp);
this.getView().pnlCustom.add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer);
this.getView().pnlCustom.add(this.lblTemp2, "align center, width 95%!, height 80!, gapbottom 10");
this.getView().getPnlCustom().add(this.lblTemp1, "align center, width 95%!, " + "gaptop " + this.spacer);
this.getView().getPnlCustom().add(this.lblTemp2, "align center, width 95%!, height 80!, gapbottom 10");
if (cardsWon != null) {
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cardsWon);
this.getView().pnlCustom.add(cv, "align center, width 95%!");
this.getView().getPnlCustom().add(cv, "align center, width 95%!");
this.model.qData.getCards().addAllCards(cardsWon);
}
}
@@ -500,8 +500,8 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
this.lblTemp2.setIconTextGap(50);
this.lblTemp2.setIcon(this.icoTemp);
this.getView().pnlCustom.add(this.lblTemp1, "align center, width 95%!");
this.getView().pnlCustom.add(this.lblTemp2, "align center, width 95%!, height 80!");
this.getView().getPnlCustom().add(this.lblTemp1, "align center, width 95%!");
this.getView().getPnlCustom().add(this.lblTemp2, "align center, width 95%!, height 80!");
}
/**

View File

@@ -96,16 +96,16 @@ public class ApplicationView implements FView {
final ForgePreferences preferences = model.getPreferences();
OldGuiNewGame.useLAFFonts.setSelected(preferences.isLafFonts());
OldGuiNewGame.getUseLAFFonts().setSelected(preferences.isLafFonts());
// newGuiCheckBox.setSelected(preferences.newGui);
OldGuiNewGame.smoothLandCheckBox.setSelected(preferences.isStackAiLand());
OldGuiNewGame.getSmoothLandCheckBox().setSelected(preferences.isStackAiLand());
OldGuiNewGame.devModeCheckBox.setSelected(preferences.isDeveloperMode());
OldGuiNewGame.cardOverlay.setSelected(preferences.isCardOverlay());
OldGuiNewGame.getCardOverlay().setSelected(preferences.isCardOverlay());
// FindBugs doesn't like the next line.
ImageCache.setScaleLargerThanOriginal(preferences.isScaleLargerThanOriginal());
OldGuiNewGame.cardScale.setSelected(preferences.isScaleLargerThanOriginal());
OldGuiNewGame.getCardScale().setSelected(preferences.isScaleLargerThanOriginal());
CardStackOffsetAction.set(preferences.getStackOffset());
CardStackAction.setVal(preferences.getMaxStackSize());
CardSizesAction.set(preferences.getCardSize());

View File

@@ -127,7 +127,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
/** Constant <code>newGuiCheckBox</code>. */
// private static JCheckBox newGuiCheckBox = new JCheckBox("", true);
/** Constant <code>smoothLandCheckBox</code>. */
static JCheckBox smoothLandCheckBox = new JCheckBox("", false);
private static JCheckBox smoothLandCheckBox = new JCheckBox("", false);
/** Constant <code>devModeCheckBox</code>. */
static JCheckBox devModeCheckBox = new JCheckBox("", true);
@@ -147,12 +147,12 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
public static JCheckBoxMenuItem removeArtifacts = new JCheckBoxMenuItem(
ForgeProps.getLocalized(MenuBar.Options.Generate.REMOVE_ARTIFACTS));
/** Constant <code>useLAFFonts</code>. */
public static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(ForgeProps.getLocalized(MenuBar.Options.FONT));
private static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(ForgeProps.getLocalized(MenuBar.Options.FONT));
/** Constant <code>cardOverlay</code>. */
public static JCheckBoxMenuItem cardOverlay = new JCheckBoxMenuItem(
private static JCheckBoxMenuItem cardOverlay = new JCheckBoxMenuItem(
ForgeProps.getLocalized(MenuBar.Options.CARD_OVERLAY));
/** Constant <code>cardScale</code>. */
public static JCheckBoxMenuItem cardScale = new JCheckBoxMenuItem(
private static JCheckBoxMenuItem cardScale = new JCheckBoxMenuItem(
ForgeProps.getLocalized(MenuBar.Options.CARD_SCALE));
private final JButton questButton = new JButton();
@@ -281,15 +281,15 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
final JMenu optionsMenu = new JMenu(ForgeProps.getLocalized(Options.TITLE));
optionsMenu.add(generatedDeck);
optionsMenu.add(OldGuiNewGame.useLAFFonts);
optionsMenu.add(OldGuiNewGame.getUseLAFFonts());
optionsMenu.addSeparator();
optionsMenu.add(OldGuiNewGame.cardOverlay);
optionsMenu.add(OldGuiNewGame.cardScale);
optionsMenu.add(OldGuiNewGame.getCardOverlay());
optionsMenu.add(OldGuiNewGame.getCardScale());
OldGuiNewGame.cardScale.addActionListener(new ActionListener() {
OldGuiNewGame.getCardScale().addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent arg0) {
ImageCache.setScaleLargerThanOriginal(OldGuiNewGame.cardScale.isSelected());
ImageCache.setScaleLargerThanOriginal(OldGuiNewGame.getCardScale().isSelected());
}
});
@@ -537,7 +537,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
this.jPanel3.setLayout(new MigLayout("align center"));
// newGuiCheckBox.setText(ForgeProps.getLocalized(NEW_GAME_TEXT.NEW_GUI));
OldGuiNewGame.smoothLandCheckBox.setText(ForgeProps.getLocalized(NewGameText.AI_LAND));
OldGuiNewGame.getSmoothLandCheckBox().setText(ForgeProps.getLocalized(NewGameText.AI_LAND));
OldGuiNewGame.devModeCheckBox.setText(ForgeProps.getLocalized(NewGameText.DEV_MODE));
OldGuiNewGame.devModeCheckBox.addActionListener(new java.awt.event.ActionListener() {
@@ -619,7 +619,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
this.getContentPane().add(this.jPanel3, "span 2, grow");
// jPanel3.add(newGuiCheckBox, "wrap");
this.jPanel3.add(OldGuiNewGame.smoothLandCheckBox, "wrap");
this.jPanel3.add(OldGuiNewGame.getSmoothLandCheckBox(), "wrap");
this.jPanel3.add(OldGuiNewGame.devModeCheckBox, "wrap");
this.jPanel3.add(OldGuiNewGame.upldDrftCheckBox, "wrap");
this.jPanel3.add(OldGuiNewGame.foilRandomCheckBox, "wrap");
@@ -852,7 +852,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
AllZone.setDisplay(new GuiDisplay4());
// else AllZone.setDisplay(new GuiDisplay3());
Constant.Runtime.SMOOTH[0] = OldGuiNewGame.smoothLandCheckBox.isSelected();
Constant.Runtime.SMOOTH[0] = OldGuiNewGame.getSmoothLandCheckBox().isSelected();
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
AllZone.getDisplay().setVisible(true);
@@ -1626,7 +1626,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
public final void actionPerformed(final ActionEvent e) {
final JTextArea area = new JTextArea(12, 25);
if (OldGuiNewGame.useLAFFonts.isSelected()) {
if (OldGuiNewGame.getUseLAFFonts().isSelected()) {
final Font f = new Font(area.getFont().getName(), Font.PLAIN, 13);
area.setFont(f);
}
@@ -1692,12 +1692,12 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
try {
final ForgePreferences preferences = Singletons.getModel().getPreferences();
preferences.setLaf(UIManager.getLookAndFeel().getClass().getName());
preferences.setLafFonts(OldGuiNewGame.useLAFFonts.isSelected());
preferences.setLafFonts(OldGuiNewGame.getUseLAFFonts().isSelected());
// preferences.newGui = newGuiCheckBox.isSelected();
preferences.setStackAiLand(OldGuiNewGame.smoothLandCheckBox.isSelected());
preferences.setStackAiLand(OldGuiNewGame.getSmoothLandCheckBox().isSelected());
preferences.setMillingLossCondition(Constant.Runtime.MILL[0]);
preferences.setDeveloperMode(Constant.Runtime.DEV_MODE[0]);
preferences.setCardOverlay(OldGuiNewGame.cardOverlay.isSelected());
preferences.setCardOverlay(OldGuiNewGame.getCardOverlay().isSelected());
preferences.setScaleLargerThanOriginal(ImageCache.isScaleLargerThanOriginal());
preferences.setUploadDraftAI(Constant.Runtime.UPLOAD_DRAFT[0]);
preferences.save();
@@ -1866,4 +1866,60 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
*/
}
/**
* @return the cardOverlay
*/
public static JCheckBoxMenuItem getCardOverlay() {
return cardOverlay;
}
/**
* @param cardOverlay the cardOverlay to set
*/
public static void setCardOverlay(JCheckBoxMenuItem cardOverlay) {
OldGuiNewGame.cardOverlay = cardOverlay; // TODO: Add 0 to parameter's name.
}
/**
* @return the cardScale
*/
public static JCheckBoxMenuItem getCardScale() {
return cardScale;
}
/**
* @param cardScale the cardScale to set
*/
public static void setCardScale(JCheckBoxMenuItem cardScale) {
OldGuiNewGame.cardScale = cardScale; // TODO: Add 0 to parameter's name.
}
/**
* @return the useLAFFonts
*/
public static JCheckBoxMenuItem getUseLAFFonts() {
return useLAFFonts;
}
/**
* @param useLAFFonts the useLAFFonts to set
*/
public static void setUseLAFFonts(JCheckBoxMenuItem useLAFFonts) {
OldGuiNewGame.useLAFFonts = useLAFFonts; // TODO: Add 0 to parameter's name.
}
/**
* @return the smoothLandCheckBox
*/
static JCheckBox getSmoothLandCheckBox() {
return smoothLandCheckBox;
}
/**
* @param smoothLandCheckBox the smoothLandCheckBox to set
*/
static void setSmoothLandCheckBox(JCheckBox smoothLandCheckBox) {
OldGuiNewGame.smoothLandCheckBox = smoothLandCheckBox; // TODO: Add 0 to parameter's name.
}
}

View File

@@ -40,22 +40,22 @@ public class WinLoseFrame extends JFrame {
private final WinLoseModeHandler modeHandler;
/** The btn continue. */
public FButton btnContinue;
private FButton btnContinue;
/** The btn quit. */
public FButton btnQuit;
private FButton btnQuit;
/** The btn restart. */
public FButton btnRestart;
private FButton btnRestart;
/** The lbl title. */
public JLabel lblTitle;
private JLabel lblTitle;
/** The lbl stats. */
public JLabel lblStats;
private JLabel lblStats;
/** The pnl custom. */
public JPanel pnlCustom;
private JPanel pnlCustom;
/**
* <p>
@@ -94,15 +94,15 @@ public class WinLoseFrame extends JFrame {
// Footer should be at least 150 to keep buttons in-pane on Mac OS X
// it needs to be > 175 now that skinning is used
final int HEAD_HEIGHT = 150;
final int FOOT_HEIGHT = 182;
final int FRAME_WIDTH_SMALL = 300;
final int FRAME_WIDTH_BIG = 600;
final int headHeight = 150;
final int footHeight = 182;
final int frameWidthSmall = 300;
final int frameWidthBig = 600;
// Head panel
final JPanel pnlHead = new JPanel(new MigLayout("wrap, fill"));
pnlHead.setOpaque(false);
contentPanel.add(pnlHead, "width " + FRAME_WIDTH_SMALL + "!, align center");
contentPanel.add(pnlHead, "width " + frameWidthSmall + "!, align center");
this.lblTitle = new JLabel("WinLoseFrame > lblTitle is broken.");
this.lblTitle.setForeground(Color.white);
@@ -120,44 +120,44 @@ public class WinLoseFrame extends JFrame {
// Custom display panel in center; populated later by mode handler.
final JScrollPane scroller = new JScrollPane();
scroller.getVerticalScrollBar().setUnitIncrement(16);
this.pnlCustom = new JPanel(new MigLayout("wrap, fillx"));
this.pnlCustom.setBackground(new Color(111, 87, 59));
this.pnlCustom.setForeground(Color.white);
this.setPnlCustom(new JPanel(new MigLayout("wrap, fillx")));
this.getPnlCustom().setBackground(new Color(111, 87, 59));
this.getPnlCustom().setForeground(Color.white);
contentPanel.add(scroller, "w 96%!, align center, gapleft 2%");
scroller.getViewport().add(this.pnlCustom);
scroller.getViewport().add(this.getPnlCustom());
// Foot panel
final JPanel pnlFoot = new JPanel(new MigLayout("wrap, fill, hidemode 3"));
pnlFoot.setOpaque(false);
contentPanel.add(pnlFoot, "width " + FRAME_WIDTH_SMALL + "!, align center");
contentPanel.add(pnlFoot, "width " + frameWidthSmall + "!, align center");
this.btnContinue = new FButton("Continue");
this.btnRestart = new FButton("Restart");
this.btnQuit = new FButton("Quit");
this.setBtnContinue(new FButton("Continue"));
this.setBtnRestart(new FButton("Restart"));
this.setBtnQuit(new FButton("Quit"));
pnlFoot.add(this.btnContinue, "h 36:36, w 200!, gap 0 0 5 5, align center");
pnlFoot.add(this.btnRestart, "h 36:36, w 200!, gap 0 0 5 5, align center");
pnlFoot.add(this.btnQuit, "h 36:36, w 200!, gap 0 0 5 5, align center");
pnlFoot.add(this.getBtnContinue(), "h 36:36, w 200!, gap 0 0 5 5, align center");
pnlFoot.add(this.getBtnRestart(), "h 36:36, w 200!, gap 0 0 5 5, align center");
pnlFoot.add(this.getBtnQuit(), "h 36:36, w 200!, gap 0 0 5 5, align center");
// Button actions
this.btnQuit.addActionListener(new java.awt.event.ActionListener() {
this.getBtnQuit().addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
WinLoseFrame.this.btnQuit_actionPerformed(e);
WinLoseFrame.this.btnQuitActionPerformed(e);
}
});
this.btnContinue.addActionListener(new java.awt.event.ActionListener() {
this.getBtnContinue().addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
WinLoseFrame.this.btnContinue_actionPerformed(e);
WinLoseFrame.this.btnContinueActionPerformed(e);
}
});
this.btnRestart.addActionListener(new java.awt.event.ActionListener() {
this.getBtnRestart().addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
WinLoseFrame.this.btnRestart_actionPerformed(e);
WinLoseFrame.this.btnRestartActionPerformed(e);
}
});
@@ -165,8 +165,8 @@ public class WinLoseFrame extends JFrame {
Phase.setGameBegins(0);
if (this.matchState.isMatchOver()) {
this.btnContinue.setEnabled(false);
this.btnQuit.grabFocus();
this.getBtnContinue().setEnabled(false);
this.getBtnQuit().grabFocus();
}
// Show Wins and Loses
@@ -196,14 +196,14 @@ public class WinLoseFrame extends JFrame {
if (hasContents) {
bounds.height = screen.height - 150;
scroller.setPreferredSize(new Dimension(FRAME_WIDTH_BIG, screen.height - HEAD_HEIGHT - FOOT_HEIGHT));
bounds.width = FRAME_WIDTH_BIG;
bounds.x = (screen.width - FRAME_WIDTH_BIG) / 2;
scroller.setPreferredSize(new Dimension(frameWidthBig, screen.height - headHeight - footHeight));
bounds.width = frameWidthBig;
bounds.x = (screen.width - frameWidthBig) / 2;
bounds.y = (screen.height - bounds.height) / 2;
} else {
bounds.height = HEAD_HEIGHT + FOOT_HEIGHT;
bounds.width = FRAME_WIDTH_SMALL;
bounds.x = (screen.width - FRAME_WIDTH_SMALL) / 2;
bounds.height = headHeight + footHeight;
bounds.width = frameWidthSmall;
bounds.x = (screen.width - frameWidthSmall) / 2;
bounds.y = (screen.height - bounds.height) / 2;
}
@@ -222,7 +222,7 @@ public class WinLoseFrame extends JFrame {
* @param e
* a {@link java.awt.event.ActionEvent} object.
*/
final void btnContinue_actionPerformed(final ActionEvent e) {
final void btnContinueActionPerformed(final ActionEvent e) {
this.closeWinLoseFrame();
AllZone.getDisplay().setVisible(true);
this.modeHandler.startNextRound();
@@ -236,7 +236,7 @@ public class WinLoseFrame extends JFrame {
* @param e
* a {@link java.awt.event.ActionEvent} object.
*/
final void btnRestart_actionPerformed(final ActionEvent e) {
final void btnRestartActionPerformed(final ActionEvent e) {
this.closeWinLoseFrame();
AllZone.getDisplay().setVisible(true);
this.matchState.reset();
@@ -251,7 +251,7 @@ public class WinLoseFrame extends JFrame {
* @param e
* a {@link java.awt.event.ActionEvent} object.
*/
final void btnQuit_actionPerformed(final ActionEvent e) {
final void btnQuitActionPerformed(final ActionEvent e) {
this.closeWinLoseFrame();
this.matchState.reset();
this.modeHandler.actionOnQuit();
@@ -279,6 +279,62 @@ public class WinLoseFrame extends JFrame {
return frame;
}
/**
* @return the btnContinue
*/
public FButton getBtnContinue() {
return btnContinue;
}
/**
* @param btnContinue the btnContinue to set
*/
public void setBtnContinue(FButton btnContinue) {
this.btnContinue = btnContinue; // TODO: Add 0 to parameter's name.
}
/**
* @return the btnRestart
*/
public FButton getBtnRestart() {
return btnRestart;
}
/**
* @param btnRestart the btnRestart to set
*/
public void setBtnRestart(FButton btnRestart) {
this.btnRestart = btnRestart; // TODO: Add 0 to parameter's name.
}
/**
* @return the btnQuit
*/
public FButton getBtnQuit() {
return btnQuit;
}
/**
* @param btnQuit the btnQuit to set
*/
public void setBtnQuit(FButton btnQuit) {
this.btnQuit = btnQuit; // TODO: Add 0 to parameter's name.
}
/**
* @return the pnlCustom
*/
public JPanel getPnlCustom() {
return pnlCustom;
}
/**
* @param pnlCustom the pnlCustom to set
*/
public void setPnlCustom(JPanel pnlCustom) {
this.pnlCustom = pnlCustom; // TODO: Add 0 to parameter's name.
}
private class WinLoseBorder extends AbstractBorder {
@Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width,