Added a CopySpellOntoStack Function and modified the PayManaCost code a little bit (to prevent selected targets from storm spells not showing up on the stack). Made Storm Arbitary

This commit is contained in:
jendave
2011-08-06 05:01:39 +00:00
parent 6b5abdc751
commit 9224760313
3 changed files with 74 additions and 101 deletions

View File

@@ -170,6 +170,38 @@ public class CardFactory implements NewConstants {
}
final void copySpellontoStack(Card Source, Card in, boolean CopyDetails) {
Card c = AllZone.CardFactory.copyCardintoNew(in);
SpellAbility[] sa = c.getSpellAbility();
c.setController(Source.getController());
if(CopyDetails == true) {
c.addXManaCostPaid(in.getXManaCostPaid());
c.addMultiKickerMagnitude(in.getMultiKickerMagnitude());
if(in.isKicked()) c.setKicked(true);
if(c.hasChoices()) {
for(int i = 0; i < in.getChoices().size(); i++) {
c.addSpellChoice(in.getChoice(i));
}
}
}
for(int i = 0; i < sa.length; i++) {
if(in.getAbilityUsed() == i) {
if(c.isKicked() && !sa[i].isKickerAbility()) {
} else {
if(in.getSpellAbility()[i].getTargetCard() != null)
sa[i].setTargetCard(in.getSpellAbility()[i].getTargetCard());
if(in.getSpellAbility()[i].getTargetPlayer() != null) {
if(in.getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Human)
|| (in.getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Computer)))
sa[i].setTargetPlayer(in.getSpellAbility()[i].getTargetPlayer());
}
AllZone.GameAction.playSpellAbility(sa[i]);
}
}
}
}
/*
final public Card getCard(String cardName, String owner) {
cardName = AllZone.NameChanger.getOriginalName(cardName);
@@ -7787,36 +7819,7 @@ public class CardFactory implements NewConstants {
@Override
public void resolve() {
Card c = copyCardintoNew(getTargetCard());
SpellAbility[] sa = c.getSpellAbility();
c.setController(card.getController());
c.addXManaCostPaid(getTargetCard().getXManaCostPaid());
c.addMultiKickerMagnitude(getTargetCard().getMultiKickerMagnitude());
if(getTargetCard().isKicked()) c.setKicked(true);
c.setCopiedSpell(true);
if(c.hasChoices()) {
for(int i = 0; i < getTargetCard().getChoices().size(); i++) {
c.addSpellChoice(getTargetCard().getChoice(i));
}
}
for(int i = 0; i < sa.length; i++) {
if(getTargetCard().getAbilityUsed() == i) {
if(c.isKicked() && !sa[i].isKickerAbility()) {
} else {
if(getTargetCard().getSpellAbility()[i].getTargetCard() != null)
sa[i].setTargetCard(getTargetCard().getSpellAbility()[i].getTargetCard());
if(getTargetCard().getSpellAbility()[i].getTargetPlayer() != null) {
if(getTargetCard().getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Human)
|| (getTargetCard().getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Computer)))
sa[i].setTargetPlayer(getTargetCard().getSpellAbility()[i].getTargetPlayer());
}
//TODO Selecting New Targets. Then Apply to storm.
AllZone.GameAction.playSpellAbility(sa[i]);
}
}
}
copySpellontoStack(card,getTargetCard(), true);
}
public boolean canPlay()
@@ -7839,35 +7842,7 @@ public class CardFactory implements NewConstants {
private static final long serialVersionUID = -131686114078716307L;
@Override
public void resolve() {
Card c = copyCardintoNew(getTargetCard());
SpellAbility[] sa = c.getSpellAbility();
c.setController(card.getController());
c.addXManaCostPaid(getTargetCard().getXManaCostPaid());
c.addMultiKickerMagnitude(getTargetCard().getMultiKickerMagnitude());
if(getTargetCard().isKicked()) c.setKicked(true);
c.setCopiedSpell(true);
if(c.hasChoices()) {
for(int i = 0; i < getTargetCard().getChoices().size(); i++) {
c.addSpellChoice(getTargetCard().getChoice(i));
}
}
for(int i = 0; i < sa.length; i++) {
if(getTargetCard().getAbilityUsed() == i) {
if(c.isKicked() && !sa[i].isKickerAbility()) {
} else {
if(getTargetCard().getSpellAbility()[i].getTargetCard() != null)
sa[i].setTargetCard(getTargetCard().getSpellAbility()[i].getTargetCard());
if(getTargetCard().getSpellAbility()[i].getTargetPlayer() != null) {
if(getTargetCard().getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Human)
|| (getTargetCard().getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Computer)))
sa[i].setTargetPlayer(getTargetCard().getSpellAbility()[i].getTargetPlayer());
}
//TODO Selecting New Targets. Then Apply to storm.
AllZone.GameAction.playSpellAbility(sa[i]);
}
}
}
copySpellontoStack(card,getTargetCard(), true);
done();
}//resolve()
@@ -7964,36 +7939,7 @@ public class CardFactory implements NewConstants {
@Override
public void resolve() {
Card c = copyCardintoNew(getTargetCard());
SpellAbility[] sa = c.getSpellAbility();
c.setController(card.getController());
c.addXManaCostPaid(getTargetCard().getXManaCostPaid());
c.addMultiKickerMagnitude(getTargetCard().getMultiKickerMagnitude());
if(getTargetCard().isKicked()) c.setKicked(true);
c.setCopiedSpell(true);
if(c.hasChoices()) {
for(int i = 0; i < getTargetCard().getChoices().size(); i++) {
c.addSpellChoice(getTargetCard().getChoice(i));
}
}
for(int i = 0; i < sa.length; i++) {
if(getTargetCard().getAbilityUsed() == i) {
if(c.isKicked() && !sa[i].isKickerAbility()) {
} else {
if(getTargetCard().getSpellAbility()[i].getTargetCard() != null)
sa[i].setTargetCard(getTargetCard().getSpellAbility()[i].getTargetCard());
if(getTargetCard().getSpellAbility()[i].getTargetPlayer() != null) {
if(getTargetCard().getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Human)
|| (getTargetCard().getSpellAbility()[i].getTargetPlayer().equals(Constant.Player.Computer)))
sa[i].setTargetPlayer(getTargetCard().getSpellAbility()[i].getTargetPlayer());
}
//TODO Selecting New Targets. Then Apply to storm.
AllZone.GameAction.playSpellAbility(sa[i]);
}
}
}
copySpellontoStack(card,getTargetCard(), true);
}
public boolean canPlay()
@@ -8467,23 +8413,23 @@ public class CardFactory implements NewConstants {
public void execute() {
String player = AllZone.Phase.getActivePlayer();
PlayerZone Play = AllZone.getZone(Constant.Zone.Play, player);
Card Minds_D = card;
if(player == "Human") AllZone.GameAction.shuffle(card.getController());
CardList MindsList = new CardList(Play.getCards());
MindsList = MindsList.getName("Mind's Desire");
MindsList.remove(card);
if(MindsList.contains(card) == true) {
if(MindsList.size() > 0) {
Play.remove(card);
Minds_D = MindsList.get(0);
} else JOptionPane.showMessageDialog(null, "Click Mind's Desire to see the available cards to play without paying its mana cost.", "", JOptionPane.INFORMATION_MESSAGE);
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
CardList libList = new CardList(lib.getCards());
Card c = null;
if(libList.size() > 0) {
c = libList.get(0);
}
if(c != null) {
PlayerZone RFG = AllZone.getZone(Constant.Zone.Removed_From_Play, player);
AllZone.GameAction.moveTo(RFG, c);
card.attachCard(c);
Minds_D.attachCard(c);
}
final Card Minds = card;
// AllZone.GameAction.exile(Minds);

View File

@@ -642,6 +642,24 @@ public class GameActionUtil {
Ripple.execute();
}
public static void playCard_Storm(Card c) {
if(c.getKeyword().contains("Storm") && !c.isCopiedSpell())
{
final Card StormCard = c;
StormCard.removeIntrinsicKeyword("Storm");
final int StormNumber = Phase.StormCount - 1;
final Ability Storm = new Ability(c, "0") {
public void resolve() {
for(int i = 0; i < (StormNumber); i++) {
AllZone.CardFactory.copySpellontoStack(StormCard,StormCard,true);
}; // For
}
};
Storm.setStackDescription(c + " - Storm.");
AllZone.Stack.add(Storm);
}
}
/**
public static void playCard_Storm(Card c) {
if(c.getKeyword().contains("Storm"))
{
@@ -1035,7 +1053,7 @@ public class GameActionUtil {
AllZone.Stack.add(Storm);
}
}
**/
public static void playCard_Vengevine(Card c) {
if (c.isCreature() == true && (Phase.PlayerCreatureSpellCount == 2 || Phase.ComputerCreatureSpellCount == 2))
{

View File

@@ -19,15 +19,18 @@ public class Input_PayManaCost extends Input {
private final SpellAbility spell;
public Input_PayManaCost(SpellAbility sa) {
originalManaCost = sa.getManaCost();
originalManaCost = sa.getManaCost(); // Change
originalCard = sa.getSourceCard();
spell = sa;
manaCost = new ManaCost(sa.getManaCost());
if(Phase.GameBegins == 1) {
if(sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
if(spell.getAfterPayMana() != null) stopSetNext(spell.getAfterPayMana());
else {
manaCost = new ManaCost("0");
AllZone.Stack.add(spell);
}
} else {
manaCost = AllZone.GameAction.GetSpellCostChange(sa);
}
@@ -57,6 +60,11 @@ public class Input_PayManaCost extends Input {
}
private void done() {
if(spell.getSourceCard().isCopiedSpell()) {
if(spell.getAfterPayMana() != null) {
stopSetNext(spell.getAfterPayMana());
} else stopSetNext(new ComputerAI_StackNotEmpty());
} else {
AllZone.ManaPool.paid();
resetManaCost();
@@ -74,6 +82,7 @@ public class Input_PayManaCost extends Input {
stopSetNext(new ComputerAI_StackNotEmpty());
}
}
}
@Override
public void selectButtonCancel() {