mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- Fixed possible NPE's in findParentsTargetedCard.
- Converted Insurrection to script.
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
Name:Insurrection
|
Name:Insurrection
|
||||||
ManaCost:5 R R R
|
ManaCost:5 R R R
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
Text:Untap all creatures and gain control of them until end of turn. They gain haste until end of turn.
|
Text:no text
|
||||||
SVar:PlayMain1:TRUE
|
A:SP$ UntapAll | Cost$ 5 R R R | ValidCards$ Creature | SubAbility$ DBGainControl | SpellDescription$ Untap all creatures and gain control of them until end of turn. They gain haste until end of turn.
|
||||||
|
SVar:DBGainControl:DB$ GainControl | AllValid$ Creature | NewController$ You | AddKWs$ Haste | LoseControl$ EOT
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/insurrection.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/insurrection.jpg
|
||||||
SetInfo:ONS|Rare|http://magiccards.info/scans/en/on/213.jpg
|
SetInfo:ONS|Rare|http://magiccards.info/scans/en/on/213.jpg
|
||||||
|
|||||||
@@ -1788,7 +1788,7 @@ public class AbilityFactory {
|
|||||||
else if (defined.equals("Targeted")) {
|
else if (defined.equals("Targeted")) {
|
||||||
final SpellAbility parent = AbilityFactory.findParentsTargetedCard(sa);
|
final SpellAbility parent = AbilityFactory.findParentsTargetedCard(sa);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
if (parent.getTarget() != null) {
|
if (parent.getTarget() != null && parent.getTarget().getTargetCards() != null) {
|
||||||
cards.addAll(parent.getTarget().getTargetCards());
|
cards.addAll(parent.getTarget().getTargetCards());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2194,11 +2194,13 @@ public class AbilityFactory {
|
|||||||
SpellAbility parent = sa;
|
SpellAbility parent = sa;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!(parent instanceof AbilitySub)) {
|
if (!(parent instanceof AbilitySub) || ((AbilitySub) parent).getParent() == null) {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
parent = ((AbilitySub) parent).getParent();
|
parent = ((AbilitySub) parent).getParent();
|
||||||
} while ((parent.getTarget() == null) || (parent.getTarget().getTargetCards().size() == 0));
|
} while (parent.getTarget() == null
|
||||||
|
|| parent.getTarget().getTargetCards() == null
|
||||||
|
|| parent.getTarget().getTargetCards().size() == 0);
|
||||||
|
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -950,10 +950,9 @@ public final class AbilityFactoryCombat {
|
|||||||
|
|
||||||
boolean chance = false;
|
boolean chance = false;
|
||||||
|
|
||||||
CardList list = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield).getType("Creature");
|
|
||||||
list = list.getTargetableCards(sa);
|
|
||||||
|
|
||||||
if (abTgt != null) {
|
if (abTgt != null) {
|
||||||
|
CardList list = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield).getType("Creature");
|
||||||
|
list = list.getTargetableCards(sa);
|
||||||
list = list.getValidCards(abTgt.getValidTgts(), source.getController(), source);
|
list = list.getValidCards(abTgt.getValidTgts(), source.getController(), source);
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -970,15 +969,15 @@ public final class AbilityFactoryCombat {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
final Card blocker = CardFactoryUtil.getBestCreatureAI(list);
|
return false;
|
||||||
if (blocker == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
abTgt.addTarget(CardFactoryUtil.getBestCreatureAI(list));
|
|
||||||
chance = true; // TODO change this to true, once the human input
|
|
||||||
// takes mustblocks into account
|
|
||||||
}
|
}
|
||||||
|
final Card blocker = CardFactoryUtil.getBestCreatureAI(list);
|
||||||
|
if (blocker == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
abTgt.addTarget(blocker);
|
||||||
|
chance = true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -521,7 +521,18 @@ public class AbilityFactoryGainControl {
|
|||||||
*/
|
*/
|
||||||
private boolean gainControlDrawbackAI(final SpellAbility sa) {
|
private boolean gainControlDrawbackAI(final SpellAbility sa) {
|
||||||
if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) {
|
if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) {
|
||||||
// all is good
|
if (this.params.containsKey("AllValid")) {
|
||||||
|
CardList tgtCards = AllZoneUtil.getCardsIn(Constant.Zone.Battlefield)
|
||||||
|
.getController(AllZone.getHumanPlayer());
|
||||||
|
tgtCards = AbilityFactory.filterListByType(tgtCards, this.params.get("AllValid"), sa);
|
||||||
|
if (tgtCards.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((this.lose != null) && this.lose.contains("EOT")
|
||||||
|
&& AllZone.getPhaseHandler().isAfter(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return this.gainControlTgtAI(sa);
|
return this.gainControlTgtAI(sa);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public class AbilityFactoryPermanentState {
|
|||||||
sb.append("up to ").append(params.get("Amount")).append(" ");
|
sb.append("up to ").append(params.get("Amount")).append(" ");
|
||||||
sb.append(params.get("UntapType")).append("s");
|
sb.append(params.get("UntapType")).append("s");
|
||||||
} else {
|
} else {
|
||||||
ArrayList<Card> tgtCards;
|
ArrayList<Card> tgtCards = new ArrayList<Card>();
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
tgtCards = tgt.getTargetCards();
|
tgtCards = tgt.getTargetCards();
|
||||||
@@ -1325,9 +1325,11 @@ public class AbilityFactoryPermanentState {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
private static boolean untapAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
|
private static boolean untapAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
|
||||||
/*
|
// check SubAbilities DoTrigger?
|
||||||
* All cards using this currently have SVar:RemAIDeck:True
|
final AbilitySub abSub = sa.getSubAbility();
|
||||||
*/
|
if (abSub != null && abSub.chkAIDrawback()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,12 +176,12 @@ public class CardFactorySorceries {
|
|||||||
} // *************** END ************ END **************************
|
} // *************** END ************ END **************************
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Insurrection")) {
|
/*else if (cardName.equals("Insurrection")) {
|
||||||
/*
|
/*
|
||||||
* Untap all creatures and gain control of them until end of turn.
|
* Untap all creatures and gain control of them until end of turn.
|
||||||
* They gain haste until end of turn.
|
* They gain haste until end of turn.
|
||||||
*/
|
*/
|
||||||
final ArrayList<PlayerZone> orig = new ArrayList<PlayerZone>();
|
/*final ArrayList<PlayerZone> orig = new ArrayList<PlayerZone>();
|
||||||
final PlayerZone[] newZone = new PlayerZone[1];
|
final PlayerZone[] newZone = new PlayerZone[1];
|
||||||
final ArrayList<Player> controllerEOT = new ArrayList<Player>();
|
final ArrayList<Player> controllerEOT = new ArrayList<Player>();
|
||||||
final ArrayList<Card> targets = new ArrayList<Card>();
|
final ArrayList<Card> targets = new ArrayList<Card>();
|
||||||
@@ -245,7 +245,7 @@ public class CardFactorySorceries {
|
|||||||
}; // SpellAbility
|
}; // SpellAbility
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
card.setSVar("PlayMain1", "TRUE");
|
card.setSVar("PlayMain1", "TRUE");
|
||||||
} // *************** END ************ END **************************
|
}*/ // *************** END ************ END **************************
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Brilliant Ultimatum")) {
|
else if (cardName.equals("Brilliant Ultimatum")) {
|
||||||
@@ -1136,56 +1136,6 @@ public class CardFactorySorceries {
|
|||||||
spell.setBeforePayMana(input);
|
spell.setBeforePayMana(input);
|
||||||
} // *************** END ************ END **************************
|
} // *************** END ************ END **************************
|
||||||
|
|
||||||
/*************** START *********** START **************************
|
|
||||||
else if (cardName.equals("Recall")) {
|
|
||||||
/*
|
|
||||||
* Discard X cards, then return a card from your graveyard to your
|
|
||||||
* hand for each card discarded this way. Exile Recall.
|
|
||||||
*
|
|
||||||
final Cost cost = new Cost(card.getManaCost(), cardName, false);
|
|
||||||
final SpellAbility spell = new Spell(card, cost, null) {
|
|
||||||
private static final long serialVersionUID = -3935814273439962834L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
// for compy to play this wisely, it should check hand, and if there
|
|
||||||
// are no spells that canPlayAI(), then use recall. maybe.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
int numCards = card.getXManaCostPaid();
|
|
||||||
final Player player = card.getController();
|
|
||||||
final int maxCards = player.getCardsIn(Zone.Hand).size();
|
|
||||||
if (numCards != 0) {
|
|
||||||
numCards = Math.min(numCards, maxCards);
|
|
||||||
if (player.isHuman()) {
|
|
||||||
AllZone.getInputControl()
|
|
||||||
.setInput(CardFactoryUtil.inputDiscardRecall(numCards, card, this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* else { //computer
|
|
||||||
* card.getControler().discardRandom(numCards);
|
|
||||||
* Singletons.getModel().getGameAction().exile(card); CardList grave =
|
|
||||||
* AllZoneUtil.getPlayerGraveyard(card.getController());
|
|
||||||
* for(int i = 1; i <= numCards; i ++) { Card t1 =
|
|
||||||
* CardFactoryUtil.AI_getBestCreature(grave); if(null != t1)
|
|
||||||
* { t1 = grave.get(0); grave.remove(t1);
|
|
||||||
* Singletons.getModel().getGameAction().moveToHand(t1); } } }
|
|
||||||
*
|
|
||||||
} // resolve()
|
|
||||||
}; // SpellAbility
|
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(card).append(" - discard X cards and return X cards to your hand.");
|
|
||||||
spell.setStackDescription(sb.toString());
|
|
||||||
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
} // *************** END ************ END **************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Windfall")) {
|
else if (cardName.equals("Windfall")) {
|
||||||
final SpellAbility spell = new Spell(card) {
|
final SpellAbility spell = new Spell(card) {
|
||||||
|
|||||||
Reference in New Issue
Block a user