diff --git a/.gitattributes b/.gitattributes
index 1c8410df1d4..167b0222ed2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4380,6 +4380,7 @@ res/cardsfolder/l/living_airship.txt svneol=native#text/plain
res/cardsfolder/l/living_armor.txt svneol=native#text/plain
res/cardsfolder/l/living_artifact.txt svneol=native#text/plain
res/cardsfolder/l/living_death.txt svneol=native#text/plain
+res/cardsfolder/l/living_destiny.txt -text
res/cardsfolder/l/living_hive.txt svneol=native#text/plain
res/cardsfolder/l/living_lands.txt svneol=native#text/plain
res/cardsfolder/l/living_plane.txt svneol=native#text/plain
@@ -9611,6 +9612,7 @@ src/main/java/forge/card/cost/CostPayLife.java -text
src/main/java/forge/card/cost/CostPutCounter.java -text
src/main/java/forge/card/cost/CostRemoveCounter.java -text
src/main/java/forge/card/cost/CostReturn.java -text
+src/main/java/forge/card/cost/CostReveal.java -text
src/main/java/forge/card/cost/CostSacrifice.java -text
src/main/java/forge/card/cost/CostTap.java -text
src/main/java/forge/card/cost/CostTapType.java -text
diff --git a/res/cardsfolder/l/living_destiny.txt b/res/cardsfolder/l/living_destiny.txt
new file mode 100644
index 00000000000..ccefcd983c3
--- /dev/null
+++ b/res/cardsfolder/l/living_destiny.txt
@@ -0,0 +1,10 @@
+Name:Living Destiny
+ManaCost:3 G
+Types:Instant
+Text:no text
+A:SP$ GainLife | Cost$ 3 G Reveal<1/Creature> | LifeAmount$ X | SpellDescription$ You gain life equal to the revealed card's converted mana cost.
+SVar:X:Revealed$CardManaCost
+SVar:RemAIDeck:True
+SVar:Rarity:Common
+SVar:Picture:http://www.wizards.com/global/images/magic/general/living_destiny.jpg
+End
\ No newline at end of file
diff --git a/src/main/java/forge/GameAction.java b/src/main/java/forge/GameAction.java
index a52af4ba3a5..52c3e2cb162 100644
--- a/src/main/java/forge/GameAction.java
+++ b/src/main/java/forge/GameAction.java
@@ -490,15 +490,17 @@ public class GameAction {
CardList hand = AllZoneUtil.getPlayerHand(AllZone.getComputerPlayer());
hand = hand.getValidCards(uTypes, sa.getActivatingPlayer(), sa.getSourceCard());
- if (hand.size() < numDiscard)
+ if (hand.size() < numDiscard){
return null;
+ }
CardList discard = new CardList();
CardListUtil.sortCMC(hand);
hand.reverse();
- for (int i = 0; i < numDiscard; i++)
+ for (int i = 0; i < numDiscard; i++){
discard.add(hand.get(i));
+ }
return discard;
}
diff --git a/src/main/java/forge/Player.java b/src/main/java/forge/Player.java
index 076fcd0ed09..309ae61a1a0 100644
--- a/src/main/java/forge/Player.java
+++ b/src/main/java/forge/Player.java
@@ -1105,13 +1105,19 @@ public abstract class Player extends MyObservable {
*
* @param num a int.
* @param sa a {@link forge.card.spellability.SpellAbility} object.
+ * @return
*/
- public void discardRandom(final int num, final SpellAbility sa) {
+ public CardList discardRandom(final int num, final SpellAbility sa) {
+ CardList discarded = new CardList();
for (int i = 0; i < num; i++) {
CardList list = AllZoneUtil.getPlayerHand(this);
- if (list.size() != 0)
- doDiscard(CardUtil.getRandom(list.toArray()), sa);
+ if (list.size() != 0){
+ Card disc = CardUtil.getRandom(list.toArray());
+ discarded.add(disc);
+ doDiscard(disc, sa);
+ }
}
+ return discarded;
}
/**
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory.java b/src/main/java/forge/card/abilityFactory/AbilityFactory.java
index cfbec5693fe..400650c8269 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory.java
@@ -1077,16 +1077,16 @@ public class AbilityFactory {
}
CardList list = new CardList();
- if (calcX[0].startsWith("Sacrificed"))
+ if (calcX[0].startsWith("Sacrificed")) {
list = findRootAbility(ability).getPaidList("Sacrificed");
-
- else if (calcX[0].startsWith("Discarded"))
+ } else if (calcX[0].startsWith("Discarded")){
list = findRootAbility(ability).getPaidList("Discarded");
-
- else if (calcX[0].startsWith("Exiled")) {
+ } else if (calcX[0].startsWith("Exiled")) {
list = findRootAbility(ability).getPaidList("Exiled");
} else if (calcX[0].startsWith("Tapped")) {
list = findRootAbility(ability).getPaidList("Tapped");
+ } else if (calcX[0].startsWith("Revealed")) {
+ list = findRootAbility(ability).getPaidList("Revealed");
} else if (calcX[0].startsWith("Targeted")) {
Target t = ability.getTarget();
if (null != t) {
diff --git a/src/main/java/forge/card/cost/Cost.java b/src/main/java/forge/card/cost/Cost.java
index a68c1193193..60fde991c2c 100644
--- a/src/main/java/forge/card/cost/Cost.java
+++ b/src/main/java/forge/card/cost/Cost.java
@@ -98,6 +98,7 @@ public class Cost {
private final static String exileFromGraveStr = "ExileFromGrave<";
private final static String exileFromTopStr = "ExileFromTop<";
private final static String returnStr = "Return<";
+ private final static String revealStr = "Reveal<";
/**
*
Constructor for Cost.
@@ -124,7 +125,7 @@ public class Cost {
String[] splitStr = abCostParse(parse, subStr, 4);
parse = abUpdateParse(parse, subStr);
- String type = splitStr.length > 2 ? splitStr[2] : null;
+ String type = splitStr.length > 2 ? splitStr[2] : "CARDNAME";
String description = splitStr.length > 3 ? splitStr[3] : null;
costParts.add(new CostRemoveCounter(splitStr[0], Counters.valueOf(splitStr[1]), type, description));
@@ -212,6 +213,14 @@ public class Cost {
String description = splitStr.length > 2 ? splitStr[2] : null;
costParts.add(new CostReturn(splitStr[0], splitStr[1], description));
}
+
+ while (parse.contains(revealStr)) {
+ String[] splitStr = abCostParse(parse, revealStr, 3);
+ parse = abUpdateParse(parse, revealStr);
+
+ String description = splitStr.length > 2 ? splitStr[2] : null;
+ costParts.add(new CostReveal(splitStr[0], splitStr[1], description));
+ }
// These won't show up with multiples
if (parse.contains("Untap")) {
diff --git a/src/main/java/forge/card/cost/CostDiscard.java b/src/main/java/forge/card/cost/CostDiscard.java
index 3f33a26df43..54f20539dc1 100644
--- a/src/main/java/forge/card/cost/CostDiscard.java
+++ b/src/main/java/forge/card/cost/CostDiscard.java
@@ -17,9 +17,7 @@ public class CostDiscard extends CostPartWithList {
// Discard
public CostDiscard(String amount, String type, String description){
- this.amount = amount;
- this.type = type;
- this.typeDescription = description;
+ super(amount, type, description);
}
@Override
@@ -101,18 +99,27 @@ public class CostDiscard extends CostPartWithList {
CardList handList = AllZoneUtil.getPlayerHand(activator);
String discType = getType();
String amount = getAmount();
+ resetList();
if (getThis()) {
+ if (!handList.contains(source)){
+ return false;
+ }
activator.discard(source, ability);
payment.setPaidManaPart(this, true);
+ addToList(source);
} else if (discType.equals("Hand")) {
+ list = handList;
activator.discardHand(ability);
payment.setPaidManaPart(this, true);
} else if (discType.equals("LastDrawn")) {
- if (handList.contains(activator.getLastDrawnCard())) {
- activator.discard(activator.getLastDrawnCard(), ability);
- payment.setPaidManaPart(this, true);
+ Card lastDrawn = activator.getLastDrawnCard();
+ addToList(lastDrawn);
+ if (!handList.contains(lastDrawn)) {
+ return false;
}
+ activator.discard(lastDrawn, ability);
+ payment.setPaidManaPart(this, true);
} else {
Integer c = convertAmount();
@@ -128,7 +135,7 @@ public class CostDiscard extends CostPartWithList {
}
}
- activator.discardRandom(c, ability);
+ list = activator.discardRandom(c, ability);
payment.setPaidManaPart(this, true);
} else {
String validType[] = discType.split(";");
@@ -149,6 +156,7 @@ public class CostDiscard extends CostPartWithList {
return false;
}
}
+ addListToHash(ability, "Discarded");
return true;
}
@@ -161,14 +169,14 @@ public class CostDiscard extends CostPartWithList {
if (type.equals("LastDrawn")){
if (!hand.contains(activator.getLastDrawnCard()))
return false;
- list.add(activator.getLastDrawnCard());
+ addToList(activator.getLastDrawnCard());
}
else if (getThis()){
if (!hand.contains(source))
return false;
- list.add(source);
+ addToList(source);
}
else if (type.equals("Hand")){
@@ -208,7 +216,7 @@ public class CostDiscard extends CostPartWithList {
*
* @return a {@link forge.gui.input.Input} object.
*/
- public static Input input_discardCost(final String discType, final CardList handList, SpellAbility sa, final Cost_Payment payment, final CostPart part, final int nNeeded) {
+ public static Input input_discardCost(final String discType, final CardList handList, SpellAbility sa, final Cost_Payment payment, final CostDiscard part, final int nNeeded) {
final SpellAbility sp = sa;
Input target = new Input() {
private static final long serialVersionUID = -329993322080934435L;
@@ -217,20 +225,15 @@ public class CostDiscard extends CostPartWithList {
@Override
public void showMessage() {
- boolean any = discType.equals("Any") ? true : false;
if (AllZone.getHumanHand().size() == 0) stop();
StringBuilder type = new StringBuilder("");
- if (any || !discType.equals("Card")) {
+ if (!discType.equals("Card")) {
type.append(" ").append(discType);
}
StringBuilder sb = new StringBuilder();
- sb.append("Select ");
- if (any) {
- sb.append("any ");
- } else {
- sb.append("a ").append(type.toString()).append(" ");
- }
- sb.append("card to discard.");
+ sb.append("Select a");
+ sb.append(part.getDescriptiveType());
+ sb.append(" to discard.");
if (nNeeded > 1) {
sb.append(" You have ");
sb.append(nNeeded - nDiscard);
@@ -250,6 +253,7 @@ public class CostDiscard extends CostPartWithList {
if (zone.is(Constant.Zone.Hand) && handList.contains(card)) {
// send in CardList for Typing
card.getController().discard(card, sp);
+ part.addToList(card);
handList.remove(card);
nDiscard++;
@@ -270,6 +274,7 @@ public class CostDiscard extends CostPartWithList {
public void done() {
stop();
+ part.addListToHash(sp, "Discarded");
payment.paidCost(part);
}
};
diff --git a/src/main/java/forge/card/cost/CostExile.java b/src/main/java/forge/card/cost/CostExile.java
index bfc2baf5c24..86a95c7d562 100644
--- a/src/main/java/forge/card/cost/CostExile.java
+++ b/src/main/java/forge/card/cost/CostExile.java
@@ -32,9 +32,7 @@ public class CostExile extends CostPartWithList {
}
public CostExile(String amount, String type, String description, String from){
- this.amount = amount;
- this.type = type;
- this.typeDescription = description;
+ super(amount, type, description);
if (from != null)
this.from = from;
}
@@ -173,9 +171,10 @@ public class CostExile extends CostPartWithList {
Iterator itr = list.iterator();
while(itr.hasNext()){
Card c = (Card)itr.next();
- payment.getAbility().addCostToHashList(c, "Exiled");
+ part.addToList(c);
AllZone.getGameAction().exile(c);
}
+ part.addListToHash(sa, "Exiled");
payment.paidCost(part);
}
else{
@@ -202,7 +201,7 @@ public class CostExile extends CostPartWithList {
if (o != null) {
Card c = (Card) o;
typeList.remove(c);
- payment.getAbility().addCostToHashList(c, "Exiled");
+ part.addToList(c);
AllZone.getGameAction().exile(c);
if (i == nNeeded - 1) done();
}
@@ -220,6 +219,7 @@ public class CostExile extends CostPartWithList {
public void done() {
stop();
+ part.addListToHash(sa, "Exiled");
payment.paidCost(part);
}
@@ -275,7 +275,7 @@ public class CostExile extends CostPartWithList {
public void selectCard(Card card, PlayerZone zone) {
if (typeList.contains(card)) {
nExiles++;
- payment.getAbility().addCostToHashList(card, "Exiled");
+ part.addToList(card);
AllZone.getGameAction().exile(card);
typeList.remove(card);
//in case nothing else to exile
@@ -290,6 +290,7 @@ public class CostExile extends CostPartWithList {
public void done() {
stop();
+ part.addListToHash(sa, "Exiled");
payment.paidCost(part);
}
@@ -328,7 +329,9 @@ public class CostExile extends CostPartWithList {
if (choice.equals(0)) {
payment.getAbility().addCostToHashList(card, "Exiled");
AllZone.getGameAction().exile(card);
+ part.addToList(card);
stop();
+ part.addListToHash(sa, "Exiled");
payment.paidCost(part);
} else {
stop();
diff --git a/src/main/java/forge/card/cost/CostPart.java b/src/main/java/forge/card/cost/CostPart.java
index bcb491215b5..831ea17f3e8 100644
--- a/src/main/java/forge/card/cost/CostPart.java
+++ b/src/main/java/forge/card/cost/CostPart.java
@@ -13,6 +13,14 @@ public abstract class CostPart {
protected String type = "Card";
protected String typeDescription = null;
+ public CostPart(){}
+
+ public CostPart(String amount, String type, String description){
+ this.amount = amount;
+ this.type = type;
+ this.typeDescription = description;
+ }
+
public String getAmount() {
return amount;
}
diff --git a/src/main/java/forge/card/cost/CostPartWithList.java b/src/main/java/forge/card/cost/CostPartWithList.java
index a1bb0ee1df9..a18d314dc59 100644
--- a/src/main/java/forge/card/cost/CostPartWithList.java
+++ b/src/main/java/forge/card/cost/CostPartWithList.java
@@ -2,6 +2,7 @@ package forge.card.cost;
import forge.Card;
import forge.CardList;
+import forge.card.spellability.SpellAbility;
public abstract class CostPartWithList extends CostPart {
protected CardList list = null;
@@ -9,4 +10,17 @@ public abstract class CostPartWithList extends CostPart {
public void setList(CardList setList) { list = setList; }
public void resetList() { list = new CardList(); }
public void addToList(Card c) { list.add(c); }
+
+ public void addListToHash(SpellAbility sa, String hash){
+ for(Card card : list){
+ sa.addCostToHashList(card, hash);
+ }
+ }
+
+ public CostPartWithList(){}
+
+ public CostPartWithList(String amount, String type, String description){
+ super(amount, type, description);
+ resetList();
+ }
}
diff --git a/src/main/java/forge/card/cost/CostRemoveCounter.java b/src/main/java/forge/card/cost/CostRemoveCounter.java
index 739107d7daa..041dba20718 100644
--- a/src/main/java/forge/card/cost/CostRemoveCounter.java
+++ b/src/main/java/forge/card/cost/CostRemoveCounter.java
@@ -21,16 +21,10 @@ public class CostRemoveCounter extends CostPart {
}
public CostRemoveCounter(String amount, Counters counter, String type, String description){
+ super(amount, type, description);
isReusable = true;
- this.amount = amount;
- this.counter = counter;
-
- if (type != null)
- this.type = type;
- else
- this.type = "CARDNAME";
- this.typeDescription = description;
+ this.counter = counter;
}
@Override
diff --git a/src/main/java/forge/card/cost/CostReturn.java b/src/main/java/forge/card/cost/CostReturn.java
index 03bd5e10d6f..cff6644fa4d 100644
--- a/src/main/java/forge/card/cost/CostReturn.java
+++ b/src/main/java/forge/card/cost/CostReturn.java
@@ -18,9 +18,7 @@ public class CostReturn extends CostPartWithList {
// Return
public CostReturn(String amount, String type, String description){
- this.amount = amount;
- this.type = type;
- this.typeDescription = description;
+ super(amount, type, description);
}
@Override
@@ -127,7 +125,7 @@ public class CostReturn extends CostPartWithList {
* @param part TODO
* @return a {@link forge.gui.input.Input} object.
*/
- public static Input returnType(final SpellAbility sa, final String type, final Cost_Payment payment, final CostPart part, final int nNeeded) {
+ public static Input returnType(final SpellAbility sa, final String type, final Cost_Payment payment, final CostReturn part, final int nNeeded) {
Input target = new Input() {
private static final long serialVersionUID = 2685832214519141903L;
private CardList typeList;
@@ -158,6 +156,7 @@ public class CostReturn extends CostPartWithList {
public void selectCard(Card card, PlayerZone zone) {
if (typeList.contains(card)) {
nReturns++;
+ part.addToList(card);
AllZone.getGameAction().moveToHand(card);
typeList.remove(card);
//in case nothing else to return
@@ -177,6 +176,7 @@ public class CostReturn extends CostPartWithList {
public void cancel() {
stop();
+ part.addListToHash(sa, "Returned");
payment.cancelCost();
}
};
@@ -192,7 +192,7 @@ public class CostReturn extends CostPartWithList {
* @param part TODO
* @return a {@link forge.gui.input.Input} object.
*/
- public static Input returnThis(final SpellAbility sa, final Cost_Payment payment, final CostPart part) {
+ public static Input returnThis(final SpellAbility sa, final Cost_Payment payment, final CostReturn part) {
Input target = new Input() {
private static final long serialVersionUID = 2685832214519141903L;
@@ -208,8 +208,10 @@ public class CostReturn extends CostPartWithList {
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, possibleValues, possibleValues[0]);
if (choice.equals(0)) {
+ part.addToList(card);
AllZone.getGameAction().moveToHand(card);
stop();
+ part.addListToHash(sa, "Returned");
payment.paidCost(part);
} else {
stop();
diff --git a/src/main/java/forge/card/cost/CostReveal.java b/src/main/java/forge/card/cost/CostReveal.java
new file mode 100644
index 00000000000..746f933acea
--- /dev/null
+++ b/src/main/java/forge/card/cost/CostReveal.java
@@ -0,0 +1,215 @@
+package forge.card.cost;
+
+import forge.AllZone;
+import forge.AllZoneUtil;
+import forge.ButtonUtil;
+import forge.Card;
+import forge.CardList;
+import forge.Constant;
+import forge.Player;
+import forge.card.abilityFactory.AbilityFactory;
+import forge.card.spellability.SpellAbility;
+import forge.gui.GuiUtils;
+import forge.gui.input.Input;
+import forge.PlayerZone;
+
+public class CostReveal extends CostPartWithList {
+ //Reveal
+
+ public CostReveal(String amount, String type, String description){
+ super(amount, type, description);
+ }
+
+ @Override
+ public boolean canPay(SpellAbility ability, Card source, Player activator, Cost cost) {
+ CardList handList = AllZoneUtil.getPlayerHand(activator);
+ String type = getType();
+ Integer amount = convertAmount();
+
+ if (getThis()) {
+ if (!AllZone.getZone(source).is(Constant.Zone.Hand))
+ return false;
+ } else {
+ handList = handList.getValidCards(type.split(";"), activator, source);
+ if (amount != null && amount > handList.size()) {
+ // not enough cards in hand to pay
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean decideAIPayment(SpellAbility ability, Card source, Cost_Payment payment) {
+ String type = getType();
+ Player activator = ability.getActivatingPlayer();
+ CardList hand = AllZoneUtil.getPlayerHand(activator);
+ resetList();
+
+ if (getThis()){
+ if (!hand.contains(source))
+ return false;
+
+ list.add(source);
+ } else{
+ hand = hand.getValidCards(type.split(";"), activator, source);
+ Integer c = convertAmount();
+ if (c == null){
+ String sVar = source.getSVar(amount);
+ if (sVar.equals("XChoice")){
+ c = hand.size();
+ }
+ else{
+ c = AbilityFactory.calculateAmount(source, amount, ability);
+ }
+ }
+
+ list = AllZone.getGameAction().AI_discardNumType(c, type.split(";"), ability);
+ }
+ return list != null;
+ }
+
+ @Override
+ public void payAI(SpellAbility ability, Card source, Cost_Payment payment) {
+ GuiUtils.getChoiceOptional("Revealed cards:", list.toArray());
+ }
+
+ @Override
+ public boolean payHuman(SpellAbility ability, Card source, Cost_Payment payment) {
+ Player activator = ability.getActivatingPlayer();
+ String amount = getAmount();
+ resetList();
+
+ if (getThis()) {
+ addToList(source);
+ payment.setPaidManaPart(this, true);
+ } else {
+ Integer c = convertAmount();
+
+ CardList handList = AllZoneUtil.getPlayerHand(activator);
+ handList = handList.getValidCards(type.split(";"), activator, ability.getSourceCard());
+
+ if (c == null){
+ String sVar = source.getSVar(amount);
+ if (sVar.equals("XChoice")){
+ c = CostUtil.chooseXValue(source, handList.size());
+ }
+ else{
+ c = AbilityFactory.calculateAmount(source, amount, ability);
+ }
+ }
+
+ CostUtil.setInput(input_revealCost(type, handList, payment, this, ability, c));
+ return false;
+ }
+ addListToHash(ability, "Revealed");
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Reveal ");
+
+ Integer i = convertAmount();
+
+ if (getThis()) {
+ sb.append(type);
+ }
+ else {
+ StringBuilder desc = new StringBuilder();
+
+ if (type.equals("Card"))
+ desc.append("Card");
+ else
+ desc.append(typeDescription == null ? type : typeDescription).append(" card");
+
+ sb.append(Cost.convertAmountTypeToWords(i, amount, desc.toString()));
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public void refund(Card source) {
+
+ }
+
+ // Inputs
+
+ /**
+ * input_discardCost.
+ * @param discType a {@link java.lang.String} object.
+ * @param handList a {@link forge.CardList} object.
+ * @param payment a {@link forge.card.cost.Cost_Payment} object.
+ * @param part TODO
+ * @param sa TODO
+ * @param nNeeded a int.
+ * @return a {@link forge.gui.input.Input} object.
+ */
+ public static Input input_revealCost(final String discType, final CardList handList, final Cost_Payment payment, final CostReveal part, final SpellAbility sa, final int nNeeded) {
+ Input target = new Input() {
+ private static final long serialVersionUID = -329993322080934435L;
+
+ int nReveal = 0;
+
+ @Override
+ public void showMessage() {
+ if (AllZone.getHumanHand().size() < nNeeded) stop();
+ StringBuilder type = new StringBuilder("");
+ if (!discType.equals("Card")) {
+ type.append(" ").append(discType);
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append("Select a");
+ sb.append(part.getDescriptiveType());
+ sb.append(" to reveal.");
+ if (nNeeded > 1) {
+ sb.append(" You have ");
+ sb.append(nNeeded - nReveal);
+ sb.append(" remaining.");
+ }
+ AllZone.getDisplay().showMessage(sb.toString());
+ ButtonUtil.enableOnlyCancel();
+ }
+
+ @Override
+ public void selectButtonCancel() {
+ cancel();
+ }
+
+ @Override
+ public void selectCard(Card card, PlayerZone zone) {
+ if (zone.is(Constant.Zone.Hand) && handList.contains(card)) {
+ // send in CardList for Typing
+ handList.remove(card);
+ part.addToList(card);
+ nReveal++;
+
+ //in case no more cards in hand
+ if (nReveal == nNeeded)
+ done();
+ else if (AllZone.getHumanHand().size() == 0) // this really shouldn't happen
+ cancel();
+ else
+ showMessage();
+ }
+ }
+
+ public void cancel() {
+ stop();
+ payment.cancelCost();
+ }
+
+ public void done() {
+ stop();
+ // "Inform" AI of the revealed cards
+ part.addListToHash(sa, "Revealed");
+ payment.paidCost(part);
+ }
+ };
+
+ return target;
+ }//input_discard()
+
+}
diff --git a/src/main/java/forge/card/cost/CostSacrifice.java b/src/main/java/forge/card/cost/CostSacrifice.java
index c82d32a262c..58a0d07ae0c 100644
--- a/src/main/java/forge/card/cost/CostSacrifice.java
+++ b/src/main/java/forge/card/cost/CostSacrifice.java
@@ -17,9 +17,7 @@ import forge.gui.input.Input;
public class CostSacrifice extends CostPartWithList {
public CostSacrifice(String amount, String type, String description){
- this.amount = amount;
- this.type = type;
- this.typeDescription = description;
+ super(amount, type, description);
}
@Override
@@ -85,7 +83,9 @@ public class CostSacrifice extends CostPartWithList {
CostUtil.setInput(CostSacrifice.sacrificeThis(ability, payment, this));
}
else if (amount.equals("All")){
+ this.list = list;
CostSacrifice.sacrificeAll(ability, payment, this, list);
+ addListToHash(ability, "Sacrificed");
return true;
}
else{
@@ -193,7 +193,7 @@ public class CostSacrifice extends CostPartWithList {
public void selectCard(Card card, PlayerZone zone) {
if (typeList.contains(card)) {
nSacrifices++;
- payment.getAbility().addCostToHashList(card, "Sacrificed");
+ part.addToList(card);
AllZone.getGameAction().sacrifice(card);
typeList.remove(card);
//in case nothing else to sacrifice
@@ -208,11 +208,13 @@ public class CostSacrifice extends CostPartWithList {
public void done() {
stop();
+ part.addListToHash(sa, "Sacrificed");
payment.paidCost(part);
}
public void cancel() {
stop();
+
payment.cancelCost();
}
};
@@ -228,7 +230,7 @@ public class CostSacrifice extends CostPartWithList {
* @param part TODO
* @return a {@link forge.gui.input.Input} object.
*/
- public static Input sacrificeThis(final SpellAbility sa, final Cost_Payment payment, final CostPart part) {
+ public static Input sacrificeThis(final SpellAbility sa, final Cost_Payment payment, final CostSacrifice part) {
Input target = new Input() {
private static final long serialVersionUID = 2685832214519141903L;
@@ -244,7 +246,8 @@ public class CostSacrifice extends CostPartWithList {
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, possibleValues, possibleValues[0]);
if (choice.equals(0)) {
- payment.getAbility().addCostToHashList(card, "Sacrificed");
+ part.addToList(card);
+ part.addListToHash(sa, "Sacrificed");
AllZone.getGameAction().sacrifice(card);
stop();
payment.paidCost(part);
diff --git a/src/main/java/forge/card/cost/CostTapType.java b/src/main/java/forge/card/cost/CostTapType.java
index db9d0eaf012..7f6100304f2 100644
--- a/src/main/java/forge/card/cost/CostTapType.java
+++ b/src/main/java/forge/card/cost/CostTapType.java
@@ -15,11 +15,8 @@ import forge.gui.input.Input;
public class CostTapType extends CostPartWithList {
public CostTapType(String amount, String type, String description){
- list = new CardList();
+ super(amount, type, description);
isReusable = true;
- this.amount = amount;
- this.type = type;
- this.typeDescription = description;
}
public String getDescription(){
@@ -128,7 +125,7 @@ public class CostTapType extends CostPartWithList {
* @param payment a {@link forge.card.cost.Cost_Payment} object.
* @return a {@link forge.gui.input.Input} object.
*/
- public static Input input_tapXCost(final CostTapType tapType, final CardList cardList, SpellAbility sa, final Cost_Payment payment, final int nCards) {
+ public static Input input_tapXCost(final CostTapType tapType, final CardList cardList, final SpellAbility sa, final Cost_Payment payment, final int nCards) {
Input target = new Input() {
private static final long serialVersionUID = 6438988130447851042L;
@@ -155,7 +152,7 @@ public class CostTapType extends CostPartWithList {
card.tap();
tapType.addToList(card);
cardList.remove(card);
- payment.getAbility().addCostToHashList(card, "Tapped");
+
nTapped++;
if (nTapped == nCards)
@@ -175,6 +172,7 @@ public class CostTapType extends CostPartWithList {
public void done() {
stop();
payment.paidCost(tapType);
+ tapType.addListToHash(sa, "Tapped");
}
};