checkstyle

This commit is contained in:
jendave
2011-10-28 18:32:18 +00:00
parent 3e73d6b770
commit d003bd415d
49 changed files with 2614 additions and 2393 deletions

View File

@@ -143,7 +143,9 @@
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
@@ -168,7 +170,7 @@
<!-- Place left curly at EOL for one-line clauses,
and on next line for multi-line clauses.
-->
<property name="option" value="nlow" />
<!-- <property name="option" value="nlow" /> -->
</module>
<module name="NeedBraces"/>

View File

@@ -3113,7 +3113,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*/
public final void executeTrigger(final ZCTrigger type) {
for (Ability_Triggered t : zcTriggers) {
if (t.trigger.equals(type) && t.isBasic()) {
if (t.getTrigger().equals(type) && t.isBasic()) {
t.execute();
}
}

View File

@@ -606,7 +606,7 @@ public class ComputerUtil {
// don't use abilities with dangerous drawbacks
if (m.getSubAbility() != null) {
if (!m.getSubAbility().chkAI_Drawback()) {
if (!m.getSubAbility().chkAIDrawback()) {
continue;
}
}
@@ -801,7 +801,7 @@ public class ComputerUtil {
// don't use abilities with dangerous drawbacks
if (m.getSubAbility() != null) {
if (!m.getSubAbility().chkAI_Drawback()) {
if (!m.getSubAbility().chkAIDrawback()) {
continue;
}
needsLimitedResources = true; // TODO: check for good
@@ -844,7 +844,7 @@ public class ComputerUtil {
// don't use abilities with dangerous drawbacks
if (m.getSubAbility() != null) {
if (!m.getSubAbility().chkAI_Drawback()) {
if (!m.getSubAbility().chkAIDrawback()) {
continue;
}
needsLimitedResources = true; // TODO: check for good

File diff suppressed because it is too large Load Diff

View File

@@ -41,16 +41,17 @@ public class AbilityFactory_AlterLife {
* createAbilityGainLife.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility createAbilityGainLife(final AbilityFactory AF) {
public static SpellAbility createAbilityGainLife(final AbilityFactory abilityFactory) {
final SpellAbility abGainLife = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
final SpellAbility abGainLife = new Ability_Activated(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = 8869422603616247307L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -83,15 +84,16 @@ public class AbilityFactory_AlterLife {
* createSpellGainLife.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility createSpellGainLife(final AbilityFactory AF) {
final SpellAbility spGainLife = new Spell(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
public static SpellAbility createSpellGainLife(final AbilityFactory abilityFactory) {
final SpellAbility spGainLife = new Spell(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = 6631124959690157874L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -124,15 +126,15 @@ public class AbilityFactory_AlterLife {
* createDrawbackGainLife.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility createDrawbackGainLife(final AbilityFactory AF) {
final SpellAbility dbGainLife = new Ability_Sub(AF.getHostCard(), AF.getAbTgt()) {
public static SpellAbility createDrawbackGainLife(final AbilityFactory abilityFactory) {
final SpellAbility dbGainLife = new Ability_Sub(abilityFactory.getHostCard(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = 6631124959690157874L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -157,7 +159,7 @@ public class AbilityFactory_AlterLife {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -206,8 +208,9 @@ public class AbilityFactory_AlterLife {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player player : tgtPlayers)
for (Player player : tgtPlayers) {
sb.append(player).append(" ");
}
sb.append("gains ").append(amount).append(" life.");
@@ -384,10 +387,11 @@ public class AbilityFactory_AlterLife {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player p : tgtPlayers)
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
p.gainLife(lifeAmount, sa.getSourceCard());
}
}
}
// *************************************************************************
@@ -399,15 +403,16 @@ public class AbilityFactory_AlterLife {
* createAbilityLoseLife.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility createAbilityLoseLife(final AbilityFactory AF) {
final SpellAbility abLoseLife = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
public static SpellAbility createAbilityLoseLife(final AbilityFactory abilityFactory) {
final SpellAbility abLoseLife = new Ability_Activated(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = 1129762905315395160L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -444,15 +449,16 @@ public class AbilityFactory_AlterLife {
* createSpellLoseLife.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility createSpellLoseLife(final AbilityFactory AF) {
final SpellAbility spLoseLife = new Spell(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
public static SpellAbility createSpellLoseLife(final AbilityFactory abilityFactory) {
final SpellAbility spLoseLife = new Spell(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = -2966932725306192437L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -484,15 +490,15 @@ public class AbilityFactory_AlterLife {
* createDrawbackLoseLife.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility createDrawbackLoseLife(final AbilityFactory AF) {
final SpellAbility dbLoseLife = new Ability_Sub(AF.getHostCard(), AF.getAbTgt()) {
public static SpellAbility createDrawbackLoseLife(final AbilityFactory abilityFactory) {
final SpellAbility dbLoseLife = new Ability_Sub(abilityFactory.getHostCard(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = -2966932725306192437L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -517,7 +523,7 @@ public class AbilityFactory_AlterLife {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -564,8 +570,9 @@ public class AbilityFactory_AlterLife {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player player : tgtPlayers)
for (Player player : tgtPlayers) {
sb.append(player).append(" ");
}
sb.append("loses ").append(amount).append(" life.");
@@ -749,11 +756,11 @@ public class AbilityFactory_AlterLife {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player p : tgtPlayers)
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
p.loseLife(lifeAmount, sa.getSourceCard());
}
}
}
// *************************************************************************
@@ -874,7 +881,7 @@ public class AbilityFactory_AlterLife {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -914,10 +921,11 @@ public class AbilityFactory_AlterLife {
tgt.addTarget(AllZone.getHumanPlayer());
} else {
ArrayList<Player> players = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
for (Player p : players)
for (Player p : players) {
if (!mandatory && p.isComputer() && p.getPoisonCounters() > p.getOpponent().getPoisonCounters()) {
return false;
}
}
}
// check SubAbilities DoTrigger?
@@ -952,10 +960,11 @@ public class AbilityFactory_AlterLife {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player p : tgtPlayers)
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
p.addPoisonCounters(amount);
}
}
}
/**
@@ -1192,7 +1201,7 @@ public class AbilityFactory_AlterLife {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -1548,7 +1557,7 @@ public class AbilityFactory_AlterLife {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}

View File

@@ -128,7 +128,7 @@ public final class AbilityFactory_Animate {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return animatePlayDrawbackAI(af, this);
}
@@ -354,7 +354,7 @@ public final class AbilityFactory_Animate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
useAbility &= subAb.chkAI_Drawback();
useAbility &= subAb.chkAIDrawback();
}
return useAbility;
@@ -379,7 +379,7 @@ public final class AbilityFactory_Animate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -414,7 +414,7 @@ public final class AbilityFactory_Animate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance || mandatory;
@@ -892,7 +892,7 @@ public final class AbilityFactory_Animate {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return animateAllPlayDrawbackAI(af, this);
}
@@ -964,7 +964,7 @@ public final class AbilityFactory_Animate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
useAbility &= subAb.chkAI_Drawback();
useAbility &= subAb.chkAIDrawback();
}
return useAbility;
@@ -986,7 +986,7 @@ public final class AbilityFactory_Animate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -1005,7 +1005,8 @@ public final class AbilityFactory_Animate {
* a boolean.
* @return a boolean.
*/
private static boolean animateAllTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean animateAllTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
if (!ComputerUtil.canPayCost(sa)) { // If there is a cost payment
return false;
}
@@ -1014,7 +1015,7 @@ public final class AbilityFactory_Animate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance || mandatory;

View File

@@ -38,23 +38,24 @@ public class AbilityFactory_Attach {
/**
* Creates the spell attach.
*
* @param AF
* @param abilityFactory
* the aF
* @return the spell ability
*/
public static SpellAbility createSpellAttach(final AbilityFactory AF) {
public static SpellAbility createSpellAttach(final AbilityFactory abilityFactory) {
// There are two types of Spell Attachments: Auras and
// Instants/Sorceries
// Auras generally target what that card will attach to
// I/S generally target the Attacher and the Attachee
SpellAbility spAttach = null;
if (AF.getHostCard().isAura()) {
if (abilityFactory.getHostCard().isAura()) {
// The 4th parameter is to resolve an issue with SetDescription in
// default Spell_Permanent constructor
spAttach = new Spell_Permanent(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt(), false) {
spAttach = new Spell_Permanent(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt(), false) {
private static final long serialVersionUID = 6631124959690157874L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -81,10 +82,10 @@ public class AbilityFactory_Attach {
// that use it
// And the Targeting system can't really handle them at this time
// (11/7/1)
spAttach = new Spell(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
spAttach = new Spell(abilityFactory.getHostCard(), abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = 6631124959690157874L;
final AbilityFactory af = AF;
private final AbilityFactory af = abilityFactory;
@Override
public String getStackDescription() {
@@ -110,11 +111,11 @@ public class AbilityFactory_Attach {
/**
* Creates the ability attach.
*
* @param AF
* @param abilityFactory
* the aF
* @return the spell ability
*/
public static SpellAbility createAbilityAttach(final AbilityFactory AF) {
public static SpellAbility createAbilityAttach(final AbilityFactory abilityFactory) {
// placeholder for Equip and other similar cards
return null;
}
@@ -123,11 +124,11 @@ public class AbilityFactory_Attach {
/**
* Creates the drawback attach.
*
* @param AF
* @param abilityFactory
* the aF
* @return the spell ability
*/
public static SpellAbility createDrawbackAttach(final AbilityFactory AF) {
public static SpellAbility createDrawbackAttach(final AbilityFactory abilityFactory) {
// placeholder for DBs that might attach
return null;
}
@@ -167,8 +168,9 @@ public class AbilityFactory_Attach {
targets = AbilityFactory.getDefinedObjects(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
}
for (Object o : targets)
for (Object o : targets) {
sb.append(o).append(" ");
}
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
@@ -465,8 +467,9 @@ public class AbilityFactory_Attach {
String kws = params.get("AddKeyword");
if (kws != null) {
for (String kw : kws.split(" & "))
for (String kw : kws.split(" & ")) {
keywords.add(kw);
}
}
}
}
@@ -499,11 +502,11 @@ public class AbilityFactory_Attach {
// keywords
@Override
public boolean addCard(final Card c) {
for (String kw : finalKWs)
for (String kw : finalKWs) {
if (c.hasKeyword(kw)) {
return false;
}
}
return true;
}
});
@@ -597,8 +600,9 @@ public class AbilityFactory_Attach {
String kws = params.get("AddKeyword");
if (kws != null) {
for (String kw : kws.split(" & "))
for (String kw : kws.split(" & ")) {
keywords.add(kw);
}
}
}
}

View File

@@ -26,22 +26,23 @@ public class AbilityFactory_ChangeState {
/**
* Gets the change state ability.
*
* @param AF
* @param abilityFactory
* the aF
* @return the change state ability
*/
public static SpellAbility getChangeStateAbility(final AbilityFactory AF) {
SpellAbility ret = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
public static SpellAbility getChangeStateAbility(final AbilityFactory abilityFactory) {
SpellAbility ret = new Ability_Activated(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = -1083427558368639457L;
@Override
public String getStackDescription() {
return changeStateStackDescription(AF, this);
return changeStateStackDescription(abilityFactory, this);
}
@Override
public void resolve() {
changeStateResolve(AF, this);
changeStateResolve(abilityFactory, this);
}
};
@@ -51,22 +52,22 @@ public class AbilityFactory_ChangeState {
/**
* Gets the change state spell.
*
* @param AF
* @param abilityFactory
* the aF
* @return the change state spell
*/
public static SpellAbility getChangeStateSpell(final AbilityFactory AF) {
SpellAbility ret = new Spell(AF.getHostCard()) {
public static SpellAbility getChangeStateSpell(final AbilityFactory abilityFactory) {
SpellAbility ret = new Spell(abilityFactory.getHostCard()) {
private static final long serialVersionUID = -7506856902233086859L;
@Override
public String getStackDescription() {
return changeStateStackDescription(AF, this);
return changeStateStackDescription(abilityFactory, this);
}
@Override
public void resolve() {
changeStateResolve(AF, this);
changeStateResolve(abilityFactory, this);
}
};
@@ -76,26 +77,26 @@ public class AbilityFactory_ChangeState {
/**
* Gets the change state drawback.
*
* @param AF
* @param abilityFactory
* the aF
* @return the change state drawback
*/
public static SpellAbility getChangeStateDrawback(final AbilityFactory AF) {
Ability_Sub ret = new Ability_Sub(AF.getHostCard(), AF.getAbTgt()) {
public static SpellAbility getChangeStateDrawback(final AbilityFactory abilityFactory) {
Ability_Sub ret = new Ability_Sub(abilityFactory.getHostCard(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = -3793247725721587468L;
@Override
public String getStackDescription() {
return changeStateStackDescription(AF, this);
return changeStateStackDescription(abilityFactory, this);
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
// Gross generalization, but this always considers alternate
// states more powerful
if (AF.getHostCard().isInAlternateState()) {
if (abilityFactory.getHostCard().isInAlternateState()) {
return false;
}
@@ -104,7 +105,7 @@ public class AbilityFactory_ChangeState {
@Override
public boolean doTrigger(final boolean mandatory) {
if (!mandatory && AF.getHostCard().isInAlternateState()) {
if (!mandatory && abilityFactory.getHostCard().isInAlternateState()) {
return false;
}
@@ -113,7 +114,7 @@ public class AbilityFactory_ChangeState {
@Override
public void resolve() {
changeStateResolve(AF, this);
changeStateResolve(abilityFactory, this);
}
};
@@ -121,11 +122,11 @@ public class AbilityFactory_ChangeState {
return ret;
}
private static String changeStateStackDescription(final AbilityFactory AF, final SpellAbility sa) {
Map<String, String> params = AF.getMapParams();
private static String changeStateStackDescription(final AbilityFactory abilityFactory, final SpellAbility sa) {
Map<String, String> params = abilityFactory.getMapParams();
StringBuilder sb = new StringBuilder();
Card host = AF.getHostCard();
Card host = abilityFactory.getHostCard();
String conditionDesc = params.get("ConditionDescription");
if (conditionDesc != null) {
@@ -134,7 +135,7 @@ public class AbilityFactory_ChangeState {
ArrayList<Card> tgtCards;
Target tgt = AF.getAbTgt();
Target tgt = abilityFactory.getAbTgt();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
} else {
@@ -176,19 +177,20 @@ public class AbilityFactory_ChangeState {
return sb.toString();
}
private static void changeStateResolve(final AbilityFactory AF, final SpellAbility sa) {
private static void changeStateResolve(final AbilityFactory abilityFactory, final SpellAbility sa) {
ArrayList<Card> tgtCards;
if (AF.getAbTgt() != null) {
tgtCards = AF.getAbTgt().getTargetCards();
if (abilityFactory.getAbTgt() != null) {
tgtCards = abilityFactory.getAbTgt().getTargetCards();
} else {
tgtCards = AbilityFactory.getDefinedCards(AF.getHostCard(), AF.getMapParams().get("Defined"), sa);
tgtCards = AbilityFactory.getDefinedCards(abilityFactory.getHostCard(),
abilityFactory.getMapParams().get("Defined"), sa);
}
for (Card tgt : tgtCards) {
if (AF.getAbTgt() != null) {
if (!CardFactoryUtil.canTarget(AF.getHostCard(), tgt)) {
if (abilityFactory.getAbTgt() != null) {
if (!CardFactoryUtil.canTarget(abilityFactory.getHostCard(), tgt)) {
continue;
}
}
@@ -204,23 +206,24 @@ public class AbilityFactory_ChangeState {
/**
* Gets the change state all ability.
*
* @param AF
* @param abilityFactory
* the aF
* @return the change state all ability
*/
public static SpellAbility getChangeStateAllAbility(final AbilityFactory AF) {
SpellAbility ret = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
public static SpellAbility getChangeStateAllAbility(final AbilityFactory abilityFactory) {
SpellAbility ret = new Ability_Activated(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = 7841029107610111992L;
@Override
public String getStackDescription() {
return changeStateAllStackDescription(AF, this);
return changeStateAllStackDescription(abilityFactory, this);
}
@Override
public void resolve() {
changeStateAllResolve(AF, this);
changeStateAllResolve(abilityFactory, this);
}
};
@@ -231,23 +234,23 @@ public class AbilityFactory_ChangeState {
/**
* Gets the change state all spell.
*
* @param AF
* @param abilityFactory
* the aF
* @return the change state all spell
*/
public static SpellAbility getChangeStateAllSpell(final AbilityFactory AF) {
SpellAbility ret = new Spell(AF.getHostCard()) {
public static SpellAbility getChangeStateAllSpell(final AbilityFactory abilityFactory) {
SpellAbility ret = new Spell(abilityFactory.getHostCard()) {
private static final long serialVersionUID = 4217632586060204603L;
@Override
public String getStackDescription() {
return changeStateAllStackDescription(AF, this);
return changeStateAllStackDescription(abilityFactory, this);
}
@Override
public void resolve() {
changeStateAllResolve(AF, this);
changeStateAllResolve(abilityFactory, this);
}
};
@@ -257,26 +260,26 @@ public class AbilityFactory_ChangeState {
/**
* Gets the change state all drawback.
*
* @param AF
* @param abilityFactory
* the aF
* @return the change state all drawback
*/
public static SpellAbility getChangeStateAllDrawback(final AbilityFactory AF) {
Ability_Sub ret = new Ability_Sub(AF.getHostCard(), AF.getAbTgt()) {
public static SpellAbility getChangeStateAllDrawback(final AbilityFactory abilityFactory) {
Ability_Sub ret = new Ability_Sub(abilityFactory.getHostCard(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = 4047514893482113436L;
@Override
public String getStackDescription() {
return changeStateAllStackDescription(AF, this);
return changeStateAllStackDescription(abilityFactory, this);
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
// Gross generalization, but this always considers alternate
// states more powerful
if (AF.getHostCard().isInAlternateState()) {
if (abilityFactory.getHostCard().isInAlternateState()) {
return false;
}
@@ -290,7 +293,7 @@ public class AbilityFactory_ChangeState {
@Override
public void resolve() {
changeStateAllResolve(AF, this);
changeStateAllResolve(abilityFactory, this);
}
};
@@ -298,28 +301,28 @@ public class AbilityFactory_ChangeState {
return ret;
}
private static void changeStateAllResolve(final AbilityFactory AF, final SpellAbility sa) {
HashMap<String, String> params = AF.getMapParams();
private static void changeStateAllResolve(final AbilityFactory abilityFactory, final SpellAbility sa) {
HashMap<String, String> params = abilityFactory.getMapParams();
Card card = sa.getSourceCard();
Target tgt = AF.getAbTgt();
Target tgt = abilityFactory.getAbTgt();
Player targetPlayer = null;
if (tgt != null) {
targetPlayer = tgt.getTargetPlayers().get(0);
}
String Valid = "";
String valid = "";
if (params.containsKey("ValidCards")) {
Valid = params.get("ValidCards");
valid = params.get("ValidCards");
}
// Ugh. If calculateAmount needs to be called with DestroyAll it _needs_
// to use the X variable
// We really need a better solution to this
if (Valid.contains("X")) {
Valid = Valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
if (valid.contains("X")) {
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
}
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
@@ -328,7 +331,7 @@ public class AbilityFactory_ChangeState {
list = list.getController(targetPlayer);
}
list = AbilityFactory.filterListByType(list, Valid, sa);
list = AbilityFactory.filterListByType(list, valid, sa);
boolean remChanged = params.containsKey("RememberChanged");
if (remChanged) {
@@ -336,15 +339,16 @@ public class AbilityFactory_ChangeState {
}
for (int i = 0; i < list.size(); i++) {
if (list.get(i).changeState())
if (list.get(i).changeState()) {
card.addRemembered(list.get(i));
}
}
}
private static String changeStateAllStackDescription(final AbilityFactory AF, final SpellAbility sa) {
private static String changeStateAllStackDescription(final AbilityFactory abilityFactory, final SpellAbility sa) {
Card host = AF.getHostCard();
Map<String, String> params = AF.getMapParams();
Card host = abilityFactory.getHostCard();
Map<String, String> params = abilityFactory.getMapParams();
StringBuilder sb = new StringBuilder();
if (sa instanceof Ability_Sub) {

View File

@@ -138,7 +138,7 @@ public final class AbilityFactory_ChangeZone {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return changeZonePlayDrawbackAI(af, this);
}
@@ -274,7 +274,8 @@ public final class AbilityFactory_ChangeZone {
* a boolean.
* @return a boolean.
*/
private static boolean changeZoneTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean changeZoneTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
HashMap<String, String> params = af.getMapParams();
String origin = params.get("Origin");
@@ -432,7 +433,7 @@ public final class AbilityFactory_ChangeZone {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -477,7 +478,8 @@ public final class AbilityFactory_ChangeZone {
* a boolean.
* @return a boolean.
*/
private static boolean changeHiddenTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean changeHiddenTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
// Fetching should occur fairly often as it helps cast more spells, and
// have access to more mana
@@ -1202,7 +1204,8 @@ public final class AbilityFactory_ChangeZone {
}
// only use blink or bounce effects
if (!(destination.equals(Zone.Exile) && (subAPI.equals("DelayedTrigger") || subAPI.equals("ChangeZone")))
if (!(destination.equals(Zone.Exile) && (subAPI.equals("DelayedTrigger")
|| subAPI.equals("ChangeZone")))
&& !destination.equals(Zone.Hand)) {
return false;
}
@@ -1222,7 +1225,7 @@ public final class AbilityFactory_ChangeZone {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < pct) && chance);
@@ -1298,7 +1301,8 @@ public final class AbilityFactory_ChangeZone {
CardList aiPermanents = list.getController(AllZone.getComputerPlayer());
// if it's blink or bounce, try to save my about to die stuff
if ((destination.equals(Zone.Hand) || (destination.equals(Zone.Exile) && (subAPI.equals("DelayedTrigger") || (subAPI
if ((destination.equals(Zone.Hand) || (destination.equals(Zone.Exile)
&& (subAPI.equals("DelayedTrigger") || (subAPI
.equals("ChangeZone") && subAffected.equals("Remembered")))))
&& tgt.getMinTargets(sa.getSourceCard(), sa) <= 1) {
@@ -1338,8 +1342,7 @@ public final class AbilityFactory_ChangeZone {
aiPermanents = aiPermanents.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
if (c.getNumberOfCounters() > 0)
{
if (c.getNumberOfCounters() > 0) {
return false; // don't blink something with
}
// counters TODO check good and
@@ -1371,7 +1374,8 @@ public final class AbilityFactory_ChangeZone {
// blink human targets only during combat
if (origin.equals(Zone.Battlefield)
&& destination.equals(Zone.Exile)
&& (subAPI.equals("DelayedTrigger") || (subAPI.equals("ChangeZone") && subAffected.equals("Remembered")))
&& (subAPI.equals("DelayedTrigger") || (subAPI.equals("ChangeZone")
&& subAffected.equals("Remembered")))
&& !(AllZone.getPhase().is(Constant.Phase.Combat_Declare_Attackers_InstantAbility) || sa.isAbility())) {
return false;
}
@@ -1909,7 +1913,7 @@ public final class AbilityFactory_ChangeZone {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return changeZoneAllPlayDrawbackAI(af, this);
}
@@ -2054,7 +2058,7 @@ public final class AbilityFactory_ChangeZone {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .8 || sa.isTrigger()) && chance);

View File

@@ -60,22 +60,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseTypeStackDescription(af, this);
return AbilityFactory_Choose.chooseTypeStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return chooseTypeCanPlayAI(af, this);
return AbilityFactory_Choose.chooseTypeCanPlayAI(af, this);
}
@Override
public void resolve() {
chooseTypeResolve(af, this);
AbilityFactory_Choose.chooseTypeResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return chooseTypeTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.chooseTypeTriggerAI(af, this, mandatory);
}
};
@@ -97,17 +97,17 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseTypeStackDescription(af, this);
return AbilityFactory_Choose.chooseTypeStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return chooseTypeCanPlayAI(af, this);
return AbilityFactory_Choose.chooseTypeCanPlayAI(af, this);
}
@Override
public void resolve() {
chooseTypeResolve(af, this);
AbilityFactory_Choose.chooseTypeResolve(af, this);
}
};
@@ -129,22 +129,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseTypeStackDescription(af, this);
return AbilityFactory_Choose.chooseTypeStackDescription(af, this);
}
@Override
public void resolve() {
chooseTypeResolve(af, this);
AbilityFactory_Choose.chooseTypeResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@Override
public boolean doTrigger(final boolean mandatory) {
return chooseTypeTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.chooseTypeTriggerAI(af, this, mandatory);
}
};
@@ -163,8 +163,8 @@ public final class AbilityFactory_Choose {
* @return a {@link java.lang.String} object.
*/
private static String chooseTypeStackDescription(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
StringBuilder sb = new StringBuilder();
final HashMap<String, String> params = af.getMapParams();
final StringBuilder sb = new StringBuilder();
if (!(sa instanceof Ability_Sub)) {
sb.append(sa.getSourceCard()).append(" - ");
@@ -174,19 +174,19 @@ public final class AbilityFactory_Choose {
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player p : tgtPlayers) {
for (final Player p : tgtPlayers) {
sb.append(p).append(" ");
}
sb.append("chooses a type.");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -206,7 +206,7 @@ public final class AbilityFactory_Choose {
* @return a boolean.
*/
private static boolean chooseTypeCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
return chooseTypeTriggerAI(af, sa, false);
return AbilityFactory_Choose.chooseTypeTriggerAI(af, sa, false);
}
/**
@@ -222,20 +222,21 @@ public final class AbilityFactory_Choose {
* a boolean.
* @return a boolean.
*/
private static boolean chooseTypeTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean chooseTypeTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
if (!ComputerUtil.canPayCost(sa)) {
return false;
}
Target tgt = sa.getTarget();
final Target tgt = sa.getTarget();
if (sa.getTarget() != null) {
tgt.resetTargets();
sa.getTarget().addTarget(AllZone.getComputerPlayer());
} else {
ArrayList<Player> tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(),
af.getMapParams().get("Defined"), sa);
for (Player p : tgtPlayers) {
final ArrayList<Player> tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams()
.get("Defined"), sa);
for (final Player p : tgtPlayers) {
if (p.isHuman() && !mandatory) {
return false;
}
@@ -255,35 +256,36 @@ public final class AbilityFactory_Choose {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void chooseTypeResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card card = af.getHostCard();
String type = params.get("Type");
ArrayList<String> invalidTypes = new ArrayList<String>();
final HashMap<String, String> params = af.getMapParams();
final Card card = af.getHostCard();
final String type = params.get("Type");
final ArrayList<String> invalidTypes = new ArrayList<String>();
if (params.containsKey("InvalidTypes")) {
invalidTypes.addAll(Arrays.asList(params.get("InvalidTypes").split(",")));
}
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canTarget(sa)) {
if (type.equals("Card")) {
boolean valid = false;
while (!valid) {
if (sa.getActivatingPlayer().isHuman()) {
Object o = GuiUtils.getChoice("Choose a card type", CardUtil.getCardTypes().toArray());
final Object o = GuiUtils
.getChoice("Choose a card type", CardUtil.getCardTypes().toArray());
if (null == o) {
return;
}
String choice = (String) o;
final String choice = (String) o;
if (CardUtil.isACardType(choice) && !invalidTypes.contains(choice)) {
valid = true;
card.setChosenType(choice);
@@ -301,15 +303,15 @@ public final class AbilityFactory_Choose {
boolean valid = false;
while (!valid) {
if (sa.getActivatingPlayer().isHuman()) {
ArrayList<String> validChoices = CardUtil.getCreatureTypes();
for (String s : invalidTypes) {
final ArrayList<String> validChoices = CardUtil.getCreatureTypes();
for (final String s : invalidTypes) {
validChoices.remove(s);
}
Object o = GuiUtils.getChoice("Choose a creature type", validChoices.toArray());
final Object o = GuiUtils.getChoice("Choose a creature type", validChoices.toArray());
if (null == o) {
return;
}
String choice = (String) o;
final String choice = (String) o;
if (CardUtil.isACreatureType(choice) && !invalidTypes.contains(choice)) {
valid = true;
card.setChosenType(choice);
@@ -317,7 +319,7 @@ public final class AbilityFactory_Choose {
} else {
String chosen = "";
if (params.containsKey("AILogic")) {
String logic = params.get("AILogic");
final String logic = params.get("AILogic");
if (logic.equals("MostProminentOnBattlefield")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZoneUtil
.getCardsIn(Zone.Battlefield));
@@ -354,12 +356,12 @@ public final class AbilityFactory_Choose {
boolean valid = false;
while (!valid) {
if (sa.getActivatingPlayer().isHuman()) {
Object o = GuiUtils.getChoice("Choose a basic land type", CardUtil.getBasicTypes()
final Object o = GuiUtils.getChoice("Choose a basic land type", CardUtil.getBasicTypes()
.toArray());
if (null == o) {
return;
}
String choice = (String) o;
final String choice = (String) o;
if (CardUtil.isABasicLandType(choice) && !invalidTypes.contains(choice)) {
valid = true;
card.setChosenType(choice);
@@ -373,11 +375,12 @@ public final class AbilityFactory_Choose {
boolean valid = false;
while (!valid) {
if (sa.getActivatingPlayer().isHuman()) {
Object o = GuiUtils.getChoice("Choose a land type", CardUtil.getLandTypes().toArray());
final Object o = GuiUtils
.getChoice("Choose a land type", CardUtil.getLandTypes().toArray());
if (null == o) {
return;
}
String choice = (String) o;
final String choice = (String) o;
if (!invalidTypes.contains(choice)) {
valid = true;
card.setChosenType(choice);
@@ -413,22 +416,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseColorStackDescription(af, this);
return AbilityFactory_Choose.chooseColorStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return chooseColorCanPlayAI(af, this);
return AbilityFactory_Choose.chooseColorCanPlayAI(af, this);
}
@Override
public void resolve() {
chooseColorResolve(af, this);
AbilityFactory_Choose.chooseColorResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return chooseColorTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.chooseColorTriggerAI(af, this, mandatory);
}
};
@@ -451,17 +454,17 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseColorStackDescription(af, this);
return AbilityFactory_Choose.chooseColorStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return chooseColorCanPlayAI(af, this);
return AbilityFactory_Choose.chooseColorCanPlayAI(af, this);
}
@Override
public void resolve() {
chooseColorResolve(af, this);
AbilityFactory_Choose.chooseColorResolve(af, this);
}
};
@@ -484,22 +487,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseColorStackDescription(af, this);
return AbilityFactory_Choose.chooseColorStackDescription(af, this);
}
@Override
public void resolve() {
chooseColorResolve(af, this);
AbilityFactory_Choose.chooseColorResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@Override
public boolean doTrigger(final boolean mandatory) {
return chooseColorTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.chooseColorTriggerAI(af, this, mandatory);
}
};
@@ -518,8 +521,8 @@ public final class AbilityFactory_Choose {
* @return a {@link java.lang.String} object.
*/
private static String chooseColorStackDescription(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
StringBuilder sb = new StringBuilder();
final HashMap<String, String> params = af.getMapParams();
final StringBuilder sb = new StringBuilder();
if (!(sa instanceof Ability_Sub)) {
sb.append(sa.getSourceCard()).append(" - ");
@@ -529,14 +532,14 @@ public final class AbilityFactory_Choose {
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
}
for (Player p : tgtPlayers) {
for (final Player p : tgtPlayers) {
sb.append(p).append(" ");
}
sb.append("chooses a color");
@@ -545,7 +548,7 @@ public final class AbilityFactory_Choose {
}
sb.append(".");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -566,7 +569,7 @@ public final class AbilityFactory_Choose {
*/
private static boolean chooseColorCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
// Note: if (AILogic == MostProminentAttackers) return isDuringCombat();
return chooseColorTriggerAI(af, sa, false);
return AbilityFactory_Choose.chooseColorTriggerAI(af, sa, false);
}
/**
@@ -582,7 +585,8 @@ public final class AbilityFactory_Choose {
* a boolean.
* @return a boolean.
*/
private static boolean chooseColorTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean chooseColorTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
return false;
/*
* if (!ComputerUtil.canPayCost(sa)) { return false; }
@@ -609,38 +613,39 @@ public final class AbilityFactory_Choose {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void chooseColorResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card card = af.getHostCard();
final HashMap<String, String> params = af.getMapParams();
final Card card = af.getHostCard();
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canTarget(sa)) {
if (sa.getActivatingPlayer().isHuman()) {
if (params.containsKey("OrColors")) {
List<String> o = GuiUtils.getChoices("Choose a color or colors", Constant.Color.onlyColors);
final List<String> o = GuiUtils.getChoices("Choose a color or colors",
Constant.Color.onlyColors);
card.setChosenColor(new ArrayList<String>(o));
} else {
Object o = GuiUtils.getChoice("Choose a color", Constant.Color.onlyColors);
final Object o = GuiUtils.getChoice("Choose a color", Constant.Color.onlyColors);
if (null == o) {
return;
}
String choice = (String) o;
ArrayList<String> tmpColors = new ArrayList<String>();
final String choice = (String) o;
final ArrayList<String> tmpColors = new ArrayList<String>();
tmpColors.add(choice);
card.setChosenColor(tmpColors);
}
} else {
String chosen = "";
if (params.containsKey("AILogic")) {
String logic = params.get("AILogic");
final String logic = params.get("AILogic");
if (logic.equals("MostProminentInHumanDeck")) {
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame().getController(
AllZone.getHumanPlayer()));
@@ -657,7 +662,7 @@ public final class AbilityFactory_Choose {
chosen = CardFactoryUtil.getMostProminentColor(list);
}
if (logic.equals("MostProminentPermanent")) {
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
chosen = CardFactoryUtil.getMostProminentColor(list);
}
if (logic.equals("MostProminentAttackers")) {
@@ -669,7 +674,7 @@ public final class AbilityFactory_Choose {
chosen = Constant.Color.Green;
}
GuiUtils.getChoice("Computer picked: ", chosen);
ArrayList<String> colorTemp = new ArrayList<String>();
final ArrayList<String> colorTemp = new ArrayList<String>();
colorTemp.add(chosen);
card.setChosenColor(colorTemp);
}
@@ -698,22 +703,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseNumberStackDescription(af, this);
return AbilityFactory_Choose.chooseNumberStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return chooseNumberCanPlayAI(af, this);
return AbilityFactory_Choose.chooseNumberCanPlayAI(af, this);
}
@Override
public void resolve() {
chooseNumberResolve(af, this);
AbilityFactory_Choose.chooseNumberResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return chooseNumberTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.chooseNumberTriggerAI(af, this, mandatory);
}
};
@@ -736,17 +741,17 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseNumberStackDescription(af, this);
return AbilityFactory_Choose.chooseNumberStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return chooseNumberCanPlayAI(af, this);
return AbilityFactory_Choose.chooseNumberCanPlayAI(af, this);
}
@Override
public void resolve() {
chooseNumberResolve(af, this);
AbilityFactory_Choose.chooseNumberResolve(af, this);
}
};
@@ -769,22 +774,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return chooseNumberStackDescription(af, this);
return AbilityFactory_Choose.chooseNumberStackDescription(af, this);
}
@Override
public void resolve() {
chooseNumberResolve(af, this);
AbilityFactory_Choose.chooseNumberResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@Override
public boolean doTrigger(final boolean mandatory) {
return chooseNumberTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.chooseNumberTriggerAI(af, this, mandatory);
}
};
@@ -803,7 +808,7 @@ public final class AbilityFactory_Choose {
* @return a {@link java.lang.String} object.
*/
private static String chooseNumberStackDescription(final AbilityFactory af, final SpellAbility sa) {
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
if (sa instanceof Ability_Sub) {
sb.append(" ");
@@ -813,19 +818,19 @@ public final class AbilityFactory_Choose {
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
}
for (Player p : tgtPlayers) {
for (final Player p : tgtPlayers) {
sb.append(p).append(" ");
}
sb.append("chooses a number.");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -845,7 +850,7 @@ public final class AbilityFactory_Choose {
* @return a boolean.
*/
private static boolean chooseNumberCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
return chooseNumberTriggerAI(af, sa, false);
return AbilityFactory_Choose.chooseNumberTriggerAI(af, sa, false);
}
/**
@@ -861,7 +866,8 @@ public final class AbilityFactory_Choose {
* a boolean.
* @return a boolean.
*/
private static boolean chooseNumberTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean chooseNumberTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
return false;
}
@@ -876,13 +882,13 @@ public final class AbilityFactory_Choose {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void chooseNumberResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card card = af.getHostCard();
int min = params.containsKey("Min") ? Integer.parseInt(params.get("Min")) : 0;
int max = params.containsKey("Max") ? Integer.parseInt(params.get("Max")) : 99;
boolean random = params.containsKey("Random");
final HashMap<String, String> params = af.getMapParams();
final Card card = af.getHostCard();
final int min = params.containsKey("Min") ? Integer.parseInt(params.get("Min")) : 0;
final int max = params.containsKey("Max") ? Integer.parseInt(params.get("Max")) : 99;
final boolean random = params.containsKey("Random");
String[] choices = new String[max + 1];
final String[] choices = new String[max + 1];
if (!random) {
// initialize the array
for (int i = min; i <= max; i++) {
@@ -892,24 +898,24 @@ public final class AbilityFactory_Choose {
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canTarget(sa)) {
if (sa.getActivatingPlayer().isHuman()) {
int chosen;
if (random) {
Random randomGen = new Random();
final Random randomGen = new Random();
chosen = randomGen.nextInt(max - min) + min;
String message = "Randomly chosen number: " + chosen;
final String message = "Randomly chosen number: " + chosen;
JOptionPane.showMessageDialog(null, message, "" + card, JOptionPane.PLAIN_MESSAGE);
} else {
Object o = GuiUtils.getChoice("Choose a number", choices);
final Object o = GuiUtils.getChoice("Choose a number", choices);
if (null == o) {
return;
}
@@ -945,22 +951,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return choosePlayerStackDescription(af, this);
return AbilityFactory_Choose.choosePlayerStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return choosePlayerCanPlayAI(af, this);
return AbilityFactory_Choose.choosePlayerCanPlayAI(af, this);
}
@Override
public void resolve() {
choosePlayerResolve(af, this);
AbilityFactory_Choose.choosePlayerResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return choosePlayerTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.choosePlayerTriggerAI(af, this, mandatory);
}
};
@@ -984,17 +990,17 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return choosePlayerStackDescription(af, this);
return AbilityFactory_Choose.choosePlayerStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return choosePlayerCanPlayAI(af, this);
return AbilityFactory_Choose.choosePlayerCanPlayAI(af, this);
}
@Override
public void resolve() {
choosePlayerResolve(af, this);
AbilityFactory_Choose.choosePlayerResolve(af, this);
}
};
@@ -1018,22 +1024,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return choosePlayerStackDescription(af, this);
return AbilityFactory_Choose.choosePlayerStackDescription(af, this);
}
@Override
public void resolve() {
choosePlayerResolve(af, this);
AbilityFactory_Choose.choosePlayerResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@Override
public boolean doTrigger(final boolean mandatory) {
return choosePlayerTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.choosePlayerTriggerAI(af, this, mandatory);
}
};
@@ -1052,7 +1058,7 @@ public final class AbilityFactory_Choose {
* @return a {@link java.lang.String} object.
*/
private static String choosePlayerStackDescription(final AbilityFactory af, final SpellAbility sa) {
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
if (sa instanceof Ability_Sub) {
sb.append(" ");
@@ -1062,19 +1068,19 @@ public final class AbilityFactory_Choose {
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
}
for (Player p : tgtPlayers) {
for (final Player p : tgtPlayers) {
sb.append(p).append(" ");
}
sb.append("chooses a player.");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -1094,7 +1100,7 @@ public final class AbilityFactory_Choose {
* @return a boolean.
*/
private static boolean choosePlayerCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
return choosePlayerTriggerAI(af, sa, false);
return AbilityFactory_Choose.choosePlayerTriggerAI(af, sa, false);
}
/**
@@ -1110,7 +1116,8 @@ public final class AbilityFactory_Choose {
* a boolean.
* @return a boolean.
*/
private static boolean choosePlayerTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean choosePlayerTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
return false;
}
@@ -1125,29 +1132,29 @@ public final class AbilityFactory_Choose {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void choosePlayerResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card card = af.getHostCard();
final HashMap<String, String> params = af.getMapParams();
final Card card = af.getHostCard();
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
ArrayList<Player> choices = params.containsKey("Choices") ? AbilityFactory.getDefinedPlayers(
final ArrayList<Player> choices = params.containsKey("Choices") ? AbilityFactory.getDefinedPlayers(
sa.getSourceCard(), params.get("Choices"), sa) : new ArrayList<Player>(AllZone.getPlayersInGame());
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canTarget(sa)) {
if (sa.getActivatingPlayer().isHuman()) {
Object o = GuiUtils.getChoice("Choose a player", choices.toArray());
final Object o = GuiUtils.getChoice("Choose a player", choices.toArray());
if (null == o) {
return;
}
Player chosen = (Player) o;
final Player chosen = (Player) o;
card.setChosenPlayer(chosen);
} else {
@@ -1177,22 +1184,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return nameCardStackDescription(af, this);
return AbilityFactory_Choose.nameCardStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return nameCardCanPlayAI(af, this);
return AbilityFactory_Choose.nameCardCanPlayAI(af, this);
}
@Override
public void resolve() {
nameCardResolve(af, this);
AbilityFactory_Choose.nameCardResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return nameCardTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.nameCardTriggerAI(af, this, mandatory);
}
};
@@ -1215,17 +1222,17 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return nameCardStackDescription(af, this);
return AbilityFactory_Choose.nameCardStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return nameCardCanPlayAI(af, this);
return AbilityFactory_Choose.nameCardCanPlayAI(af, this);
}
@Override
public void resolve() {
nameCardResolve(af, this);
AbilityFactory_Choose.nameCardResolve(af, this);
}
};
@@ -1248,22 +1255,22 @@ public final class AbilityFactory_Choose {
@Override
public String getStackDescription() {
return nameCardStackDescription(af, this);
return AbilityFactory_Choose.nameCardStackDescription(af, this);
}
@Override
public void resolve() {
nameCardResolve(af, this);
AbilityFactory_Choose.nameCardResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@Override
public boolean doTrigger(final boolean mandatory) {
return nameCardTriggerAI(af, this, mandatory);
return AbilityFactory_Choose.nameCardTriggerAI(af, this, mandatory);
}
};
@@ -1282,7 +1289,7 @@ public final class AbilityFactory_Choose {
* @return a {@link java.lang.String} object.
*/
private static String nameCardStackDescription(final AbilityFactory af, final SpellAbility sa) {
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
if (sa instanceof Ability_Sub) {
sb.append(" ");
@@ -1292,19 +1299,19 @@ public final class AbilityFactory_Choose {
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
}
for (Player p : tgtPlayers) {
for (final Player p : tgtPlayers) {
sb.append(p).append(" ");
}
sb.append("names a card.");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -1324,7 +1331,7 @@ public final class AbilityFactory_Choose {
* @return a boolean.
*/
private static boolean nameCardCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
return choosePlayerTriggerAI(af, sa, false);
return AbilityFactory_Choose.choosePlayerTriggerAI(af, sa, false);
}
/**
@@ -1356,12 +1363,12 @@ public final class AbilityFactory_Choose {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void nameCardResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card host = af.getHostCard();
final HashMap<String, String> params = af.getMapParams();
final Card host = af.getHostCard();
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
@@ -1375,20 +1382,20 @@ public final class AbilityFactory_Choose {
validDesc = params.get("ValidDesc");
}
for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canTarget(sa)) {
boolean ok = false;
String name = null;
while (!ok) {
if (sa.getActivatingPlayer().isHuman()) {
String message = validDesc.equals("card") ? "Name a card" : "Name a " + validDesc
final String message = validDesc.equals("card") ? "Name a card" : "Name a " + validDesc
+ " card. (Case sensitive)";
name = JOptionPane.showInputDialog(null, message, host.getName(), JOptionPane.QUESTION_MESSAGE);
if (!valid.equals("Card") && !(null == name)) {
try {
Card temp = AllZone.getCardFactory().getCard(name, p);
final Card temp = AllZone.getCardFactory().getCard(name, p);
ok = temp.isValid(valid, host.getController(), host);
} catch (Exception ignored) {
} catch (final Exception ignored) {
ok = false;
}
} else {
@@ -1401,6 +1408,7 @@ public final class AbilityFactory_Choose {
} else {
CardList list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer());
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return !c.isLand();
}

View File

@@ -62,7 +62,7 @@ public final class AbilityFactory_Clash {
@Override
public void resolve() {
clashResolve(af, this);
AbilityFactory_Clash.clashResolve(af, this);
}
};
@@ -105,7 +105,7 @@ public final class AbilityFactory_Clash {
@Override
public void resolve() {
clashResolve(af, this);
AbilityFactory_Clash.clashResolve(af, this);
}
};
@@ -137,7 +137,7 @@ public final class AbilityFactory_Clash {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -153,7 +153,7 @@ public final class AbilityFactory_Clash {
@Override
public void resolve() {
clashResolve(af, this);
AbilityFactory_Clash.clashResolve(af, this);
}
};
@@ -171,16 +171,16 @@ public final class AbilityFactory_Clash {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void clashResolve(final AbilityFactory af, final SpellAbility sa) {
AbilityFactory afOutcomes = new AbilityFactory();
boolean victory = af.getHostCard().getController().clashWithOpponent(af.getHostCard());
final AbilityFactory afOutcomes = new AbilityFactory();
final boolean victory = af.getHostCard().getController().clashWithOpponent(af.getHostCard());
// Run triggers
HashMap<String, Object> runParams = new HashMap<String, Object>();
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Player", af.getHostCard().getController());
if (victory) {
if (af.getMapParams().containsKey("WinSubAbility")) {
SpellAbility win = afOutcomes.getAbility(
final SpellAbility win = afOutcomes.getAbility(
af.getHostCard().getSVar(af.getMapParams().get("WinSubAbility")), af.getHostCard());
win.setActivatingPlayer(af.getHostCard().getController());
((Ability_Sub) win).setParent(sa);
@@ -190,7 +190,7 @@ public final class AbilityFactory_Clash {
runParams.put("Won", "True");
} else {
if (af.getMapParams().containsKey("OtherwiseSubAbility")) {
SpellAbility otherwise = afOutcomes.getAbility(
final SpellAbility otherwise = afOutcomes.getAbility(
af.getHostCard().getSVar(af.getMapParams().get("OtherwiseSubAbility")), af.getHostCard());
otherwise.setActivatingPlayer(af.getHostCard().getController());
((Ability_Sub) otherwise).setParent(sa);
@@ -233,12 +233,12 @@ public final class AbilityFactory_Clash {
@Override
public String getStackDescription() {
return flipGetStackDescription(af, this);
return AbilityFactory_Clash.flipGetStackDescription(af, this);
}
@Override
public void resolve() {
flipResolve(af, this);
AbilityFactory_Clash.flipResolve(af, this);
}
};
@@ -276,12 +276,12 @@ public final class AbilityFactory_Clash {
@Override
public String getStackDescription() {
return flipGetStackDescription(af, this);
return AbilityFactory_Clash.flipGetStackDescription(af, this);
}
@Override
public void resolve() {
flipResolve(af, this);
AbilityFactory_Clash.flipResolve(af, this);
}
};
@@ -313,7 +313,7 @@ public final class AbilityFactory_Clash {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -324,12 +324,12 @@ public final class AbilityFactory_Clash {
@Override
public String getStackDescription() {
return flipGetStackDescription(af, this);
return AbilityFactory_Clash.flipGetStackDescription(af, this);
}
@Override
public void resolve() {
flipResolve(af, this);
AbilityFactory_Clash.flipResolve(af, this);
}
};
@@ -348,11 +348,12 @@ public final class AbilityFactory_Clash {
* @return a {@link java.lang.String} object.
*/
private static String flipGetStackDescription(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card host = af.getHostCard();
Player player = params.containsKey("OpponentCalls") ? host.getController().getOpponent() : host.getController();
final HashMap<String, String> params = af.getMapParams();
final Card host = af.getHostCard();
final Player player = params.containsKey("OpponentCalls") ? host.getController().getOpponent() : host
.getController();
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
if (!(sa instanceof Ability_Sub)) {
sb.append(sa.getSourceCard()).append(" - ");
@@ -362,7 +363,7 @@ public final class AbilityFactory_Clash {
sb.append(player).append(" flips a coin.");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -381,17 +382,17 @@ public final class AbilityFactory_Clash {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void flipResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card host = af.getHostCard();
Player player = host.getController();
final HashMap<String, String> params = af.getMapParams();
final Card host = af.getHostCard();
final Player player = host.getController();
ArrayList<Player> caller = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Caller"), sa);
final ArrayList<Player> caller = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Caller"), sa);
if (caller.size() == 0) {
caller.add(player);
}
AbilityFactory afOutcomes = new AbilityFactory();
boolean victory = GameActionUtil.flipACoin(caller.get(0), sa.getSourceCard());
final AbilityFactory afOutcomes = new AbilityFactory();
final boolean victory = GameActionUtil.flipACoin(caller.get(0), sa.getSourceCard());
// Run triggers
// HashMap<String,Object> runParams = new HashMap<String,Object>();
@@ -405,7 +406,7 @@ public final class AbilityFactory_Clash {
host.addRemembered(host);
}
if (params.containsKey("WinSubAbility")) {
SpellAbility win = afOutcomes.getAbility(host.getSVar(params.get("WinSubAbility")), host);
final SpellAbility win = afOutcomes.getAbility(host.getSVar(params.get("WinSubAbility")), host);
win.setActivatingPlayer(player);
((Ability_Sub) win).setParent(sa);
@@ -417,7 +418,7 @@ public final class AbilityFactory_Clash {
host.addRemembered(host);
}
if (params.containsKey("LoseSubAbility")) {
SpellAbility lose = afOutcomes.getAbility(host.getSVar(params.get("LoseSubAbility")), host);
final SpellAbility lose = afOutcomes.getAbility(host.getSVar(params.get("LoseSubAbility")), host);
lose.setActivatingPlayer(player);
((Ability_Sub) lose).setParent(sa);

View File

@@ -37,7 +37,7 @@ public final class AbilityFactory_Cleanup {
private static final long serialVersionUID = 6192972525033429820L;
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -48,7 +48,7 @@ public final class AbilityFactory_Cleanup {
@Override
public void resolve() {
doResolve(af, this);
AbilityFactory_Cleanup.doResolve(af, this);
}
};
@@ -66,7 +66,7 @@ public final class AbilityFactory_Cleanup {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void doResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
final HashMap<String, String> params = af.getMapParams();
if (params.containsKey("ClearRemembered")) {
sa.getSourceCard().clearRemembered();

View File

@@ -54,21 +54,22 @@ public final class AbilityFactory_Combat {
public String getStackDescription() {
// when getStackDesc is called, just build exactly what is
// happening
return fogStackDescription(af, this);
return AbilityFactory_Combat.fogStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return fogCanPlayAI(af, this);
return AbilityFactory_Combat.fogCanPlayAI(af, this);
}
@Override
public void resolve() {
fogResolve(af, this);
AbilityFactory_Combat.fogResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return fogDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.fogDoTriggerAI(af, this, mandatory);
}
};
@@ -92,16 +93,17 @@ public final class AbilityFactory_Combat {
public String getStackDescription() {
// when getStackDesc is called, just build exactly what is
// happening
return fogStackDescription(af, this);
return AbilityFactory_Combat.fogStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return fogCanPlayAI(af, this);
return AbilityFactory_Combat.fogCanPlayAI(af, this);
}
@Override
public void resolve() {
fogResolve(af, this);
AbilityFactory_Combat.fogResolve(af, this);
}
};
@@ -123,17 +125,17 @@ public final class AbilityFactory_Combat {
@Override
public void resolve() {
fogResolve(af, this);
AbilityFactory_Combat.fogResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
return fogPlayDrawbackAI(af, this);
public boolean chkAIDrawback() {
return AbilityFactory_Combat.fogPlayDrawbackAI(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return fogDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.fogDoTriggerAI(af, this, mandatory);
}
};
@@ -152,7 +154,7 @@ public final class AbilityFactory_Combat {
* @return a {@link java.lang.String} object.
*/
public static String fogStackDescription(final AbilityFactory af, final SpellAbility sa) {
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
if (!(sa instanceof Ability_Sub)) {
sb.append(sa.getSourceCard().getName()).append(" - ");
@@ -163,7 +165,7 @@ public final class AbilityFactory_Combat {
sb.append(sa.getSourceCard().getController());
sb.append(" prevents all combat damage this turn.");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -201,9 +203,9 @@ public final class AbilityFactory_Combat {
return false;
}
Ability_Sub subAb = sa.getSubAbility();
final Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
if (!subAb.chkAI_Drawback()) {
if (!subAb.chkAIDrawback()) {
return false;
}
}
@@ -232,9 +234,9 @@ public final class AbilityFactory_Combat {
chance = AllZone.getPhase().isAfter(Constant.Phase.Combat_Damage);
}
Ability_Sub subAb = sa.getSubAbility();
final Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -267,7 +269,7 @@ public final class AbilityFactory_Combat {
}
// check SubAbilities DoTrigger?
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return chance && abSub.doTrigger(mandatory);
}
@@ -315,22 +317,22 @@ public final class AbilityFactory_Combat {
@Override
public String getStackDescription() {
return mustAttackStackDescription(af, this);
return AbilityFactory_Combat.mustAttackStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return mustAttackCanPlayAI(af, this);
return AbilityFactory_Combat.mustAttackCanPlayAI(af, this);
}
@Override
public void resolve() {
mustAttackResolve(af, this);
AbilityFactory_Combat.mustAttackResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return mustAttackDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.mustAttackDoTriggerAI(af, this, mandatory);
}
};
@@ -352,17 +354,17 @@ public final class AbilityFactory_Combat {
@Override
public String getStackDescription() {
return mustAttackStackDescription(af, this);
return AbilityFactory_Combat.mustAttackStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return mustAttackCanPlayAI(af, this);
return AbilityFactory_Combat.mustAttackCanPlayAI(af, this);
}
@Override
public void resolve() {
mustAttackResolve(af, this);
AbilityFactory_Combat.mustAttackResolve(af, this);
}
};
@@ -384,17 +386,17 @@ public final class AbilityFactory_Combat {
@Override
public void resolve() {
mustAttackResolve(af, this);
AbilityFactory_Combat.mustAttackResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
return mustAttackPlayDrawbackAI(af, this);
public boolean chkAIDrawback() {
return AbilityFactory_Combat.mustAttackPlayDrawbackAI(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return mustAttackDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.mustAttackDoTriggerAI(af, this, mandatory);
}
};
@@ -402,9 +404,9 @@ public final class AbilityFactory_Combat {
}
private static String mustAttackStackDescription(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card host = af.getHostCard();
StringBuilder sb = new StringBuilder();
final HashMap<String, String> params = af.getMapParams();
final Card host = af.getHostCard();
final StringBuilder sb = new StringBuilder();
if (sa instanceof Ability_Sub) {
sb.append(" ");
@@ -416,7 +418,7 @@ public final class AbilityFactory_Combat {
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
@@ -430,13 +432,13 @@ public final class AbilityFactory_Combat {
// TODO - if more needs arise in the future
}
for (Player player : tgtPlayers) {
for (final Player player : tgtPlayers) {
sb.append("Creatures ").append(player).append(" controls attack ");
sb.append(defender).append(" during his or her next turn.");
}
// begin standard post-
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -456,15 +458,16 @@ public final class AbilityFactory_Combat {
// TODO - implement AI
chance = false;
Ability_Sub subAb = sa.getSubAbility();
final Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
}
private static boolean mustAttackDoTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
private static boolean mustAttackDoTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
// If there is a cost payment it's usually not mandatory
if (!ComputerUtil.canPayCost(sa) && !mandatory) {
return false;
@@ -476,7 +479,7 @@ public final class AbilityFactory_Combat {
chance = false;
// check SubAbilities DoTrigger?
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return chance && abSub.doTrigger(mandatory);
}
@@ -485,19 +488,19 @@ public final class AbilityFactory_Combat {
}
private static void mustAttackResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
final HashMap<String, String> params = af.getMapParams();
ArrayList<Player> tgtPlayers;
Target tgt = af.getAbTgt();
if (tgt != null && !params.containsKey("Defined")) {
final Target tgt = af.getAbTgt();
if ((tgt != null) && !params.containsKey("Defined")) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (final Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) {
if ((tgt == null) || p.canTarget(sa)) {
Object entity;
if (params.get("Defender").equals("Self")) {
entity = af.getHostCard();
@@ -532,22 +535,22 @@ public final class AbilityFactory_Combat {
@Override
public String getStackDescription() {
return removeFromCombatStackDescription(af, this);
return AbilityFactory_Combat.removeFromCombatStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return removeFromCombatCanPlayAI(af, this);
return AbilityFactory_Combat.removeFromCombatCanPlayAI(af, this);
}
@Override
public void resolve() {
removeFromCombatResolve(af, this);
AbilityFactory_Combat.removeFromCombatResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return removeFromCombatDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.removeFromCombatDoTriggerAI(af, this, mandatory);
}
};
@@ -569,17 +572,17 @@ public final class AbilityFactory_Combat {
@Override
public String getStackDescription() {
return removeFromCombatStackDescription(af, this);
return AbilityFactory_Combat.removeFromCombatStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return removeFromCombatCanPlayAI(af, this);
return AbilityFactory_Combat.removeFromCombatCanPlayAI(af, this);
}
@Override
public void resolve() {
removeFromCombatResolve(af, this);
AbilityFactory_Combat.removeFromCombatResolve(af, this);
}
};
@@ -601,17 +604,17 @@ public final class AbilityFactory_Combat {
@Override
public void resolve() {
removeFromCombatResolve(af, this);
AbilityFactory_Combat.removeFromCombatResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
return removeFromCombatPlayDrawbackAI(af, this);
public boolean chkAIDrawback() {
return AbilityFactory_Combat.removeFromCombatPlayDrawbackAI(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return removeFromCombatDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.removeFromCombatDoTriggerAI(af, this, mandatory);
}
};
@@ -619,8 +622,8 @@ public final class AbilityFactory_Combat {
}
private static String removeFromCombatStackDescription(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
StringBuilder sb = new StringBuilder();
final HashMap<String, String> params = af.getMapParams();
final StringBuilder sb = new StringBuilder();
if (sa instanceof Ability_Sub) {
sb.append(" ");
@@ -632,7 +635,7 @@ public final class AbilityFactory_Combat {
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
} else {
@@ -641,14 +644,14 @@ public final class AbilityFactory_Combat {
sb.append("Remove ");
for (Card c : tgtCards) {
for (final Card c : tgtCards) {
sb.append(c);
}
sb.append(" from combat.");
// begin standard post-
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -668,9 +671,9 @@ public final class AbilityFactory_Combat {
// TODO - implement AI
chance = false;
Ability_Sub subAb = sa.getSubAbility();
final Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -689,7 +692,7 @@ public final class AbilityFactory_Combat {
chance = false;
// check SubAbilities DoTrigger?
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return chance && abSub.doTrigger(mandatory);
}
@@ -698,19 +701,19 @@ public final class AbilityFactory_Combat {
}
private static void removeFromCombatResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
final HashMap<String, String> params = af.getMapParams();
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
if (tgt != null && !params.containsKey("Defined")) {
final Target tgt = af.getAbTgt();
if ((tgt != null) && !params.containsKey("Defined")) {
tgtCards = tgt.getTargetCards();
} else {
tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa);
}
for (final Card c : tgtCards) {
if (tgt == null || CardFactoryUtil.canTarget(sa, c)) {
if ((tgt == null) || CardFactoryUtil.canTarget(sa, c)) {
AllZone.getCombat().removeFromCombat(c);
}
}
@@ -742,22 +745,22 @@ public final class AbilityFactory_Combat {
@Override
public String getStackDescription() {
return mustBlockStackDescription(af, this);
return AbilityFactory_Combat.mustBlockStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return mustBlockCanPlayAI(af, this);
return AbilityFactory_Combat.mustBlockCanPlayAI(af, this);
}
@Override
public void resolve() {
mustBlockResolve(af, this);
AbilityFactory_Combat.mustBlockResolve(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return mustBlockDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.mustBlockDoTriggerAI(af, this, mandatory);
}
};
@@ -781,17 +784,17 @@ public final class AbilityFactory_Combat {
@Override
public String getStackDescription() {
return mustBlockStackDescription(af, this);
return AbilityFactory_Combat.mustBlockStackDescription(af, this);
}
@Override
public boolean canPlayAI() {
return mustBlockCanPlayAI(af, this);
return AbilityFactory_Combat.mustBlockCanPlayAI(af, this);
}
@Override
public void resolve() {
mustBlockResolve(af, this);
AbilityFactory_Combat.mustBlockResolve(af, this);
}
};
@@ -815,17 +818,17 @@ public final class AbilityFactory_Combat {
@Override
public void resolve() {
mustBlockResolve(af, this);
AbilityFactory_Combat.mustBlockResolve(af, this);
}
@Override
public boolean chkAI_Drawback() {
return mustBlockPlayDrawbackAI(af, this);
public boolean chkAIDrawback() {
return AbilityFactory_Combat.mustBlockPlayDrawbackAI(af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return mustBlockDoTriggerAI(af, this, mandatory);
return AbilityFactory_Combat.mustBlockDoTriggerAI(af, this, mandatory);
}
};
@@ -833,9 +836,9 @@ public final class AbilityFactory_Combat {
}
private static String mustBlockStackDescription(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card host = af.getHostCard();
StringBuilder sb = new StringBuilder();
final HashMap<String, String> params = af.getMapParams();
final Card host = af.getHostCard();
final StringBuilder sb = new StringBuilder();
if (sa instanceof Ability_Sub) {
sb.append(" ");
@@ -847,7 +850,7 @@ public final class AbilityFactory_Combat {
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
} else {
@@ -856,19 +859,19 @@ public final class AbilityFactory_Combat {
String attacker = null;
if (params.containsKey("DefinedAttacker")) {
ArrayList<Card> cards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("DefinedAttacker"),
sa);
final ArrayList<Card> cards = AbilityFactory.getDefinedCards(sa.getSourceCard(),
params.get("DefinedAttacker"), sa);
attacker = cards.get(0).toString();
} else {
attacker = host.toString();
}
for (Card c : tgtCards) {
for (final Card c : tgtCards) {
sb.append(c).append(" must block ").append(attacker).append(" if able.");
}
// begin standard post-
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
@@ -889,18 +892,19 @@ public final class AbilityFactory_Combat {
// TODO - implement AI
chance = false;
Ability_Sub subAb = sa.getSubAbility();
final Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
}
private static boolean mustBlockDoTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
HashMap<String, String> params = af.getMapParams();
private static boolean mustBlockDoTriggerAI(final AbilityFactory af,
final SpellAbility sa, final boolean mandatory) {
final HashMap<String, String> params = af.getMapParams();
final Card source = sa.getSourceCard();
Target abTgt = sa.getTarget();
final Target abTgt = sa.getTarget();
// If there is a cost payment it's usually not mandatory
if (!ComputerUtil.canPayCost(sa) && !mandatory) {
@@ -914,8 +918,8 @@ public final class AbilityFactory_Combat {
Card attacker = null;
if (params.containsKey("DefinedAttacker")) {
ArrayList<Card> cards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("DefinedAttacker"),
sa);
final ArrayList<Card> cards = AbilityFactory.getDefinedCards(sa.getSourceCard(),
params.get("DefinedAttacker"), sa);
if (cards.isEmpty()) {
return false;
}
@@ -937,6 +941,7 @@ public final class AbilityFactory_Combat {
if (abTgt != null) {
list = list.getValidCards(abTgt.getValidTgts(), source.getController(), source);
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
if (!CombatUtil.canBlock(definedAttacker, c)) {
return false;
@@ -951,12 +956,12 @@ public final class AbilityFactory_Combat {
}
});
if (!list.isEmpty()) {
Card blocker = CardFactoryUtil.AI_getBestCreature(list);
final Card blocker = CardFactoryUtil.AI_getBestCreature(list);
if (blocker == null) {
return false;
}
abTgt.addTarget(CardFactoryUtil.AI_getBestCreature(list));
chance = true; // TODO:change this to true, once the human input
chance = true; // TODO change this to true, once the human input
// takes mustblocks into account
}
} else {
@@ -964,7 +969,7 @@ public final class AbilityFactory_Combat {
}
// check SubAbilities DoTrigger?
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return chance && abSub.doTrigger(mandatory);
}
@@ -973,12 +978,12 @@ public final class AbilityFactory_Combat {
}
private static void mustBlockResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams();
Card host = af.getHostCard();
final HashMap<String, String> params = af.getMapParams();
final Card host = af.getHostCard();
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
} else {
@@ -994,8 +999,8 @@ public final class AbilityFactory_Combat {
}
for (final Card c : tgtCards) {
if (tgt == null || CardFactoryUtil.canTarget(sa, c)) {
Card attacker = cards.get(0);
if ((tgt == null) || CardFactoryUtil.canTarget(sa, c)) {
final Card attacker = cards.get(0);
c.addMustBlockCard(attacker);
System.out.println(c + " is adding " + attacker + " to mustBlockCards: " + c.getMustBlockCards());
}

View File

@@ -137,7 +137,7 @@ public final class AbilityFactory_Copy {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -304,7 +304,7 @@ public final class AbilityFactory_Copy {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return abSub.chkAI_Drawback();
return abSub.chkAIDrawback();
}
}
return true;
@@ -573,7 +573,7 @@ public final class AbilityFactory_Copy {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -677,7 +677,7 @@ public final class AbilityFactory_Copy {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return randomReturn && abSub.chkAI_Drawback();
return randomReturn && abSub.chkAIDrawback();
}
}
return randomReturn;

View File

@@ -19,12 +19,12 @@ import forge.card.spellability.Target;
import forge.card.spellability.Target_Selection;
//Destination - send countered spell to: (only applies to Spells; ignored for Abilities)
// -Graveyard (Default)
// -Exile
// -TopOfLibrary
// -Hand
// -BottomOfLibrary
// -ShuffleIntoLibrary
// -Graveyard (Default)
// -Exile
// -TopOfLibrary
// -Hand
// -BottomOfLibrary
// -ShuffleIntoLibrary
//PowerSink - true if the drawback type part of Power Sink should be used
//ExtraActions - this has been removed. All SubAbilitys should now use the standard SubAbility system
@@ -56,13 +56,13 @@ public class AbilityFactory_CounterMagic {
* a {@link forge.card.abilityFactory.AbilityFactory} object.
*/
public AbilityFactory_CounterMagic(final AbilityFactory newAF) {
af = newAF;
params = af.getMapParams();
this.af = newAF;
this.params = this.af.getMapParams();
destination = params.containsKey("Destination") ? params.get("Destination") : "Graveyard";
this.destination = this.params.containsKey("Destination") ? this.params.get("Destination") : "Graveyard";
if (params.containsKey("UnlessCost")) {
unlessCost = params.get("UnlessCost").trim();
if (this.params.containsKey("UnlessCost")) {
this.unlessCost = this.params.get("UnlessCost").trim();
}
}
@@ -72,34 +72,36 @@ public class AbilityFactory_CounterMagic {
* getAbilityCounter.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public final SpellAbility getAbilityCounter(final AbilityFactory AF) {
final SpellAbility abCounter = new Ability_Activated(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
public final SpellAbility getAbilityCounter(final AbilityFactory abilityFactory) {
final SpellAbility abCounter = new Ability_Activated(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = -3895990436431818899L;
@Override
public String getStackDescription() {
// when getStackDesc is called, just build exactly what is
// happening
return counterStackDescription(af, this);
return AbilityFactory_CounterMagic.this.counterStackDescription(AbilityFactory_CounterMagic.this.af,
this);
}
@Override
public boolean canPlayAI() {
return counterCanPlayAI(af, this);
return AbilityFactory_CounterMagic.this.counterCanPlayAI(AbilityFactory_CounterMagic.this.af, this);
}
@Override
public void resolve() {
counterResolve(af, this);
AbilityFactory_CounterMagic.this.counterResolve(AbilityFactory_CounterMagic.this.af, this);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return counterCanPlayAI(af, this);
return AbilityFactory_CounterMagic.this.counterCanPlayAI(AbilityFactory_CounterMagic.this.af, this);
}
};
@@ -111,27 +113,29 @@ public class AbilityFactory_CounterMagic {
* getSpellCounter.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public final SpellAbility getSpellCounter(final AbilityFactory AF) {
final SpellAbility spCounter = new Spell(AF.getHostCard(), AF.getAbCost(), AF.getAbTgt()) {
public final SpellAbility getSpellCounter(final AbilityFactory abilityFactory) {
final SpellAbility spCounter = new Spell(abilityFactory.getHostCard(),
abilityFactory.getAbCost(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = -4272851734871573693L;
@Override
public String getStackDescription() {
return counterStackDescription(af, this);
return AbilityFactory_CounterMagic.this.counterStackDescription(AbilityFactory_CounterMagic.this.af,
this);
}
@Override
public boolean canPlayAI() {
return counterCanPlayAI(af, this);
return AbilityFactory_CounterMagic.this.counterCanPlayAI(AbilityFactory_CounterMagic.this.af, this);
}
@Override
public void resolve() {
counterResolve(af, this);
AbilityFactory_CounterMagic.this.counterResolve(AbilityFactory_CounterMagic.this.af, this);
}
};
@@ -144,37 +148,40 @@ public class AbilityFactory_CounterMagic {
* getDrawbackCounter.
* </p>
*
* @param AF
* @param abilityFactory
* a {@link forge.card.abilityFactory.AbilityFactory} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public final SpellAbility getDrawbackCounter(final AbilityFactory AF) {
final SpellAbility dbCounter = new Ability_Sub(AF.getHostCard(), AF.getAbTgt()) {
public final SpellAbility getDrawbackCounter(final AbilityFactory abilityFactory) {
final SpellAbility dbCounter = new Ability_Sub(abilityFactory.getHostCard(), abilityFactory.getAbTgt()) {
private static final long serialVersionUID = -4272851734871573693L;
@Override
public String getStackDescription() {
return counterStackDescription(af, this);
return AbilityFactory_CounterMagic.this.counterStackDescription(AbilityFactory_CounterMagic.this.af,
this);
}
@Override
public boolean canPlayAI() {
return counterCanPlayAI(af, this);
return AbilityFactory_CounterMagic.this.counterCanPlayAI(AbilityFactory_CounterMagic.this.af, this);
}
@Override
public void resolve() {
counterResolve(af, this);
AbilityFactory_CounterMagic.this.counterResolve(AbilityFactory_CounterMagic.this.af, this);
}
@Override
public boolean chkAI_Drawback() {
return counterDoTriggerAI(af, this, true);
public boolean chkAIDrawback() {
return AbilityFactory_CounterMagic.this.counterDoTriggerAI(AbilityFactory_CounterMagic.this.af, this,
true);
}
@Override
public boolean doTrigger(final boolean mandatory) {
return counterDoTriggerAI(af, this, mandatory);
return AbilityFactory_CounterMagic.this.counterDoTriggerAI(AbilityFactory_CounterMagic.this.af, this,
mandatory);
}
};
@@ -194,7 +201,7 @@ public class AbilityFactory_CounterMagic {
*/
private boolean counterCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
boolean toReturn = true;
Cost abCost = af.getAbCost();
final Cost abCost = af.getAbCost();
final Card source = sa.getSourceCard();
if (AllZone.getStack().size() < 1) {
return false;
@@ -210,10 +217,10 @@ public class AbilityFactory_CounterMagic {
}
}
Target tgt = sa.getTarget();
final Target tgt = sa.getTarget();
if (tgt != null) {
SpellAbility topSA = AllZone.getStack().peekAbility();
final SpellAbility topSA = AllZone.getStack().peekAbility();
if (!CardFactoryUtil.isCounterable(topSA.getSourceCard()) || topSA.getActivatingPlayer().isComputer()) {
return false;
}
@@ -226,16 +233,16 @@ public class AbilityFactory_CounterMagic {
}
}
if (unlessCost != null) {
if (this.unlessCost != null) {
// Is this Usable Mana Sources? Or Total Available Mana?
int usableManaSources = CardFactoryUtil.getUsableManaSources(AllZone.getHumanPlayer());
final int usableManaSources = CardFactoryUtil.getUsableManaSources(AllZone.getHumanPlayer());
int toPay = 0;
boolean setPayX = false;
if (unlessCost.equals("X") && source.getSVar(unlessCost).equals("Count$xPaid")) {
if (this.unlessCost.equals("X") && source.getSVar(this.unlessCost).equals("Count$xPaid")) {
setPayX = true;
toPay = ComputerUtil.determineLeftoverMana(sa);
} else {
toPay = AbilityFactory.calculateAmount(source, unlessCost, sa);
toPay = AbilityFactory.calculateAmount(source, this.unlessCost, sa);
}
if (toPay == 0) {
@@ -245,7 +252,7 @@ public class AbilityFactory_CounterMagic {
if (toPay <= usableManaSources) {
// If this is a reusable Resource, feel free to play it most of
// the time
if (!sa.getPayCosts().isReusuableResource() || MyRandom.random.nextFloat() < .4) {
if (!sa.getPayCosts().isReusuableResource() || (MyRandom.random.nextFloat() < .4)) {
return false;
}
}
@@ -262,9 +269,9 @@ public class AbilityFactory_CounterMagic {
// But really it should be more picky about how it counters things
Ability_Sub subAb = sa.getSubAbility();
final Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
toReturn &= subAb.chkAI_Drawback();
toReturn &= subAb.chkAIDrawback();
}
return toReturn;
@@ -289,9 +296,9 @@ public class AbilityFactory_CounterMagic {
return false;
}
Target tgt = sa.getTarget();
final Target tgt = sa.getTarget();
if (tgt != null) {
SpellAbility topSA = AllZone.getStack().peekAbility();
final SpellAbility topSA = AllZone.getStack().peekAbility();
if (!CardFactoryUtil.isCounterable(topSA.getSourceCard()) || topSA.getActivatingPlayer().isComputer()) {
return false;
}
@@ -303,17 +310,17 @@ public class AbilityFactory_CounterMagic {
return false;
}
Card source = sa.getSourceCard();
if (unlessCost != null) {
final Card source = sa.getSourceCard();
if (this.unlessCost != null) {
// Is this Usable Mana Sources? Or Total Available Mana?
int usableManaSources = CardFactoryUtil.getUsableManaSources(AllZone.getHumanPlayer());
final int usableManaSources = CardFactoryUtil.getUsableManaSources(AllZone.getHumanPlayer());
int toPay = 0;
boolean setPayX = false;
if (unlessCost.equals("X") && source.getSVar(unlessCost).equals("Count$xPaid")) {
if (this.unlessCost.equals("X") && source.getSVar(this.unlessCost).equals("Count$xPaid")) {
setPayX = true;
toPay = ComputerUtil.determineLeftoverMana(sa);
} else {
toPay = AbilityFactory.calculateAmount(source, unlessCost, sa);
toPay = AbilityFactory.calculateAmount(source, this.unlessCost, sa);
}
if (toPay == 0) {
@@ -323,7 +330,7 @@ public class AbilityFactory_CounterMagic {
if (toPay <= usableManaSources) {
// If this is a reusable Resource, feel free to play it most
// of the time
if (!sa.getPayCosts().isReusuableResource() || MyRandom.random.nextFloat() < .4) {
if (!sa.getPayCosts().isReusuableResource() || (MyRandom.random.nextFloat() < .4)) {
return false;
}
}
@@ -341,9 +348,9 @@ public class AbilityFactory_CounterMagic {
// But really it should be more picky about how it counters things
Ability_Sub subAb = sa.getSubAbility();
final Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
toReturn &= subAb.chkAI_Drawback();
toReturn &= subAb.chkAIDrawback();
}
return toReturn;
@@ -365,45 +372,45 @@ public class AbilityFactory_CounterMagic {
// still on the stack
ArrayList<SpellAbility> sas;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
sas = tgt.getTargetSAs();
} else {
sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), params.get("Defined"), sa);
sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), this.params.get("Defined"), sa);
}
if (params.containsKey("ForgetOtherTargets")) {
if (params.get("ForgetOtherTargets").equals("True")) {
if (this.params.containsKey("ForgetOtherTargets")) {
if (this.params.get("ForgetOtherTargets").equals("True")) {
af.getHostCard().clearRemembered();
}
}
for (final SpellAbility tgtSA : sas) {
Card tgtSACard = tgtSA.getSourceCard();
final Card tgtSACard = tgtSA.getSourceCard();
if (tgtSA.isSpell() && tgtSACard.keywordsContain("CARDNAME can't be countered.")) {
continue;
}
SpellAbility_StackInstance si = AllZone.getStack().getInstanceFromSpellAbility(tgtSA);
final SpellAbility_StackInstance si = AllZone.getStack().getInstanceFromSpellAbility(tgtSA);
if (si == null) {
continue;
}
removeFromStack(tgtSA, sa, si);
this.removeFromStack(tgtSA, sa, si);
// Destroy Permanent may be able to be turned into a SubAbility
if (tgtSA.isAbility() && params.containsKey("DestroyPermanent")) {
if (tgtSA.isAbility() && this.params.containsKey("DestroyPermanent")) {
AllZone.getGameAction().destroy(tgtSACard);
}
if (params.containsKey("RememberTargets")) {
if (params.get("RememberTargets").equals("True")) {
if (this.params.containsKey("RememberTargets")) {
if (this.params.get("RememberTargets").equals("True")) {
af.getHostCard().addRemembered(tgtSACard);
}
}
}
}// end counterResolve
} // end counterResolve
/**
* <p>
@@ -418,7 +425,7 @@ public class AbilityFactory_CounterMagic {
*/
private String counterStackDescription(final AbilityFactory af, final SpellAbility sa) {
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
if (!(sa instanceof Ability_Sub)) {
sb.append(sa.getSourceCard().getName()).append(" - ");
@@ -428,11 +435,11 @@ public class AbilityFactory_CounterMagic {
ArrayList<SpellAbility> sas;
Target tgt = af.getAbTgt();
final Target tgt = af.getAbTgt();
if (tgt != null) {
sas = tgt.getTargetSAs();
} else {
sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), params.get("Defined"), sa);
sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), this.params.get("Defined"), sa);
}
sb.append("countering");
@@ -447,19 +454,19 @@ public class AbilityFactory_CounterMagic {
}
}
if (isAbility && params.containsKey("DestroyPermanent")) {
if (isAbility && this.params.containsKey("DestroyPermanent")) {
sb.append(" and destroy it");
}
sb.append(".");
Ability_Sub abSub = sa.getSubAbility();
final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
return sb.toString();
}// end counterStackDescription
} // end counterStackDescription
/**
* <p>
@@ -474,23 +481,25 @@ public class AbilityFactory_CounterMagic {
* a {@link forge.card.spellability.SpellAbility_StackInstance}
* object.
*/
private void removeFromStack(final SpellAbility tgtSA, final SpellAbility srcSA, final SpellAbility_StackInstance si) {
private void removeFromStack(final SpellAbility tgtSA,
final SpellAbility srcSA, final SpellAbility_StackInstance si)
{
AllZone.getStack().remove(si);
if (tgtSA.isAbility()) {
// For Ability-targeted counterspells - do not move it anywhere,
// even if Destination$ is specified.
} else if (destination.equals("Graveyard")) {
} else if (this.destination.equals("Graveyard")) {
AllZone.getGameAction().moveToGraveyard(tgtSA.getSourceCard());
} else if (destination.equals("Exile")) {
} else if (this.destination.equals("Exile")) {
AllZone.getGameAction().exile(tgtSA.getSourceCard());
} else if (destination.equals("TopOfLibrary")) {
} else if (this.destination.equals("TopOfLibrary")) {
AllZone.getGameAction().moveToLibrary(tgtSA.getSourceCard());
} else if (destination.equals("Hand")) {
} else if (this.destination.equals("Hand")) {
AllZone.getGameAction().moveToHand(tgtSA.getSourceCard());
} else if (destination.equals("BottomOfLibrary")) {
} else if (this.destination.equals("BottomOfLibrary")) {
AllZone.getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
} else if (destination.equals("ShuffleIntoLibrary")) {
} else if (this.destination.equals("ShuffleIntoLibrary")) {
AllZone.getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
tgtSA.getSourceCard().getController().shuffle();
} else {
@@ -499,8 +508,8 @@ public class AbilityFactory_CounterMagic {
}
if (!tgtSA.isAbility()) {
System.out.println("Send countered spell to " + destination);
System.out.println("Send countered spell to " + this.destination);
}
}
}// end class AbilityFactory_CounterMagic
} // end class AbilityFactory_CounterMagic

View File

@@ -143,7 +143,7 @@ public class AbilityFactory_Counters {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return putPlayDrawbackAI(af, this);
}
@@ -369,7 +369,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
if (AbilityFactory.playReusable(sa)) {
@@ -453,7 +453,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -788,7 +788,7 @@ public class AbilityFactory_Counters {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return removePlayDrawbackAI(af, this);
}
@@ -926,7 +926,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);
@@ -971,7 +971,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -1168,7 +1168,7 @@ public class AbilityFactory_Counters {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return proliferateShouldPlayAI(this);
}
@@ -1222,7 +1222,7 @@ public class AbilityFactory_Counters {
boolean chance = true;
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
// TODO Make sure Human has poison counters or there are some counters
@@ -1532,7 +1532,7 @@ public class AbilityFactory_Counters {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return putAllPlayDrawbackAI(af, this);
}
@@ -1685,7 +1685,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);
@@ -1840,7 +1840,7 @@ public class AbilityFactory_Counters {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return removeCounterAllPlayDrawbackAI(af, this);
}
@@ -2061,7 +2061,7 @@ public class AbilityFactory_Counters {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return moveCounterPlayDrawbackAI(af, this);
}
@@ -2160,7 +2160,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
if (AbilityFactory.playReusable(sa)) {
@@ -2186,7 +2186,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;

View File

@@ -138,7 +138,7 @@ public class AbilityFactory_DealDamage {
private static final long serialVersionUID = 7239608350643325111L;
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
// Make sure there is a valid target
return damageDrawback(this);
}
@@ -357,7 +357,7 @@ public class AbilityFactory_DealDamage {
Ability_Sub subAb = saMe.getSubAbility();
if (subAb != null) {
rr &= subAb.chkAI_Drawback();
rr &= subAb.chkAIDrawback();
}
return rr;
}
@@ -889,7 +889,7 @@ public class AbilityFactory_DealDamage {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
// check AI life before playing this drawback?
return true;
}
@@ -1017,7 +1017,7 @@ public class AbilityFactory_DealDamage {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);

View File

@@ -138,7 +138,7 @@ public final class AbilityFactory_Debuff {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return debuffDrawbackAI(af, this);
}
@@ -678,7 +678,7 @@ public final class AbilityFactory_Debuff {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return debuffAllChkDrawbackAI(af, this);
}

View File

@@ -104,7 +104,7 @@ public class AbilityFactory_DelayedTrigger {
private static final long serialVersionUID = 6192972525033429820L;
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return doChkAI_Drawback(AF, this);
}
@@ -139,7 +139,7 @@ public class AbilityFactory_DelayedTrigger {
SpellAbility trigsa = tempCreator.getAbility(AF.getHostCard().getSVar(svarName), AF.getHostCard());
if (trigsa instanceof Ability_Sub) {
return ((Ability_Sub) trigsa).chkAI_Drawback();
return ((Ability_Sub) trigsa).chkAIDrawback();
} else {
return trigsa.canPlayAI();
}

View File

@@ -126,7 +126,7 @@ public class AbilityFactory_Destroy {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return false;
}
@@ -175,7 +175,7 @@ public class AbilityFactory_Destroy {
// If NoRegen is not set, filter out creatures that have a
// regeneration shield
if (!noRegen) {
// TODO: filter out things that could regenerate in response?
// TODO filter out things that could regenerate in response?
// might be tougher?
list = list.filter(new CardListFilter() {
public boolean addCard(final Card c) {
@@ -257,7 +257,7 @@ public class AbilityFactory_Destroy {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);
@@ -304,7 +304,7 @@ public class AbilityFactory_Destroy {
// If NoRegen is not set, filter out creatures that have a
// regeneration shield
if (!noRegen) {
// TODO: filter out things that could regenerate in response?
// TODO filter out things that could regenerate in response?
// might be tougher?
preferred = preferred.filter(new CardListFilter() {
public boolean addCard(final Card c) {
@@ -313,8 +313,9 @@ public class AbilityFactory_Destroy {
});
}
for (Card c : preferred)
for (Card c : preferred) {
list.remove(c);
}
while (tgt.getNumTargeted() < tgt.getMaxTargets(sa.getSourceCard(), sa)) {
if (preferred.size() == 0) {
@@ -527,8 +528,8 @@ public class AbilityFactory_Destroy {
final SpellAbility abDestroyAll = new Ability_Activated(af.getHostCard(), af.getAbCost(), af.getAbTgt()) {
private static final long serialVersionUID = -1376444173137861437L;
final HashMap<String, String> params = af.getMapParams();
final boolean noRegen = params.containsKey("NoRegen");
private final HashMap<String, String> params = af.getMapParams();
private final boolean noRegen = params.containsKey("NoRegen");
@Override
public String getStackDescription() {
@@ -567,8 +568,8 @@ public class AbilityFactory_Destroy {
final SpellAbility spDestroyAll = new Spell(af.getHostCard(), af.getAbCost(), af.getAbTgt()) {
private static final long serialVersionUID = -3712659336576469102L;
final HashMap<String, String> params = af.getMapParams();
final boolean noRegen = params.containsKey("NoRegen");
private final HashMap<String, String> params = af.getMapParams();
private final boolean noRegen = params.containsKey("NoRegen");
@Override
public String getStackDescription() {
@@ -606,8 +607,8 @@ public class AbilityFactory_Destroy {
final SpellAbility dbDestroyAll = new Ability_Sub(af.getHostCard(), af.getAbTgt()) {
private static final long serialVersionUID = -242160421677518351L;
final HashMap<String, String> params = af.getMapParams();
final boolean noRegen = params.containsKey("NoRegen");
private final HashMap<String, String> params = af.getMapParams();
private final boolean noRegen = params.containsKey("NoRegen");
@Override
public String getStackDescription() {
@@ -624,7 +625,7 @@ public class AbilityFactory_Destroy {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -651,7 +652,9 @@ public class AbilityFactory_Destroy {
* a boolean.
* @return a {@link java.lang.String} object.
*/
private static String destroyAllStackDescription(final AbilityFactory af, final SpellAbility sa, final boolean noRegen) {
private static String destroyAllStackDescription(final AbilityFactory af,
final SpellAbility sa, final boolean noRegen)
{
StringBuilder sb = new StringBuilder();
String name = af.getHostCard().getName();
@@ -706,17 +709,17 @@ public class AbilityFactory_Destroy {
Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard();
final HashMap<String, String> params = af.getMapParams();
String Valid = "";
String valid = "";
if (params.containsKey("ValidCards")) {
Valid = params.get("ValidCards");
valid = params.get("ValidCards");
}
if (Valid.contains("X") && source.getSVar("X").equals("Count$xPaid")) {
if (valid.contains("X") && source.getSVar("X").equals("Count$xPaid")) {
// Set PayX here to maximum value.
int xPay = ComputerUtil.determineLeftoverMana(sa);
source.setSVar("PayX", Integer.toString(xPay));
Valid = Valid.replace("X", Integer.toString(xPay));
valid = valid.replace("X", Integer.toString(xPay));
}
CardList humanlist = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
@@ -730,8 +733,8 @@ public class AbilityFactory_Destroy {
computerlist.clear();
}
humanlist = humanlist.getValidCards(Valid.split(","), source.getController(), source);
computerlist = computerlist.getValidCards(Valid.split(","), source.getController(), source);
humanlist = humanlist.getValidCards(valid.split(","), source.getController(), source);
computerlist = computerlist.getValidCards(valid.split(","), source.getController(), source);
humanlist = humanlist.getNotKeyword("Indestructible");
computerlist = computerlist.getNotKeyword("Indestructible");
@@ -754,7 +757,7 @@ public class AbilityFactory_Destroy {
.evaluateCreatureList(humanlist)) {
return false;
}
}// only lands involved
} // only lands involved
else if (humanlist.getNotType("Land").size() == 0 && computerlist.getNotType("Land").size() == 0) {
if (CardFactoryUtil.evaluatePermanentList(computerlist) + 1 >= CardFactoryUtil
.evaluatePermanentList(humanlist)) {
@@ -769,7 +772,7 @@ public class AbilityFactory_Destroy {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .9667) && chance);
@@ -798,17 +801,17 @@ public class AbilityFactory_Destroy {
targetPlayer = tgt.getTargetPlayers().get(0);
}
String Valid = "";
String valid = "";
if (params.containsKey("ValidCards")) {
Valid = params.get("ValidCards");
valid = params.get("ValidCards");
}
// Ugh. If calculateAmount needs to be called with DestroyAll it _needs_
// to use the X variable
// We really need a better solution to this
if (Valid.contains("X")) {
Valid = Valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
if (valid.contains("X")) {
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
}
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
@@ -817,7 +820,7 @@ public class AbilityFactory_Destroy {
list = list.getController(targetPlayer);
}
list = AbilityFactory.filterListByType(list, Valid, sa);
list = AbilityFactory.filterListByType(list, valid, sa);
boolean remDestroyed = params.containsKey("RememberDestroyed");
if (remDestroyed) {
@@ -832,10 +835,11 @@ public class AbilityFactory_Destroy {
}
} else {
for (int i = 0; i < list.size(); i++) {
if (AllZone.getGameAction().destroy(list.get(i)) && remDestroyed)
if (AllZone.getGameAction().destroy(list.get(i)) && remDestroyed) {
card.addRemembered(list.get(i));
}
}
}
}
}// end class AbilityFactory_Destroy
} // end class AbilityFactory_Destroy

View File

@@ -135,7 +135,7 @@ public class AbilityFactory_Effect {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}

View File

@@ -143,7 +143,7 @@ public final class AbilityFactory_EndGameCondition {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -379,7 +379,7 @@ public final class AbilityFactory_EndGameCondition {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}

View File

@@ -188,7 +188,7 @@ public class AbilityFactory_GainControl {
} // resolve
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return gainControlDrawbackAI(this);
}

View File

@@ -165,7 +165,7 @@ public class AbilityFactory_Mana {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -868,7 +868,7 @@ public class AbilityFactory_Mana {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return drainManaPlayDrawbackAI(af, this);
}
@@ -966,7 +966,7 @@ public class AbilityFactory_Mana {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -1046,7 +1046,7 @@ public class AbilityFactory_Mana {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;

View File

@@ -133,7 +133,7 @@ public class AbilityFactory_PermanentState {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return untapPlayDrawbackAI(af, this);
}
@@ -237,7 +237,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -315,7 +315,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -691,7 +691,7 @@ public class AbilityFactory_PermanentState {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return tapPlayDrawbackAI(af, this);
}
@@ -807,7 +807,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -884,7 +884,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -1208,7 +1208,7 @@ public class AbilityFactory_PermanentState {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return untapAllPlayDrawbackAI(af, this);
}
@@ -1434,7 +1434,7 @@ public class AbilityFactory_PermanentState {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return tapAllPlayDrawbackAI(af, this);
}
@@ -1767,7 +1767,7 @@ public class AbilityFactory_PermanentState {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return tapOrUntapPlayDrawbackAI(af, this);
}
@@ -1874,7 +1874,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -1951,7 +1951,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -2101,7 +2101,7 @@ public class AbilityFactory_PermanentState {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return phasesPlayDrawbackAI(af, this);
}
@@ -2202,7 +2202,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -2269,7 +2269,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;

View File

@@ -134,7 +134,7 @@ public class AbilityFactory_PreventDamage {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -344,7 +344,7 @@ public class AbilityFactory_PreventDamage {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;

View File

@@ -141,7 +141,7 @@ public final class AbilityFactory_Protection {
} // resolve
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return protectDrawbackAI(af, this);
}
@@ -898,7 +898,7 @@ public final class AbilityFactory_Protection {
} // resolve
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return protectAllDrawbackAI(af, this);
}

View File

@@ -178,7 +178,7 @@ public class AbilityFactory_Pump {
}// resolve
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return pumpDrawbackAI(this);
}
@@ -1037,7 +1037,7 @@ public class AbilityFactory_Pump {
}// resolve
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return pumpAllChkDrawbackAI(this);
}

View File

@@ -138,7 +138,7 @@ public class AbilityFactory_Regenerate {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -314,7 +314,7 @@ public class AbilityFactory_Regenerate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -567,7 +567,7 @@ public class AbilityFactory_Regenerate {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -687,7 +687,7 @@ public class AbilityFactory_Regenerate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;

View File

@@ -139,7 +139,7 @@ public final class AbilityFactory_Reveal {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -259,7 +259,7 @@ public final class AbilityFactory_Reveal {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return randomReturn && abSub.chkAI_Drawback();
return randomReturn && abSub.chkAIDrawback();
}
}
@@ -671,7 +671,7 @@ public final class AbilityFactory_Reveal {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -809,7 +809,7 @@ public final class AbilityFactory_Reveal {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return randomReturn && abSub.chkAI_Drawback();
return randomReturn && abSub.chkAIDrawback();
}
}
@@ -1032,7 +1032,7 @@ public final class AbilityFactory_Reveal {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return revealHandTargetAI(af, this, false, false);
}
@@ -1145,7 +1145,7 @@ public final class AbilityFactory_Reveal {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}
@@ -1365,7 +1365,7 @@ public final class AbilityFactory_Reveal {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return scryTargetAI(af, this);
}
@@ -1534,7 +1534,7 @@ public final class AbilityFactory_Reveal {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return randomReturn && abSub.chkAI_Drawback();
return randomReturn && abSub.chkAIDrawback();
}
}
return randomReturn;
@@ -1646,7 +1646,7 @@ public final class AbilityFactory_Reveal {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return false;
}
@@ -1949,7 +1949,7 @@ public final class AbilityFactory_Reveal {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
// reuse code from RevealHand
return revealHandTargetAI(af, this, false, false);
}
@@ -2068,7 +2068,7 @@ public final class AbilityFactory_Reveal {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}

View File

@@ -122,7 +122,7 @@ public class AbilityFactory_Sacrifice {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return sacrificePlayDrawbackAI(af, this);
}
@@ -257,7 +257,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -282,7 +282,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance;
@@ -318,7 +318,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return chance || mandatory;
@@ -627,7 +627,7 @@ public class AbilityFactory_Sacrifice {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}
@@ -763,7 +763,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
chance &= subAb.chkAI_Drawback();
chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .9667) && chance);

View File

@@ -203,7 +203,7 @@ public class AbilityFactory_Token extends AbilityFactory {
private static final long serialVersionUID = 7239608350643325111L;
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}

View File

@@ -119,7 +119,7 @@ public class AbilityFactory_Turns {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return true;
}

View File

@@ -132,7 +132,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return drawTargetAI(af, this, false, false);
}
@@ -299,7 +299,7 @@ public class AbilityFactory_ZoneAffecting {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}
@@ -626,7 +626,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return millDrawback(af, this);
}
@@ -860,7 +860,7 @@ public class AbilityFactory_ZoneAffecting {
// check SubAbilities DoTrigger?
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
return abSub.chkAI_Drawback();
return abSub.chkAIDrawback();
}
return true;
@@ -1051,7 +1051,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return discardCheckDrawbackAI(af, this);
}
@@ -1424,7 +1424,7 @@ public class AbilityFactory_ZoneAffecting {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
randomReturn &= subAb.chkAI_Drawback();
randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}// discardCanPlayAI()
@@ -1602,7 +1602,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return shuffleTargetAI(af, this, false, false);
}

View File

@@ -627,7 +627,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
private static final long serialVersionUID = 7202704600935499188L;
public void execute() {
ability.setStackDescription("As Sarpadian Empires, Vol. VII enters the battlefield, choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.");
ability.setStackDescription("As Sarpadian Empires, Vol. VII enters the battlefield, "
+ "choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.");
AllZone.getStack().addSimultaneousStackEntry(ability);
@@ -665,7 +666,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
};
Input soilTarget = new Input() {
boolean once = false;
private boolean once = false;
private static final long serialVersionUID = 8243511353958609599L;
@Override
@@ -907,7 +908,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
private static final long serialVersionUID = -7679939432259603542L;
public void execute() {
ability.setStackDescription("If Mox Diamond would enter the battlefield, you may discard a land card instead. If you do, put Mox Diamond onto the battlefield. If you don't, put it into its owner's graveyard.");
ability.setStackDescription("If Mox Diamond would enter the battlefield, you may "
+ "discard a land card instead. If you do, put Mox Diamond onto the battlefield. "
+ "If you don't, put it into its owner's graveyard.");
AllZone.getStack().addSimultaneousStackEntry(ability);
}
@@ -1012,9 +1015,12 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
StringBuilder sb = new StringBuilder();
sb.append(abCost);
sb.append("Reveal cards from the top of your library until you reveal a land card. Goblin Charbelcher deals damage equal ");
sb.append("to the number of nonland cards revealed this way to target creature or player. If the revealed land card was a Mountain, ");
sb.append("Goblin Charbelcher deals double that damage instead. Put the revealed cards on the bottom of your library in any order.");
sb.append("Reveal cards from the top of your library until you reveal a land card. "
+ "Goblin Charbelcher deals damage equal ");
sb.append("to the number of nonland cards revealed this way to target creature or player. "
+ "If the revealed land card was a Mountain, ");
sb.append("Goblin Charbelcher deals double that damage instead. Put the revealed cards on "
+ "the bottom of your library in any order.");
ability.setDescription(sb.toString());
ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
@@ -1101,7 +1107,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
}; // ability
ability.setDescription(abCost
+ "Put up to four target basic land cards from a player's graveyard on top of his or her library in any order. That player draws a card at the beginning of the next turn's upkeep.");
+ "Put up to four target basic land cards from a player's graveyard on top of his "
+ "or her library in any order. That player draws a card at "
+ "the beginning of the next turn's upkeep.");
card.addSpellAbility(ability);
} // *************** END ************ END **************************
@@ -1152,7 +1160,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
};
ab1.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
ab1.setDescription(abCost
+ "Put the top two cards of target player's library into that player's graveyard. If both cards share a color, repeat this process.");
+ "Put the top two cards of target player's library into that player's graveyard. "
+ "If both cards share a color, repeat this process.");
card.addSpellAbility(ab1);
} // *************** END ************ END **************************
@@ -1307,7 +1316,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
if (card.getController().isHuman()) {
AllZone.getInputControl().setInput(new Input() {
private static final long serialVersionUID = -2305549394512889450L;
CardList exiled = new CardList();
private CardList exiled = new CardList();
@Override
public void showMessage() {
@@ -1371,7 +1380,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
}
}; // ability
ability.setDescription(abCost
+ "Exile any number of cards from your hand face down. Put that many cards from the top of your library into your hand. Then look at the exiled cards and put them on top of your library in any order.");
+ "Exile any number of cards from your hand face down. Put that many cards "
+ "from the top of your library into your hand. Then look at the exiled cards "
+ "and put them on top of your library in any order.");
ability.setStackDescription(cardName + " - exile any number of cards from your hand.");
card.addSpellAbility(ability);
} // *************** END ************ END **************************
@@ -1433,7 +1444,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
ability.setStackDescription(sbStack.toString());
ability.setDescription(abCost
+ "Name a card. Reveal a card at random from your hand. If it's the named card, CARDNAME deals 2 damage to target creature or player.");
+ "Name a card. Reveal a card at random from your hand. If it's the named card, "
+ "CARDNAME deals 2 damage to target creature or player.");
ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
card.addSpellAbility(ability);
@@ -1531,7 +1543,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Shuffle your library, then reveal the top card. ");
sbDesc.append("Until end of turn, for as long as that card remains on top of your library, play with the top card of your library revealed ");
sbDesc.append("Until end of turn, for as long as that card remains on top of your library, "
+ "play with the top card of your library revealed ");
sbDesc.append("and you may play that card without paying its mana cost. ");
sbDesc.append("(If it has X in its mana cost, X is 0.)");
ability.setDescription(abCost + sbDesc.toString());
@@ -1599,7 +1612,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
private static final long serialVersionUID = -572849470457911366L;
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return false;
}
@@ -1640,7 +1653,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
};
ability.setSubAbility(sub);
ability.setDescription(abCost
+ "Choose target creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its power to the other.");
+ "Choose target creature you control and target creature an opponent controls. "
+ "Each of those creatures deals damage equal to its power to the other.");
ability.setStackDescription(card + " - Each creature deals damage equal to its power to the other.");
card.addSpellAbility(ability);
} // *************** END ************ END **************************
@@ -1738,7 +1752,11 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
else if (cardName.equals("Sylvan Library")) {
final Trigger drawStepTrigger = forge.card.trigger.TriggerHandler
.parseTrigger(
"Mode$ Phase | Phase$ Draw | ValidPlayer$ You | OptionalDecider$ You | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ At the beginning of your draw step, you may draw two additional cards. If you do, choose two cards in your hand drawn this turn. For each of those cards, pay 4 life or put the card on top of your library.",
"Mode$ Phase | Phase$ Draw | ValidPlayer$ You | OptionalDecider$ You | "
+ "TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ At the beginning of "
+ "your draw step, you may draw two additional cards. If you do, choose two "
+ "cards in your hand drawn this turn. For each of those cards, "
+ "pay 4 life or put the card on top of your library.",
card, true);
final Ability ability = new Ability(card, "") {
@Override
@@ -1763,8 +1781,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (zone.is(Constant.Zone.Hand) && true == card.getDrawnThisTurn()) {
if (player.canPayLife(4) && GameActionUtil.showYesNoDialog(card, cardQuestion)) {
if (zone.is(Constant.Zone.Hand) && card.getDrawnThisTurn()) {
if (player.canPayLife(4) && GameActionUtil
.showYesNoDialog(card, cardQuestion)) {
player.payLife(4, card);
// card stays in hand
} else {
@@ -1782,7 +1801,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
}; // Ability
StringBuilder sb = new StringBuilder();
sb.append("At the beginning of your draw step, you may draw two additional cards. If you do, choose two cards in your hand drawn this turn. For each of those cards, pay 4 life or put the card on top of your library.");
sb.append("At the beginning of your draw step, you may draw two additional cards. "
+ "If you do, choose two cards in your hand drawn this turn. For each of those cards, "
+ "pay 4 life or put the card on top of your library.");
ability.setStackDescription(sb.toString());
drawStepTrigger.setOverridingAbility(ability);

File diff suppressed because it is too large Load Diff

View File

@@ -191,7 +191,7 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Gilder Bairn")) {
Cost abCost = new Cost("2 GU Untap", cardName, true);
Target tgt = new Target(card, "Select target permanent.", new String[] {"Permanent"});
Target tgt = new Target(card, "Select target permanent.", new String[] { "Permanent" });
final Ability_Activated a1 = new Ability_Activated(card, abCost, tgt) {
private static final long serialVersionUID = -1847685865277129366L;
@@ -203,9 +203,9 @@ public class CardFactory_Creatures {
return;
} else if (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
// zerker clean up:
for (Counters c_1 : Counters.values()) {
if (c.getCounters(c_1) > 0) {
c.addCounter(c_1, c.getCounters(c_1));
for (Counters c1 : Counters.values()) {
if (c.getCounters(c1) > 0) {
c.addCounter(c1, c.getCounters(c1));
}
}
}
@@ -248,7 +248,7 @@ public class CardFactory_Creatures {
@Override
public void resolve() {
String choice = "";
String[] choices = {"3/3", "2/2 with flying", "1/6 with defender"};
String[] choices = { "3/3", "2/2 with flying", "1/6 with defender" };
if (card.getController().isHuman()) {
choice = GuiUtils.getChoice("Choose one", choices);
@@ -438,8 +438,8 @@ public class CardFactory_Creatures {
}
};
ability.setStackDescription(
"When Sleeper Agent enters the battlefield, target opponent gains control of it.");
ability.setStackDescription("When Sleeper Agent enters the battlefield, "
+ "target opponent gains control of it.");
Command intoPlay = new Command() {
private static final long serialVersionUID = -3934471871041458847L;
@@ -509,8 +509,7 @@ public class CardFactory_Creatures {
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (card.isArtifact() && zone.is(Constant.Zone.Battlefield)
&& card.getController().isHuman())
{
&& card.getController().isHuman()) {
ability.setTargetCard(card);
AllZone.getStack().add(ability);
stop();
@@ -527,8 +526,8 @@ public class CardFactory_Creatures {
} else { // computer
Object o = getArt.execute();
if (o != null)// should never happen, but just in case
{
// should never happen, but just in case
if (o != null) {
ability.setTargetCard((Card) o);
AllZone.getStack().addSimultaneousStackEntry(ability);
@@ -828,8 +827,8 @@ public class CardFactory_Creatures {
color[0] = Constant.Color.White;
int max = list.getKeywordsContain(color[0]).size();
String[] colors = {Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red,
Constant.Color.Green};
String[] colors = { Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red,
Constant.Color.Green };
for (String c : colors) {
int cmp = list.getKeywordsContain(c).size();
if (cmp > max) {
@@ -867,8 +866,8 @@ public class CardFactory_Creatures {
@Override
public void resolve() {
CardList cl = CardFactoryUtil.makeToken("Stangg Twin", "RG 3 4 Stangg Twin", card.getController(),
"R G", new String[] {"Legendary", "Creature", "Human", "Warrior" }, 3, 4,
new String[] {""});
"R G", new String[] { "Legendary", "Creature", "Human", "Warrior" }, 3, 4,
new String[] { "" });
cl.get(0).addLeavesPlayCommand(new Command() {
private static final long serialVersionUID = 3367390368512271319L;
@@ -881,9 +880,9 @@ public class CardFactory_Creatures {
});
}
};
ability.setStackDescription(
"When Stangg enters the battlefield, if Stangg is on the battlefield, "
+ "put a legendary 3/4 red and green Human Warrior creature token named Stangg Twin onto the battlefield.");
ability.setStackDescription("When Stangg enters the battlefield, if Stangg is on the battlefield, "
+ "put a legendary 3/4 red and green Human Warrior creature token "
+ "named Stangg Twin onto the battlefield.");
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = 6667896040611028600L;
@@ -951,10 +950,10 @@ public class CardFactory_Creatures {
}; // SpellAbility
card.addSpellAbility(ability);
ability.setDescription(
"W U B R G: You may play target Elemental card from your graveyard without paying its mana cost.");
ability.setStackDescription(
"Horde of Notions - play Elemental card from graveyard without paying its mana cost.");
ability.setDescription("W U B R G: You may play target Elemental card from "
+ "your graveyard without paying its mana cost.");
ability.setStackDescription("Horde of Notions - play Elemental card from "
+ "graveyard without paying its mana cost.");
ability.setBeforePayMana(new Input_PayManaCost(ability));
} // *************** END ************ END **************************
@@ -983,14 +982,12 @@ public class CardFactory_Creatures {
};
card.addSpellAbility(copyTokens1);
copyTokens1
.setDescription(abCost
+ "For each creature token you control, "
+ "put a token that's a copy of that creature onto the battlefield.");
copyTokens1.setDescription(abCost + "For each creature token you control, "
+ "put a token that's a copy of that creature onto the battlefield.");
StringBuilder sb = new StringBuilder();
sb.append(card.getName())
.append(" - For each creature token you control, "
+ "put a token that's a copy of that creature onto the battlefield.");
sb.append(card.getName()).append(
" - For each creature token you control, "
+ "put a token that's a copy of that creature onto the battlefield.");
copyTokens1.setStackDescription(sb.toString());
} // *************** END ************ END **************************
@@ -1003,7 +1000,7 @@ public class CardFactory_Creatures {
public void resolve() {
int lifeGain = 0;
if (card.getController().isHuman()) {
String[] choices = {"white", "blue", "black", "red", "green"};
String[] choices = { "white", "blue", "black", "red", "green" };
Object o = GuiUtils.getChoiceOptional("Select Color: ", choices);
Log.debug("Treva, the Renewer", "Color:" + o);
lifeGain = CardFactoryUtil.getNumberOfPermanentsByColor((String) o);
@@ -1023,7 +1020,7 @@ public class CardFactory_Creatures {
return false;
}
}; // ability2
// card.clearSpellAbility();
// card.clearSpellAbility();
card.addSpellAbility(ability2);
StringBuilder sb2 = new StringBuilder();
@@ -1161,7 +1158,7 @@ public class CardFactory_Creatures {
if (damageableWolves.size() == 0) {
// can't damage
// anything
// anything
return;
}
@@ -1223,8 +1220,7 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Shifting Wall") || cardName.equals("Maga, Traitor to Mortals")
|| cardName.equals("Feral Hydra") || cardName.equals("Krakilin") || cardName.equals("Ivy Elemental")
|| cardName.equals("Lightning Serpent"))
{
|| cardName.equals("Lightning Serpent")) {
SpellAbility spell = new Spell_Permanent(card) {
private static final long serialVersionUID = 7708945715867177172L;
@@ -1252,13 +1248,13 @@ public class CardFactory_Creatures {
@Override
public void resolve() {
int XCounters = card.getXManaCostPaid();
int xCounters = card.getXManaCostPaid();
Card c = AllZone.getGameAction().moveToPlay(getSourceCard());
if (XCounters >= 5) {
XCounters = 2 * XCounters;
if (xCounters >= 5) {
xCounters = 2 * xCounters;
}
c.addCounter(Counters.P1P1, XCounters);
c.addCounter(Counters.P1P1, xCounters);
}
};
// Do not remove SpellAbilities created by AbilityFactory or
@@ -1313,8 +1309,7 @@ public class CardFactory_Creatures {
int total = card.getCounters(Counters.P1P1);
if (getTargetCard() != null) {
if (AllZoneUtil.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard()))
{
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
getTargetCard().addDamage(total, card);
}
} else {
@@ -1329,11 +1324,11 @@ public class CardFactory_Creatures {
StringBuilder sb = new StringBuilder();
sb.append(abCost + "Remove all +1/+1 counters from " + cardName + ": " + cardName);
sb.append(" deals damage to target creature or player equal to the "
+ "number of +1/+1 counters removed this way.");
+ "number of +1/+1 counters removed this way.");
ability2.setDescription(sb.toString());
ability2.setStackDescription("Molten Hydra deals damage to number of "
+ "+1/+1 counters on it to target creature or player.");
+ "+1/+1 counters on it to target creature or player.");
} // *************** END ************ END **************************
// *************** START *********** START **************************
@@ -1370,8 +1365,8 @@ public class CardFactory_Creatures {
if (c.isAura()) {
String[] enchantThisType = {""};
String[] message = {""};
String[] enchantThisType = { "" };
String[] message = { "" };
// The type following "Enchant" maybe
// upercase or lowercase, cardsfolder
@@ -1379,13 +1374,12 @@ public class CardFactory_Creatures {
// Note that I am being overly cautious.
if (c.hasKeyword("Enchant creature without flying")
|| c.hasKeyword("Enchant Creature without flying"))
{
|| c.hasKeyword("Enchant Creature without flying")) {
enchantThisType[0] = "Creature.withoutFlying";
message[0] = "Select a creature without flying";
} else if (c.hasKeyword("Enchant creature with converted mana cost 2 or less")
|| c.hasKeyword("Enchant Creature with converted mana cost 2 or less"))
{
|| c.hasKeyword("Enchant Creature with "
+ "converted mana cost 2 or less")) {
enchantThisType[0] = "Creature.cmcLE2";
message[0] = "Select a creature with converted mana cost 2 or less";
} else if (c.hasKeyword("Enchant red or green creature")) {
@@ -1394,8 +1388,8 @@ public class CardFactory_Creatures {
} else if (c.hasKeyword("Enchant tapped creature")) {
enchantThisType[0] = "Creature.tapped";
message[0] = "Select a tapped creature";
} else if (c.hasKeyword("Enchant creature") || c.hasKeyword("Enchant Creature"))
{
} else if (c.hasKeyword("Enchant creature")
|| c.hasKeyword("Enchant Creature")) {
enchantThisType[0] = "Creature";
message[0] = "Select a creature";
} else if (c.hasKeyword("Enchant wall") || c.hasKeyword("Enchant Wall")) {
@@ -1408,8 +1402,8 @@ public class CardFactory_Creatures {
} else if (c.hasKeyword("Enchant land") || c.hasKeyword("Enchant Land")) {
enchantThisType[0] = "Land";
message[0] = "Select a land";
} else if (c.hasKeyword("Enchant artifact") || c.hasKeyword("Enchant Artifact"))
{
} else if (c.hasKeyword("Enchant artifact")
|| c.hasKeyword("Enchant Artifact")) {
enchantThisType[0] = "Artifact";
message[0] = "Select an artifact";
} else if (c.hasKeyword("Enchant enchantment")
@@ -1457,8 +1451,8 @@ public class CardFactory_Creatures {
}); // Input()
} // if we were able to match the
// selected aura with our list of
// criteria
// selected aura with our list of
// criteria
} // If enchantment selected is an aura
} // If an enchantment is selected
} // If there are enchantments in library
@@ -1562,7 +1556,7 @@ public class CardFactory_Creatures {
public void execute() {
ability.setStackDescription("Kinsbaile Borderguard enters "
+ "the battlefield with a +1/+1 counter on it for each other Kithkin you control.");
+ "the battlefield with a +1/+1 counter on it for each other Kithkin you control.");
AllZone.getStack().addSimultaneousStackEntry(ability);
}
@@ -1578,7 +1572,7 @@ public class CardFactory_Creatures {
public void makeToken() {
CardFactoryUtil.makeToken("Kithkin Soldier", "W 1 1 Kithkin Soldier", card.getController(), "W",
new String[] {"Creature", "Kithkin", "Soldier"}, 1, 1, new String[] {""});
new String[] { "Creature", "Kithkin", "Soldier" }, 1, 1, new String[] { "" });
}
};
@@ -1587,7 +1581,7 @@ public class CardFactory_Creatures {
public void execute() {
ability2.setStackDescription("When Kinsbaile Borderguard "
+ "is put into a graveyard from play, put a 1/1 white "
+ "is put into a graveyard from play, put a 1/1 white "
+ "Kithkin Soldier creature token onto the battlefield for each counter on it.");
AllZone.getStack().addSimultaneousStackEntry(ability2);
@@ -1656,8 +1650,7 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Gnarlid Pack") || cardName.equals("Apex Hawks") || cardName.equals("Enclave Elite")
|| cardName.equals("Quag Vampires") || cardName.equals("Skitter of Lizards")
|| cardName.equals("Joraga Warcaller"))
{
|| cardName.equals("Joraga Warcaller")) {
final Ability_Static ability = new Ability_Static(card, "0") {
@Override
public void resolve() {
@@ -1888,7 +1881,7 @@ public class CardFactory_Creatures {
public void resolve() {
AllZone.getInputControl().setInput(new Input() {
private static final long serialVersionUID = 6150236529653275947L;
CardList revealed = new CardList();
private CardList revealed = new CardList();
@Override
public void showMessage() {
@@ -1943,8 +1936,7 @@ public class CardFactory_Creatures {
} // resolve()
}; // SpellAbility
ability.setDescription(abCost
+ "Reveal any number of artifact cards in your hand. "
ability.setDescription(abCost + "Reveal any number of artifact cards in your hand. "
+ "Add 2 to your mana pool for each card revealed this way.");
ability.setStackDescription(cardName + " - Reveal any number of artifact cards in your hand.");
card.addSpellAbility(ability);
@@ -2022,9 +2014,9 @@ public class CardFactory_Creatures {
// here, we add the ability to the stack since it's
// triggered.
StringBuilder sb = new StringBuilder();
sb.append(card.getName())
.append(" - tap up to 5 permanents target player controls. "
+ "Target player skips his or her next untap step.");
sb.append(card.getName()).append(
" - tap up to 5 permanents target player controls. "
+ "Target player skips his or her next untap step.");
ability.setStackDescription(sb.toString());
AllZone.getStack().add(ability);
stop();
@@ -2157,8 +2149,7 @@ public class CardFactory_Creatures {
private static final long serialVersionUID = 7680692311339496770L;
public void execute() {
sacOrSac.setStackDescription("When "
+ cardName
sacOrSac.setStackDescription("When " + cardName
+ " enters the battlefield, sacrifice it unless you "
+ "sacrifice any number of creatures with total power 12 or greater.");
AllZone.getStack().addSimultaneousStackEntry(sacOrSac);
@@ -2173,8 +2164,7 @@ public class CardFactory_Creatures {
else if (cardName.equals("Clone") || cardName.equals("Vesuvan Doppelganger")
|| cardName.equals("Quicksilver Gargantuan") || cardName.equals("Jwari Shapeshifter")
|| cardName.equals("Phyrexian Metamorph") || cardName.equals("Phantasmal Image")
|| cardName.equals("Body Double"))
{
|| cardName.equals("Body Double")) {
final CardFactoryInterface cfact = cf;
final Card[] copyTarget = new Card[1];
final Card[] cloned = new Card[1];
@@ -2259,9 +2249,9 @@ public class CardFactory_Creatures {
if (cardName.equals("Vesuvan Doppelganger")) {
cloned[0].addExtrinsicKeyword("At the beginning of your upkeep, "
+ "you may have this creature become a copy of target creature "
+ "you may have this creature become a copy of target creature "
+ "except it doesn't copy that creature's color. "
+ "If you do, this creature gains this ability.");
+ "If you do, this creature gains this ability.");
cloned[0].addColor("U", cloned[0], false, true);
} else if (cardName.equals("Quicksilver Gargantuan")) {
cloned[0].setBaseDefense(7);
@@ -2269,7 +2259,7 @@ public class CardFactory_Creatures {
} else if (cardName.equals("Phantasmal Image")) {
StringBuilder trigScript = new StringBuilder(
"Mode$ BecomesTarget | ValidTarget$ Card.Self | "
+ "TriggerZones$ Battlefield | Execute$ ");
+ "TriggerZones$ Battlefield | Execute$ ");
StringBuilder svarName = new StringBuilder("TrigSac");
// Couple of hoops to jump through to make sure no
// svar is overwritten.
@@ -2284,9 +2274,8 @@ public class CardFactory_Creatures {
}
}
trigScript.append(svarName.toString());
trigScript
.append(" | TriggerDescription$ When this creature "
+ "becomes the target of a spell or ability, sacrifice it.");
trigScript.append(" | TriggerDescription$ When this creature "
+ "becomes the target of a spell or ability, sacrifice it.");
cloned[0].addTrigger(forge.card.trigger.TriggerHandler.parseTrigger(trigScript.toString(),
card, true));
cloned[0].setSVar(svarName.toString(), "AB$Sacrifice | Cost$ 0 | Defined$ Self");
@@ -2320,8 +2309,7 @@ public class CardFactory_Creatures {
@Override
public void selectCard(final Card c, final PlayerZone z) {
if (z.is(Constant.Zone.Battlefield)
&& (c.isCreature() || (cardName.equals("Phyrexian Metamorph") && c.isArtifact())))
{
&& (c.isCreature() || (cardName.equals("Phyrexian Metamorph") && c.isArtifact()))) {
if (cardName.equals("Jwari Shapeshifter") && !c.isType("Ally")) {
return;
}
@@ -2392,7 +2380,7 @@ public class CardFactory_Creatures {
if (!revealed.isEmpty()) {
GuiUtils.getChoice("Revealed at random", revealed.toArray());
} else {
GuiUtils.getChoice("Revealed at random", new String[] {"Nothing to reveal"});
GuiUtils.getChoice("Revealed at random", new String[] { "Nothing to reveal" });
}
for (Card c : revealed) {
@@ -2432,7 +2420,7 @@ public class CardFactory_Creatures {
private static final long serialVersionUID = -8926850792424930054L;
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return false;
}
@@ -2514,8 +2502,7 @@ public class CardFactory_Creatures {
}; // SpellAbility
card.addSpellAbility(ability);
ability.setDescription(abCost
+ "Put a -1/-1 counter on target creature. "
ability.setDescription(abCost + "Put a -1/-1 counter on target creature. "
+ "Then if that creature's toughness is 1 or greater, regenerate it.");
StringBuilder sb = new StringBuilder();
@@ -2525,16 +2512,14 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Awakener Druid")) {
final long[] timeStamp = {0};
final long[] timeStamp = { 0 };
Trigger myTrig = TriggerHandler
.parseTrigger(
"Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | "
+ "ValidCard$ Card.Self | TriggerDescription$ "
+ "When CARDNAME enters the battlefield, target Forest "
+ "becomes a 4/5 green Treefolk creature for as long as CARDNAME is on the "
+ "battlefield. It's still a land.",
card, true);
Trigger myTrig = TriggerHandler.parseTrigger(
"Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | "
+ "ValidCard$ Card.Self | TriggerDescription$ "
+ "When CARDNAME enters the battlefield, target Forest "
+ "becomes a 4/5 green Treefolk creature for as long as CARDNAME is on the "
+ "battlefield. It's still a land.", card, true);
Target myTarget = new Target(card, "Choose target forest.", "Land.Forest".split(","), "1", "1");
final SpellAbility awaken = new Ability(card, "0") {
@Override
@@ -2543,18 +2528,18 @@ public class CardFactory_Creatures {
return;
}
final Card c = getTarget().getTargetCards().get(0);
String[] types = {"Creature", "Treefolk"};
String[] types = { "Creature", "Treefolk" };
String[] keywords = {};
timeStamp[0] = CardFactoryUtil.activateManland(c, 4, 5, types, keywords, "G");
final Command onleave = new Command() {
private static final long serialVersionUID = -6004932214386L;
long stamp = timeStamp[0];
Card tgt = c;
private long stamp = timeStamp[0];
private Card tgt = c;
public void execute() {
String[] types = {"Creature", "Treefolk"};
String[] keywords = {""};
String[] types = { "Creature", "Treefolk" };
String[] keywords = { "" };
CardFactoryUtil.revertManland(tgt, types, keywords, "G", stamp);
}
};

View File

@@ -43,7 +43,7 @@ class CardFactory_Equipment {
* @return a int.
*/
public static int shouldEquip(final Card c) {
ArrayList<String> a = c.getKeyword();
final ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++) {
// Keyword renamed to eqPump, was VanillaEquipment
@@ -69,25 +69,26 @@ class CardFactory_Equipment {
// *************** START *********** START **************************
if (cardName.equals("Umbral Mantle")) {
Cost abCost = new Cost("0", cardName, true);
Target target = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
final Cost abCost = new Cost("0", cardName, true);
final Target target = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
final Ability_Activated equip = new Ability_Activated(card, abCost, target) {
private static final long serialVersionUID = -6122939616068165612L;
@Override
public void resolve() {
if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
if (AllZoneUtil.isCardInPlay(this.getTargetCard())
&& CardFactoryUtil.canTarget(card, this.getTargetCard())) {
if (card.isEquipping()) {
Card crd = card.getEquipping().get(0);
if (crd.equals(getTargetCard())) {
final Card crd = card.getEquipping().get(0);
if (crd.equals(this.getTargetCard())) {
return;
}
card.unEquipCard(crd);
}
card.equipCard(getTargetCard());
card.equipCard(this.getTargetCard());
}
}
@@ -95,15 +96,16 @@ class CardFactory_Equipment {
public boolean canPlayAI() {
return false;
}
};// equip ability
}; // equip ability
equip.setType("Extrinsic");
final Ability untapboost = new Ability(card, "3") {
Command EOT(final Card c) {
Command eot(final Card c) {
return new Command() {
private static final long serialVersionUID = -8840812331316327448L;
@Override
public void execute() {
if (AllZoneUtil.isCardInPlay(getSourceCard())) {
c.addTempAttackBoost(-2);
@@ -116,49 +118,51 @@ class CardFactory_Equipment {
@Override
public void resolve() {
getSourceCard().addTempAttackBoost(2);
getSourceCard().addTempDefenseBoost(2);
AllZone.getEndOfTurn().addUntil(EOT(getSourceCard()));
this.getSourceCard().addTempAttackBoost(2);
this.getSourceCard().addTempDefenseBoost(2);
AllZone.getEndOfTurn().addUntil(this.eot(this.getSourceCard()));
}
@Override
public boolean canPlay() {
return (getSourceCard().isTapped() && !getSourceCard().hasSickness() && super.canPlay());
return (this.getSourceCard().isTapped() && !this.getSourceCard().hasSickness() && super.canPlay());
}
};// equiped creature's ability
}; // equiped creature's ability
untapboost.makeUntapAbility();
Command onEquip = new Command() {
final Command onEquip = new Command() {
private static final long serialVersionUID = -4784079305541955698L;
@Override
public void execute() {
if (card.isEquipping()) {
Card crd = card.getEquipping().get(0);
final Card crd = card.getEquipping().get(0);
StringBuilder sbDesc = new StringBuilder();
final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("3, Untap: ").append(crd).append(" gets +2/+2 until end of turn");
untapboost.setDescription(sbDesc.toString());
StringBuilder sbStack = new StringBuilder();
final StringBuilder sbStack = new StringBuilder();
sbStack.append(crd).append(" - +2/+2 until EOT");
untapboost.setStackDescription(sbStack.toString());
crd.addSpellAbility(untapboost);
}
}// execute()
};// Command
} // execute()
}; // Command
Command onUnEquip = new Command() {
final Command onUnEquip = new Command() {
private static final long serialVersionUID = -3427116314295067303L;
@Override
public void execute() {
if (card.isEquipping()) {
Card crd = card.getEquipping().get(0);
final Card crd = card.getEquipping().get(0);
crd.removeSpellAbility(untapboost);
}
}// execute()
};// Command
} // execute()
}; // Command
equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip));
equip.getRestrictions().setSorcerySpeed(true);
@@ -180,17 +184,18 @@ class CardFactory_Equipment {
// not changed
@Override
public void resolve() {
if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
if (AllZoneUtil.isCardInPlay(this.getTargetCard())
&& CardFactoryUtil.canTarget(card, this.getTargetCard())) {
if (card.isEquipping()) {
Card crd = card.getEquipping().get(0);
if (crd.equals(getTargetCard())) {
final Card crd = card.getEquipping().get(0);
if (crd.equals(this.getTargetCard())) {
return;
}
card.unEquipCard(crd);
}
card.equipCard(getTargetCard());
card.equipCard(this.getTargetCard());
}
}
@@ -204,20 +209,21 @@ class CardFactory_Equipment {
// not changed
@Override
public boolean canPlayAI() {
return getCreature().size() != 0 && !card.isEquipping() && super.canPlayAI();
return (this.getCreature().size() != 0) && !card.isEquipping() && super.canPlayAI();
}
// not changed
@Override
public void chooseTargetAI() {
Card target = CardFactoryUtil.AI_getBestCreature(getCreature());
setTargetCard(target);
final Card target = CardFactoryUtil.AI_getBestCreature(this.getCreature());
this.setTargetCard(target);
}
// not changed
CardList getCreature() {
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return CardFactoryUtil.AI_doesCreatureAttack(c) && CardFactoryUtil.canTarget(card, c)
&& (!c.hasKeyword("Defender"));
@@ -234,36 +240,38 @@ class CardFactory_Equipment {
}
return list;
}// getCreature()
};// equip ability
} // getCreature()
}; // equip ability
Command onEquip = new Command() {
final Command onEquip = new Command() {
private static final long serialVersionUID = -5356474407155702171L;
@Override
public void execute() {
if (card.isEquipping()) {
Card crd = card.getEquipping().get(0);
int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
final Card crd = card.getEquipping().get(0);
final int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
crd.addSemiPermanentAttackBoost(pump);
crd.addSemiPermanentDefenseBoost(pump);
}
}// execute()
};// Command
} // execute()
}; // Command
Command onUnEquip = new Command() {
final Command onUnEquip = new Command() {
private static final long serialVersionUID = 5196262972986079207L;
@Override
public void execute() {
if (card.isEquipping()) {
Card crd = card.getEquipping().get(0);
int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
final Card crd = card.getEquipping().get(0);
final int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
crd.addSemiPermanentAttackBoost(-pump);
crd.addSemiPermanentDefenseBoost(-pump);
}
}// execute()
};// Command
} // execute()
}; // Command
equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip));
@@ -281,7 +289,7 @@ class CardFactory_Equipment {
@Override
public void resolve() {
if (card.getEquipping().size() != 0) {
Card equipping = card.getEquipping().get(0);
final Card equipping = card.getEquipping().get(0);
if (equipping.isType("Vampire")) {
equipping.addCounter(Counters.P1P1, 2);
} else {
@@ -291,10 +299,12 @@ class CardFactory_Equipment {
}
};
final Trigger myTrigger = TriggerHandler
.parseTrigger(
"Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ TrigOverride | TriggerDescription$ Whenever a creature is put into a graveyard from the battlefield, put a +1/+1 counter on equipped creature. If equipped creature is a Vampire, put two +1/+1 counters on it instead.",
card, true);
final Trigger myTrigger = TriggerHandler.parseTrigger(
"Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | "
+ "ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ TrigOverride | "
+ "TriggerDescription$ Whenever a creature is put into a "
+ "graveyard from the battlefield, put a +1/+1 counter on equipped creature. "
+ "If equipped creature is a Vampire, put two +1/+1 counters on it instead.", card, true);
myTrigger.setOverridingAbility(triggeredAbility);
card.addTrigger(myTrigger);
@@ -313,16 +323,17 @@ class CardFactory_Equipment {
AllZone.getDisplay().showMessage(card + " - Select target creature you control to attach");
ButtonUtil.disableAll();
if (list.size() == 0) {
stop();
this.stop();
}
}
@Override
public void selectCard(final Card c, final PlayerZone z) {
if (z.is(Constant.Zone.Battlefield, card.getController()) && c.isCreature()
&& CardFactoryUtil.canTarget(card, c)) {
&& CardFactoryUtil.canTarget(card, c))
{
card.equipCard(c);
stop();
this.stop();
}
}
@@ -332,15 +343,16 @@ class CardFactory_Equipment {
@Override
public void resolve() {
AllZone.getInputControl().setInput(in);
}// resolve()
} // resolve()
}; // comesIntoPlayAbility
Command intoPlay = new Command() {
final Command intoPlay = new Command() {
private static final long serialVersionUID = 2985015252466920757L;
@Override
public void execute() {
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
sb.append("When Piston Sledge enters the battlefield, attach it to target creature you control.");
comesIntoPlayAbility.setStackDescription(sb.toString());
@@ -350,15 +362,15 @@ class CardFactory_Equipment {
};
card.addComesIntoPlayCommand(intoPlay);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
if (shouldEquip(card) != -1) {
int n = shouldEquip(card);
if (CardFactory_Equipment.shouldEquip(card) != -1) {
final int n = CardFactory_Equipment.shouldEquip(card);
if (n != -1) {
String parse = card.getKeyword().get(n).toString();
final String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String[] k = parse.split(":");
final String[] k = parse.split(":");
String tmpCost;
tmpCost = k[0].substring(6);
String keywordsUnsplit = "";
@@ -370,13 +382,12 @@ class CardFactory_Equipment {
int power = 0;
int tough = 0;
String[] ptk = k[1].split("/");
if (ptk.length == 1) // keywords in first cell
{
final String[] ptk = k[1].split("/");
// keywords in first cell
if (ptk.length == 1) {
keywordsUnsplit = ptk[0];
} else // parse the power/toughness boosts in first two cells
{
} else {
// parse the power/toughness boosts in first two cells
for (int i = 0; i < 2; i++) {
if (ptk[i].matches("[\\+\\-][0-9]")) {
ptk[i] = ptk[i].replace("+", "");
@@ -394,7 +405,7 @@ class CardFactory_Equipment {
if (keywordsUnsplit.length() > 0) // then there is at least one
// extrinsic keyword to assign
{
String[] tempKwds = keywordsUnsplit.split("&");
final String[] tempKwds = keywordsUnsplit.split("&");
extrinsicKeywords = new String[tempKwds.length];
for (int i = 0; i < tempKwds.length; i++) {
@@ -407,7 +418,7 @@ class CardFactory_Equipment {
card.addUnEquipCommand(CardFactoryUtil.eqPump_unEquip(card, power, tough, extrinsicKeywords, abCost));
}
}// eqPump (was VanillaEquipment)
} // eqPump (was VanillaEquipment)
if (card.hasKeyword("Living Weapon")) {
card.removeIntrinsicKeyword("Living Weapon");
@@ -415,14 +426,14 @@ class CardFactory_Equipment {
@Override
public void resolve() {
String[] types = new String[] { "Creature", "Germ" };
String[] keywords = new String[0];
CardList germs = CardFactoryUtil.makeToken("Germ", "B 0 0 Germ", card.getController(), "B", types,
1, 1, keywords);
final String[] types = new String[] { "Creature", "Germ" };
final String[] keywords = new String[0];
final CardList germs = CardFactoryUtil.makeToken("Germ", "B 0 0 Germ", card.getController(), "B",
types, 1, 1, keywords);
card.equipCard(germs.get(0));
for (Card c : germs) {
for (final Card c : germs) {
c.setBaseAttack(0);
c.setBaseDefense(0);
}
@@ -430,10 +441,12 @@ class CardFactory_Equipment {
};
final Trigger etbTrigger = TriggerHandler
.parseTrigger(
"Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigOverriding | TriggerDescription$ Living Weapon (When this Equipment enters the battlefield, put a 0/0 black Germ creature token onto the battlefield, then attach this to it.)",
card, true);
final Trigger etbTrigger = TriggerHandler.parseTrigger(
"Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | "
+ "ValidCard$ Card.Self | Execute$ TrigOverriding | TriggerDescription$ "
+ "Living Weapon (When this Equipment enters the battlefield, "
+ "put a 0/0 black Germ creature token onto the battlefield, then attach this to it.)",
card, true);
etbTrigger.setOverridingAbility(etbAbility);
card.addTrigger(etbTrigger);

View File

@@ -53,7 +53,7 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
if (cardName.equals("Sprout Swarm")) {
final SpellAbility spell_one = new Spell(card) {
final SpellAbility spellOne = new Spell(card) {
private static final long serialVersionUID = -609007714604161377L;
@Override
@@ -67,34 +67,34 @@ public class CardFactory_Instants {
}
}; // SpellAbility
final SpellAbility spell_two = new Spell(card) {
final SpellAbility spellTwo = new Spell(card) {
private static final long serialVersionUID = -1387385820860395676L;
@Override
public void resolve() {
CardFactoryUtil.makeTokenSaproling(card.getController());
// return card to the hand
PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
final PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
AllZone.getGameAction().moveTo(hand, card);
}
}; // SpellAbility
spell_one.setManaCost("1 G");
spell_two.setManaCost("4 G");
spell_two.setAdditionalManaCost("3");
spellOne.setManaCost("1 G");
spellTwo.setManaCost("4 G");
spellTwo.setAdditionalManaCost("3");
spell_one.setDescription("Put a 1/1 green Saproling token onto the battlefield.");
spell_two
.setDescription("Buyback 3 (You may pay an additional 3 as you cast this spell. If you do, put this card into your hand as it resolves.)");
spellOne.setDescription("Put a 1/1 green Saproling token onto the battlefield.");
spellTwo.setDescription("Buyback 3 (You may pay an additional 3 as you cast this spell. "
+ "If you do, put this card into your hand as it resolves.)");
spell_one.setStackDescription("Sprout Swarm - Put a 1/1 green Saproling token onto the battlefield");
spell_two
.setStackDescription("Sprout Swarm - Buyback, Put a 1/1 green Saproling token onto the battlefield");
spellOne.setStackDescription("Sprout Swarm - Put a 1/1 green Saproling token onto the battlefield");
spellTwo.setStackDescription("Sprout Swarm - Buyback, Put a 1/1 green "
+ "Saproling token onto the battlefield");
spell_two.setIsBuyBackAbility(true);
spellTwo.setIsBuyBackAbility(true);
card.addSpellAbility(spell_one);
card.addSpellAbility(spell_two);
card.addSpellAbility(spellOne);
card.addSpellAbility(spellTwo);
} // *************** END ************ END **************************
// *************** START *********** START **************************
@@ -108,149 +108,144 @@ public class CardFactory_Instants {
Card choice = null;
// check for no cards in hand on resolve
PlayerZone library = card.getController().getZone(Constant.Zone.Library);
PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
final PlayerZone library = card.getController().getZone(Constant.Zone.Library);
final PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
// PlayerZone Grave =
// card.getController().getZone(Constant.Zone.Graveyard);
CardList cards = new CardList();
final CardList cards = new CardList();
if (library.size() == 0) {
JOptionPane.showMessageDialog(null, "No more cards in library.", "",
JOptionPane.INFORMATION_MESSAGE);
return;
}
int Count = 5;
int count = 5;
if (library.size() < 5) {
Count = library.size();
count = library.size();
}
for (int i = 0; i < Count; i++) {
for (int i = 0; i < count; i++) {
cards.add(library.get(i));
}
CardList Pile1 = new CardList();
CardList Pile2 = new CardList();
final CardList pile1 = new CardList();
final CardList pile2 = new CardList();
boolean stop = false;
int Pile1CMC = 0;
int Pile2CMC = 0;
int pile1CMC = 0;
int pile2CMC = 0;
GuiUtils.getChoice("Revealing top " + Count + " cards of library: ", cards.toArray());
GuiUtils.getChoice("Revealing top " + count + " cards of library: ", cards.toArray());
// Human chooses
if (card.getController().isComputer()) {
for (int i = 0; i < Count; i++) {
if (stop == false) {
for (int i = 0; i < count; i++) {
if (!stop) {
choice = GuiUtils.getChoiceOptional("Choose cards to put into the first pile: ",
cards.toArray());
if (choice != null) {
Pile1.add(choice);
pile1.add(choice);
cards.remove(choice);
Pile1CMC = Pile1CMC + CardUtil.getConvertedManaCost(choice);
pile1CMC = pile1CMC + CardUtil.getConvertedManaCost(choice);
} else {
stop = true;
}
}
}
for (int i = 0; i < Count; i++) {
if (!Pile1.contains(library.get(i))) {
Pile2.add(library.get(i));
Pile2CMC = Pile2CMC + CardUtil.getConvertedManaCost(library.get(i));
for (int i = 0; i < count; i++) {
if (!pile1.contains(library.get(i))) {
pile2.add(library.get(i));
pile2CMC = pile2CMC + CardUtil.getConvertedManaCost(library.get(i));
}
}
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
sb.append("You have spilt the cards into the following piles" + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
for (int i = 0; i < Pile1.size(); i++) {
sb.append(Pile1.get(i).getName() + "\r\n");
for (int i = 0; i < pile1.size(); i++) {
sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
for (int i = 0; i < Pile2.size(); i++) {
sb.append(Pile2.get(i).getName() + "\r\n");
for (int i = 0; i < pile2.size(); i++) {
sb.append(pile2.get(i).getName() + "\r\n");
}
JOptionPane.showMessageDialog(null, sb, "", JOptionPane.INFORMATION_MESSAGE);
if (Pile1CMC >= Pile2CMC) {
JOptionPane
.showMessageDialog(
null,
"Computer adds the first pile to its hand and puts the second pile into the graveyard",
"", JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < Pile1.size(); i++) {
AllZone.getGameAction().moveTo(hand, Pile1.get(i));
if (pile1CMC >= pile2CMC) {
JOptionPane.showMessageDialog(null, "Computer adds the first pile to its hand "
+ "and puts the second pile into the graveyard", "",
JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < pile1.size(); i++) {
AllZone.getGameAction().moveTo(hand, pile1.get(i));
}
for (int i = 0; i < Pile2.size(); i++) {
AllZone.getGameAction().moveToGraveyard(Pile2.get(i));
for (int i = 0; i < pile2.size(); i++) {
AllZone.getGameAction().moveToGraveyard(pile2.get(i));
}
} else {
JOptionPane
.showMessageDialog(
null,
"Computer adds the second pile to its hand and puts the first pile into the graveyard",
"", JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < Pile2.size(); i++) {
AllZone.getGameAction().moveTo(hand, Pile2.get(i));
JOptionPane.showMessageDialog(null, "Computer adds the second pile to its hand and "
+ "puts the first pile into the graveyard", "", JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < pile2.size(); i++) {
AllZone.getGameAction().moveTo(hand, pile2.get(i));
}
for (int i = 0; i < Pile1.size(); i++) {
AllZone.getGameAction().moveToGraveyard(Pile1.get(i));
for (int i = 0; i < pile1.size(); i++) {
AllZone.getGameAction().moveToGraveyard(pile1.get(i));
}
}
} else// Computer chooses (It picks the highest converted
// mana cost card and 1 random card.)
{
} else {
// Computer chooses (It picks the highest converted
// mana cost card and 1 random card.)
Card biggest = null;
biggest = library.get(0);
for (int i = 0; i < Count; i++) {
for (int i = 0; i < count; i++) {
if (CardUtil.getConvertedManaCost(biggest.getManaCost()) >= CardUtil
.getConvertedManaCost(biggest.getManaCost())) {
biggest = cards.get(i);
}
}
Pile1.add(biggest);
pile1.add(biggest);
cards.remove(biggest);
if (cards.size() > 0) {
Card Random = CardUtil.getRandom(cards.toArray());
Pile1.add(Random);
final Card random = CardUtil.getRandom(cards.toArray());
pile1.add(random);
}
for (int i = 0; i < Count; i++) {
if (!Pile1.contains(library.get(i))) {
Pile2.add(library.get(i));
for (int i = 0; i < count; i++) {
if (!pile1.contains(library.get(i))) {
pile2.add(library.get(i));
}
}
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
sb.append("Choose a pile to add to your hand: " + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
for (int i = 0; i < Pile1.size(); i++) {
sb.append(Pile1.get(i).getName() + "\r\n");
for (int i = 0; i < pile1.size(); i++) {
sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
for (int i = 0; i < Pile2.size(); i++) {
sb.append(Pile2.get(i).getName() + "\r\n");
for (int i = 0; i < pile2.size(); i++) {
sb.append(pile2.get(i).getName() + "\r\n");
}
Object[] possibleValues = { "Pile 1", "Pile 2" };
Object q = JOptionPane.showOptionDialog(null, sb, "Fact or Fiction",
final Object[] possibleValues = { "Pile 1", "Pile 2" };
final Object q = JOptionPane.showOptionDialog(null, sb, "Fact or Fiction",
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, possibleValues,
possibleValues[0]);
if (q.equals(0)) {
for (int i = 0; i < Pile1.size(); i++) {
AllZone.getGameAction().moveTo(hand, Pile1.get(i));
for (int i = 0; i < pile1.size(); i++) {
AllZone.getGameAction().moveTo(hand, pile1.get(i));
}
for (int i = 0; i < Pile2.size(); i++) {
AllZone.getGameAction().moveToGraveyard(Pile2.get(i));
for (int i = 0; i < pile2.size(); i++) {
AllZone.getGameAction().moveToGraveyard(pile2.get(i));
}
} else {
for (int i = 0; i < Pile2.size(); i++) {
AllZone.getGameAction().moveTo(hand, Pile2.get(i));
for (int i = 0; i < pile2.size(); i++) {
AllZone.getGameAction().moveTo(hand, pile2.get(i));
}
for (int i = 0; i < Pile1.size(); i++) {
AllZone.getGameAction().moveToGraveyard(Pile1.get(i));
for (int i = 0; i < pile1.size(); i++) {
AllZone.getGameAction().moveToGraveyard(pile1.get(i));
}
}
}
Pile1.clear();
Pile2.clear();
pile1.clear();
pile2.clear();
} // resolve()
@Override
public boolean canPlayAI() {
CardList cards = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
final CardList cards = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
return cards.size() >= 10;
}
}; // SpellAbility
@@ -260,25 +255,25 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
else if (cardName.equals("Echoing Decay")) {
Cost cost = new Cost(card.getManaCost(), cardName, false);
Target tgt = new Target(card, "C");
final Cost cost = new Cost(card.getManaCost(), cardName, false);
final Target tgt = new Target(card, "C");
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = 3154935854257358023L;
@Override
public boolean canPlayAI() {
CardList c = getCreature();
final CardList c = this.getCreature();
if (c.isEmpty()) {
return false;
} else {
setTargetCard(c.get(0));
this.setTargetCard(c.get(0));
return true;
}
} // canPlayAI()
CardList getCreature() {
CardList out = new CardList();
CardList list = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
final CardList out = new CardList();
final CardList list = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
list.shuffle();
for (int i = 0; i < list.size(); i++) {
@@ -289,8 +284,8 @@ public class CardFactory_Instants {
// in case human player only has a few creatures in play,
// target anything
if (out.isEmpty() && 0 < CardFactoryUtil.AI_getHumanCreature(2, card, true).size()
&& 3 > CardFactoryUtil.AI_getHumanCreature(card, true).size()) {
if (out.isEmpty() && (0 < CardFactoryUtil.AI_getHumanCreature(2, card, true).size())
&& (3 > CardFactoryUtil.AI_getHumanCreature(card, true).size())) {
out.addAll(CardFactoryUtil.AI_getHumanCreature(2, card, true));
CardListUtil.sortFlying(out);
}
@@ -299,8 +294,9 @@ public class CardFactory_Instants {
@Override
public void resolve() {
if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
final Card c = getTargetCard();
if (AllZoneUtil.isCardInPlay(this.getTargetCard())
&& CardFactoryUtil.canTarget(card, this.getTargetCard())) {
final Card c = this.getTargetCard();
c.addTempAttackBoost(-2);
c.addTempDefenseBoost(-2);
@@ -308,6 +304,7 @@ public class CardFactory_Instants {
AllZone.getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = 1327455269456577020L;
@Override
public void execute() {
c.addTempAttackBoost(2);
c.addTempDefenseBoost(2);
@@ -317,10 +314,10 @@ public class CardFactory_Instants {
// get all creatures
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
list = list.getName(getTargetCard().getName());
list.remove(getTargetCard());
list = list.getName(this.getTargetCard().getName());
list.remove(this.getTargetCard());
if (!getTargetCard().isFaceDown()) {
if (!this.getTargetCard().isFaceDown()) {
for (int i = 0; i < list.size(); i++) {
final Card crd = list.get(i);
@@ -330,6 +327,7 @@ public class CardFactory_Instants {
AllZone.getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = 5151337777143949221L;
@Override
public void execute() {
crd.addTempAttackBoost(2);
crd.addTempDefenseBoost(2);
@@ -349,15 +347,15 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
else if (cardName.equals("Hidetsugu's Second Rite")) {
Target t = new Target(card, "Select target player", "Player");
Cost cost = new Cost("3 R", cardName, false);
final Target t = new Target(card, "Select target player", "Player");
final Cost cost = new Cost("3 R", cardName, false);
final SpellAbility spell = new Spell(card, cost, t) {
private static final long serialVersionUID = 176857775451818523L;
@Override
public void resolve() {
if (getTargetPlayer().getLife() == 10) {
getTargetPlayer().addDamage(10, card);
if (this.getTargetPlayer().getLife() == 10) {
this.getTargetPlayer().addDamage(10, card);
}
}
@@ -381,51 +379,53 @@ public class CardFactory_Instants {
@Override
public boolean canPlayAI() {
CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
return 4 < AllZone.getPhase().getTurn() && 0 < human.size();
final CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
return (4 < AllZone.getPhase().getTurn()) && (0 < human.size());
}
@Override
public void chooseTargetAI() {
CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
setTargetCard(CardFactoryUtil.AI_getBestCreature(human));
final CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
this.setTargetCard(CardFactoryUtil.AI_getBestCreature(human));
}
@Override
public void resolve() {
// if target card is not in play, just quit
if (!AllZoneUtil.isCardInPlay(getTargetCard()) || !CardFactoryUtil.canTarget(card, getTargetCard())) {
if (!AllZoneUtil.isCardInPlay(this.getTargetCard())
|| !CardFactoryUtil.canTarget(card, this.getTargetCard())) {
return;
}
// get all permanents
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
final CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
CardList sameName = all.getName(getTargetCard().getName());
CardList sameName = all.getName(this.getTargetCard().getName());
sameName = sameName.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return !c.isFaceDown();
}
});
if (!getTargetCard().isFaceDown()) {
if (!this.getTargetCard().isFaceDown()) {
// bounce all permanents with the same name
for (int i = 0; i < sameName.size(); i++) {
if (sameName.get(i).isToken()) {
AllZone.getGameAction().exile(sameName.get(i));
} else {
PlayerZone hand = sameName.get(i).getOwner().getZone(Constant.Zone.Hand);
final PlayerZone hand = sameName.get(i).getOwner().getZone(Constant.Zone.Hand);
AllZone.getGameAction().moveTo(hand, sameName.get(i));
}
} // for
} // if (!isFaceDown())
else {
PlayerZone hand = getTargetCard().getOwner().getZone(Constant.Zone.Hand);
AllZone.getGameAction().moveTo(hand, getTargetCard());
final PlayerZone hand = this.getTargetCard().getOwner().getZone(Constant.Zone.Hand);
AllZone.getGameAction().moveTo(hand, this.getTargetCard());
}
} // resolve()
}; // SpellAbility
Input target = new Input() {
final Input target = new Input() {
private static final long serialVersionUID = -3978705328511825933L;
@Override
@@ -436,19 +436,20 @@ public class CardFactory_Instants {
@Override
public void selectButtonCancel() {
stop();
this.stop();
}
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (!card.isLand() && zone.is(Constant.Zone.Battlefield) && CardFactoryUtil.canTarget(spell, card)) {
if (!card.isLand() && zone.is(Constant.Zone.Battlefield)
&& CardFactoryUtil.canTarget(spell, card)) {
spell.setTargetCard(card);
if (this.isFree()) {
this.setFree(false);
AllZone.getStack().add(spell);
stop();
this.stop();
} else {
stopSetNext(new Input_PayManaCost(spell));
this.stopSetNext(new Input_PayManaCost(spell));
}
}
}
@@ -468,22 +469,22 @@ public class CardFactory_Instants {
@Override
public void resolve() {
Player player = card.getController();
final Player player = card.getController();
if (player.isHuman()) {
humanResolve();
this.humanResolve();
} else {
computerResolve();
this.computerResolve();
}
player.shuffle();
}
public void humanResolve() {
CardList libraryList = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
CardList selectedCards = new CardList();
final CardList libraryList = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
final CardList selectedCards = new CardList();
Object o = GuiUtils.getChoiceOptional("Select first card", libraryList.toArray());
if (o != null) {
Card c1 = (Card) o;
final Card c1 = (Card) o;
libraryList.remove(c1);
selectedCards.add(c1);
} else {
@@ -491,7 +492,7 @@ public class CardFactory_Instants {
}
o = GuiUtils.getChoiceOptional("Select second card", libraryList.toArray());
if (o != null) {
Card c2 = (Card) o;
final Card c2 = (Card) o;
libraryList.remove(c2);
selectedCards.add(c2);
} else {
@@ -499,7 +500,7 @@ public class CardFactory_Instants {
}
o = GuiUtils.getChoiceOptional("Select third card", libraryList.toArray());
if (o != null) {
Card c3 = (Card) o;
final Card c3 = (Card) o;
libraryList.remove(c3);
selectedCards.add(c3);
} else {
@@ -507,19 +508,19 @@ public class CardFactory_Instants {
}
// comp randomly selects one of the three cards
Card choice = selectedCards.get(MyRandom.random.nextInt(2));
final Card choice = selectedCards.get(MyRandom.random.nextInt(2));
selectedCards.remove(choice);
AllZone.getGameAction().moveToHand(choice);
for (Card trash : selectedCards) {
for (final Card trash : selectedCards) {
AllZone.getGameAction().moveToGraveyard(trash);
}
}
public void computerResolve() {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Library);
CardList selectedCards = new CardList();
final CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Library);
final CardList selectedCards = new CardList();
// pick best creature
Card c = CardFactoryUtil.AI_getBestCreature(list);
@@ -545,21 +546,21 @@ public class CardFactory_Instants {
// NOTE: Using getChoiceOptional() results in a null error
// when you click on Cancel.
Object o = GuiUtils.getChoice("Select card to give to computer", selectedCards.toArray());
final Object o = GuiUtils.getChoice("Select card to give to computer", selectedCards.toArray());
Card choice = (Card) o;
final Card choice = (Card) o;
selectedCards.remove(choice);
AllZone.getGameAction().moveToHand(choice);
for (Card trash : selectedCards) {
for (final Card trash : selectedCards) {
AllZone.getGameAction().moveToGraveyard(trash);
}
}
@Override
public boolean canPlay() {
CardList library = card.getController().getCardsIn(Zone.Library);
final CardList library = card.getController().getCardsIn(Zone.Library);
return library.size() >= 3;
}
@@ -625,10 +626,10 @@ public class CardFactory_Instants {
/*
* Return all artifacts target player owns to his or her hand.
*/
Target t = new Target(card, "Select target player", "Player");
Cost cost = new Cost("1 U", cardName, false);
final Target t = new Target(card, "Select target player", "Player");
final Cost cost = new Cost("1 U", cardName, false);
SpellAbility spell = new Spell(card, cost, t) {
final SpellAbility spell = new Spell(card, cost, t) {
private static final long serialVersionUID = -4098702062413878046L;
@Override
@@ -640,17 +641,17 @@ public class CardFactory_Instants {
@Override
public void chooseTargetAI() {
setTargetPlayer(AllZone.getHumanPlayer());
this.setTargetPlayer(AllZone.getHumanPlayer());
} // chooseTargetAI()
@Override
public void resolve() {
Player player = getTargetPlayer();
final Player player = this.getTargetPlayer();
CardList artifacts = AllZoneUtil.getCardsIn(Zone.Battlefield);
artifacts = artifacts.getType("Artifact");
for (int i = 0; i < artifacts.size(); i++) {
Card thisArtifact = artifacts.get(i);
final Card thisArtifact = artifacts.get(i);
if (thisArtifact.getOwner().equals(player)) {
// moveToHand handles tokens
AllZone.getGameAction().moveToHand(thisArtifact);
@@ -660,56 +661,56 @@ public class CardFactory_Instants {
};
card.addSpellAbility(spell);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Suffer the Past")) {
Cost cost = new Cost("X B", cardName, false);
Target tgt = new Target(card, "Select a Player", "Player");
final Cost cost = new Cost("X B", cardName, false);
final Target tgt = new Target(card, "Select a Player", "Player");
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = 1168802375190293222L;
@Override
public void resolve() {
Player tPlayer = getTargetPlayer();
Player player = card.getController();
final Player tPlayer = this.getTargetPlayer();
final Player player = card.getController();
final int max = card.getXManaCostPaid();
CardList graveList = tPlayer.getCardsIn(Zone.Graveyard);
int X = Math.min(max, graveList.size());
final CardList graveList = tPlayer.getCardsIn(Zone.Graveyard);
final int x = Math.min(max, graveList.size());
if (player.isHuman()) {
for (int i = 0; i < X; i++) {
Object o = GuiUtils.getChoice("Remove from game", graveList.toArray());
for (int i = 0; i < x; i++) {
final Object o = GuiUtils.getChoice("Remove from game", graveList.toArray());
if (o == null) {
break;
}
Card c1 = (Card) o;
final Card c1 = (Card) o;
graveList.remove(c1); // remove from the display
// list
AllZone.getGameAction().exile(c1);
}
} else { // Computer
// Random random = MyRandom.random;
for (int j = 0; j < X; j++) {
for (int j = 0; j < x; j++) {
// int index = random.nextInt(X-j);
AllZone.getGameAction().exile(graveList.get(j));
}
}
tPlayer.loseLife(X, card);
player.gainLife(X, card);
tPlayer.loseLife(x, card);
player.gainLife(x, card);
card.setXManaCostPaid(0);
}
@Override
public void chooseTargetAI() {
setTargetPlayer(AllZone.getHumanPlayer());
this.setTargetPlayer(AllZone.getHumanPlayer());
} // chooseTargetAI()
@Override
public boolean canPlayAI() {
CardList graveList = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
final CardList graveList = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
final int maxX = ComputerUtil.getAvailableMana().size() - 1;
return (maxX >= 3) && (graveList.size() > 0);
@@ -726,21 +727,21 @@ public class CardFactory_Instants {
@Override
public void resolve() {
Player player = card.getController();
CardList libList = player.getCardsIn(Zone.Library);
final Player player = card.getController();
final CardList libList = player.getCardsIn(Zone.Library);
final String[] input = new String[1];
input[0] = JOptionPane.showInputDialog(null, "Which card?", "Pick card",
JOptionPane.QUESTION_MESSAGE);
for (int i = 0; i < 7; i++) {
Card c = libList.get(i);
final Card c = libList.get(i);
AllZone.getGameAction().exile(c);
}
int max = libList.size();
final int max = libList.size();
int stop = 0;
for (int i = 0; i < max; i++) {
Card c = libList.get(i);
final Card c = libList.get(i);
if (c.getName().equals(input[0])) {
if (stop == 0) {
AllZone.getGameAction().moveToHand(c);
@@ -755,8 +756,8 @@ public class CardFactory_Instants {
@Override
public boolean canPlay() {
CardList libList = card.getController().getCardsIn(Zone.Library);
return libList.size() > 6 && super.canPlay();
final CardList libList = card.getController().getCardsIn(Zone.Library);
return (libList.size() > 6) && super.canPlay();
}
@Override
@@ -765,7 +766,9 @@ public class CardFactory_Instants {
}
}; // SpellAbility
spell.setStackDescription("Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card. Put that card into your hand and exile all other cards revealed this way");
spell.setStackDescription("Name a card. Exile the top six cards of your library, "
+ "then reveal cards from the top of your library until you reveal the named card. "
+ "Put that card into your hand and exile all other cards revealed this way");
card.addSpellAbility(spell);
} // *************** END ************ END **************************
@@ -797,15 +800,15 @@ public class CardFactory_Instants {
public void resolve() {
// this needs to get a list of opponents creatures and set
// the siren flag
Player player = card.getController();
Player opponent = player.getOpponent();
CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
for (Card creature : creatures) {
final Player player = card.getController();
final Player opponent = player.getOpponent();
final CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
for (final Card creature : creatures) {
// skip walls, skip creatures with summoning sickness
// also skip creatures with haste if they came onto the
// battlefield this turn
if ((!creature.isWall() && !creature.hasSickness())
|| (creature.hasKeyword("Haste") && creature.getTurnInZone() != 1)) {
|| (creature.hasKeyword("Haste") && (creature.getTurnInZone() != 1))) {
creature.setSirenAttackOrDestroy(true);
// System.out.println("Siren's Call - setting flag for "+creature.getName());
}
@@ -813,11 +816,11 @@ public class CardFactory_Instants {
final SpellAbility destroy = new Ability(card, "0") {
@Override
public void resolve() {
Player player = card.getController();
Player opponent = player.getOpponent();
CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
final Player player = card.getController();
final Player opponent = player.getOpponent();
final CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
for (Card creature : creatures) {
for (final Card creature : creatures) {
// System.out.println("Siren's Call - EOT - "+creature.getName()
// +" flag: "+creature.getSirenAttackOrDestroy());
// System.out.println("Siren's Call - EOT - "+creature.getName()
@@ -833,14 +836,16 @@ public class CardFactory_Instants {
}
}
};
Command atEOT = new Command() {
final Command atEOT = new Command() {
private static final long serialVersionUID = 5369528776959445848L;
@Override
public void execute() {
StringBuilder sb = new StringBuilder();
sb.append(card)
.append(" - At the beginning of the next end step, destroy all non-Wall creatures that player controls that didn't attack this turn. ");
sb.append("Ignore this effect for each creature the player didn't control continuously since the beginning of the turn.");
final StringBuilder sb = new StringBuilder();
sb.append(card).append(" - At the beginning of the next end step, ");
sb.append("destroy all non-Wall creatures that player controls that didn't ");
sb.append("attack this turn. Ignore this effect for each creature the player ");
sb.append("didn't control continuously since the beginning of the turn.");
destroy.setDescription(sb.toString());
destroy.setStackDescription(sb.toString());
@@ -851,7 +856,7 @@ public class CardFactory_Instants {
} // resolve
}; // SpellAbility
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" - All creatures that can attack must do so or be destroyed.");
spell.setStackDescription(sb.toString());
@@ -862,7 +867,7 @@ public class CardFactory_Instants {
else if (cardName.equals("Telling Time")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 2626878556107707854L;
String[] prompt = new String[] { "Put a card into your hand", "Put a card on top of library",
private String[] prompt = new String[] { "Put a card into your hand", "Put a card on top of library",
"Put a card on bottom of library" };
@Override
@@ -872,15 +877,15 @@ public class CardFactory_Instants {
@Override
public void resolve() {
PlayerZone lib = card.getController().getZone(Constant.Zone.Library);
CardList choices = new CardList();
for (int i = 0; i < 3 && lib.size() > 0; i++) {
final PlayerZone lib = card.getController().getZone(Constant.Zone.Library);
final CardList choices = new CardList();
for (int i = 0; (i < 3) && (lib.size() > 0); i++) {
choices.add(lib.get(i));
}
for (int i = 0; i < 3 && !choices.isEmpty(); i++) {
Object o = GuiUtils.getChoice(prompt[i], choices.toArray());
Card c1 = (Card) o;
for (int i = 0; (i < 3) && !choices.isEmpty(); i++) {
final Object o = GuiUtils.getChoice(this.prompt[i], choices.toArray());
final Card c1 = (Card) o;
if (i == 0) {
AllZone.getGameAction().moveToHand(c1);
} else if (i == 1) {
@@ -895,7 +900,7 @@ public class CardFactory_Instants {
};
card.addSpellAbility(spell);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Remove Enchantments")) {
@@ -910,10 +915,11 @@ public class CardFactory_Instants {
@Override
public void resolve() {
final Player you = card.getController();
CardList ens = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.enchantments);
CardList toReturn = ens.filter(new CardListFilter() {
final CardList ens = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.enchantments);
final CardList toReturn = ens.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
Card enchanting = c.getEnchantingCard();
final Card enchanting = c.getEnchantingCard();
if (enchanting != null) {
if ((enchanting.isAttacking() && enchanting.getController().isPlayer(you.getOpponent()))
@@ -925,11 +931,11 @@ public class CardFactory_Instants {
return (c.getOwner().isPlayer(you) && c.getController().isPlayer(you));
}
});
for (Card c : toReturn) {
for (final Card c : toReturn) {
AllZone.getGameAction().moveToHand(c);
}
for (Card c : ens) {
for (final Card c : ens) {
if (!toReturn.contains(c)) {
AllZone.getGameAction().destroy(c);
}
@@ -949,27 +955,28 @@ public class CardFactory_Instants {
* creature has infect, Burn the Impure deals 3 damage to that
* creature's controller.
*/
Cost abCost = new Cost("1 R", cardName, false);
final Cost abCost = new Cost("1 R", cardName, false);
final SpellAbility spell = new Spell(card, abCost, new Target(card, "TgtC")) {
private static final long serialVersionUID = -3069135027502686218L;
int damage = 3;
private int damage = 3;
@Override
public void chooseTargetAI() {
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
creatures = creatures.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return c.getNetAttack() <= damage && !c.hasKeyword("Indestructible");
return (c.getNetAttack() <= damage) && !c.hasKeyword("Indestructible");
}
});
CardList infect = creatures.getKeyword("Infect");
final CardList infect = creatures.getKeyword("Infect");
if (infect.size() > 0) {
Card c = CardFactoryUtil.AI_getBestCreature(infect);
setTargetCard(c);
final Card c = CardFactoryUtil.AI_getBestCreature(infect);
this.setTargetCard(c);
} else {
Card c = CardFactoryUtil.AI_getBestCreature(creatures);
setTargetCard(c);
final Card c = CardFactoryUtil.AI_getBestCreature(creatures);
this.setTargetCard(c);
}
} // chooseTargetAI()
@@ -978,8 +985,9 @@ public class CardFactory_Instants {
public boolean canPlayAI() {
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
creatures = creatures.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return c.getNetAttack() <= damage && !c.hasKeyword("Indestructible");
return (c.getNetAttack() <= damage) && !c.hasKeyword("Indestructible");
}
});
return creatures.size() > 0;
@@ -987,9 +995,10 @@ public class CardFactory_Instants {
@Override
public void resolve() {
if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
Card c = getTargetCard();
c.addDamage(damage, card);
if (AllZoneUtil.isCardInPlay(this.getTargetCard())
&& CardFactoryUtil.canTarget(card, this.getTargetCard())) {
final Card c = this.getTargetCard();
c.addDamage(this.damage, card);
if (c.hasKeyword("Infect")) {
c.getController().addDamage(3, card);
}
@@ -997,7 +1006,7 @@ public class CardFactory_Instants {
}
}; // SpellAbility
StringBuilder sb = new StringBuilder();
final StringBuilder sb = new StringBuilder();
sb.append(cardName);
sb.append(" deals 3 damage to target creature. If that creature has infect, ");
sb.append(cardName);
@@ -1014,8 +1023,8 @@ public class CardFactory_Instants {
* of the chosen type target player controls, or untap all tapped
* permanents of that type that player controls.
*/
Cost abCost = new Cost("2 U U", cardName, false);
Target target = new Target(card, "Select target player", "Player".split(","));
final Cost abCost = new Cost("2 U U", cardName, false);
final Target target = new Target(card, "Select target player", "Player".split(","));
final SpellAbility spell = new Spell(card, abCost, target) {
private static final long serialVersionUID = -2175586347805121896L;
@@ -1026,16 +1035,16 @@ public class CardFactory_Instants {
@Override
public void resolve() {
String[] choices = new String[] { "Artifact", "Creature", "Land" };
Object o = GuiUtils.getChoice("Select permanent type", choices);
String cardType = (String) o;
CardList list = getTargetPlayer().getCardsIn(Zone.Battlefield).getType(cardType);
final String[] choices = new String[] { "Artifact", "Creature", "Land" };
final Object o = GuiUtils.getChoice("Select permanent type", choices);
final String cardType = (String) o;
final CardList list = this.getTargetPlayer().getCardsIn(Zone.Battlefield).getType(cardType);
String[] tapOrUntap = new String[] { "Tap", "Untap" };
Object z = GuiUtils.getChoice("Tap or Untap?", tapOrUntap);
boolean tap = (z.equals("Tap")) ? true : false;
final String[] tapOrUntap = new String[] { "Tap", "Untap" };
final Object z = GuiUtils.getChoice("Tap or Untap?", tapOrUntap);
final boolean tap = (z.equals("Tap")) ? true : false;
for (Card c : list) {
for (final Card c : list) {
if (tap) {
c.tap();
} else {
@@ -1050,19 +1059,19 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
else if (cardName.equals("Wing Puncture")) {
Target t2 = new Target(card, "Select target creature with flying", "Creature.withFlying".split(","));
final Target t2 = new Target(card, "Select target creature with flying", "Creature.withFlying".split(","));
final Ability_Sub sub = new Ability_Sub(card, t2) {
private static final long serialVersionUID = 4618047889975691050L;
@Override
public boolean chkAI_Drawback() {
public boolean chkAIDrawback() {
return false;
}
@Override
public void resolve() {
Card myc = this.getParent().getTargetCard();
Card tgt = getTargetCard();
final Card myc = this.getParent().getTargetCard();
final Card tgt = this.getTargetCard();
if (AllZoneUtil.isCardInPlay(myc) && AllZoneUtil.isCardInPlay(tgt)) {
if (CardFactoryUtil.canTarget(card, myc) && CardFactoryUtil.canTarget(card, tgt)) {
tgt.addDamage(myc.getNetAttack(), myc);
@@ -1076,8 +1085,8 @@ public class CardFactory_Instants {
}
};
Cost abCost = new Cost("G", cardName, false);
Target t1 = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
final Cost abCost = new Cost("G", cardName, false);
final Target t1 = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
final SpellAbility spell = new Spell(card, abCost, t1) {
private static final long serialVersionUID = 8964235807056739219L;
@@ -1092,7 +1101,8 @@ public class CardFactory_Instants {
}
};
spell.setSubAbility(sub);
spell.setDescription("Target creature you control deals damage equal to its power to target creature with flying.");
spell.setDescription("Target creature you control deals damage "
+ "equal to its power to target creature with flying.");
spell.setStackDescription(card
+ " - Creature you control deals damage equal to its power to creature with flying.");

View File

@@ -99,11 +99,11 @@ class CardFactory_Lands {
tapCard();
}
}// if
} // if
else {
tapCard();
}
}// execute()
} // execute()
private void tapCard() {
// it enters the battlefield this way, and should not fire
@@ -111,7 +111,7 @@ class CardFactory_Lands {
card.setTapped(true);
}
});
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Dark Depths")) {
@@ -174,7 +174,11 @@ class CardFactory_Lands {
AllZone.getGameAction().sacrifice(card);
}
};
// ability.setDescription("Dark Depths enters the battlefield with ten ice counters on it.\r\n\r\n3: Remove an ice counter from Dark Depths.\r\n\r\nWhen Dark Depths has no ice counters on it, sacrifice it. If you do, put an indestructible legendary 20/20 black Avatar creature token with flying named Marit Lage onto the battlefield.");
// ability.setDescription("Dark Depths enters the battlefield with
//ten ice counters on it.\r\n\r\n3: Remove an ice counter from Dark Depths.
//\r\n\r\nWhen Dark Depths has no ice counters on it, sacrifice it.
//If you do, put an indestructible legendary 20/20 black Avatar creature token
//with flying named Marit Lage onto the battlefield.");
ability.setDescription("3: remove an Ice Counter.");
StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" - remove an ice counter.");
@@ -183,7 +187,7 @@ class CardFactory_Lands {
card.addSpellAbility(ability);
sacrifice.setStackDescription("Sacrifice " + card.getName());
card.addSpellAbility(sacrifice);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Novijen, Heart of Progress")) {
@@ -201,7 +205,7 @@ class CardFactory_Lands {
Ability_Activated ability = new Ability_Activated(card, abCost, null) {
private static final long serialVersionUID = 1416258136308898492L;
CardList inPlay = new CardList();
private CardList inPlay = new CardList();
@Override
public boolean canPlayAI() {
@@ -241,7 +245,7 @@ class CardFactory_Lands {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = -194247993330560188L;
final Player player = card.getController();
private final Player player = card.getController();
public void execute() {
if (player.isHuman()) {
@@ -271,8 +275,8 @@ class CardFactory_Lands {
stop();
}
}
}// selectCard()
};// Input
} // selectCard()
}; // Input
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped)
.size() < 2)) {
AllZone.getGameAction().sacrifice(card);
@@ -288,7 +292,7 @@ class CardFactory_Lands {
};
card.addComesIntoPlayCommand(comesIntoPlay);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Kjeldoran Outpost") || cardName.equals("Balduvian Trading Post")
@@ -310,7 +314,7 @@ class CardFactory_Lands {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 6175830918425915833L;
final Player player = card.getController();
private final Player player = card.getController();
public void execute() {
final CardList land = player.getCardsIn(Zone.Battlefield).getValidCards(type[0], player, card);
@@ -349,15 +353,15 @@ class CardFactory_Lands {
AllZone.getGameAction().sacrifice(c);
stop();
}
}// selectCard()
};// Input
} // selectCard()
}; // Input
AllZone.getInputControl().setInput(target);
}
}
};
card.addComesIntoPlayCommand(comesIntoPlay);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Sheltered Valley")) {
@@ -379,13 +383,13 @@ class CardFactory_Lands {
};
card.addComesIntoPlayCommand(comesIntoPlay);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Scorched Ruins")) {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 6175830918425915833L;
final Player player = card.getController();
private final Player player = card.getController();
public void execute() {
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
@@ -438,15 +442,15 @@ class CardFactory_Lands {
stop();
}
}
}// selectCard()
};// Input
} // selectCard()
}; // Input
AllZone.getInputControl().setInput(target);
}
}
};
card.addComesIntoPlayCommand(comesIntoPlay);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
// Lorwyn Dual Lands, and a couple Morningtide...
@@ -526,14 +530,14 @@ class CardFactory_Lands {
stop();
}
});
}// execute()
} // execute()
private void revealCard(final Card c) {
JOptionPane.showMessageDialog(null, c.getController() + " reveals " + c.getName(), card.getName(),
JOptionPane.PLAIN_MESSAGE);
}
});
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START ************ START **************************
else if (cardName.equals("Calciform Pools") || cardName.equals("Dreadship Reef")
@@ -634,7 +638,8 @@ class CardFactory_Lands {
num[0] = Integer.parseInt(answer);
String splitNum = (String) (GuiUtils.getChoiceOptional("Number of " + primary + " to add", choices));
String splitNum = (String) (GuiUtils.getChoiceOptional(
"Number of " + primary + " to add", choices));
if (splitNum == null) {
stop();
return;
@@ -654,7 +659,7 @@ class CardFactory_Lands {
addMana.setAfterPayMana(runtime);
card.addSpellAbility(addMana);
card.addSpellAbility(abMana);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Crosis's Catacombs") || cardName.equals("Darigaaz's Caldera")
@@ -701,15 +706,15 @@ class CardFactory_Lands {
AllZone.getGameAction().moveToHand(c);
stop();
}
}// selectCard()
};// Input
} // selectCard()
}; // Input
AllZone.getInputControl().setInput(target);
}
}
};
card.addComesIntoPlayCommand(comesIntoPlay);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Coral Atoll") || cardName.equals("Dormant Volcano") || cardName.equals("Everglades")
@@ -762,13 +767,14 @@ class CardFactory_Lands {
AllZone.getGameAction().moveToHand(c);
stop();
}
}// selectCard()
};// Input
} // selectCard()
}; // Input
AllZone.getInputControl().setInput(target);
}
}
};
sacOrNo.setStackDescription("When CARDNAME enters the battlefield, sacrifice it unless you return an untapped "
sacOrNo.setStackDescription("When CARDNAME enters the battlefield, "
+ "sacrifice it unless you return an untapped "
+ type[0] + " you control to its owner's hand.");
final Command comesIntoPlay = new Command() {
@@ -780,9 +786,9 @@ class CardFactory_Lands {
};
card.addComesIntoPlayCommand(comesIntoPlay);
}// *************** END ************ END **************************
} // *************** END ************ END **************************
return card;
}
}// end class CardFactory_Lands
} // end class CardFactory_Lands

View File

@@ -261,18 +261,18 @@ public class CardFactory_Sorceries {
// *************** START *********** START **************************
else if (cardName.equals("Mind's Desire")) {
final Spell PlayCreature = new Spell(card) {
final Spell playCreature = new Spell(card) {
private static final long serialVersionUID = 53838791023456795L;
@Override
public void resolve() {
Player player = card.getController();
PlayerZone play = player.getZone(Constant.Zone.Battlefield);
PlayerZone RFG = player.getZone(Constant.Zone.Exile);
Card[] Attached = card.getAttachedCardsByMindsDesire();
RFG.remove(Attached[0]);
play.add(Attached[0]);
card.unattachCardByMindDesire(Attached[0]);
PlayerZone rfg = player.getZone(Constant.Zone.Exile);
Card[] attached = card.getAttachedCardsByMindsDesire();
rfg.remove(attached[0]);
play.add(attached[0]);
card.unattachCardByMindDesire(attached[0]);
} // resolve()
}; // SpellAbility
@@ -284,31 +284,31 @@ public class CardFactory_Sorceries {
Card c = null;
Player player = card.getController();
if (player.isHuman()) {
Card[] Attached = getSourceCard().getAttachedCardsByMindsDesire();
Card[] Choices = new Card[Attached.length];
boolean SystemsGo = true;
Card[] attached = getSourceCard().getAttachedCardsByMindsDesire();
Card[] choices = new Card[attached.length];
boolean systemsGo = true;
if (AllZone.getStack().size() > 0) {
CardList Config = new CardList();
for (int i = 0; i < Attached.length; i++) {
if (Attached[i].isInstant()|| Attached[i].hasKeyword("Flash")) {
Config.add(Attached[i]);
CardList config = new CardList();
for (int i = 0; i < attached.length; i++) {
if (attached[i].isInstant() || attached[i].hasKeyword("Flash")) {
config.add(attached[i]);
}
}
for (int i = 0; i < Config.size(); i++) {
Card crd = Config.get(i);
Choices[i] = crd;
for (int i = 0; i < config.size(); i++) {
Card crd = config.get(i);
choices[i] = crd;
}
if (Config.size() == 0) {
SystemsGo = false;
if (config.size() == 0) {
systemsGo = false;
}
} else {
for (int i = 0; i < Attached.length; i++) {
Choices[i] = Attached[i];
for (int i = 0; i < attached.length; i++) {
choices[i] = attached[i];
}
}
Object check = null;
if (SystemsGo) {
check = GuiUtils.getChoiceOptional("Select Card to play for free", Choices);
if (systemsGo) {
check = GuiUtils.getChoiceOptional("Select Card to play for free", choices);
if (check != null) {
target = ((Card) check);
}
@@ -336,29 +336,29 @@ public class CardFactory_Sorceries {
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - Copied from Mind's Desire");
PlayCreature.setStackDescription(sb.toString());
playCreature.setStackDescription(sb.toString());
Card[] ReAttach = new Card[Attached.length];
ReAttach[0] = c;
int ReAttach_Count = 0;
for (int i = 0; i < Attached.length; i++) {
if (Attached[i] != target) {
ReAttach_Count = ReAttach_Count + 1;
ReAttach[ReAttach_Count] = Attached[i];
Card[] reAttach = new Card[attached.length];
reAttach[0] = c;
int reAttachCount = 0;
for (int i = 0; i < attached.length; i++) {
if (attached[i] != target) {
reAttachCount = reAttachCount + 1;
reAttach[reAttachCount] = attached[i];
}
}
// Clear Attached List
for (int i = 0; i < Attached.length; i++) {
card.unattachCardByMindDesire(Attached[i]);
for (int i = 0; i < attached.length; i++) {
card.unattachCardByMindDesire(attached[i]);
}
// Re-add
for (int i = 0; i < ReAttach.length; i++) {
if (ReAttach[i] != null) {
card.attachCardByMindsDesire(ReAttach[i]);
for (int i = 0; i < reAttach.length; i++) {
if (reAttach[i] != null) {
card.attachCardByMindsDesire(reAttach[i]);
}
}
target.addSpellAbility(PlayCreature);
AllZone.getStack().add(PlayCreature);
target.addSpellAbility(playCreature);
AllZone.getStack().add(playCreature);
} else {
AllZone.getGameAction().playCardNoCost(c);
card.unattachCardByMindDesire(c);
@@ -391,17 +391,17 @@ public class CardFactory_Sorceries {
public void execute() {
Player player = AllZone.getPhase().getPlayerTurn();
PlayerZone Play = player.getZone(Constant.Zone.Battlefield);
Card Minds_D = card;
PlayerZone play = player.getZone(Constant.Zone.Battlefield);
Card mindsD = card;
if (player.isHuman()) {
card.getController().shuffle();
}
CardList MindsList = player.getCardsIn(Zone.Battlefield);
MindsList = MindsList.getName("Mind's Desire");
MindsList.remove(card);
if (MindsList.size() > 0) {
Play.remove(card);
Minds_D = MindsList.get(0);
CardList mindsList = player.getCardsIn(Zone.Battlefield);
mindsList = mindsList.getName("Mind's Desire");
mindsList.remove(card);
if (mindsList.size() > 0) {
play.remove(card);
mindsD = mindsList.get(0);
} else {
JOptionPane.showMessageDialog(null,
"Click Mind's Desire to see the available cards to play without paying its mana cost.",
@@ -411,20 +411,20 @@ public class CardFactory_Sorceries {
Card c = null;
if (libList.size() > 0) {
c = libList.get(0);
PlayerZone RFG = player.getZone(Constant.Zone.Exile);
AllZone.getGameAction().moveTo(RFG, c);
Minds_D.attachCardByMindsDesire(c);
PlayerZone rfg = player.getZone(Constant.Zone.Exile);
AllZone.getGameAction().moveTo(rfg, c);
mindsD.attachCardByMindsDesire(c);
}
final Card Minds = card;
final Card minds = card;
// AllZone.getGameAction().exile(Minds);
Minds.setImmutable(true);
minds.setImmutable(true);
Command untilEOT = new Command() {
private static final long serialVersionUID = -28032591440730370L;
public void execute() {
Player player = AllZone.getPhase().getPlayerTurn();
PlayerZone play = player.getZone(Constant.Zone.Battlefield);
play.remove(Minds);
play.remove(minds);
}
};
AllZone.getEndOfTurn().addUntil(untilEOT);
@@ -467,67 +467,67 @@ public class CardFactory_Sorceries {
JOptionPane.INFORMATION_MESSAGE);
return;
}
int Count = 5;
int count = 5;
if (lib.size() < 5) {
Count = lib.size();
count = lib.size();
}
for (int i = 0; i < Count; i++) {
for (int i = 0; i < count; i++) {
cards.add(lib.get(i));
}
for (int i = 0; i < Count; i++) {
for (int i = 0; i < count; i++) {
exiled.add(lib.get(i));
AllZone.getGameAction().exile(lib.get(i));
}
CardList Pile1 = new CardList();
CardList Pile2 = new CardList();
CardList pile1 = new CardList();
CardList pile2 = new CardList();
boolean stop = false;
int Pile1CMC = 0;
int Pile2CMC = 0;
int pile1CMC = 0;
int pile2CMC = 0;
GuiUtils.getChoice("Revealing top " + Count + " cards of library: ", cards.toArray());
GuiUtils.getChoice("Revealing top " + count + " cards of library: ", cards.toArray());
// Human chooses
if (card.getController().isComputer()) {
for (int i = 0; i < Count; i++) {
for (int i = 0; i < count; i++) {
if (!stop) {
choice = GuiUtils.getChoiceOptional("Choose cards to put into the first pile: ",
cards.toArray());
if (choice != null) {
Pile1.add(choice);
pile1.add(choice);
cards.remove(choice);
Pile1CMC = Pile1CMC + CardUtil.getConvertedManaCost(choice);
pile1CMC = pile1CMC + CardUtil.getConvertedManaCost(choice);
} else {
stop = true;
}
}
}
for (int i = 0; i < Count; i++) {
if (!Pile1.contains(exiled.get(i))) {
Pile2.add(exiled.get(i));
Pile2CMC = Pile2CMC + CardUtil.getConvertedManaCost(exiled.get(i));
for (int i = 0; i < count; i++) {
if (!pile1.contains(exiled.get(i))) {
pile2.add(exiled.get(i));
pile2CMC = pile2CMC + CardUtil.getConvertedManaCost(exiled.get(i));
}
}
StringBuilder sb = new StringBuilder();
sb.append("You have spilt the cards into the following piles" + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
for (int i = 0; i < Pile1.size(); i++) {
sb.append(Pile1.get(i).getName() + "\r\n");
for (int i = 0; i < pile1.size(); i++) {
sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
for (int i = 0; i < Pile2.size(); i++) {
sb.append(Pile2.get(i).getName() + "\r\n");
for (int i = 0; i < pile2.size(); i++) {
sb.append(pile2.get(i).getName() + "\r\n");
}
JOptionPane.showMessageDialog(null, sb, "", JOptionPane.INFORMATION_MESSAGE);
if (Pile1CMC >= Pile2CMC) {
if (pile1CMC >= pile2CMC) {
JOptionPane.showMessageDialog(null, "Computer chooses the Pile 1", "",
JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < Pile1.size(); i++) {
ArrayList<SpellAbility> choices = Pile1.get(i).getBasicSpells();
for (int i = 0; i < pile1.size(); i++) {
ArrayList<SpellAbility> choices = pile1.get(i).getBasicSpells();
for (SpellAbility sa : choices) {
if (sa.canPlayAI()) {
ComputerUtil.playStackFree(sa);
if (Pile1.get(i).isPermanent()) {
exiled.remove(Pile1.get(i));
if (pile1.get(i).isPermanent()) {
exiled.remove(pile1.get(i));
}
break;
}
@@ -536,14 +536,14 @@ public class CardFactory_Sorceries {
} else {
JOptionPane.showMessageDialog(null, "Computer chooses the Pile 2", "",
JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < Pile2.size(); i++) {
ArrayList<SpellAbility> choices = Pile2.get(i).getBasicSpells();
for (int i = 0; i < pile2.size(); i++) {
ArrayList<SpellAbility> choices = pile2.get(i).getBasicSpells();
for (SpellAbility sa : choices) {
if (sa.canPlayAI()) {
ComputerUtil.playStackFree(sa);
if (Pile2.get(i).isPermanent()) {
exiled.remove(Pile2.get(i));
if (pile2.get(i).isPermanent()) {
exiled.remove(pile2.get(i));
}
break;
}
@@ -562,26 +562,26 @@ public class CardFactory_Sorceries {
}
}
Pile1.add(biggest);
pile1.add(biggest);
cards.remove(biggest);
if (cards.size() > 2) {
Card Random = CardUtil.getRandom(cards.toArray());
Pile1.add(Random);
Card random = CardUtil.getRandom(cards.toArray());
pile1.add(random);
}
for (int i = 0; i < Count; i++) {
if (!Pile1.contains(exiled.get(i))) {
Pile2.add(exiled.get(i));
for (int i = 0; i < count; i++) {
if (!pile1.contains(exiled.get(i))) {
pile2.add(exiled.get(i));
}
}
StringBuilder sb = new StringBuilder();
sb.append("Choose a pile to add to your hand: " + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
for (int i = 0; i < Pile1.size(); i++) {
sb.append(Pile1.get(i).getName() + "\r\n");
for (int i = 0; i < pile1.size(); i++) {
sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
for (int i = 0; i < Pile2.size(); i++) {
sb.append(Pile2.get(i).getName() + "\r\n");
for (int i = 0; i < pile2.size(); i++) {
sb.append(pile2.get(i).getName() + "\r\n");
}
Object[] possibleValues = {"Pile 1", "Pile 2"};
Object q = JOptionPane.showOptionDialog(null, sb, "Brilliant Ultimatum",
@@ -590,9 +590,9 @@ public class CardFactory_Sorceries {
CardList chosen;
if (q.equals(0)) {
chosen = Pile1;
chosen = pile1;
} else {
chosen = Pile2;
chosen = pile2;
}
int numChosen = chosen.size();
@@ -618,8 +618,8 @@ public class CardFactory_Sorceries {
}
}
Pile1.clear();
Pile2.clear();
pile1.clear();
pile2.clear();
} // resolve()
@Override
@@ -808,8 +808,8 @@ public class CardFactory_Sorceries {
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = -6003403347798646257L;
int damage = 3;
Card check;
private int damage = 3;
private Card check;
@Override
public boolean canPlayAI() {
@@ -900,12 +900,12 @@ public class CardFactory_Sorceries {
@Override
public void resolve() {
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
int Soldiers = card.getXManaCostPaid();
for (int i = 0; i < Soldiers; i++) {
int soldiers = card.getXManaCostPaid();
for (int i = 0; i < soldiers; i++) {
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", card.getController(), "W", new String[] {
"Creature", "Soldier" }, 1, 1, new String[] { "" });
}
if (Soldiers >= 5) {
if (soldiers >= 5) {
for (int i = 0; i < all.size(); i++) {
Card c = all.get(i);
if (c.isCreature()) {
@@ -963,7 +963,7 @@ public class CardFactory_Sorceries {
card.setFlashback(true);
card.addSpellAbility(spell);
card.addSpellAbility(CardFactoryUtil.ability_Flashback(card, "4 G G G"));
card.addSpellAbility(CardFactoryUtil.abilityFlashback(card, "4 G G G"));
} // *************** END ************ END **************************
// *************** START *********** START **************************
@@ -1594,8 +1594,8 @@ public class CardFactory_Sorceries {
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = -3234630801871872940L;
int damage = 3;
Card check;
private int damage = 3;
private Card check;
@Override
public boolean canPlayAI() {
@@ -1921,21 +1921,21 @@ public class CardFactory_Sorceries {
/*
* We want compy to have less cards in hand than the human
*/
CardList Hhand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
CardList Chand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
return Chand.size() < Hhand.size();
CardList humanHand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
CardList computerHand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
return computerHand.size() < humanHand.size();
}
@Override
public void resolve() {
CardList Hhand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
CardList Chand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
CardList humanHand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
CardList computerHand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
int num = Math.max(Hhand.size(), Chand.size());
int num = Math.max(humanHand.size(), computerHand.size());
discardDraw(AllZone.getHumanPlayer(), num);
discardDraw(AllZone.getComputerPlayer(), num);
}// resolve()
} // resolve()
void discardDraw(final Player player, final int num) {
player.discardHand(this);
@@ -2355,7 +2355,7 @@ public class CardFactory_Sorceries {
}
}
// "Return target creature card with converted mana cost
// "Return target creature card with converted mana cost
// X or less from your graveyard to the battlefield",
if (userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) {
Card c = ab1card[0];
@@ -2449,8 +2449,8 @@ public class CardFactory_Sorceries {
final Input targetXCreatures = new Input() {
private static final long serialVersionUID = 2584765431286321048L;
int stop = 0;
int count = 0;
private int stop = 0;
private int count = 0;
@Override
public void showMessage() {

View File

@@ -33,8 +33,8 @@ public class LazyCardFactory extends AbstractCardFactory {
public LazyCardFactory(final File cardsfolder) {
super(cardsfolder);
getMap().clear();
cardReader = new CardReader(cardsfolder, getMap());
this.getMap().clear();
this.cardReader = new CardReader(cardsfolder, this.getMap());
}
/**
@@ -43,7 +43,7 @@ public class LazyCardFactory extends AbstractCardFactory {
* @return cardReader
*/
public final CardReader getCardReader() {
return cardReader;
return this.cardReader;
}
/**
@@ -69,24 +69,24 @@ public class LazyCardFactory extends AbstractCardFactory {
*/
@Override
protected final Card getCard2(final String cardName, final Player owner) {
final Map<String, Card> cardNamesToCards = getMap();
final Map<String, Card> cardNamesToCards = this.getMap();
Card result = null;
boolean wasLoaded = cardNamesToCards.containsKey(cardName);
if (!wasLoaded) {
if (cardsFailedToLoad.contains(cardName)) {
if (this.cardsFailedToLoad.contains(cardName)) {
return null; // no more System.err, exceptions of other drama -
// just return null.
}
final String canonicalASCIIName = CardUtil.canonicalizeCardName(cardName);
Card cardRequested = getCardReader().findCard(canonicalASCIIName);
final Card cardRequested = this.getCardReader().findCard(canonicalASCIIName);
if (null != cardRequested) {
cardNamesToCards.put(cardName, cardRequested);
wasLoaded = true;
} else {
cardsFailedToLoad.add(cardName);
this.cardsFailedToLoad.add(cardName);
System.err.println(String.format("LazyCF: Tried to read from disk card '%s' but not found it!",
cardName));
return null;

View File

@@ -18,20 +18,20 @@ import forge.card.mana.ManaPool;
* @version $Id$
*/
public abstract class Ability_Mana extends Ability_Activated implements java.io.Serializable {
/** Constant <code>serialVersionUID=-6816356991224950520L</code> */
/** Constant <code>serialVersionUID=-6816356991224950520L</code>. */
private static final long serialVersionUID = -6816356991224950520L;
private String origProduced;
private int amount = 1;
/** The reflected. */
protected boolean reflected = false;
private boolean reflected = false;
/** The undoable. */
protected boolean undoable = true;
private boolean undoable = true;
/** The canceled. */
protected boolean canceled = false;
private boolean canceled = false;
/**
* <p>

View File

@@ -28,7 +28,7 @@ public abstract class Ability_Sub extends SpellAbility implements java.io.Serial
*/
public Ability_Sub(final Card sourceCard, final Target tgt) {
super(SpellAbility.Ability, sourceCard);
setTarget(tgt);
this.setTarget(tgt);
}
/** {@inheritDoc} */
@@ -45,9 +45,10 @@ public abstract class Ability_Sub extends SpellAbility implements java.io.Serial
*
* @return a boolean.
*/
public abstract boolean chkAI_Drawback();
public abstract boolean chkAIDrawback();
/** {@inheritDoc} */
@Override
public abstract boolean doTrigger(boolean mandatory);
/**
@@ -70,6 +71,6 @@ public abstract class Ability_Sub extends SpellAbility implements java.io.Serial
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public final SpellAbility getParent() {
return parent;
return this.parent;
}
}

View File

@@ -23,13 +23,31 @@ public class Ability_Triggered extends Ability implements Command {
private static final long serialVersionUID = 4970998845621323960L;
/** The restrictions. */
public String[] restrictions;
private String[] restrictions;
/** The trigger. */
public ZCTrigger trigger;
private ZCTrigger trigger;
/**
* Gets the trigger.
*
* @return the trigger
*/
public final ZCTrigger getTrigger() {
return trigger;
}
/**
* Sets the trigger.
*
* @param trigger the new trigger
*/
public final void setTrigger(final ZCTrigger trigger) {
this.trigger = trigger;
}
/** The todo. */
public Command todo;
private Command todo;
/**
* <p>
@@ -114,7 +132,7 @@ public class Ability_Triggered extends Ability implements Command {
/** {@inheritDoc} */
@Override
public final boolean equals(final Object o) // TODO: triggers affecting other cards
public final boolean equals(final Object o) // TODO triggers affecting other cards
{
if (!(o instanceof Ability_Triggered)) {
return false;

View File

@@ -24,23 +24,23 @@ public class SpellAbility_StackInstance {
// Coming off the Stack would work similarly, except it would just add the
// full active SI instead of each of the parts
/** The ability. */
SpellAbility ability = null;
private SpellAbility ability = null;
/** The sub instace. */
SpellAbility_StackInstance subInstace = null;
private SpellAbility_StackInstance subInstace = null;
// When going to a SubAbility that SA has a Instance Choice object
/** The tc. */
Target_Choices tc = null;
private Target_Choices tc = null;
/** The activating player. */
Player activatingPlayer = null;
private Player activatingPlayer = null;
/** The activated from. */
String activatedFrom = null;
private String activatedFrom = null;
/** The stack description. */
String stackDescription = null;
private String stackDescription = null;
// Adjusted Mana Cost
// private String adjustedManaCost = "";
@@ -222,12 +222,12 @@ public class SpellAbility_StackInstance {
* isStateTrigger.
* </p>
*
* @param ID
* @param id
* a int.
* @return a boolean.
*/
public final boolean isStateTrigger(final int ID) {
return ability.getSourceTrigger() == ID;
public final boolean isStateTrigger(final int id) {
return ability.getSourceTrigger() == id;
}
/**

View File

@@ -368,8 +368,9 @@ public class SpellAbility_Variables {
* a {@link java.lang.String} object.
*/
public final void setPhases(final String phasesString) {
for (String s : phasesString.split(","))
for (String s : phasesString.split(",")) {
phases.add(s);
}
}
/**
@@ -520,11 +521,11 @@ public class SpellAbility_Variables {
* Setter for the field <code>svarToCheck</code>.
* </p>
*
* @param SVar
* @param sVar
* a {@link java.lang.String} object.
*/
public final void setSvarToCheck(final String SVar) {
svarToCheck = SVar;
public final void setSvarToCheck(final String sVar) {
svarToCheck = sVar;
}
/**
@@ -532,11 +533,11 @@ public class SpellAbility_Variables {
* Setter for the field <code>svarOperator</code>.
* </p>
*
* @param Operator
* @param operator
* a {@link java.lang.String} object.
*/
public final void setSvarOperator(final String Operator) {
svarOperator = Operator;
public final void setSvarOperator(final String operator) {
svarOperator = operator;
}
/**
@@ -544,11 +545,11 @@ public class SpellAbility_Variables {
* Setter for the field <code>svarOperand</code>.
* </p>
*
* @param Operand
* @param operand
* a {@link java.lang.String} object.
*/
public final void setSvarOperand(final String Operand) {
svarOperand = Operand;
public final void setSvarOperand(final String operand) {
svarOperand = operand;
}
} // end class SpellAbility_Variables

View File

@@ -36,7 +36,7 @@ public class Spell_Permanent extends Spell {
private String championValidDesc = "";
/** The champion input comes. */
final Input championInputComes = new Input() {
private final Input championInputComes = new Input() {
private static final long serialVersionUID = -7503268232821397107L;
@Override
@@ -58,7 +58,7 @@ public class Spell_Permanent extends Spell {
}; // CommandReturn
/** The champion ability comes. */
final SpellAbility championAbilityComes = new Ability(getSourceCard(), "0") {
private final SpellAbility championAbilityComes = new Ability(getSourceCard(), "0") {
@Override
public void resolve() {
@@ -97,7 +97,7 @@ public class Spell_Permanent extends Spell {
};
/** The champion command comes. */
Command championCommandComes = new Command() {
private Command championCommandComes = new Command() {
private static final long serialVersionUID = -3580408066322945328L;
@@ -111,7 +111,7 @@ public class Spell_Permanent extends Spell {
}; // championCommandComes
/** The champion command leaves play. */
Command championCommandLeavesPlay = new Command() {
private Command championCommandLeavesPlay = new Command() {
private static final long serialVersionUID = -5903638227914705191L;