mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Fixed Incendiary Command from crashing when the controller chooses the two choices with targets
This commit is contained in:
@@ -32,6 +32,7 @@ public class Card extends MyObservable {
|
|||||||
private ArrayList<String> type = new ArrayList<String>();
|
private ArrayList<String> type = new ArrayList<String>();
|
||||||
private ArrayList<String> prevType = new ArrayList<String>();
|
private ArrayList<String> prevType = new ArrayList<String>();
|
||||||
private ArrayList<String> ChoicesMade = new ArrayList<String>();
|
private ArrayList<String> ChoicesMade = new ArrayList<String>();
|
||||||
|
private ArrayList<String> Targets_for_Choices = new ArrayList<String>();
|
||||||
private ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
private ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
||||||
private ArrayList<Ability_Mana> manaAbility = new ArrayList<Ability_Mana>();
|
private ArrayList<Ability_Mana> manaAbility = new ArrayList<Ability_Mana>();
|
||||||
|
|
||||||
@@ -731,6 +732,19 @@ public class Card extends MyObservable {
|
|||||||
public String getChoice(int i) {
|
public String getChoice(int i) {
|
||||||
return ChoicesMade.get(i);
|
return ChoicesMade.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSpellChoiceTarget(String string)
|
||||||
|
{
|
||||||
|
Targets_for_Choices.add(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getChoiceTargets() {
|
||||||
|
return Targets_for_Choices;
|
||||||
|
}
|
||||||
|
public String getChoiceTarget(int i) {
|
||||||
|
return Targets_for_Choices.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
public void setSpellWithChoices(boolean b)
|
public void setSpellWithChoices(boolean b)
|
||||||
{
|
{
|
||||||
SpellwithChoices = b;
|
SpellwithChoices = b;
|
||||||
|
|||||||
@@ -183,6 +183,9 @@ public class CardFactory implements NewConstants {
|
|||||||
for(int i = 0; i < in.getChoices().size(); i++) {
|
for(int i = 0; i < in.getChoices().size(); i++) {
|
||||||
c.addSpellChoice(in.getChoice(i));
|
c.addSpellChoice(in.getChoice(i));
|
||||||
}
|
}
|
||||||
|
for(int i = 0; i < in.getChoiceTargets().size(); i++) {
|
||||||
|
c.setSpellChoiceTarget(in.getChoiceTarget(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i = 0; i < sa.length; i++) {
|
for(int i = 0; i < sa.length; i++) {
|
||||||
@@ -10466,8 +10469,12 @@ public class CardFactory implements NewConstants {
|
|||||||
// System.out.println(m_land[0]);
|
// System.out.println(m_land[0]);
|
||||||
// System.out.println(m_player[0]);
|
// System.out.println(m_player[0]);
|
||||||
//"Incendiary Command deals 4 damage to target player",
|
//"Incendiary Command deals 4 damage to target player",
|
||||||
if(userChoice.contains(cardChoice[0]) || card.getChoices().contains(cardChoice[0]))
|
for(int i = 0; i <card.getChoices().size(); i++) {
|
||||||
|
if(card.getChoice(i).equals(cardChoice[0])) {
|
||||||
|
setTargetPlayer(card.getChoiceTarget(0));
|
||||||
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(4);
|
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//"Incendiary Command deals 2 damage to each creature",
|
//"Incendiary Command deals 2 damage to each creature",
|
||||||
if(userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) {
|
if(userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) {
|
||||||
@@ -10484,7 +10491,21 @@ public class CardFactory implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//"Destroy target nonbasic land",
|
//"Destroy target nonbasic land",
|
||||||
if(userChoice.contains(cardChoice[2]) || card.getChoices().contains(cardChoice[2])) AllZone.GameAction.destroy(getTargetCard());
|
for(int i = 0; i <card.getChoices().size(); i++) {
|
||||||
|
if(card.getChoice(i).equals(cardChoice[2])) {
|
||||||
|
PlayerZone Hplay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
|
||||||
|
PlayerZone Cplay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
|
||||||
|
// CardList all = AllZone.CardFactory.getAllCards();
|
||||||
|
CardList all = new CardList(Hplay.getCards());
|
||||||
|
all.add(new CardList(Cplay.getCards()));
|
||||||
|
for(int i2 = 0; i2 < all.size(); i2++) {
|
||||||
|
if(String.valueOf(all.get(i2).getUniqueNumber()).equals(card.getChoiceTarget(card.getChoices().size() - 1))) {
|
||||||
|
setTargetCard(all.get(i2));
|
||||||
|
AllZone.GameAction.destroy(getTargetCard());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//"Each player discards all cards in his or her hand, then draws that many cards"
|
//"Each player discards all cards in his or her hand, then draws that many cards"
|
||||||
if(userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3])) {
|
if(userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3])) {
|
||||||
@@ -10550,8 +10571,10 @@ public class CardFactory implements NewConstants {
|
|||||||
@Override
|
@Override
|
||||||
public void selectCard(Card c, PlayerZone zone) {
|
public void selectCard(Card c, PlayerZone zone) {
|
||||||
if(c.isLand() && zone.is(Constant.Zone.Play) && !c.getType().contains("Basic")) {
|
if(c.isLand() && zone.is(Constant.Zone.Play) && !c.getType().contains("Basic")) {
|
||||||
|
if(card.isCopiedSpell()) card.getChoiceTargets().remove(0);
|
||||||
m_land[0] = c;
|
m_land[0] = c;
|
||||||
spell.setTargetCard(c);
|
spell.setTargetCard(c);
|
||||||
|
card.setSpellChoiceTarget(String.valueOf(c.getUniqueNumber()));
|
||||||
setStackDescription.execute();
|
setStackDescription.execute();
|
||||||
stopSetNext(new Input_PayManaCost(spell));
|
stopSetNext(new Input_PayManaCost(spell));
|
||||||
}//if
|
}//if
|
||||||
@@ -10574,8 +10597,10 @@ public class CardFactory implements NewConstants {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectPlayer(String player) {
|
public void selectPlayer(String player) {
|
||||||
|
if(card.isCopiedSpell()) card.getChoiceTargets().remove(0);
|
||||||
m_player[0] = player;
|
m_player[0] = player;
|
||||||
spell.setTargetPlayer(player);
|
spell.setTargetPlayer(player);
|
||||||
|
card.setSpellChoiceTarget(player);
|
||||||
setStackDescription.execute();
|
setStackDescription.execute();
|
||||||
//if user needs to target nonbasic land
|
//if user needs to target nonbasic land
|
||||||
if(userChoice.contains(cardChoice[2]) || card.getChoices().contains(cardChoice[2])) stopSetNext(targetLand);
|
if(userChoice.contains(cardChoice[2]) || card.getChoices().contains(cardChoice[2])) stopSetNext(targetLand);
|
||||||
@@ -10604,7 +10629,8 @@ public class CardFactory implements NewConstants {
|
|||||||
//reset variables
|
//reset variables
|
||||||
m_player[0] = null;
|
m_player[0] = null;
|
||||||
m_land[0] = null;
|
m_land[0] = null;
|
||||||
|
card.getChoices().clear();
|
||||||
|
card.getChoiceTargets().clear();
|
||||||
userChoice.clear();
|
userChoice.clear();
|
||||||
|
|
||||||
ArrayList<String> display = new ArrayList<String>();
|
ArrayList<String> display = new ArrayList<String>();
|
||||||
|
|||||||
Reference in New Issue
Block a user