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:
@@ -1,7 +1,10 @@
|
|||||||
Name:Haunting Misery
|
Name:Haunting Misery
|
||||||
ManaCost:1 B B
|
ManaCost:1 B B
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
Text:As an additional cost, exile X creature cards from your graveyard. Haunting Misery deals X damage to target player.
|
Text:no text
|
||||||
|
A:SP$ DealDamage | Cost$ 1 B B ExileFromGrave<X/Creature> | Tgt$ TgtP | NumDmg$ ChosenX | SpellDescription$ CARDNAME deals X damage to target player.
|
||||||
|
SVar:X:XChoice
|
||||||
|
#ChosenX SVar created by Cost payment
|
||||||
SVar:RemAIDeck:True
|
SVar:RemAIDeck:True
|
||||||
SVar:Rarity:Common
|
SVar:Rarity:Common
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/haunting_misery.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/haunting_misery.jpg
|
||||||
|
|||||||
@@ -1782,7 +1782,7 @@ public class CardFactory_Sorceries {
|
|||||||
card.setSVar("PlayMain1", "TRUE");
|
card.setSVar("PlayMain1", "TRUE");
|
||||||
} //*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
/*
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if (cardName.equals("Haunting Misery")) {
|
else if (cardName.equals("Haunting Misery")) {
|
||||||
Cost cost = new Cost("1 B B", cardName, false);
|
Cost cost = new Cost("1 B B", cardName, false);
|
||||||
@@ -1835,7 +1835,7 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
*/
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if (cardName.equals("Brood Birthing")) {
|
else if (cardName.equals("Brood Birthing")) {
|
||||||
|
|||||||
@@ -101,10 +101,18 @@ public class CostExile extends CostPartWithList {
|
|||||||
c = AbilityFactory.calculateAmount(source, amount, ability);
|
c = AbilityFactory.calculateAmount(source, amount, ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getThis())
|
if (getThis()){
|
||||||
CostUtil.setInput(Cost_Input.exileThis(ability, payment, this));
|
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));
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,10 +124,22 @@ public class CostExile extends CostPartWithList {
|
|||||||
else{
|
else{
|
||||||
Integer c = convertAmount();
|
Integer c = convertAmount();
|
||||||
if (c == null){
|
if (c == null){
|
||||||
|
String sVar = source.getSVar(amount);
|
||||||
|
// Generalize this
|
||||||
|
if (sVar.equals("XChoice")){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
c = AbilityFactory.calculateAmount(source, amount, ability);
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package forge.card.cost;
|
package forge.card.cost;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
@@ -8,11 +10,13 @@ import forge.ButtonUtil;
|
|||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
|
import forge.GameActionUtil;
|
||||||
import forge.Phase;
|
import forge.Phase;
|
||||||
import forge.Player;
|
import forge.Player;
|
||||||
import forge.PlayerZone;
|
import forge.PlayerZone;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
|
import forge.gui.GuiUtils;
|
||||||
import forge.gui.input.Input;
|
import forge.gui.input.Input;
|
||||||
import forge.gui.input.Input_PayManaCostUtil;
|
import forge.gui.input.Input_PayManaCostUtil;
|
||||||
|
|
||||||
@@ -508,6 +512,80 @@ public class Cost_Input {
|
|||||||
return target;
|
return target;
|
||||||
}//exileType()
|
}//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>
|
* <p>input_tapXCost.</p>
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ public class SpellAbility_Requirements {
|
|||||||
if (select != null)
|
if (select != null)
|
||||||
select.resetTargets();
|
select.resetTargets();
|
||||||
|
|
||||||
|
ability.resetOnceResolved();
|
||||||
payment.cancelPayment();
|
payment.cancelPayment();
|
||||||
AllZone.getStack().clearFrozen();
|
AllZone.getStack().clearFrozen();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user