mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Add Missing Exile Inputs and support for XChoice
Convert Haunting Misery to Script
This commit is contained in:
@@ -1782,7 +1782,7 @@ public class CardFactory_Sorceries {
|
||||
card.setSVar("PlayMain1", "TRUE");
|
||||
} //*************** END ************ END **************************
|
||||
|
||||
|
||||
/*
|
||||
//*************** START *********** START **************************
|
||||
else if (cardName.equals("Haunting Misery")) {
|
||||
Cost cost = new Cost("1 B B", cardName, false);
|
||||
@@ -1835,7 +1835,7 @@ public class CardFactory_Sorceries {
|
||||
|
||||
card.addSpellAbility(spell);
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
*/
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if (cardName.equals("Brood Birthing")) {
|
||||
|
||||
@@ -101,10 +101,18 @@ public class CostExile extends CostPartWithList {
|
||||
c = AbilityFactory.calculateAmount(source, amount, ability);
|
||||
}
|
||||
}
|
||||
if (getThis())
|
||||
if (getThis()){
|
||||
CostUtil.setInput(Cost_Input.exileThis(ability, payment, this));
|
||||
else
|
||||
}
|
||||
else if (from.equals(Constant.Zone.Battlefield) || from.equals(Constant.Zone.Hand)){
|
||||
CostUtil.setInput(Cost_Input.exileType(ability, this, getType(), payment, c));
|
||||
}
|
||||
else if (from.equals(Constant.Zone.Library)){
|
||||
Cost_Input.exileFromTop(ability, this, payment, c);
|
||||
}
|
||||
else{
|
||||
CostUtil.setInput(Cost_Input.exileFrom(ability, this, getType(), payment, c));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,10 +124,22 @@ public class CostExile extends CostPartWithList {
|
||||
else{
|
||||
Integer c = convertAmount();
|
||||
if (c == null){
|
||||
String sVar = source.getSVar(amount);
|
||||
// Generalize this
|
||||
if (sVar.equals("XChoice")){
|
||||
return false;
|
||||
}
|
||||
|
||||
c = AbilityFactory.calculateAmount(source, amount, ability);
|
||||
}
|
||||
list = ComputerUtil.chooseExileFrom(getFrom(), getType(), source, ability.getTargetCard(), c);
|
||||
if (list == null)
|
||||
|
||||
if (from.equals(Constant.Zone.Library)){
|
||||
list = AllZoneUtil.getPlayerCardsInLibrary(AllZone.getComputerPlayer(), c);
|
||||
}
|
||||
else{
|
||||
list = ComputerUtil.chooseExileFrom(getFrom(), getType(), source, ability.getTargetCard(), c);
|
||||
}
|
||||
if (list == null || list.size() < c)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import forge.AllZone;
|
||||
@@ -8,11 +10,13 @@ import forge.ButtonUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
import forge.Constant;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Phase;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.input.Input;
|
||||
import forge.gui.input.Input_PayManaCostUtil;
|
||||
|
||||
@@ -508,6 +512,80 @@ public class Cost_Input {
|
||||
return target;
|
||||
}//exileType()
|
||||
|
||||
public static Input exileFrom(final SpellAbility sa, final CostExile part, final String type, final Cost_Payment payment, final int nNeeded) {
|
||||
Input target = new Input() {
|
||||
private static final long serialVersionUID = 734256837615635021L;
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
CardList typeList = AllZoneUtil.getCardsInZone(part.getFrom(), sa.getActivatingPlayer());
|
||||
typeList = typeList.getValidCards(type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
for (int i = 0; i < nNeeded; i++) {
|
||||
if (typeList.size() == 0)
|
||||
cancel();
|
||||
|
||||
Object o = GuiUtils.getChoiceOptional("Exile from "+part.getFrom(), typeList.toArray());
|
||||
|
||||
if (o != null) {
|
||||
Card c = (Card) o;
|
||||
typeList.remove(c);
|
||||
payment.getAbility().addCostToHashList(c, "Exiled");
|
||||
AllZone.getGameAction().exile(c);
|
||||
if (i == nNeeded - 1) done();
|
||||
}
|
||||
else{
|
||||
cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectButtonCancel() {
|
||||
cancel();
|
||||
}
|
||||
|
||||
public void done() {
|
||||
stop();
|
||||
payment.paidCost(part);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
stop();
|
||||
payment.cancelCost();
|
||||
}
|
||||
};
|
||||
return target;
|
||||
}//exileFrom()
|
||||
|
||||
|
||||
public static void exileFromTop(final SpellAbility sa, final CostExile part, final Cost_Payment payment, final int nNeeded){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Exile ").append(nNeeded).append(" cards from the top of your library?");
|
||||
CardList list = AllZoneUtil.getPlayerCardsInLibrary(sa.getActivatingPlayer(), nNeeded);
|
||||
|
||||
if (list.size() > nNeeded){
|
||||
// I don't believe this is possible
|
||||
payment.cancelCost();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean doExile = GameActionUtil.showYesNoDialog(sa.getSourceCard(), sb.toString());
|
||||
if (doExile){
|
||||
Iterator<Card> itr = list.iterator();
|
||||
while(itr.hasNext()){
|
||||
Card c = (Card)itr.next();
|
||||
payment.getAbility().addCostToHashList(c, "Exiled");
|
||||
AllZone.getGameAction().exile(c);
|
||||
}
|
||||
payment.paidCost(part);
|
||||
}
|
||||
else{
|
||||
payment.cancelCost();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>input_tapXCost.</p>
|
||||
*
|
||||
|
||||
@@ -150,6 +150,7 @@ public class SpellAbility_Requirements {
|
||||
if (select != null)
|
||||
select.resetTargets();
|
||||
|
||||
ability.resetOnceResolved();
|
||||
payment.cancelPayment();
|
||||
AllZone.getStack().clearFrozen();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user