checkstyle

This commit is contained in:
jendave
2011-10-31 06:36:35 +00:00
parent 8d61edf4fe
commit b187e3193c
36 changed files with 2098 additions and 2180 deletions

View File

@@ -275,7 +275,7 @@ public class AIPlayer extends Player {
public final void sacrificePermanent(final String prompt, final CardList choices) {
if (choices.size() > 0) {
// TODO - this could probably use better AI
Card c = CardFactoryUtil.AI_getWorstPermanent(choices, false, false, false, false);
Card c = CardFactoryUtil.getWorstPermanentAI(choices, false, false, false, false);
AllZone.getGameAction().sacrificeDestroy(c);
}
}

View File

@@ -2198,7 +2198,7 @@ public class CombatUtil {
}
});
if (enchantments.size() > 0) {
Card card = CardFactoryUtil.AI_getBestEnchantment(enchantments, c, false);
Card card = CardFactoryUtil.getBestEnchantmentAI(enchantments, c, false);
AllZone.getGameAction().moveToPlay(card);
c.getController().shuffle();
}
@@ -2277,7 +2277,7 @@ public class CombatUtil {
card.setCreatureAttackedThisCombat(true);
}
} else if (c.getController().isComputer()) {
Card card = CardFactoryUtil.AI_getBestCreature(soldiers);
Card card = CardFactoryUtil.getBestCreatureAI(soldiers);
if (card != null) {
AllZone.getGameAction().moveToPlay(card);
@@ -2568,7 +2568,7 @@ public class CombatUtil {
enchantment = ((Card) check);
}
} else {
enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments, attacker, false);
enchantment = CardFactoryUtil.getBestEnchantmentAI(enchantments, attacker, false);
}
if (enchantment != null && AllZoneUtil.isCardInPlay(attacker)) {
GameAction.changeZone(AllZone.getZoneOf(enchantment),

View File

@@ -1490,7 +1490,7 @@ public class ComputerUtil {
Card c;
if (list.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getWorstCreature(list);
c = CardFactoryUtil.getWorstCreatureAI(list);
} else if (list.getNotType("Land").size() == 0) {
c = CardFactoryUtil.getWorstLand(AllZone.getComputerPlayer());
} else {

View File

@@ -316,9 +316,9 @@ public class ComputerUtil_Block2 {
// destroyed
killingBlockers = getKillingBlockers(attacker, safeBlockers, combat);
if (killingBlockers.size() > 0) {
blocker = CardFactoryUtil.AI_getWorstCreature(killingBlockers);
blocker = CardFactoryUtil.getWorstCreatureAI(killingBlockers);
} else {
blocker = CardFactoryUtil.AI_getWorstCreature(safeBlockers);
blocker = CardFactoryUtil.getWorstCreatureAI(safeBlockers);
getBlockedButUnkilled().add(attacker);
}
} // no safe blockers
@@ -327,7 +327,7 @@ public class ComputerUtil_Block2 {
if (killingBlockers.size() > 0) {
// 3.Blockers that can destroy the attacker and are worth
// less
Card worst = CardFactoryUtil.AI_getWorstCreature(killingBlockers);
Card worst = CardFactoryUtil.getWorstCreatureAI(killingBlockers);
if (CardFactoryUtil.evaluateCreature(worst) + getDiff() < CardFactoryUtil
.evaluateCreature(attacker)) {
@@ -428,7 +428,7 @@ public class ComputerUtil_Block2 {
return combat;
}
Card leader = CardFactoryUtil.AI_getBestCreature(usableBlockers);
Card leader = CardFactoryUtil.getBestCreatureAI(usableBlockers);
blockGang.add(leader);
usableBlockers.remove(leader);
absorbedDamage = leader.getEnoughDamageToKill(attacker.getNetCombatDamage(), attacker, true);
@@ -485,7 +485,7 @@ public class ComputerUtil_Block2 {
killingBlockers = getKillingBlockers(attacker, getPossibleBlockers(attacker, getBlockersLeft(), combat),
combat);
if (killingBlockers.size() > 0 && CombatUtil.lifeInDanger(combat)) {
Card blocker = CardFactoryUtil.AI_getWorstCreature(killingBlockers);
Card blocker = CardFactoryUtil.getWorstCreatureAI(killingBlockers);
combat.addBlocker(attacker, blocker);
currentAttackers.remove(attacker);
getBlockersLeft().remove(blocker);
@@ -513,7 +513,7 @@ public class ComputerUtil_Block2 {
for (Card attacker : getAttackersLeft()) {
chumpBlockers = getPossibleBlockers(attacker, getBlockersLeft(), combat);
if (chumpBlockers.size() > 0 && CombatUtil.lifeInDanger(combat)) {
Card blocker = CardFactoryUtil.AI_getWorstCreature(chumpBlockers);
Card blocker = CardFactoryUtil.getWorstCreatureAI(chumpBlockers);
combat.addBlocker(attacker, blocker);
currentAttackers.remove(attacker);
getBlockedButUnkilled().add(attacker);

View File

@@ -2013,7 +2013,7 @@ public class GameAction {
}
}
if (chosen == null) {
chosen = CardFactoryUtil.AI_getWorstCreature(grave);
chosen = CardFactoryUtil.getWorstCreatureAI(grave);
}
if (chosen == null) {

View File

@@ -918,9 +918,9 @@ public class MagicStack extends MyObservable {
// AI choosing what to haunt
final CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
if (oppCreats.size() != 0) {
haunterDiesWork.setTargetCard(CardFactoryUtil.AI_getWorstCreature(oppCreats));
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats));
} else {
haunterDiesWork.setTargetCard(CardFactoryUtil.AI_getWorstCreature(creats));
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(creats));
}
this.add(haunterDiesWork);
}

View File

@@ -270,7 +270,7 @@ public class PhaseUtil {
}
});
if (artList.size() > 0) {
CardFactoryUtil.AI_getBestArtifact(artList).untap();
CardFactoryUtil.getBestArtifactAI(artList).untap();
}
} else {
Input target = new Input() {

View File

@@ -537,7 +537,7 @@ public class Upkeep implements java.io.Serializable {
if (indestruct.size() > 0) {
AllZone.getGameAction().destroyNoRegeneration(indestruct.get(0));
} else {
final Card target = CardFactoryUtil.AI_getWorstCreature(targets);
final Card target = CardFactoryUtil.getWorstCreatureAI(targets);
if (null == target) {
// must be nothing valid to destroy
} else {
@@ -625,7 +625,7 @@ public class Upkeep implements java.io.Serializable {
} // selectCard()
}); // Input
} else { // computer
final Card target = CardFactoryUtil.AI_getCheapestPermanent(artifacts, c, false);
final Card target = CardFactoryUtil.getCheapestPermanentAI(artifacts, c, false);
if (null == target) {
this.tapAndDamage(player);
} else {
@@ -683,7 +683,7 @@ public class Upkeep implements java.io.Serializable {
PlayerUtil.input_sacrificePermanent(creatures, c.getName()
+ " - Select a creature to sacrifice."));
} else { // computer
final Card target = CardFactoryUtil.AI_getWorstCreature(creatures);
final Card target = CardFactoryUtil.getWorstCreatureAI(creatures);
AllZone.getGameAction().sacrifice(target);
}
} // resolve
@@ -748,7 +748,7 @@ public class Upkeep implements java.io.Serializable {
final int power = creatures.get(0).getNetAttack();
if (player.isHuman()) {
AllZone.getInputControl().setInput(
CardFactoryUtil.input_destroyNoRegeneration(this.getLowestPowerList(creatures),
CardFactoryUtil.inputDestroyNoRegeneration(this.getLowestPowerList(creatures),
"Select creature with power: " + power + " to sacrifice."));
} else { // computer
final Card compyTarget = this.getCompyCardToDestroy(creatures);
@@ -827,7 +827,7 @@ public class Upkeep implements java.io.Serializable {
+ " - Select a land to sacrifice."));
}
} else {
final Card target = CardFactoryUtil.AI_getBestLand(playerLand);
final Card target = CardFactoryUtil.getBestLandAI(playerLand);
AllZone.getGameAction().sacrifice(target);
}
@@ -2587,7 +2587,7 @@ public class Upkeep implements java.io.Serializable {
for (int i = 0; i < num; i++) {
if (player.isComputer()) {
final Card toTap = CardFactoryUtil.AI_getWorstPermanent(list, false, false, false, false);
final Card toTap = CardFactoryUtil.getWorstPermanentAI(list, false, false, false, false);
if (null != toTap) {
toTap.tap();
list.remove(toTap);

View File

@@ -320,7 +320,7 @@ public class AbilityFactory_Attach {
return null;
}
return CardFactoryUtil.AI_getWorstPermanent(list, true, true, true, false);
return CardFactoryUtil.getWorstPermanentAI(list, true, true, true, false);
}
/**
@@ -337,7 +337,7 @@ public class AbilityFactory_Attach {
return null;
}
return CardFactoryUtil.AI_getBest(list);
return CardFactoryUtil.getBestAI(list);
}
/**
@@ -391,7 +391,7 @@ public class AbilityFactory_Attach {
}
final Card c = CardFactoryUtil.AI_getBest(list);
final Card c = CardFactoryUtil.getBestAI(list);
// If Mandatory (brought directly into play without casting) gotta
// choose something
@@ -441,7 +441,7 @@ public class AbilityFactory_Attach {
}
});
return CardFactoryUtil.AI_getBest(magnetList);
return CardFactoryUtil.getBestAI(magnetList);
}
int totToughness = 0;
@@ -536,11 +536,11 @@ public class AbilityFactory_Attach {
return !c.isCreature() || CombatUtil.canAttack(c);
}
});
c = CardFactoryUtil.AI_getBest(prefList);
c = CardFactoryUtil.getBestAI(prefList);
} else {
// If we grant abilities, we may want to put it on something Weak?
// Possibly more defensive?
c = CardFactoryUtil.AI_getWorstPermanent(prefList, false, false, false, false);
c = CardFactoryUtil.getWorstPermanentAI(prefList, false, false, false, false);
}
if (c == null) {
@@ -628,7 +628,7 @@ public class AbilityFactory_Attach {
if ((prefList == null) || (prefList.size() == 0)) {
prefList = new CardList(list);
} else {
c = CardFactoryUtil.AI_getBest(prefList);
c = CardFactoryUtil.getBestAI(prefList);
if (c != null) {
return c;
}
@@ -648,7 +648,7 @@ public class AbilityFactory_Attach {
}
}
c = CardFactoryUtil.AI_getBest(prefList);
c = CardFactoryUtil.getBestAI(prefList);
if (c == null) {
return AbilityFactory_Attach.chooseLessPreferred(mandatory, list);
@@ -686,7 +686,7 @@ public class AbilityFactory_Attach {
list = list.getNotType(type); // Filter out Basic Lands that have the
// same type as the changing type
final Card c = CardFactoryUtil.AI_getBest(list);
final Card c = CardFactoryUtil.getBestAI(list);
// TODO Port over some of the existing code, but rewrite most of it.
// Ultimately, these spells need to be used to reduce mana base of a
@@ -748,7 +748,7 @@ public class AbilityFactory_Attach {
}
});
final Card c = CardFactoryUtil.AI_getBest(prefList);
final Card c = CardFactoryUtil.getBestAI(prefList);
if (c == null) {
return AbilityFactory_Attach.chooseLessPreferred(mandatory, list);

View File

@@ -942,19 +942,19 @@ public final class AbilityFactory_ChangeZone {
} else if (AbilityFactory_ChangeZone.areAllBasics(type)) {
c = AbilityFactory_ChangeZone.basicManaFixing(fetchList, type);
} else if (fetchList.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getBestCreature(fetchList); // if only
c = CardFactoryUtil.getBestCreatureAI(fetchList); // if only
// creatures
// take the
// best
} else if (Zone.Battlefield.equals(destination) || Zone.Graveyard.equals(destination)) {
c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false);
c = CardFactoryUtil.getMostExpensivePermanentAI(fetchList, af.getHostCard(), false);
} else if (Zone.Exile.equals(destination)) {
// Exiling your own stuff, if Exiling opponents stuff choose
// best
if (destZone.getPlayer().isHuman()) {
c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false);
c = CardFactoryUtil.getMostExpensivePermanentAI(fetchList, af.getHostCard(), false);
} else {
c = CardFactoryUtil.AI_getCheapestPermanent(fetchList, af.getHostCard(), false);
c = CardFactoryUtil.getCheapestPermanentAI(fetchList, af.getHostCard(), false);
}
} else {
// Don't fetch another tutor with the same name
@@ -1318,7 +1318,7 @@ public final class AbilityFactory_ChangeZone {
if (!threatenedTargets.isEmpty()) {
// Choose "best" of the remaining to save
tgt.addTarget(CardFactoryUtil.AI_getBestCreature(threatenedTargets));
tgt.addTarget(CardFactoryUtil.getBestCreatureAI(threatenedTargets));
return true;
}
}
@@ -1357,7 +1357,7 @@ public final class AbilityFactory_ChangeZone {
});
if (!aiPermanents.isEmpty()) {
// Choose "best" of the remaining to save
tgt.addTarget(CardFactoryUtil.AI_getBest(aiPermanents));
tgt.addTarget(CardFactoryUtil.getBestAI(aiPermanents));
return true;
}
}
@@ -1400,15 +1400,15 @@ public final class AbilityFactory_ChangeZone {
Card choice = null;
if (!list.isEmpty()) {
final Card mostExpensive = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false);
final Card mostExpensive = CardFactoryUtil.getMostExpensivePermanentAI(list, af.getHostCard(), false);
if (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield)) {
if (mostExpensive.isCreature()) {
// if a creature is most expensive take the best one
if (destination.equals(Zone.Exile)) {
// If Exiling things, don't give bonus to Tokens
choice = CardFactoryUtil.AI_getBestCreature(list);
choice = CardFactoryUtil.getBestCreatureAI(list);
} else {
choice = CardFactoryUtil.AI_getBestCreatureToBounce(list);
choice = CardFactoryUtil.getBestCreatureToBounceAI(list);
}
} else {
choice = mostExpensive;
@@ -1495,12 +1495,12 @@ public final class AbilityFactory_ChangeZone {
Card choice = null;
if (!list.isEmpty()) {
if (CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false).isCreature()
if (CardFactoryUtil.getMostExpensivePermanentAI(list, af.getHostCard(), false).isCreature()
&& (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield))) {
// if a creature is most expensive take the best
choice = CardFactoryUtil.AI_getBestCreatureToBounce(list);
choice = CardFactoryUtil.getBestCreatureToBounceAI(list);
} else if (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield)) {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false);
choice = CardFactoryUtil.getMostExpensivePermanentAI(list, af.getHostCard(), false);
} else {
// TODO AI needs more improvement to it's retrieval (reuse
// some code from spReturn here)

View File

@@ -954,11 +954,11 @@ public final class AbilityFactory_Combat {
}
});
if (!list.isEmpty()) {
final Card blocker = CardFactoryUtil.AI_getBestCreature(list);
final Card blocker = CardFactoryUtil.getBestCreatureAI(list);
if (blocker == null) {
return false;
}
abTgt.addTarget(CardFactoryUtil.AI_getBestCreature(list));
abTgt.addTarget(CardFactoryUtil.getBestCreatureAI(list));
chance = true; // TODO change this to true, once the human input
// takes mustblocks into account
}

View File

@@ -277,9 +277,9 @@ public final class AbilityFactory_Copy {
Card choice;
if (list.filter(CardListFilter.CREATURES).size() > 0) {
choice = CardFactoryUtil.AI_getBestCreature(list);
choice = CardFactoryUtil.getBestCreatureAI(list);
} else {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, source, true);
choice = CardFactoryUtil.getMostExpensivePermanentAI(list, source, true);
}
if (choice == null) { // can't find anything left

View File

@@ -533,7 +533,7 @@ public class AbilityFactory_Counters {
else {
if (type.equals("M1M1")) {
choice = CardFactoryUtil.AI_getWorstCreature(list);
choice = CardFactoryUtil.getWorstCreatureAI(list);
} else {
choice = CardFactoryUtil.getRandomCard(list);
}
@@ -545,7 +545,7 @@ public class AbilityFactory_Counters {
else {
if (type.equals("P1P1")) {
choice = CardFactoryUtil.AI_getWorstCreature(list);
choice = CardFactoryUtil.getWorstCreatureAI(list);
} else {
choice = CardFactoryUtil.getRandomCard(list);
}
@@ -589,9 +589,9 @@ public class AbilityFactory_Counters {
}
});
if (killable.size() > 0) {
choice = CardFactoryUtil.AI_getBestCreature(killable);
choice = CardFactoryUtil.getBestCreatureAI(killable);
} else {
choice = CardFactoryUtil.AI_getBestCreature(list);
choice = CardFactoryUtil.getBestCreatureAI(list);
}
} else {
// improve random choice here
@@ -614,7 +614,7 @@ public class AbilityFactory_Counters {
private static Card chooseBoonTarget(final CardList list, final String type) {
Card choice;
if (type.equals("P1P1")) {
choice = CardFactoryUtil.AI_getBestCreature(list);
choice = CardFactoryUtil.getBestCreatureAI(list);
} else if (type.equals("DIVINITY")) {
final CardList boon = list.filter(new CardListFilter() {
@Override
@@ -622,7 +622,7 @@ public class AbilityFactory_Counters {
return c.getCounters(Counters.DIVINITY) == 0;
}
});
choice = CardFactoryUtil.AI_getMostExpensivePermanent(boon, null, false);
choice = CardFactoryUtil.getMostExpensivePermanentAI(boon, null, false);
} else {
// The AI really should put counters on cards that can use it.
// Charge counters on things with Charge abilities, etc. Expand

View File

@@ -459,7 +459,7 @@ public class AbilityFactory_DealDamage {
Card targetCard;
if (pl.isHuman() && (killables.size() > 0)) {
targetCard = CardFactoryUtil.AI_getBestCreature(killables);
targetCard = CardFactoryUtil.getBestCreatureAI(killables);
return targetCard;
}
@@ -470,9 +470,9 @@ public class AbilityFactory_DealDamage {
if (hPlay.size() > 0) {
if (pl.isHuman()) {
targetCard = CardFactoryUtil.AI_getBestCreature(hPlay);
targetCard = CardFactoryUtil.getBestCreatureAI(hPlay);
} else {
targetCard = CardFactoryUtil.AI_getWorstCreature(hPlay);
targetCard = CardFactoryUtil.getWorstCreatureAI(hPlay);
}
return targetCard;

View File

@@ -377,7 +377,7 @@ public final class AbilityFactory_Debuff {
}
}
t = CardFactoryUtil.AI_getBestCreature(list);
t = CardFactoryUtil.getBestCreatureAI(list);
tgt.addTarget(t);
list.remove(t);
}
@@ -456,9 +456,9 @@ public final class AbilityFactory_Debuff {
Card c;
if (pref.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getBestCreature(pref);
c = CardFactoryUtil.getBestCreatureAI(pref);
} else {
c = CardFactoryUtil.AI_getMostExpensivePermanent(pref, source, true);
c = CardFactoryUtil.getMostExpensivePermanentAI(pref, source, true);
}
pref.remove(c);
@@ -475,9 +475,9 @@ public final class AbilityFactory_Debuff {
// keyword
Card c;
if (forced.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getWorstCreature(forced);
c = CardFactoryUtil.getWorstCreatureAI(forced);
} else {
c = CardFactoryUtil.AI_getCheapestPermanent(forced, source, true);
c = CardFactoryUtil.getCheapestPermanentAI(forced, source, true);
}
forced.remove(c);

View File

@@ -226,7 +226,7 @@ public class AbilityFactory_Destroy {
Card choice = null;
if (list.getNotType("Creature").size() == 0) {
choice = CardFactoryUtil.AI_getBestCreature(list); // if the
choice = CardFactoryUtil.getBestCreatureAI(list); // if the
// targets
// are
// only
@@ -235,7 +235,7 @@ public class AbilityFactory_Destroy {
// the
// best
} else {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), true);
choice = CardFactoryUtil.getMostExpensivePermanentAI(list, af.getHostCard(), true);
}
if (choice == null) { // can't find anything left
@@ -335,11 +335,11 @@ public class AbilityFactory_Destroy {
} else {
Card c;
if (preferred.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getBestCreature(preferred);
c = CardFactoryUtil.getBestCreatureAI(preferred);
} else if (preferred.getNotType("Land").size() == 0) {
c = CardFactoryUtil.AI_getBestLand(preferred);
c = CardFactoryUtil.getBestLandAI(preferred);
} else {
c = CardFactoryUtil.AI_getMostExpensivePermanent(preferred, source, false);
c = CardFactoryUtil.getMostExpensivePermanentAI(preferred, source, false);
}
tgt.addTarget(c);
preferred.remove(c);
@@ -352,9 +352,9 @@ public class AbilityFactory_Destroy {
} else {
Card c;
if (list.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getWorstCreature(list);
c = CardFactoryUtil.getWorstCreatureAI(list);
} else {
c = CardFactoryUtil.AI_getCheapestPermanent(list, source, false);
c = CardFactoryUtil.getCheapestPermanentAI(list, source, false);
}
tgt.addTarget(c);
list.remove(c);

View File

@@ -328,15 +328,15 @@ public class AbilityFactory_GainControl {
}
if (hasCreature) {
t = CardFactoryUtil.AI_getBestCreature(list);
t = CardFactoryUtil.getBestCreatureAI(list);
} else if (hasArtifact) {
t = CardFactoryUtil.AI_getBestArtifact(list);
t = CardFactoryUtil.getBestArtifactAI(list);
} else if (hasLand) {
t = CardFactoryUtil.AI_getBestLand(list);
t = CardFactoryUtil.getBestLandAI(list);
} else if (hasEnchantment) {
t = CardFactoryUtil.AI_getBestEnchantment(list, sa.getSourceCard(), true);
t = CardFactoryUtil.getBestEnchantmentAI(list, sa.getSourceCard(), true);
} else {
t = CardFactoryUtil.AI_getMostExpensivePermanent(list, sa.getSourceCard(), true);
t = CardFactoryUtil.getMostExpensivePermanentAI(list, sa.getSourceCard(), true);
}
tgt.addTarget(t);

View File

@@ -375,14 +375,14 @@ public class AbilityFactory_PermanentState {
}
if (untapList.getNotType("Creature").size() == 0) {
choice = CardFactoryUtil.AI_getBestCreature(untapList); // if
choice = CardFactoryUtil.getBestCreatureAI(untapList); // if
// only
// creatures
// take
// the
// best
} else {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(untapList, af.getHostCard(), false);
choice = CardFactoryUtil.getMostExpensivePermanentAI(untapList, af.getHostCard(), false);
}
if (choice == null) { // can't find anything left
@@ -495,13 +495,13 @@ public class AbilityFactory_PermanentState {
}
if (tapList.getNotType("Creature").size() == 0) {
choice = CardFactoryUtil.AI_getBestCreature(tapList); // if only
choice = CardFactoryUtil.getBestCreatureAI(tapList); // if only
// creatures
// take
// the
// best
} else {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(tapList, af.getHostCard(), false);
choice = CardFactoryUtil.getMostExpensivePermanentAI(tapList, af.getHostCard(), false);
}
if (choice == null) { // can't find anything left
@@ -579,7 +579,7 @@ public class AbilityFactory_PermanentState {
for (final Player p : definedPlayers) {
if (p.isHuman()) {
AllZone.getInputControl().setInput(CardFactoryUtil.input_UntapUpToNType(num, valid));
AllZone.getInputControl().setInput(CardFactoryUtil.inputUntapUpToNType(num, valid));
} else {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
list = list.getType(valid);
@@ -589,7 +589,7 @@ public class AbilityFactory_PermanentState {
while ((list.size() != 0) && (count < num)) {
for (int i = 0; (i < list.size()) && (count < num); i++) {
final Card c = CardFactoryUtil.AI_getBestLand(list);
final Card c = CardFactoryUtil.getBestLandAI(list);
c.untap();
list.remove(c);
count++;
@@ -944,13 +944,13 @@ public class AbilityFactory_PermanentState {
}
if (tapList.getNotType("Creature").size() == 0) {
choice = CardFactoryUtil.AI_getBestCreature(tapList); // if only
choice = CardFactoryUtil.getBestCreatureAI(tapList); // if only
// creatures
// take
// the
// best
} else {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(tapList, af.getHostCard(), false);
choice = CardFactoryUtil.getMostExpensivePermanentAI(tapList, af.getHostCard(), false);
}
if (choice == null) { // can't find anything left
@@ -1064,13 +1064,13 @@ public class AbilityFactory_PermanentState {
}
if (tapList.getNotType("Creature").size() == 0) {
choice = CardFactoryUtil.AI_getBestCreature(tapList); // if only
choice = CardFactoryUtil.getBestCreatureAI(tapList); // if only
// creatures
// take
// the
// best
} else {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(tapList, af.getHostCard(), false);
choice = CardFactoryUtil.getMostExpensivePermanentAI(tapList, af.getHostCard(), false);
}
if (choice == null) { // can't find anything left

View File

@@ -313,7 +313,7 @@ public class AbilityFactory_PreventDamage {
if (!threatenedTargets.isEmpty()) {
// Choose "best" of the remaining to save
tgt.addTarget(CardFactoryUtil.AI_getBestCreature(threatenedTargets));
tgt.addTarget(CardFactoryUtil.getBestCreatureAI(threatenedTargets));
chance = true;
}
@@ -439,7 +439,7 @@ public class AbilityFactory_PreventDamage {
return true;
}
tgt.addTarget(CardFactoryUtil.AI_getCheapestPermanent(targetables, hostCard, true));
tgt.addTarget(CardFactoryUtil.getCheapestPermanentAI(targetables, hostCard, true));
return true;
}

View File

@@ -214,7 +214,7 @@ public final class AbilityFactory_Protection {
}
// will the creature attack (only relevant for sorcery speed)?
if (CardFactoryUtil.AI_doesCreatureAttack(c)
if (CardFactoryUtil.doesCreatureAttackAI(c)
&& AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
return true;
@@ -387,7 +387,7 @@ public final class AbilityFactory_Protection {
}
}
t = CardFactoryUtil.AI_getBestCreature(list);
t = CardFactoryUtil.getBestCreatureAI(list);
tgt.addTarget(t);
list.remove(t);
}
@@ -453,9 +453,9 @@ public final class AbilityFactory_Protection {
Card c;
if (pref.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getBestCreature(pref);
c = CardFactoryUtil.getBestCreatureAI(pref);
} else {
c = CardFactoryUtil.AI_getMostExpensivePermanent(pref, source, true);
c = CardFactoryUtil.getMostExpensivePermanentAI(pref, source, true);
}
pref.remove(c);
@@ -470,9 +470,9 @@ public final class AbilityFactory_Protection {
Card c;
if (pref2.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getBestCreature(pref2);
c = CardFactoryUtil.getBestCreatureAI(pref2);
} else {
c = CardFactoryUtil.AI_getMostExpensivePermanent(pref2, source, true);
c = CardFactoryUtil.getMostExpensivePermanentAI(pref2, source, true);
}
pref2.remove(c);
@@ -487,9 +487,9 @@ public final class AbilityFactory_Protection {
Card c;
if (forced.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getWorstCreature(forced);
c = CardFactoryUtil.getWorstCreatureAI(forced);
} else {
c = CardFactoryUtil.AI_getCheapestPermanent(forced, source, true);
c = CardFactoryUtil.getCheapestPermanentAI(forced, source, true);
}
forced.remove(c);

View File

@@ -274,7 +274,7 @@ public class AbilityFactory_Pump {
}
// will the creature attack (only relevant for sorcery speed)?
if (CardFactoryUtil.AI_doesCreatureAttack(c)
if (CardFactoryUtil.doesCreatureAttackAI(c)
&& AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
return true;
@@ -496,7 +496,7 @@ public class AbilityFactory_Pump {
} else if (this.hostCard.equals(card)) {
final Random r = MyRandom.getRandom();
if (r.nextFloat() <= Math.pow(.6667, activations)) {
return CardFactoryUtil.AI_doesCreatureAttack(card) && !sa.getPayCosts().getTap();
return CardFactoryUtil.doesCreatureAttackAI(card) && !sa.getPayCosts().getTap();
}
} else {
final Random r = MyRandom.getRandom();
@@ -580,7 +580,7 @@ public class AbilityFactory_Pump {
}
}
t = CardFactoryUtil.AI_getBestCreature(list);
t = CardFactoryUtil.getBestCreatureAI(list);
tgt.addTarget(t);
list.remove(t);
}
@@ -635,9 +635,9 @@ public class AbilityFactory_Pump {
Card c;
if (pref.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getBestCreature(pref);
c = CardFactoryUtil.getBestCreatureAI(pref);
} else {
c = CardFactoryUtil.AI_getMostExpensivePermanent(pref, source, true);
c = CardFactoryUtil.getMostExpensivePermanentAI(pref, source, true);
}
pref.remove(c);
@@ -652,9 +652,9 @@ public class AbilityFactory_Pump {
Card c;
if (forced.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getWorstCreature(forced);
c = CardFactoryUtil.getWorstCreatureAI(forced);
} else {
c = CardFactoryUtil.AI_getCheapestPermanent(forced, source, true);
c = CardFactoryUtil.getCheapestPermanentAI(forced, source, true);
}
forced.remove(c);

View File

@@ -293,7 +293,7 @@ public class AbilityFactory_Regenerate {
if (!threatenedTargets.isEmpty()) {
// Choose "best" of the remaining to regenerate
tgt.addTarget(CardFactoryUtil.AI_getBestCreature(threatenedTargets));
tgt.addTarget(CardFactoryUtil.getBestCreatureAI(threatenedTargets));
chance = true;
}
} else {
@@ -424,7 +424,7 @@ public class AbilityFactory_Regenerate {
}
}
tgt.addTarget(CardFactoryUtil.AI_getCheapestPermanent(targetables, hostCard, true));
tgt.addTarget(CardFactoryUtil.getCheapestPermanentAI(targetables, hostCard, true));
return true;
}

View File

@@ -1078,7 +1078,6 @@ public class AbilityFactory_ZoneAffecting {
private static void discardResolve(final AbilityFactory af, final SpellAbility sa) {
final Card source = sa.getSourceCard();
final HashMap<String, String> params = af.getMapParams();
final String mode = params.get("Mode");
ArrayList<Player> tgtPlayers;
@@ -1138,7 +1137,6 @@ public class AbilityFactory_ZoneAffecting {
}
final CardList dPChHand = dPHand.getValidCards(valid.split(","), source.getController(), source);
// Reveal cards that will be discarded?
for (final Card c : dPChHand) {
p.discard(c, sa);
@@ -1172,9 +1170,9 @@ public class AbilityFactory_ZoneAffecting {
if (params.containsKey("DiscardValid")) {
final String dValid = params.get("DiscardValid");
if (dValid.contains("Creature") && !dValid.contains("nonCreature")) {
final Card c = CardFactoryUtil.AI_getBestCreature(dPChHand);
final Card c = CardFactoryUtil.getBestCreatureAI(dPChHand);
if (c != null) {
dChoices.add(CardFactoryUtil.AI_getBestCreature(dPChHand));
dChoices.add(CardFactoryUtil.getBestCreatureAI(dPChHand));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,7 @@ public interface CardFactoryInterface extends Iterable<Card> {
*
* @return an Iterator that does NOT support the remove method
*/
@Override
Iterator<Card> iterator();
/**

View File

@@ -76,7 +76,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.Card} object.
*/
public static Card AI_getMostExpensivePermanent(final CardList list, final Card spell, final boolean targeted) {
public static Card getMostExpensivePermanentAI(final CardList list, final Card spell, final boolean targeted) {
CardList all = list;
if (targeted) {
all = all.filter(new CardListFilter() {
@@ -87,7 +87,7 @@ public class CardFactoryUtil {
});
}
return CardFactoryUtil.AI_getMostExpensivePermanent(all);
return CardFactoryUtil.getMostExpensivePermanentAI(all);
}
/**
@@ -97,7 +97,7 @@ public class CardFactoryUtil {
* the all
* @return the card
*/
public static Card AI_getMostExpensivePermanent(final CardList all) {
public static Card getMostExpensivePermanentAI(final CardList all) {
if (all.size() == 0) {
return null;
}
@@ -137,14 +137,14 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.Card} object.
*/
public static Card AI_getCheapestCreature(CardList list, final Card spell, final boolean targeted) {
public static Card getCheapestCreatureAI(CardList list, final Card spell, final boolean targeted) {
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return c.isCreature();
}
});
return CardFactoryUtil.AI_getCheapestPermanent(list, spell, targeted);
return CardFactoryUtil.getCheapestPermanentAI(list, spell, targeted);
}
/**
@@ -160,7 +160,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.Card} object.
*/
public static Card AI_getCheapestPermanent(final CardList list, final Card spell, final boolean targeted) {
public static Card getCheapestPermanentAI(final CardList list, final Card spell, final boolean targeted) {
CardList all = list;
if (targeted) {
all = all.filter(new CardListFilter() {
@@ -198,7 +198,7 @@ public class CardFactoryUtil {
* a {@link forge.CardList} object.
* @return a {@link forge.Card} object.
*/
public static Card AI_getBestLand(final CardList list) {
public static Card getBestLandAI(final CardList list) {
final CardList land = list.getType("Land");
if (!(land.size() > 0)) {
return null;
@@ -266,7 +266,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.Card} object.
*/
public static Card AI_getBestEnchantment(final CardList list, final Card spell, final boolean targeted) {
public static Card getBestEnchantmentAI(final CardList list, final Card spell, final boolean targeted) {
CardList all = list;
all = all.getType("Enchantment");
if (targeted) {
@@ -309,7 +309,7 @@ public class CardFactoryUtil {
* a {@link forge.CardList} object.
* @return a {@link forge.Card} object.
*/
public static Card AI_getBestArtifact(final CardList list) {
public static Card getBestArtifactAI(final CardList list) {
CardList all = list;
all = all.getType("Artifact");
if (all.size() == 0) {
@@ -344,7 +344,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.CardList} object.
*/
public static CardList AI_getHumanArtifact(final Card spell, final boolean targeted) {
public static CardList getHumanArtifactAI(final Card spell, final boolean targeted) {
CardList artifact = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
artifact = artifact.getType("Artifact");
if (targeted) {
@@ -367,7 +367,7 @@ public class CardFactoryUtil {
* a {@link forge.Card} object.
* @return a boolean.
*/
public static boolean AI_doesCreatureAttack(final Card card) {
public static boolean doesCreatureAttackAI(final Card card) {
final Combat combat = ComputerUtil.getAttackers();
final Card[] att = combat.getAttackers();
for (final Card element : att) {
@@ -626,20 +626,20 @@ public class CardFactoryUtil {
* @return a {@link forge.Card} object.
*/
public static Card AI_getBest(final CardList list) {
public static Card getBestAI(final CardList list) {
// Get Best will filter by appropriate getBest list if ALL of the list
// is of that type
if (list.getNotType("Creature").size() == 0) {
return CardFactoryUtil.AI_getBestCreature(list);
return CardFactoryUtil.getBestCreatureAI(list);
}
if (list.getNotType("Land").size() == 0) {
return CardFactoryUtil.AI_getBestLand(list);
return CardFactoryUtil.getBestLandAI(list);
}
// TODO - Once we get an EvaluatePermanent this should call
// getBestPermanent()
return CardFactoryUtil.AI_getMostExpensivePermanent(list);
return CardFactoryUtil.getMostExpensivePermanentAI(list);
}
/**
@@ -649,7 +649,7 @@ public class CardFactoryUtil {
* the list
* @return the card
*/
public static Card AI_getBestCreature(final CardList list) {
public static Card getBestCreatureAI(final CardList list) {
CardList all = list;
all = all.getType("Creature");
Card biggest = null;
@@ -676,7 +676,7 @@ public class CardFactoryUtil {
* a {@link forge.CardList} object.
* @return a {@link forge.Card} object.
*/
public static Card AI_getBestCreatureToBounce(final CardList list) {
public static Card getBestCreatureToBounceAI(final CardList list) {
final int tokenBonus = 40;
CardList all = list;
all = all.getType("Creature");
@@ -714,7 +714,7 @@ public class CardFactoryUtil {
* a {@link forge.CardList} object.
* @return a {@link forge.Card} object.
*/
public static Card AI_getWorstCreature(final CardList list) {
public static Card getWorstCreatureAI(final CardList list) {
CardList all = list;
all = all.getType("Creature");
// get smallest creature
@@ -749,18 +749,18 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.Card} object.
*/
public static Card AI_getWorstPermanent(final CardList list, final boolean biasEnch, final boolean biasLand,
public static Card getWorstPermanentAI(final CardList list, final boolean biasEnch, final boolean biasLand,
final boolean biasArt, final boolean biasCreature) {
if (list.size() == 0) {
return null;
}
if (biasEnch && (list.getType("Enchantment").size() > 0)) {
return CardFactoryUtil.AI_getCheapestPermanent(list.getType("Enchantment"), null, false);
return CardFactoryUtil.getCheapestPermanentAI(list.getType("Enchantment"), null, false);
}
if (biasArt && (list.getType("Artifact").size() > 0)) {
return CardFactoryUtil.AI_getCheapestPermanent(list.getType("Artifact"), null, false);
return CardFactoryUtil.getCheapestPermanentAI(list.getType("Artifact"), null, false);
}
if (biasLand && (list.getType("Land").size() > 0)) {
@@ -768,7 +768,7 @@ public class CardFactoryUtil {
}
if (biasCreature && (list.getType("Creature").size() > 0)) {
return CardFactoryUtil.AI_getWorstCreature(list.getType("Creature"));
return CardFactoryUtil.getWorstCreatureAI(list.getType("Creature"));
}
if (list.getType("Land").size() > 6) {
@@ -776,7 +776,7 @@ public class CardFactoryUtil {
}
if ((list.getType("Artifact").size() > 0) || (list.getType("Enchantment").size() > 0)) {
return CardFactoryUtil.AI_getCheapestPermanent(list.filter(new CardListFilter() {
return CardFactoryUtil.getCheapestPermanentAI(list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return c.isArtifact() || c.isEnchantment();
@@ -785,12 +785,12 @@ public class CardFactoryUtil {
}
if (list.getType("Creature").size() > 0) {
return CardFactoryUtil.AI_getWorstCreature(list.getType("Creature"));
return CardFactoryUtil.getWorstCreatureAI(list.getType("Creature"));
}
// Planeswalkers fall through to here, lands will fall through if there
// aren't very many
return CardFactoryUtil.AI_getCheapestPermanent(list, null, false);
return CardFactoryUtil.getCheapestPermanentAI(list, null, false);
}
/**
@@ -806,7 +806,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_Spell(final SpellAbility spell, final CardList choices, final boolean free) {
public static Input inputSpell(final SpellAbility spell, final CardList choices, final boolean free) {
final Input target = new Input() {
private static final long serialVersionUID = 2781418414287281005L;
@@ -860,7 +860,7 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_destroyNoRegeneration(final CardList choices, final String message) {
public static Input inputDestroyNoRegeneration(final CardList choices, final String message) {
final Input target = new Input() {
private static final long serialVersionUID = -6637588517573573232L;
@@ -1058,7 +1058,7 @@ public class CardFactoryUtil {
final int attack = a;
final int defense = d;
final String origManaCost = orgManaCost;
final Ability_Activated morph_up = new Ability_Activated(sourceCard, cost, null) {
final Ability_Activated morphUp = new Ability_Activated(sourceCard, cost, null) {
private static final long serialVersionUID = -3663857013937085953L;
@Override
@@ -1098,13 +1098,13 @@ public class CardFactoryUtil {
sb.append(" -");
}
sb.append(" ").append(costDesc).append(" (Turn this face up any time for its morph cost.)");
morph_up.setDescription(sb.toString());
morphUp.setDescription(sb.toString());
final StringBuilder sbStack = new StringBuilder();
sbStack.append(sourceCard.getName()).append(" - turn this card face up.");
morph_up.setStackDescription(sbStack.toString());
morphUp.setStackDescription(sbStack.toString());
return morph_up;
return morphUp;
}
/**
@@ -1347,8 +1347,7 @@ public class CardFactoryUtil {
* a int.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility abilitySuspend(final Card sourceCard, final String suspendCost,
final int suspendCounters) {
public static SpellAbility abilitySuspend(final Card sourceCard, final String suspendCost, final int suspendCounters) {
// be careful with Suspend ability, it will not hit the stack
final SpellAbility suspend = new Ability_Static(sourceCard, suspendCost) {
@Override
@@ -1406,7 +1405,7 @@ public class CardFactoryUtil {
* a {@link forge.card.cost.Cost} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public static SpellAbility eqPump_Equip(final Card sourceCard, final int power, final int tough,
public static SpellAbility eqPumpEquip(final Card sourceCard, final int power, final int tough,
final String[] extrinsicKeywords, final Cost abCost) {
final Target target = new Target(sourceCard, "Select target creature you control",
"Creature.YouCtrl".split(","));
@@ -1443,7 +1442,7 @@ public class CardFactoryUtil {
@Override
public void chooseTargetAI() {
final Card target = CardFactoryUtil.AI_getBestCreature(this.getCreature());
final Card target = CardFactoryUtil.getBestCreatureAI(this.getCreature());
this.setTargetCard(target);
}
@@ -1524,7 +1523,7 @@ public class CardFactoryUtil {
* a {@link forge.card.cost.Cost} object.
* @return a {@link forge.Command} object.
*/
public static Command eqPump_onEquip(final Card sourceCard, final int power, final int tough,
public static Command eqPumpOnEquip(final Card sourceCard, final int power, final int tough,
final String[] extrinsicKeywords, final Cost abCost) {
final Command onEquip = new Command() {
@@ -1569,7 +1568,7 @@ public class CardFactoryUtil {
* a {@link forge.card.cost.Cost} object.
* @return a {@link forge.Command} object.
*/
public static Command eqPump_unEquip(final Card sourceCard, final int power, final int tough,
public static Command eqPumpUnEquip(final Card sourceCard, final int power, final int tough,
final String[] extrinsicKeywords, final Cost abCost) {
final Command onUnEquip = new Command() {
@@ -1653,7 +1652,7 @@ public class CardFactoryUtil {
public static Command fading(final Card sourceCard, final int power) {
final Command fade = new Command() {
private static final long serialVersionUID = 431920157968451817L;
public boolean firstTime = true;
private boolean firstTime = true;
@Override
public void execute() {
@@ -1682,7 +1681,7 @@ public class CardFactoryUtil {
public static Command vanishing(final Card sourceCard, final int power) {
final Command age = new Command() {
private static final long serialVersionUID = 431920157968451817L;
public boolean firstTime = true;
private boolean firstTime = true;
@Override
public void execute() {
@@ -1810,9 +1809,9 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message,
public static Input inputTargetSpecific(final SpellAbility spell, final CardList choices, final String message,
final boolean targeted, final boolean free) {
return CardFactoryUtil.input_targetSpecific(spell, choices, message, Command.BLANK, targeted, free);
return CardFactoryUtil.inputTargetSpecific(spell, choices, message, Command.BLANK, targeted, free);
}
// CardList choices are the only cards the user can successful select
@@ -1835,7 +1834,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message,
public static Input inputTargetSpecific(final SpellAbility spell, final CardList choices, final String message,
final Command paid, final boolean targeted, final boolean free) {
final Input target = new Input() {
private static final long serialVersionUID = -1779224307654698954L;
@@ -1892,7 +1891,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_targetChampionSac(final Card crd, final SpellAbility spell, final CardList choices,
public static Input inputTargetChampionSac(final Card crd, final SpellAbility spell, final CardList choices,
final String message, final boolean targeted, final boolean free) {
final Input target = new Input() {
private static final long serialVersionUID = -3320425330743678663L;
@@ -1942,7 +1941,7 @@ public class CardFactoryUtil {
* a {@link forge.card.spellability.SpellAbility} object.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_equipCreature(final SpellAbility equip) {
public static Input inputEquipCreature(final SpellAbility equip) {
final Input runtime = new Input() {
private static final long serialVersionUID = 2029801495067540196L;
@@ -1951,7 +1950,7 @@ public class CardFactoryUtil {
// get all creatures you control
final CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
this.stopSetNext(CardFactoryUtil.input_targetSpecific(equip, list, "Select target creature to equip",
this.stopSetNext(CardFactoryUtil.inputTargetSpecific(equip, list, "Select target creature to equip",
true, false));
}
}; // Input
@@ -1969,10 +1968,10 @@ public class CardFactoryUtil {
* a {@link forge.card.spellability.SpellAbility} object.
* @return input
*/
public static Input input_discardRecall(final int numCards, final Card recall, final SpellAbility sa) {
public static Input inputDiscardRecall(final int numCards, final Card recall, final SpellAbility sa) {
final Input target = new Input() {
private static final long serialVersionUID = 1942999595292561944L;
int n = 0;
private int n = 0;
@Override
public void showMessage() {
@@ -2032,7 +2031,7 @@ public class CardFactoryUtil {
* a {@link forge.Command} object.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input MasteroftheWildHunt_input_targetCreature(final SpellAbility spell, final CardList choices,
public static Input masterOfTheWildHuntInputTargetCreature(final SpellAbility spell, final CardList choices,
final Command paid) {
final Input target = new Input() {
private static final long serialVersionUID = -1779224307654698954L;
@@ -2116,7 +2115,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.CardList} object.
*/
public static CardList AI_getHumanCreature(final Card spell, final boolean targeted) {
public static CardList getHumanCreatureAI(final Card spell, final boolean targeted) {
CardList creature = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
if (targeted) {
creature = creature.getTargetableCards(spell);
@@ -2137,7 +2136,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.CardList} object.
*/
public static CardList AI_getHumanCreature(final String keyword, final Card spell, final boolean targeted) {
public static CardList getHumanCreatureAI(final String keyword, final Card spell, final boolean targeted) {
CardList creature = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
creature = creature.filter(new CardListFilter() {
@Override
@@ -2165,7 +2164,7 @@ public class CardFactoryUtil {
* a boolean.
* @return a {@link forge.CardList} object.
*/
public static CardList AI_getHumanCreature(final int toughness, final Card spell, final boolean targeted) {
public static CardList getHumanCreatureAI(final int toughness, final Card spell, final boolean targeted) {
CardList creature = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
creature = creature.filter(new CardListFilter() {
@Override
@@ -2187,7 +2186,7 @@ public class CardFactoryUtil {
*
* @return a {@link forge.CommandArgs} object.
*/
public static CommandArgs AI_targetHuman() {
public static CommandArgs targetHumanAI() {
return new CommandArgs() {
private static final long serialVersionUID = 8406907523134006697L;
@@ -2530,7 +2529,7 @@ public class CardFactoryUtil {
if (target == null) {
return false;
}
return target.hasProtectionFrom(card);
}
@@ -2943,10 +2942,10 @@ public class CardFactoryUtil {
n++;
}
}
System.out.println("N is equal to" +n);
System.out.println("N is equal to" + n);
return CardFactoryUtil.doXMath(n, m, c);
}
// Count$OpponentDom
if (sq[0].contains("OpponentDom")) {
someCards.addAll(cardController.getOpponent().getCardsIn(Zone.Battlefield));
@@ -2957,7 +2956,7 @@ public class CardFactoryUtil {
n++;
}
}
System.out.println("Opp N is equal to" +n);
System.out.println("Opp N is equal to" + n);
return CardFactoryUtil.doXMath(n, m, c);
}
@@ -3236,81 +3235,81 @@ public class CardFactoryUtil {
// if a card was ever written to count two different zones,
// make sure they don't get added twice.
boolean MF = false, MY = false, MH = false;
boolean OF = false, OY = false, OH = false;
boolean mf = false, my = false, mh = false;
boolean of = false, oy = false, oh = false;
if (sq[0].contains("YouCtrl")) {
if (!MF) {
if (!mf) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
MF = true;
mf = true;
}
}
if (sq[0].contains("InYourYard")) {
if (!MY) {
if (!my) {
someCards.addAll(cardController.getCardsIn(Zone.Graveyard));
MY = true;
my = true;
}
}
if (sq[0].contains("InYourLibrary")) {
if (!MY) {
if (!my) {
someCards.addAll(cardController.getCardsIn(Zone.Library));
MY = true;
my = true;
}
}
if (sq[0].contains("InYourHand")) {
if (!MH) {
if (!mh) {
someCards.addAll(cardController.getCardsIn(Zone.Hand));
MH = true;
mh = true;
}
}
if (sq[0].contains("OppCtrl")) {
if (!OF) {
if (!of) {
someCards.addAll(oppController.getCardsIn(Zone.Battlefield));
OF = true;
of = true;
}
}
if (sq[0].contains("InOppYard")) {
if (!OY) {
if (!oy) {
someCards.addAll(oppController.getCardsIn(Zone.Graveyard));
OY = true;
oy = true;
}
}
if (sq[0].contains("InOppHand")) {
if (!OH) {
if (!oh) {
someCards.addAll(oppController.getCardsIn(Zone.Hand));
OH = true;
oh = true;
}
}
if (sq[0].contains("OnBattlefield")) {
if (!MF) {
if (!mf) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
}
if (!OF) {
if (!of) {
someCards.addAll(oppController.getCardsIn(Zone.Battlefield));
}
}
if (sq[0].contains("InAllYards")) {
if (!MY) {
if (!my) {
someCards.addAll(cardController.getCardsIn(Zone.Graveyard));
}
if (!OY) {
if (!oy) {
someCards.addAll(oppController.getCardsIn(Zone.Graveyard));
}
}
if (sq[0].contains("InAllHands")) {
if (!MH) {
if (!mh) {
someCards.addAll(cardController.getCardsIn(Zone.Hand));
}
if (!OH) {
if (!oh) {
someCards.addAll(oppController.getCardsIn(Zone.Hand));
}
}
@@ -3552,12 +3551,12 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_UntapUpToNType(final int n, final String type) {
public static Input inputUntapUpToNType(final int n, final String type) {
final Input untap = new Input() {
private static final long serialVersionUID = -2167059918040912025L;
int stop = n;
int count = 0;
private int stop = n;
private int count = 0;
@Override
public void showMessage() {
@@ -3939,8 +3938,7 @@ public class CardFactoryUtil {
final Card c = ability.getSourceCard();
if ((target != null) && c.getText().contains("deals X damage to target")
&& !c.getName().equals("Death Grasp")) {
if ((target != null) && c.getText().contains("deals X damage to target") && !c.getName().equals("Death Grasp")) {
neededDamage = target.getNetDefense() - target.getDamage();
}
@@ -4285,31 +4283,31 @@ public class CardFactoryUtil {
/**
* Copy characteristics.
*
* @param From
* @param from
* the from
* @param To
* @param to
* the to
*/
public static void copyCharacteristics(final Card From, final Card To) {
To.setBaseAttack(From.getBaseAttack());
To.setBaseDefense(From.getBaseDefense());
To.setBaseLoyalty(From.getBaseLoyalty());
To.setBaseAttackString(From.getBaseAttackString());
To.setBaseDefenseString(From.getBaseDefenseString());
To.setIntrinsicKeyword(From.getIntrinsicKeyword());
To.setName(From.getName());
To.setType(From.getCharacteristics().getType());
To.setText(From.getSpellText());
To.setManaCost(From.getManaCost());
To.setColor(From.getColor());
To.setSVars(From.getSVars());
To.setSets(From.getSets());
To.setIntrinsicAbilities(From.getIntrinsicAbilities());
public static void copyCharacteristics(final Card from, final Card to) {
to.setBaseAttack(from.getBaseAttack());
to.setBaseDefense(from.getBaseDefense());
to.setBaseLoyalty(from.getBaseLoyalty());
to.setBaseAttackString(from.getBaseAttackString());
to.setBaseDefenseString(from.getBaseDefenseString());
to.setIntrinsicKeyword(from.getIntrinsicKeyword());
to.setName(from.getName());
to.setType(from.getCharacteristics().getType());
to.setText(from.getSpellText());
to.setManaCost(from.getManaCost());
to.setColor(from.getColor());
to.setSVars(from.getSVars());
to.setSets(from.getSets());
to.setIntrinsicAbilities(from.getIntrinsicAbilities());
To.setImageName(From.getImageName());
To.setImageFilename(From.getImageFilename());
To.setTriggers(From.getTriggers());
To.setStaticAbilityStrings(From.getStaticAbilityStrings());
to.setImageName(from.getImageName());
to.setImageFilename(from.getImageFilename());
to.setTriggers(from.getTriggers());
to.setStaticAbilityStrings(from.getStaticAbilityStrings());
}
@@ -4772,14 +4770,14 @@ public class CardFactoryUtil {
+ "ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank",
card, true);
final Ability haunterDies_Work = new Ability(card, "0") {
final Ability haunterDiesWork = new Ability(card, "0") {
@Override
public void resolve() {
this.getTargetCard().addHauntedBy(card);
AllZone.getGameAction().exile(card);
}
};
haunterDies_Work.setDescription(hauntDescription);
haunterDiesWork.setDescription(hauntDescription);
final Input target = new Input() {
private static final long serialVersionUID = 1981791992623774490L;
@@ -4796,8 +4794,8 @@ public class CardFactoryUtil {
return;
}
if (CardFactoryUtil.canTarget(card, c)) {
haunterDies_Work.setTargetCard(c);
AllZone.getStack().add(haunterDies_Work);
haunterDiesWork.setTargetCard(c);
AllZone.getStack().add(haunterDiesWork);
this.stop();
} else {
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
@@ -4805,7 +4803,7 @@ public class CardFactoryUtil {
}
};
final Ability haunterDies_Setup = new Ability(card, "0") {
final Ability haunterDiesSetup = new Ability(card, "0") {
@Override
public void resolve() {
final CardList creats = AllZoneUtil.getCreaturesInPlay();
@@ -4827,16 +4825,16 @@ public class CardFactoryUtil {
// AI choosing what to haunt
final CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
if (oppCreats.size() != 0) {
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(oppCreats));
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats));
} else {
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(creats));
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(creats));
}
AllZone.getStack().add(haunterDies_Work);
AllZone.getStack().add(haunterDiesWork);
}
}
};
haunterDies.setOverridingAbility(haunterDies_Setup);
haunterDies.setOverridingAbility(haunterDiesSetup);
// Second, create the trigger that runs when the haunted creature
// dies
@@ -4924,12 +4922,12 @@ public class CardFactoryUtil {
eff.setImmutable(true);
eff.addStaticAbility("Mode$ CantBeCast | ValidCard$ Card | Caster$ You "
+ "| Description$ For the rest of the game, you can't cast spells.");
+ "| Description$ For the rest of the game, you can't cast spells.");
final Trigger copyTrigger = forge.card.trigger.TriggerHandler.parseTrigger(
"Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerDescription$ "
+ "At the beginning of each of your upkeeps, copy "
+ card.toString() + " except for its epic ability.", card, false);
+ "At the beginning of each of your upkeeps, copy " + card.toString()
+ " except for its epic ability.", card, false);
copyTrigger.setOverridingAbility(origSA);
@@ -5283,7 +5281,7 @@ public class CardFactoryUtil {
}
});
if (choices.size() != 0) {
ability.setTargetCard(CardFactoryUtil.AI_getBestCreature(choices));
ability.setTargetCard(CardFactoryUtil.getBestCreatureAI(choices));
if (ability.getTargetCard() != null) {
ability.setStackDescription("Put " + card.getCounters(Counters.P1P1)
@@ -5313,15 +5311,15 @@ public class CardFactoryUtil {
final int m = Integer.parseInt(parse.substring(6));
final String abStr = "AB$ MoveCounter | Cost$ 0 | Source$ Self | "
+ "Defined$ TriggeredCard | CounterType$ P1P1 | CounterNum$ 1";
+ "Defined$ TriggeredCard | CounterType$ P1P1 | CounterNum$ 1";
card.setSVar("GraftTrig", abStr);
String trigStr = "Mode$ ChangesZone | ValidCard$ Creature.Other | "
+ "Origin$ Any | Destination$ Battlefield";
+ "Origin$ Any | Destination$ Battlefield";
trigStr += " | TriggerZones$ Battlefield | OptionalDecider$ You | "
+ "Execute$ GraftTrig | TriggerDescription$ ";
+ "Execute$ GraftTrig | TriggerDescription$ ";
trigStr += "Whenever another creature enters the battlefield, you "
+ "may move a +1/+1 counter from this creature onto it.";
+ "may move a +1/+1 counter from this creature onto it.";
final Trigger myTrigger = TriggerHandler.parseTrigger(trigStr, card, true);
card.addTrigger(myTrigger);

View File

@@ -45,7 +45,7 @@ class CardFactory_Auras {
* @return a int.
*/
public static final int shouldCycle(final Card c) {
ArrayList<String> a = c.getKeyword();
final ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++) {
if (a.get(i).toString().startsWith("Cycling")) {
return i;
@@ -81,16 +81,16 @@ class CardFactory_Auras {
if (!super.canPlayAI()) {
return false;
}
String[] landTypes = new String[] { "Plains", "Island", "Swamp", "Mountain", "Forest" };
HashMap<String, Integer> humanLandCount = new HashMap<String, Integer>();
CardList humanlands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
final String[] landTypes = new String[] { "Plains", "Island", "Swamp", "Mountain", "Forest" };
final HashMap<String, Integer> humanLandCount = new HashMap<String, Integer>();
final CardList humanlands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
for (int i = 0; i < landTypes.length; i++) {
humanLandCount.put(landTypes[i], 0);
for (final String landType : landTypes) {
humanLandCount.put(landType, 0);
}
for (Card c : humanlands) {
for (String singleType : c.getType()) {
for (final Card c : humanlands) {
for (final String singleType : c.getType()) {
if (CardUtil.isABasicLandType(singleType)) {
humanLandCount.put(singleType, humanLandCount.get(singleType) + 1);
}
@@ -100,7 +100,7 @@ class CardFactory_Auras {
int minAt = 0;
int minVal = Integer.MAX_VALUE;
for (int i = 0; i < landTypes.length; i++) {
if (getTargetCard().isType(landTypes[i])) {
if (this.getTargetCard().isType(landTypes[i])) {
continue;
}
@@ -118,7 +118,7 @@ class CardFactory_Auras {
if (list.isEmpty()) {
return false;
}
setTargetCard(list.get(0));
this.setTargetCard(list.get(0));
return true;
} // canPlayAI()
@@ -131,7 +131,7 @@ class CardFactory_Auras {
}
AllZone.getGameAction().moveToPlay(card);
Card c = getTargetCard();
final Card c = this.getTargetCard();
if (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
card.enchantEntity(c);
@@ -149,14 +149,15 @@ class CardFactory_Auras {
spell.setDescription("Enchanted land is an Island.");
}
Command onEnchant = new Command() {
final Command onEnchant = new Command() {
private static final long serialVersionUID = 3528675112863241126L;
@Override
public void execute() {
if (card.isEnchanting()) {
Card crd = card.getEnchantingCard();
ArrayList<Card> seas = crd.getEnchantedBy();
final Card crd = card.getEnchantingCard();
final ArrayList<Card> seas = crd.getEnchantedBy();
int count = 0;
for (int i = 0; i < seas.size(); i++) {
if (seas.get(i).getName().equals(card.getName())) {
@@ -180,22 +181,23 @@ class CardFactory_Auras {
otherSeas = seas.get(i);
}
}
SpellAbility[] abilities = otherSeas.getSpellAbility();
for (int i = 0; i < abilities.length; i++) {
card.addSpellAbility(abilities[i]);
final SpellAbility[] abilities = otherSeas.getSpellAbility();
for (final SpellAbility abilitie : abilities) {
card.addSpellAbility(abilitie);
}
}
}
} // execute()
}; // Command
Command onUnEnchant = new Command() {
final Command onUnEnchant = new Command() {
private static final long serialVersionUID = -202144631191180334L;
@Override
public void execute() {
if (card.isEnchanting()) {
Card crd = card.getEnchantingCard();
ArrayList<Card> seas = crd.getEnchantedBy();
final Card crd = card.getEnchantingCard();
final ArrayList<Card> seas = crd.getEnchantedBy();
int count = 0;
for (int i = 0; i < seas.size(); i++) {
if (seas.get(i).getName().equals(card.getName())) {
@@ -208,33 +210,34 @@ class CardFactory_Auras {
crd.removeType("Basic");
crd.removeType("Snow");
crd.removeType("Legendary");
SpellAbility[] cardAbilities = crd.getSpellAbility();
for (int i = 0; i < cardAbilities.length; i++) {
if (cardAbilities[i].isIntrinsic()) {
crd.removeSpellAbility(cardAbilities[i]);
final SpellAbility[] cardAbilities = crd.getSpellAbility();
for (final SpellAbility cardAbilitie : cardAbilities) {
if (cardAbilitie.isIntrinsic()) {
crd.removeSpellAbility(cardAbilitie);
}
}
Card c = AllZone.getCardFactory().copyCard(crd);
ArrayList<String> types = c.getType();
SpellAbility[] abilities = card.getSpellAbility();
final Card c = AllZone.getCardFactory().copyCard(crd);
final ArrayList<String> types = c.getType();
final SpellAbility[] abilities = card.getSpellAbility();
for (int i = 0; i < types.size(); i++) {
crd.addType(types.get(i));
}
for (int i = 0; i < abilities.length; i++) {
crd.addSpellAbility(abilities[i]);
for (final SpellAbility abilitie : abilities) {
crd.addSpellAbility(abilitie);
}
}
}
} // execute()
}; // Command
Command onLeavesPlay = new Command() {
final Command onLeavesPlay = new Command() {
private static final long serialVersionUID = -45433022112460839L;
@Override
public void execute() {
if (card.isEnchanting()) {
Card crd = card.getEnchantingCard();
final Card crd = card.getEnchantingCard();
card.unEnchantEntity(crd);
}
}
@@ -244,14 +247,15 @@ class CardFactory_Auras {
card.addUnEnchantCommand(onUnEnchant);
card.addLeavesPlayCommand(onLeavesPlay);
Input runtime = new Input() {
final Input runtime = new Input() {
private static final long serialVersionUID = -62372711146079880L;
@Override
public void showMessage() {
CardList land = AllZoneUtil.getLandsInPlay();
stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land", true, false));
final CardList land = AllZoneUtil.getLandsInPlay();
this.stopSetNext(CardFactoryUtil.inputTargetSpecific(spell, land, "Select target land", true,
false));
}
};
spell.setBeforePayMana(runtime);
@@ -259,8 +263,8 @@ class CardFactory_Auras {
// *************** START *********** START **************************
else if (cardName.equals("Earthbind")) {
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_Permanent(card, cost, tgt) {
private static final long serialVersionUID = 142389375702113977L;
@@ -273,9 +277,10 @@ class CardFactory_Auras {
return false;
}
CardListFilter f = new CardListFilter() {
final CardListFilter f = new CardListFilter() {
@Override
public final boolean addCard(final Card c) {
return c.getNetDefense() - c.getDamage() <= 2;
return (c.getNetDefense() - c.getDamage()) <= 2;
}
};
if (!list.filter(f).isEmpty()) {
@@ -285,7 +290,7 @@ class CardFactory_Auras {
for (int i = 0; i < list.size(); i++) {
if (CardFactoryUtil.canTarget(card, list.get(i))) {
setTargetCard(list.get(i));
this.setTargetCard(list.get(i));
return super.canPlayAI();
}
}
@@ -296,11 +301,11 @@ class CardFactory_Auras {
public void resolve() {
AllZone.getGameAction().moveToPlay(card);
Card c = getTargetCard();
final Card c = this.getTargetCard();
if (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
card.enchantEntity(c);
Log.debug("Enchanted: " + getTargetCard());
Log.debug("Enchanted: " + this.getTargetCard());
}
} // resolve()
}; // SpellAbility
@@ -308,13 +313,14 @@ class CardFactory_Auras {
card.addSpellAbility(spell);
final boolean[] badTarget = { true };
Command onEnchant = new Command() {
final Command onEnchant = new Command() {
private static final long serialVersionUID = -5302506578307993978L;
@Override
public void execute() {
if (card.isEnchanting()) {
Card crd = card.getEnchantingCard();
final Card crd = card.getEnchantingCard();
if (crd.hasKeyword("Flying")) {
badTarget[0] = false;
crd.addDamage(2, card);
@@ -327,25 +333,27 @@ class CardFactory_Auras {
} // execute()
}; // Command
Command onUnEnchant = new Command() {
final Command onUnEnchant = new Command() {
private static final long serialVersionUID = -6908757692588823391L;
@Override
public void execute() {
if (card.isEnchanting() && !badTarget[0]) {
Card crd = card.getEnchantingCard();
final Card crd = card.getEnchantingCard();
crd.addIntrinsicKeyword("Flying");
}
} // execute()
}; // Command
Command onLeavesPlay = new Command() {
final Command onLeavesPlay = new Command() {
private static final long serialVersionUID = -7833240882415702940L;
@Override
public void execute() {
if (card.isEnchanting()) {
Card crd = card.getEnchantingCard();
final Card crd = card.getEnchantingCard();
card.unEnchantEntity(crd);
}
}
@@ -358,8 +366,8 @@ class CardFactory_Auras {
// *************** START *********** START **************************
else if (cardName.equals("Guilty Conscience")) {
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_Permanent(card, cost, tgt) {
private static final long serialVersionUID = 1169151960692309514L;
@@ -367,13 +375,13 @@ class CardFactory_Auras {
@Override
public boolean canPlayAI() {
CardList stuffy = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield, "Stuffy Doll");
final CardList stuffy = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield, "Stuffy Doll");
if (stuffy.size() > 0) {
setTargetCard(stuffy.get(0));
this.setTargetCard(stuffy.get(0));
return true;
} else {
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
final CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
if (list.isEmpty()) {
return false;
@@ -386,8 +394,8 @@ class CardFactory_Auras {
for (int i = 0; i < list.size(); i++) {
if (CardFactoryUtil.canTarget(card, list.get(i))
&& (list.get(i).getNetAttack() >= list.get(i).getNetDefense())
&& list.get(i).getNetAttack() >= 3) {
setTargetCard(list.get(i));
&& (list.get(i).getNetAttack() >= 3)) {
this.setTargetCard(list.get(i));
return super.canPlayAI();
}
}
@@ -398,9 +406,9 @@ class CardFactory_Auras {
@Override
public void resolve() {
Card aura = AllZone.getGameAction().moveToPlay(card);
final Card aura = AllZone.getGameAction().moveToPlay(card);
Card c = getTargetCard();
final Card c = this.getTargetCard();
if (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(aura, c)) {
aura.enchantEntity(c);
@@ -425,15 +433,17 @@ class CardFactory_Auras {
return AllZoneUtil.getCardsIn(Zone.Graveyard).filter(CardListFilter.CREATURES);
}
@Override
public boolean canPlay() {
return super.canPlay() && getCreturesInGrave().size() != 0;
return super.canPlay() && (this.getCreturesInGrave().size() != 0);
}
@Override
public boolean canPlayAI() {
CardList cList = getCreturesInGrave();
CardList cList = this.getCreturesInGrave();
// AI will only target something that will stick in play.
cList = cList.filter(new CardListFilter() {
@Override
public final boolean addCard(final Card crd) {
return CardFactoryUtil.canTarget(card, crd)
&& !CardFactoryUtil.hasProtectionFrom(card, crd);
@@ -443,16 +453,16 @@ class CardFactory_Auras {
return false;
}
Card c = CardFactoryUtil.AI_getBestCreature(cList);
final Card c = CardFactoryUtil.getBestCreatureAI(cList);
setTargetCard(c);
boolean playable = 2 < c.getNetAttack() && 2 < c.getNetDefense() && super.canPlayAI();
this.setTargetCard(c);
final boolean playable = (2 < c.getNetAttack()) && (2 < c.getNetDefense()) && super.canPlayAI();
return playable;
} // canPlayAI
@Override
public void resolve() {
targetC[0] = getTargetCard();
targetC[0] = this.getTargetCard();
super.resolve();
}
@@ -460,29 +470,27 @@ class CardFactory_Auras {
// Target AbCost and Restriction are set here to get this working as
// expected
Target tgt = new Target(card, "Select a creature in a graveyard", "Creature".split(","));
final Target tgt = new Target(card, "Select a creature in a graveyard", "Creature".split(","));
tgt.setZone(Constant.Zone.Graveyard);
animate.setTarget(tgt);
Cost cost = new Cost("1 B", cardName, false);
final Cost cost = new Cost("1 B", cardName, false);
animate.setPayCosts(cost);
animate.getRestrictions().setZone(Constant.Zone.Hand);
final Ability attach = new Ability(card, "0") {
private static final long serialVersionUID = 222308932796127795L;
@Override
public void resolve() {
PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
final PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
// Animate Dead got destroyed before its ability resolved
if (!play.contains(card)) {
return;
}
Card animated = targetC[0];
PlayerZone grave = AllZone.getZoneOf(animated);
final Card animated = targetC[0];
final PlayerZone grave = AllZone.getZoneOf(animated);
if (!grave.is(Constant.Zone.Graveyard)) {
// Animated Creature got removed before ability resolved
@@ -513,6 +521,7 @@ class CardFactory_Auras {
final Command attachCmd = new Command() {
private static final long serialVersionUID = 3595188622377350327L;
@Override
public void execute() {
AllZone.getStack().addSimultaneousStackEntry(attach);
@@ -523,9 +532,9 @@ class CardFactory_Auras {
@Override
public void resolve() {
Card c = targetC[0];
final Card c = targetC[0];
PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
final PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
if (play.contains(c)) {
AllZone.getGameAction().sacrifice(c);
@@ -536,10 +545,11 @@ class CardFactory_Auras {
final Command detachCmd = new Command() {
private static final long serialVersionUID = 2425333033834543422L;
@Override
public void execute() {
Card c = targetC[0];
final Card c = targetC[0];
PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
final PlayerZone play = card.getController().getZone(Constant.Zone.Battlefield);
if (play.contains(c)) {
AllZone.getStack().addSimultaneousStackEntry(detach);
@@ -559,12 +569,12 @@ class CardFactory_Auras {
// *************** START *********** START **************************
else if (CardFactoryUtil.hasKeyword(card, "enchant") != -1) {
int n = CardFactoryUtil.hasKeyword(card, "enchant");
final int n = CardFactoryUtil.hasKeyword(card, "enchant");
if (n != -1) {
String parse = card.getKeyword().get(n).toString();
String[] k = parse.split(":");
final String parse = card.getKeyword().get(n).toString();
final String[] k = parse.split(":");
SpellAbility sa = card.getSpellAbility()[0];
final SpellAbility sa = card.getSpellAbility()[0];
sa.setIsMultiKicker(true);
sa.setMultiKickerManaCost(k[1]);
}

View File

@@ -164,7 +164,7 @@ class CardFactory_Equipment {
} // execute()
}; // Command
equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip));
equip.setBeforePayMana(CardFactoryUtil.inputEquipCreature(equip));
equip.getRestrictions().setSorcerySpeed(true);
equip.setDescription("Equip: 0");
@@ -215,7 +215,7 @@ class CardFactory_Equipment {
// not changed
@Override
public void chooseTargetAI() {
final Card target = CardFactoryUtil.AI_getBestCreature(this.getCreature());
final Card target = CardFactoryUtil.getBestCreatureAI(this.getCreature());
this.setTargetCard(target);
}
@@ -225,7 +225,7 @@ class CardFactory_Equipment {
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return CardFactoryUtil.AI_doesCreatureAttack(c) && CardFactoryUtil.canTarget(card, c)
return CardFactoryUtil.doesCreatureAttackAI(c) && CardFactoryUtil.canTarget(card, c)
&& (!c.hasKeyword("Defender"));
}
});
@@ -273,7 +273,7 @@ class CardFactory_Equipment {
} // execute()
}; // Command
equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip));
equip.setBeforePayMana(CardFactoryUtil.inputEquipCreature(equip));
equip.setDescription("Equip: 4");
card.addSpellAbility(equip);
@@ -330,8 +330,7 @@ class CardFactory_Equipment {
@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);
this.stop();
}
@@ -413,9 +412,9 @@ class CardFactory_Equipment {
}
}
card.addSpellAbility(CardFactoryUtil.eqPump_Equip(card, power, tough, extrinsicKeywords, abCost));
card.addEquipCommand(CardFactoryUtil.eqPump_onEquip(card, power, tough, extrinsicKeywords, abCost));
card.addUnEquipCommand(CardFactoryUtil.eqPump_unEquip(card, power, tough, extrinsicKeywords, abCost));
card.addSpellAbility(CardFactoryUtil.eqPumpEquip(card, power, tough, extrinsicKeywords, abCost));
card.addEquipCommand(CardFactoryUtil.eqPumpOnEquip(card, power, tough, extrinsicKeywords, abCost));
card.addUnEquipCommand(CardFactoryUtil.eqPumpUnEquip(card, power, tough, extrinsicKeywords, abCost));
}
} // eqPump (was VanillaEquipment)

View File

@@ -273,7 +273,7 @@ public class CardFactory_Instants {
CardList getCreature() {
final CardList out = new CardList();
final CardList list = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
final CardList list = CardFactoryUtil.getHumanCreatureAI("Flying", card, true);
list.shuffle();
for (int i = 0; i < list.size(); i++) {
@@ -284,9 +284,9 @@ 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())) {
out.addAll(CardFactoryUtil.AI_getHumanCreature(2, card, true));
if (out.isEmpty() && (0 < CardFactoryUtil.getHumanCreatureAI(2, card, true).size())
&& (3 > CardFactoryUtil.getHumanCreatureAI(card, true).size())) {
out.addAll(CardFactoryUtil.getHumanCreatureAI(2, card, true));
CardListUtil.sortFlying(out);
}
return out;
@@ -365,7 +365,7 @@ public class CardFactory_Instants {
}
};
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
spell.setChooseTargetAI(CardFactoryUtil.targetHumanAI());
card.addSpellAbility(spell);
@@ -379,14 +379,14 @@ public class CardFactory_Instants {
@Override
public boolean canPlayAI() {
final CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
final CardList human = CardFactoryUtil.getHumanCreatureAI(card, true);
return (4 < AllZone.getPhase().getTurn()) && (0 < human.size());
}
@Override
public void chooseTargetAI() {
final CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
this.setTargetCard(CardFactoryUtil.AI_getBestCreature(human));
final CardList human = CardFactoryUtil.getHumanCreatureAI(card, true);
this.setTargetCard(CardFactoryUtil.getBestCreatureAI(human));
}
@Override
@@ -441,8 +441,7 @@ public class CardFactory_Instants {
@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);
@@ -523,21 +522,21 @@ public class CardFactory_Instants {
final CardList selectedCards = new CardList();
// pick best creature
Card c = CardFactoryUtil.AI_getBestCreature(list);
Card c = CardFactoryUtil.getBestCreatureAI(list);
if (c == null) {
c = list.get(0);
}
list.remove(c);
selectedCards.add(c);
c = CardFactoryUtil.AI_getBestCreature(list);
c = CardFactoryUtil.getBestCreatureAI(list);
if (c == null) {
c = list.get(0);
}
list.remove(c);
selectedCards.add(c);
c = CardFactoryUtil.AI_getBestCreature(list);
c = CardFactoryUtil.getBestCreatureAI(list);
if (c == null) {
c = list.get(0);
}
@@ -867,8 +866,8 @@ public class CardFactory_Instants {
else if (cardName.equals("Telling Time")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 2626878556107707854L;
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" };
private final 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
public boolean canPlayAI() {
@@ -958,7 +957,7 @@ public class CardFactory_Instants {
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;
private int damage = 3;
private final int damage = 3;
@Override
public void chooseTargetAI() {
@@ -972,10 +971,10 @@ public class CardFactory_Instants {
});
final CardList infect = creatures.getKeyword("Infect");
if (infect.size() > 0) {
final Card c = CardFactoryUtil.AI_getBestCreature(infect);
final Card c = CardFactoryUtil.getBestCreatureAI(infect);
this.setTargetCard(c);
} else {
final Card c = CardFactoryUtil.AI_getBestCreature(creatures);
final Card c = CardFactoryUtil.getBestCreatureAI(creatures);
this.setTargetCard(c);
}
@@ -1102,7 +1101,7 @@ public class CardFactory_Instants {
};
spell.setSubAbility(sub);
spell.setDescription("Target creature you control deals damage "
+ "equal to its power to target creature with flying.");
+ "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

@@ -63,11 +63,12 @@ class CardFactory_Lands {
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = 7352127748114888255L;
@Override
public void execute() {
if (card.getController().isHuman()) {
humanExecute();
this.humanExecute();
} else {
computerExecute();
this.computerExecute();
}
}
@@ -81,27 +82,27 @@ class CardFactory_Lands {
if (pay) {
AllZone.getComputerPlayer().loseLife(2, card);
} else {
tapCard();
this.tapCard();
}
}
public void humanExecute() {
int life = card.getController().getLife();
final int life = card.getController().getLife();
if (2 < life) {
StringBuilder question = new StringBuilder();
final StringBuilder question = new StringBuilder();
question.append("Pay 2 life? If you don't, ").append(card.getName());
question.append(" enters the battlefield tapped.");
if (GameActionUtil.showYesNoDialog(card, question.toString())) {
AllZone.getHumanPlayer().loseLife(2, card);
} else {
tapCard();
this.tapCard();
}
} // if
else {
tapCard();
this.tapCard();
}
} // execute()
@@ -127,7 +128,7 @@ class CardFactory_Lands {
}
}
if (card.getCounters(Counters.ICE) > 0 && AllZoneUtil.isCardInPlay(card) && super.canPlay()) {
if ((card.getCounters(Counters.ICE) > 0) && AllZoneUtil.isCardInPlay(card) && super.canPlay()) {
return true;
} else {
return false;
@@ -136,7 +137,7 @@ class CardFactory_Lands {
@Override
public boolean canPlayAI() {
String phase = AllZone.getPhase().getPhase();
final String phase = AllZone.getPhase().getPhase();
return phase.equals(Constant.Phase.MAIN2) && super.canPlayAI();
}
@@ -156,12 +157,12 @@ class CardFactory_Lands {
// TODO - this should probably be a state effect
@Override
public boolean canPlay() {
return card.getCounters(Counters.ICE) == 0 && AllZoneUtil.isCardInPlay(card) && super.canPlay();
return (card.getCounters(Counters.ICE) == 0) && AllZoneUtil.isCardInPlay(card) && super.canPlay();
}
@Override
public boolean canPlayAI() {
return canPlay() && super.canPlayAI();
return this.canPlay() && super.canPlayAI();
}
@Override
@@ -175,12 +176,14 @@ class CardFactory_Lands {
}
};
// 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.");
// 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();
final StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" - remove an ice counter.");
ability.setStackDescription(sb.toString());
@@ -195,17 +198,18 @@ class CardFactory_Lands {
final CardListFilter targets = new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return AllZoneUtil.isCardInPlay(c) && c.isCreature()
&& c.getTurnInZone() == AllZone.getPhase().getTurn();
&& (c.getTurnInZone() == AllZone.getPhase().getTurn());
}
};
Cost abCost = new Cost("G U T", cardName, true);
Ability_Activated ability = new Ability_Activated(card, abCost, null) {
final Cost abCost = new Cost("G U T", cardName, true);
final Ability_Activated ability = new Ability_Activated(card, abCost, null) {
private static final long serialVersionUID = 1416258136308898492L;
private CardList inPlay = new CardList();
private final CardList inPlay = new CardList();
@Override
public boolean canPlayAI() {
@@ -213,16 +217,16 @@ class CardFactory_Lands {
.getPlayerTurn().isComputer())) {
return false;
}
inPlay.clear();
inPlay.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield));
return (inPlay.filter(targets).size() > 1) && super.canPlayAI();
this.inPlay.clear();
this.inPlay.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield));
return (this.inPlay.filter(targets).size() > 1) && super.canPlayAI();
}
@Override
public void resolve() {
inPlay.clear();
inPlay.addAll(AllZoneUtil.getCardsIn(Zone.Battlefield));
for (Card targ : inPlay.filter(targets)) {
this.inPlay.clear();
this.inPlay.addAll(AllZoneUtil.getCardsIn(Zone.Battlefield));
for (final Card targ : this.inPlay.filter(targets)) {
targ.addCounter(Counters.P1P1, 1);
}
}
@@ -247,23 +251,27 @@ class CardFactory_Lands {
private final Player player = card.getController();
@Override
public void execute() {
if (player.isHuman()) {
if (this.player.isHuman()) {
final int[] paid = { 0 };
Input target = new Input() {
final Input target = new Input() {
private static final long serialVersionUID = -7835834281866473546L;
@Override
public void showMessage() {
AllZone.getDisplay().showMessage(cardName + " - Select an untapped land to sacrifice");
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
AllZone.getGameAction().sacrifice(card);
stop();
this.stop();
}
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (c.isLand() && zone.is(Constant.Zone.Battlefield) && c.isUntapped()) {
AllZone.getGameAction().sacrifice(c);
@@ -272,7 +280,7 @@ class CardFactory_Lands {
AllZone.getDisplay().showMessage(
cardName + " - Select an untapped land to sacrifice");
} else {
stop();
this.stop();
}
}
} // selectCard()
@@ -316,10 +324,12 @@ class CardFactory_Lands {
private static final long serialVersionUID = 6175830918425915833L;
private final Player player = card.getController();
@Override
public void execute() {
final CardList land = player.getCardsIn(Zone.Battlefield).getValidCards(type[0], player, card);
final CardList land = this.player.getCardsIn(Zone.Battlefield).getValidCards(type[0], this.player,
card);
if (player.isComputer()) {
if (this.player.isComputer()) {
if (land.size() > 0) {
CardList tappedLand = new CardList(land.toArray());
tappedLand = tappedLand.filter(CardListFilter.TAPPED);
@@ -334,24 +344,27 @@ class CardFactory_Lands {
AllZone.getGameAction().sacrifice(card);
}
} else { // this is the human resolution
Input target = new Input() {
final Input target = new Input() {
private static final long serialVersionUID = 6653677835621129465L;
@Override
public void showMessage() {
AllZone.getDisplay().showMessage(
cardName + " - Select one " + type[0] + " to sacrifice");
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
AllZone.getGameAction().sacrifice(card);
stop();
this.stop();
}
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (c.isLand() && zone.is(Zone.Battlefield) && land.contains(c)) {
AllZone.getGameAction().sacrifice(c);
stop();
this.stop();
}
} // selectCard()
}; // Input
@@ -369,13 +382,14 @@ class CardFactory_Lands {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 685604326470832887L;
@Override
public void execute() {
final Player player = card.getController();
CardList land = player.getCardsIn(Zone.Battlefield, "Sheltered Valley");
final CardList land = player.getCardsIn(Zone.Battlefield, "Sheltered Valley");
land.remove(card);
if (land.size() > 0) {
for (Card c : land) {
for (final Card c : land) {
AllZone.getGameAction().sacrifice(c);
}
}
@@ -391,15 +405,16 @@ class CardFactory_Lands {
private static final long serialVersionUID = 6175830918425915833L;
private final Player player = card.getController();
@Override
public void execute() {
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
plains = plains.filter(CardListFilter.UNTAPPED);
if (player.isComputer()) {
if (this.player.isComputer()) {
if (plains.size() > 1) {
CardList tappedPlains = new CardList(plains.toArray());
tappedPlains = tappedPlains.getType("Basic");
for (Card c : tappedPlains) {
for (final Card c : tappedPlains) {
AllZone.getGameAction().sacrifice(c);
}
for (int i = 0; i < tappedPlains.size(); i++) {
@@ -417,20 +432,23 @@ class CardFactory_Lands {
AllZone.getGameAction().sacrifice(card);
return;
}
Input target = new Input() {
final Input target = new Input() {
private static final long serialVersionUID = 6653677835621129465L;
@Override
public void showMessage() {
AllZone.getDisplay().showMessage(
"Scorched Ruins - Select an untapped land to sacrifice");
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
AllZone.getGameAction().sacrifice(card);
stop();
this.stop();
}
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (c.isLand() && zone.is(Constant.Zone.Battlefield) && c.isUntapped()) {
AllZone.getGameAction().sacrifice(c);
@@ -439,7 +457,7 @@ class CardFactory_Lands {
AllZone.getDisplay().showMessage(
"Scorched Ruins - Select an untapped land to sacrifice");
} else {
stop();
this.stop();
}
}
} // selectCard()
@@ -487,11 +505,12 @@ class CardFactory_Lands {
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = -5646344170306812481L;
@Override
public void execute() {
if (card.getController().isHuman()) {
humanExecute();
this.humanExecute();
} else {
computerExecute();
this.computerExecute();
}
}
@@ -499,7 +518,7 @@ class CardFactory_Lands {
CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
hand = hand.getType(type);
if (hand.size() > 0) {
revealCard(hand.get(0));
this.revealCard(hand.get(0));
} else {
card.tap();
}
@@ -520,14 +539,14 @@ class CardFactory_Lands {
if (zone.is(Constant.Zone.Hand) && c.isType(type)) {
JOptionPane.showMessageDialog(null, "Revealed card: " + c.getName(), card.getName(),
JOptionPane.PLAIN_MESSAGE);
stop();
this.stop();
}
}
@Override
public void selectButtonCancel() {
card.tap();
stop();
this.stop();
}
});
} // execute()
@@ -576,7 +595,7 @@ class CardFactory_Lands {
final String primary = pTemp;
final String secondary = sTemp;
StringBuilder description = new StringBuilder();
final StringBuilder description = new StringBuilder();
description.append("1, Remove X storage counters from ").append(cardName);
description.append(": Add X mana in any combination of ").append(primary);
description.append(" and/or ").append(secondary).append(" to your mana pool.");
@@ -594,15 +613,13 @@ class CardFactory_Lands {
abMana.setUndoable(false);
final Ability addMana = new Ability(card, "1", description.toString()) {
private static final long serialVersionUID = 7177960799748450242L;
// @Override
public String mana() {
StringBuilder mana = new StringBuilder();
final StringBuilder mana = new StringBuilder();
for (int i = 0; i < split[0]; i++) {
mana.append(primary).append(" ");
}
for (int j = 0; j < num[0] - split[0]; j++) {
for (int j = 0; j < (num[0] - split[0]); j++) {
mana.append(secondary).append(" ");
}
return mana.toString().trim();
@@ -616,43 +633,42 @@ class CardFactory_Lands {
@Override
public void resolve() {
abMana.setUndoable(false);
abMana.produceMana(mana(), card.getController());
abMana.produceMana(this.mana(), card.getController());
}
};
Input runtime = new Input() {
final Input runtime = new Input() {
private static final long serialVersionUID = -8808673510875540608L;
@Override
public void showMessage() {
num[0] = card.getCounters(Counters.STORAGE);
String[] choices = new String[num[0] + 1];
final String[] choices = new String[num[0] + 1];
for (int j = 0; j <= num[0]; j++) {
choices[j] = "" + j;
}
String answer = (String) (GuiUtils.getChoiceOptional("Storage counters to remove", choices));
final String answer = (GuiUtils.getChoiceOptional("Storage counters to remove", choices));
if (answer == null) {
stop();
this.stop();
return;
}
num[0] = Integer.parseInt(answer);
String splitNum = (String) (GuiUtils.getChoiceOptional(
"Number of " + primary + " to add", choices));
final String splitNum = (GuiUtils.getChoiceOptional("Number of " + primary + " to add", choices));
if (splitNum == null) {
stop();
this.stop();
return;
}
split[0] = Integer.parseInt(splitNum);
if (num[0] > 0 || split[0] > 0) {
if ((num[0] > 0) || (split[0] > 0)) {
card.subtractCounter(Counters.STORAGE, num[0]);
stop();
this.stop();
AllZone.getStack().add(addMana);
return;
}
stop();
this.stop();
}
};
addMana.setDescription(description.toString());
@@ -668,6 +684,7 @@ class CardFactory_Lands {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 7813334062721799674L;
@Override
public void execute() {
final Player player = card.getController();
CardList land = AllZoneUtil.getPlayerLandsInPlay(player);
@@ -686,25 +703,28 @@ class CardFactory_Lands {
AllZone.getGameAction().sacrifice(card);
}
} else { // this is the human resolution
Input target = new Input() {
final Input target = new Input() {
private static final long serialVersionUID = 7944127258985401036L;
@Override
public void showMessage() {
AllZone.getDisplay().showMessage(
cardName + " - Select one non-Lair land to return to your hand");
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
AllZone.getGameAction().sacrifice(card);
stop();
this.stop();
}
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (c.isLand() && zone.is(Constant.Zone.Battlefield, AllZone.getHumanPlayer())
&& !c.isType("Lair")) {
AllZone.getGameAction().moveToHand(c);
stop();
this.stop();
}
} // selectCard()
}; // Input
@@ -742,30 +762,33 @@ class CardFactory_Lands {
if (player.isComputer()) {
if (land.size() > 0) {
Card c = CardFactoryUtil.getWorstLand(land);
final Card c = CardFactoryUtil.getWorstLand(land);
AllZone.getGameAction().moveToHand(c);
} else {
AllZone.getGameAction().sacrifice(card);
}
} else { // this is the human resolution
Input target = new Input() {
final Input target = new Input() {
private static final long serialVersionUID = -7886610643693087790L;
@Override
public void showMessage() {
AllZone.getDisplay().showMessage(
card + " - Select one untapped " + type[0] + " to return");
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
AllZone.getGameAction().sacrifice(card);
stop();
this.stop();
}
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (zone.is(Constant.Zone.Battlefield) && land.contains(c)) {
AllZone.getGameAction().moveToHand(c);
stop();
this.stop();
}
} // selectCard()
}; // Input
@@ -774,12 +797,12 @@ class CardFactory_Lands {
}
};
sacOrNo.setStackDescription("When CARDNAME enters the battlefield, "
+ "sacrifice it unless you return an untapped "
+ type[0] + " you control to its owner's hand.");
+ "sacrifice it unless you return an untapped " + type[0] + " you control to its owner's hand.");
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = -5777499632266148456L;
@Override
public void execute() {
AllZone.getStack().addSimultaneousStackEntry(sacOrNo);
}

View File

@@ -12,6 +12,7 @@ import forge.card.CardRules;
import forge.error.ErrorViewer;
import forge.item.CardDb;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
/**
* <p>
@@ -56,16 +57,16 @@ public class PreloadingCardFactory extends AbstractCardFactory {
super(file);
try {
readCards(file);
this.readCards(file);
// initialize CardList allCards
Iterator<String> it = getMap().keySet().iterator();
final Iterator<String> it = this.getMap().keySet().iterator();
Card c;
while (it.hasNext()) {
c = getCard(it.next().toString(), AllZone.getHumanPlayer());
getAllCards().add(c);
c = this.getCard(it.next().toString(), AllZone.getHumanPlayer());
this.getAllCards().add(c);
}
} catch (Exception ex) {
} catch (final Exception ex) {
ErrorViewer.showError(ex);
}
} // constructor
@@ -79,10 +80,11 @@ public class PreloadingCardFactory extends AbstractCardFactory {
* a {@link java.io.File} object.
*/
protected final void readCards(final File file) {
getMap().clear();
this.getMap().clear();
List<CardRules> listCardRules = new ArrayList<CardRules>();
CardReader read = new CardReader(ForgeProps.getFile(CARDSFOLDER), getMap(), listCardRules);
final List<CardRules> listCardRules = new ArrayList<CardRules>();
final CardReader read = new CardReader(ForgeProps.getFile(NewConstants.CARDSFOLDER), this.getMap(),
listCardRules);
// this fills in our map of card names to Card instances.
read.run();

View File

@@ -201,9 +201,9 @@ public class CostPutCounter extends CostPartWithList {
Card card = null;
if (type.equals("Creature.YouCtrl")) {
card = CardFactoryUtil.AI_getWorstCreature(typeList);
card = CardFactoryUtil.getWorstCreatureAI(typeList);
} else {
card = CardFactoryUtil.AI_getWorstPermanent(typeList, false, false, false, false);
card = CardFactoryUtil.getWorstPermanentAI(typeList, false, false, false, false);
}
addToList(card);
}

View File

@@ -43,7 +43,7 @@ public class Spell_Permanent extends Spell {
public void showMessage() {
CardList choice = (CardList) championGetCreature.execute();
stopSetNext(CardFactoryUtil.input_targetChampionSac(getSourceCard(), championAbilityComes, choice,
stopSetNext(CardFactoryUtil.inputTargetChampionSac(getSourceCard(), championAbilityComes, choice,
"Select another " + championValidDesc + " you control to exile", false, false));
ButtonUtil.disableAll(); // target this card means: sacrifice this
// card