- Converting MinTarget and MaxTarget to strings so they can be variable amounts.

- Merged Footbottom Feast to AB_Retrieve
This commit is contained in:
jendave
2011-08-06 11:09:22 +00:00
parent d92dafdc3a
commit c93c9cd22c
13 changed files with 54 additions and 53 deletions

View File

@@ -1,9 +1,10 @@
Name:Footbottom Feast
ManaCost:2 B
Types:Instant
Text:Put any number of target creature cards from your graveyard on top of your library.
K:spReturnTgt:AnyNumber:Creature:TopofLibrary
Text:no text
A:SP$Retrieve | Cost$ 2 B | Destination$ Library | TargetMin$ 0 | TargetMax$ X | TgtPrompt$ Put any number of target creature cards from your graveyard on top of your library.
K:Draw a card.
SVar:X:Count$TypeInYourYard.Creature
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/footbottom_feast.jpg
End

View File

@@ -151,8 +151,8 @@ public class AbilityFactory {
if (isTargeted)
{
int min = mapParams.containsKey("TargetMin") ? Integer.parseInt(mapParams.get("TargetMin")) : 1;
int max = mapParams.containsKey("TargetMax") ? Integer.parseInt(mapParams.get("TargetMax")) : 1;
String min = mapParams.containsKey("TargetMin") ? mapParams.get("TargetMin") : "1";
String max = mapParams.containsKey("TargetMax") ? mapParams.get("TargetMax") : "1";
if (hasValid){
// TgtPrompt now optional

View File

@@ -173,9 +173,9 @@ public class AbilityFactory_Bounce {
if (abTgt != null){
abTgt.resetTargets();
// target loop
while(abTgt.getNumTargeted() < abTgt.getMaxTargets()){
while(abTgt.getNumTargeted() < abTgt.getMaxTargets(sa.getSourceCard(), sa)){
if (list.size() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets() || abTgt.getNumTargeted() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets(sa.getSourceCard(), sa) || abTgt.getNumTargeted() == 0){
abTgt.resetTargets();
return false;
}
@@ -194,7 +194,7 @@ public class AbilityFactory_Bounce {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), true);
if (choice == null){ // can't find anything left
if (abTgt.getNumTargeted() < abTgt.getMinTargets() || abTgt.getNumTargeted() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets(sa.getSourceCard(), sa) || abTgt.getNumTargeted() == 0){
abTgt.resetTargets();
return false;
}

View File

@@ -251,9 +251,9 @@ public class AbilityFactory_Counters {
if (abTgt != null){
abTgt.resetTargets();
// target loop
while(abTgt.getNumTargeted() < abTgt.getMaxTargets()){
while(abTgt.getNumTargeted() < abTgt.getMaxTargets(sa.getSourceCard(), sa)){
if (list.size() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets() || abTgt.getNumTargeted() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets(sa.getSourceCard(), sa) || abTgt.getNumTargeted() == 0){
abTgt.resetTargets();
return false;
}
@@ -295,7 +295,7 @@ public class AbilityFactory_Counters {
}
if (choice == null){ // can't find anything left
if (abTgt.getNumTargeted() < abTgt.getMinTargets() || abTgt.getNumTargeted() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets(sa.getSourceCard(), sa) || abTgt.getNumTargeted() == 0){
abTgt.resetTargets();
return false;
}

View File

@@ -288,7 +288,7 @@ import java.util.Random;
tgt.resetTargets();
// target loop
while (tgt.getNumTargeted() < tgt.getMaxTargets()) {
while (tgt.getNumTargeted() < tgt.getMaxTargets(saMe.getSourceCard(), saMe)) {
// TODO: Consider targeting the planeswalker
if (tgt.canTgtCreatureAndPlayer()) {
@@ -317,7 +317,7 @@ import java.util.Random;
}
}
// fell through all the choices, no targets left?
if (tgt.getNumTargeted() < tgt.getMinTargets()
if (tgt.getNumTargeted() < tgt.getMinTargets(saMe.getSourceCard(), saMe)
|| tgt.getNumTargeted() == 0) {
tgt.resetTargets();
return false;

View File

@@ -191,9 +191,9 @@ public class AbilityFactory_Destroy {
if (abTgt != null){
abTgt.resetTargets();
// target loop
while(abTgt.getNumTargeted() < abTgt.getMaxTargets()){
while(abTgt.getNumTargeted() < abTgt.getMaxTargets(sa.getSourceCard(), sa)){
if (list.size() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets() || abTgt.getNumTargeted() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets(sa.getSourceCard(), sa) || abTgt.getNumTargeted() == 0){
abTgt.resetTargets();
return false;
}
@@ -210,7 +210,7 @@ public class AbilityFactory_Destroy {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), true);
if (choice == null){ // can't find anything left
if (abTgt.getNumTargeted() < abTgt.getMinTargets() || abTgt.getNumTargeted() == 0){
if (abTgt.getNumTargeted() < abTgt.getMinTargets(sa.getSourceCard(), sa) || abTgt.getNumTargeted() == 0){
abTgt.resetTargets();
return false;
}

View File

@@ -512,12 +512,12 @@ public class AbilityFactory_Fetch {
return false;
while(tgt.getNumTargeted() < tgt.getMaxTargets()){
while(tgt.getNumTargeted() < tgt.getMaxTargets(sa.getSourceCard(), sa)){
// AI Targeting
Card choice;
if (list.size() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}
@@ -537,7 +537,7 @@ public class AbilityFactory_Fetch {
choice = list.get(0);
}
if (choice == null){ // can't find anything left
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}

View File

@@ -135,11 +135,11 @@ public class AbilityFactory_GainControl {
if (list.isEmpty())
return false;
while(tgt.getNumTargeted() < tgt.getMaxTargets()){
while(tgt.getNumTargeted() < tgt.getMaxTargets(sa.getSourceCard(), sa)){
Card t = null;
if (list.isEmpty()){
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}

View File

@@ -95,11 +95,11 @@ public class AbilityFactory_PermanentState {
if (untapList.size() == 0)
return false;
while(tgt.getNumTargeted() < tgt.getMaxTargets()){
while(tgt.getNumTargeted() < tgt.getMaxTargets(sa.getSourceCard(), sa)){
Card choice = null;
if (untapList.size() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}
@@ -115,7 +115,7 @@ public class AbilityFactory_PermanentState {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(untapList, af.getHostCard(), false);
if (choice == null){ // can't find anything left
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}
@@ -251,11 +251,11 @@ public class AbilityFactory_PermanentState {
if (tapList.size() == 0)
return false;
while(tgt.getNumTargeted() < tgt.getMaxTargets()){
while(tgt.getNumTargeted() < tgt.getMaxTargets(sa.getSourceCard(), sa)){
Card choice = null;
if (tapList.size() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}
@@ -271,7 +271,7 @@ public class AbilityFactory_PermanentState {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(tapList, af.getHostCard(), false);
if (choice == null){ // can't find anything left
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}

View File

@@ -296,12 +296,12 @@ public class AbilityFactory_Pump {
if (list.isEmpty())
return false;
while(tgt.getNumTargeted() < tgt.getMaxTargets()){
while(tgt.getNumTargeted() < tgt.getMaxTargets(sa.getSourceCard(), sa)){
Card t = null;
boolean goodt = false;
if (list.isEmpty()){
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}
@@ -329,7 +329,7 @@ public class AbilityFactory_Pump {
}
if (list.isEmpty()){
if (tgt.getNumTargeted() < tgt.getMinTargets() || tgt.getNumTargeted() == 0){
if (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa) || tgt.getNumTargeted() == 0){
tgt.resetTargets();
return false;
}

View File

@@ -11146,7 +11146,7 @@ public class CardFactory implements NewConstants {
//*************** START *********** START **************************
else if(cardName.equals("Barl's Cage")) {
final String Tgts[] = {"Creature"};
Target target= new Target("Select target creature.", Tgts, 1, 1);
Target target= new Target("Select target creature.", Tgts, "1", "1");
final Ability_Cost cost = new Ability_Cost("3", card.getName(), true);

View File

@@ -11,13 +11,13 @@ public class Target {
public String[] getValidTgts() { return ValidTgts; }
public String getVTSelection() { return vtSelection; }
private int minTargets = 1;
public int getMinTargets() { return minTargets; }
private int maxTargets = 1;
public int getMaxTargets() { return maxTargets; }
private String minTargets;
private String maxTargets;
public int getMinTargets(Card c, SpellAbility sa) { return AbilityFactory.calculateAmount(c, minTargets, sa); }
public int getMaxTargets(Card c, SpellAbility sa) { return AbilityFactory.calculateAmount(c, maxTargets, sa); }
public boolean isMaxTargetsChosen() { return maxTargets == numTargeted; }
public boolean isMinTargetsChosen() { return minTargets <= numTargeted; }
public boolean isMaxTargetsChosen(Card c, SpellAbility sa) { return getMaxTargets(c, sa) == numTargeted; }
public boolean isMinTargetsChosen(Card c, SpellAbility sa) { return getMinTargets(c, sa) <= numTargeted; }
private String tgtZone = Constant.Zone.Play;
public void setZone(String tZone) { tgtZone = tZone; }
@@ -84,10 +84,10 @@ public class Target {
}
public Target(String parse){
this(parse, 1, 1);
this(parse, "1", "1");
}
public Target(String parse, int min, int max){
public Target(String parse, String min, String max){
// parse=Tgt{C}{P} - Primarily used for Pump or Damage
// C = Creature P=Player/Planeswalker
// CP = All three
@@ -126,10 +126,10 @@ public class Target {
}
public Target(String select, String[] valid){
this(select, valid, 1, 1);
this(select, valid, "1", "1");
}
public Target(String select, String[] valid, int min, int max){
public Target(String select, String[] valid, String min, String max){
tgtValid = true;
vtSelection = select;
ValidTgts = valid;

View File

@@ -42,12 +42,12 @@ public class Target_Selection {
public boolean chooseTargets(){
// if not enough targets chosen, reset and cancel Ability
if (bCancel || (bDoneTarget && !target.isMinTargetsChosen())){
if (bCancel || (bDoneTarget && !target.isMinTargetsChosen(card, ability))){
bCancel = true;
req.finishedTargeting();
return false;
}
else if (!doesTarget() || bDoneTarget && target.isMinTargetsChosen() || target.isMaxTargetsChosen()){
else if (!doesTarget() || bDoneTarget && target.isMinTargetsChosen(card, ability) || target.isMaxTargetsChosen(card, ability)){
Ability_Sub abSub = ability.getSubAbility();
if (abSub == null){
@@ -109,7 +109,7 @@ public class Target_Selection {
}//input_targetValid
//CardList choices are the only cards the user can successful select
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message,
public static Input input_targetSpecific(final SpellAbility sa, final CardList choices, final String message,
final boolean targeted, final boolean bTgtPlayer, final Target_Selection select, final SpellAbility_Requirements req) {
Input target = new Input() {
private static final long serialVersionUID = -1091595663541356356L;
@@ -128,7 +128,7 @@ public class Target_Selection {
Target t = select.getTgt();
// If reached Minimum targets, enable OK button
if (t.getMinTargets() > t.getNumTargeted())
if (t.getMinTargets(sa.getSourceCard(), sa) > t.getNumTargeted())
ButtonUtil.enableOnlyCancel();
else
ButtonUtil.enableAll();
@@ -149,7 +149,7 @@ public class Target_Selection {
@Override
public void selectCard(Card card, PlayerZone zone) {
if(targeted && !CardFactoryUtil.canTarget(spell, card)) {
if(targeted && !CardFactoryUtil.canTarget(sa, card)) {
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection? Restrictions?).");
}
else if(choices.contains(card)) {
@@ -160,7 +160,7 @@ public class Target_Selection {
@Override
public void selectPlayer(Player player) {
if (bTgtPlayer && player.canTarget(spell.getSourceCard())){
if (bTgtPlayer && player.canTarget(sa.getSourceCard())){
select.getTgt().addTarget(player);
done();
}
@@ -176,7 +176,7 @@ public class Target_Selection {
}//input_targetSpecific()
public static Input input_cardFromList(final SpellAbility spell, final CardList choices, final String message,
public static Input input_cardFromList(final SpellAbility sa, final CardList choices, final String message,
final boolean targeted, final Target_Selection select, final SpellAbility_Requirements req){
// Send in a list of valid cards, and popup a choice box to target
Input target = new Input() {