Card Development Questions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Development Questions
by SoulStorm » 18 Jan 2012, 15:29
Reality Acid spits out an error if it leaves the battlefield due to the target it was enchanting being removed from the battlefield. In this specific case, the AI sacrificed the enchanted permanent (using Barter in Blood) while reality Acid was still on the battlefield.
- | Open
- Reality Acid - activatingPlayer not set before adding to stack.
java.lang.NullPointerException
at forge.card.abilityfactory.AbilityFactory.getDefinedPlayers(AbilityFactory.java:1912)
at forge.card.abilityfactory.AbilityFactorySacrifice.sacrificeResolve(AbilityFactorySacrifice.java:435)
at forge.card.abilityfactory.AbilityFactorySacrifice$1.resolve(AbilityFactorySacrifice.java:76)
at forge.card.abilityfactory.AbilityFactory.resolve(AbilityFactory.java:2483)
at forge.card.spellability.SpellAbilityRequirements.finishPaying(SpellAbilityRequirements.java:186)
at forge.card.cost.CostPayment.payCost(CostPayment.java:233)
at forge.card.spellability.SpellAbilityRequirements.startPaying(SpellAbilityRequirements.java:175)
at forge.card.spellability.SpellAbilityRequirements.needPayment(SpellAbilityRequirements.java:162)
at forge.card.spellability.SpellAbilityRequirements.fillRequirements(SpellAbilityRequirements.java:129)
at forge.GameAction.playSpellAbilityNoStack(GameAction.java:2822)
at forge.card.trigger.TriggerHandler$2.resolve(TriggerHandler.java:1028)
at forge.card.abilityfactory.AbilityFactory.resolve(AbilityFactory.java:2483)
at forge.MagicStack.resolveStack(MagicStack.java:908)
at forge.PhaseHandler.passPriority(PhaseHandler.java:846)
at forge.ComputerAIGeneral.stackResponse(ComputerAIGeneral.java:585)
at forge.ComputerAIGeneral.stackNotEmpty(ComputerAIGeneral.java:527)
at forge.ComputerAIInput.think(ComputerAIInput.java:95)
at forge.ComputerAIInput.showMessage(ComputerAIInput.java:71)
at forge.GuiInput.setInput(GuiInput.java:68)
at forge.GuiInput.update(GuiInput.java:54)
at java.util.Observable.notifyObservers(Unknown Source)
at java.util.Observable.notifyObservers(Unknown Source)
at forge.MyObservable.updateObservers(MyObservable.java:38)
at forge.gui.input.InputControl.resetInput(InputControl.java:144)
at forge.PhaseHandler.passPriority(PhaseHandler.java:835)
at forge.gui.input.InputPassPriority.selectButtonOK(InputPassPriority.java:72)
at forge.GuiInput.selectButtonOK(GuiInput.java:86)
at forge.control.match.ControlInput.btnOKActionPerformed(ControlInput.java:105)
at forge.control.match.ControlInput.access$0(ControlInput.java:104)
at forge.control.match.ControlInput$1.actionPerformed(ControlInput.java:52)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Re: Card Development Questions
by Sloth » 18 Jan 2012, 16:37
Yes Reality Acid can't stay this way. It will not work when brought into play through other means than casting it.SoulStorm wrote:Reality Acid spits out an error if it leaves the battlefield due to the target it was enchanting being removed from the battlefield. In this specific case, the AI sacrificed the enchanted permanent (using Barter in Blood) while reality Acid was still on the battlefield.
EDIT: Trying to fix it.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Card Development Questions
by jeffwadsworth » 18 Jan 2012, 17:13
Testing a script for Mind Funeral (hard-coded right now). I don't think it can be done right now, but perhaps someone else can see the light.
I used Mirror-Mad Phantasm as a template, but apparently the idea is flawed.
- | Open
- Name:Mind Funeral
ManaCost:1 U B
Types:Sorcery
Text:no text
A:SP$ DigUntil | Cost$ 1 U B | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ4 | Valid$ Land | ValidDescription$ land | FoundDestination$ Graveyard | RevealedDestination$ Graveyard | RememberFound$ True | SubAbility$ DBCleanup | SpellDescription$ Target opponent reveals cards from the top of his or her library until four land cards are revealed. That player puts all cards revealed this way into his or her graveyard.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/mind_funeral.jpg
SetInfo:ARB|Uncommon|http://magiccards.info/scans/en/arb/26.jpg
Oracle:Target opponent reveals cards from the top of his or her library until four land cards are revealed. That player puts all cards revealed this way into his or her graveyard.
End
I used Mirror-Mad Phantasm as a template, but apparently the idea is flawed.
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by friarsol » 18 Jan 2012, 17:21
Not sure why you are using a ConditionCheck here.
- Code: Select all
A:SP$ DigUntil | Cost$ 1 U B | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | Amount$ 4 | Valid$ Land | ValidDescription$ land | FoundDestination$ Graveyard | RevealedDestination$ Graveyard | SpellDescription$ Target opponent reveals cards from the top of his or her library until four land cards are revealed. That player puts all cards revealed this way into his or her graveyard.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by jeffwadsworth » 18 Jan 2012, 17:48
It is based off the Mirror-Mad Phantasm card. Someone noted that the card was scriptable on the hard-coded cards Wiki. I was hoping they could enlighten us.friarsol wrote:Not sure why you are using a ConditionCheck here.
- Code: Select all
A:SP$ DigUntil | Cost$ 1 U B | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | Amount$ 4 | Valid$ Land | ValidDescription$ land | FoundDestination$ Graveyard | RevealedDestination$ Graveyard | SpellDescription$ Target opponent reveals cards from the top of his or her library until four land cards are revealed. That player puts all cards revealed this way into his or her graveyard.
- | Open
- Name:Mirror-Mad Phantasm
ManaCost:3 U U
Types:Creature Spirit
Text:no text
PT:5/1
K:Flying
A:AB$ ChangeZone | Cost$ 1 U | Defined$ Self | Origin$ Battlefield | Destination $ Library | Shuffle$ True | RememberChanged$ True | SubAbility$ DBDig | SpellDescription$ CARDNAME's owner shuffles it into his or her library. If that player does, he or she reveals cards from the top of that library until a card named CARDNAME is revealed. That player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard.
SVar:DBDig:DB$ DigUntil | Cost$ G T | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 | Valid$ Card.namedMirror-Mad Phantasm | ValidDescription$ Mirror-Mad Phantasm | FoundDestination$ Battlefield | RevealedDestination$ Graveyard | SubAbility$ DBCleanup
SVar:DBCleanup:DB$Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/mirror_mad_phantasm.jpg
SetInfo:ISD|Mythic|http://magiccards.info/scans/en/isd/68.jpg
Oracle:Flying\n{1}{U}: Mirror-Mad Phantasm's owner shuffles it into his or her library. If that player does, he or she reveals cards from the top of that library until a card named Mirror-Mad Phantasm is revealed. The player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard.
End
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by friarsol » 18 Jan 2012, 17:53
Yea, I thought it was scriptable. Did you try the added "Amount$ 4" in the script I posted?
It looks like Mirror-Mad uses the Conditional to take care of this part of the card "CARDNAME's owner shuffles it into his or her library. If that player does,"
Not sure why Mirror-Mad has a Cost (for a SubAbility) either.
It looks like Mirror-Mad uses the Conditional to take care of this part of the card "CARDNAME's owner shuffles it into his or her library. If that player does,"
Not sure why Mirror-Mad has a Cost (for a SubAbility) either.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by friarsol » 18 Jan 2012, 18:02
Oh also, you shouldn't need both FoundDestination and RevealedDestination. If everything is going to the same Destination, just use RevealedDestination.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by jeffwadsworth » 18 Jan 2012, 22:24
Trying to convert Profane Command to script, but running into a timing issue with ChangeZone.
You target a creature in your graveyard before payment of X, thus nothing shows up in the "target" box in current script other than 0 cast cost creatures. Does anyone see a solution? Note that ChangeType$ can not be used here to my knowledge.
- | Open
- Name:Profane Command
ManaCost:X B B
Types:Sorcery
Text:no text
A:SP$ Charm | Cost$ X B B | Choices$ DBLoseLife,DBChange,DBPump,DBPump2 | CharmNum$ 2 | SpellDescription$ Choose two : Target player loses X life; or return target creature card with converted mana cost X or less from your graveyard to the battlefield; or target creature gets -X/-X until end of turn; or up to X target creatures gain fear until end of turn. (They can't be blocked except by artifact creatures and/or black creatures.)
SVar:DBLoseLife:DB$ LoseLife | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ X | SpellDescription$ Target player loses X life.
SVar:DBChange:DB$ ChangeZone | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature | Origin$ Graveyard | Destination $ Battlefield | SpellDescription$ Return target creature card with converted mana cost X or less from your graveyard to the battlefield.
SVar:DBPump:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -X | NumDef$ -X | SpellDescription$ Target creature gets -X/-X until end of turn.
SVar:DBPump2:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ Fear | SpellDescription$ Target creature gains fear until end of turn.
SVar:X:Count$xPaid
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/profane_command.jpg
SetInfo:LRW|Rare|http://magiccards.info/scans/en/lw/135.jpg
Oracle:Choose two - Target player loses X life; or return target creature card with converted mana cost X or less from your graveyard to the battlefield; or target creature gets -X/-X until end of turn; or up to X target creatures gain fear until end of turn. (They can't be blocked except by artifact creatures and/or black creatures.)
End
You target a creature in your graveyard before payment of X, thus nothing shows up in the "target" box in current script other than 0 cast cost creatures. Does anyone see a solution? Note that ChangeType$ can not be used here to my knowledge.
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by friarsol » 19 Jan 2012, 00:15
I would recommend using the Gorilla Shaman trick here, but I don't know if this will work since other things have a different use for X.
- Code: Select all
A:AB$ Destroy | Cost$ X X 1 | ValidTgts$ Artifact.nonCreature | TgtPrompt$ Select target noncreature artifact | SpellDescription$ Destroy target noncreature artifact with converted mana cost X.
# It may seem wrong to not use X in the target, but since the Target is what defines X, it's redundant (and not supported by the code)
SVar:X:Targeted$CardManaCost
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by Sloth » 19 Jan 2012, 06:17
AF Charm is so buggy, i'm not sure it is a good idea to convert it.jeffwadsworth wrote:Trying to convert Profane Command to script, but running into a timing issue with ChangeZone.
- | Open
- Name:Profane Command
ManaCost:X B B
Types:Sorcery
Text:no text
A:SP$ Charm | Cost$ X B B | Choices$ DBLoseLife,DBChange,DBPump,DBPump2 | CharmNum$ 2 | SpellDescription$ Choose two : Target player loses X life; or return target creature card with converted mana cost X or less from your graveyard to the battlefield; or target creature gets -X/-X until end of turn; or up to X target creatures gain fear until end of turn. (They can't be blocked except by artifact creatures and/or black creatures.)
SVar:DBLoseLife:DB$ LoseLife | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ X | SpellDescription$ Target player loses X life.
SVar:DBChange:DB$ ChangeZone | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature | Origin$ Graveyard | Destination $ Battlefield | SpellDescription$ Return target creature card with converted mana cost X or less from your graveyard to the battlefield.
SVar:DBPump:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ -X | NumDef$ -X | SpellDescription$ Target creature gets -X/-X until end of turn.
SVar:DBPump2:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ Fear | SpellDescription$ Target creature gains fear until end of turn.
SVar:X:Count$xPaid
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/profane_command.jpg
SetInfo:LRW|Rare|http://magiccards.info/scans/en/lw/135.jpg
Oracle:Choose two - Target player loses X life; or return target creature card with converted mana cost X or less from your graveyard to the battlefield; or target creature gets -X/-X until end of turn; or up to X target creatures gain fear until end of turn. (They can't be blocked except by artifact creatures and/or black creatures.)
End
You target a creature in your graveyard before payment of X, thus nothing shows up in the "target" box in current script other than 0 cast cost creatures. Does anyone see a solution? Note that ChangeType$ can not be used here to my knowledge.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Card Development Questions
by moomarc » 19 Jan 2012, 06:39
Scripting Interdict, I've run into a RememberObjects problem for the effect. Using Targeted remembers the actual ability countered, not the source card. What would the correct parameter be? I've tried TargetedCard and TargetedSource, but both add nothing to the remembered list on the effect.
- Interdict | Open
- Code: Select all
Name:Interdict
ManaCost:1 U
Types:Instant
Text:no text
A:SP$ Counter | Cost$ 1 U | TargetType$ Activated | TgtPrompt$ Select target activated ability from an artifact, creature, enchantment, or land. | ValidTgts$ Artifact,Creature,Enchantment,Land | ForgetOtherTargets$ True | SubAbility$ DBEffect | SpellDescription$ Counter target activated ability from an artifact, creature, enchantment, or land. That permanent's activated abilities can't be activated this turn. (Mana abilities can't be targeted.)
SVar:DBEffect:DB$ Effect | Name$ Interdict Effect | StaticAbilities$ STCantBeActivated | RememberObjects$ Targeted | SubAbility$ DBDraw
SVar:STCantBeActivated:Mode$ CantBeActivated | ValidCard$ Permanent.IsRemembered
SVar:DBDraw:DB$Draw | NumCards$ 1 | SpellDescription$ Draw a card.
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/interdict.jpg
SetInfo:TMP|Uncommon|http://magiccards.info/scans/en/tp/69.jpg
Oracle:Counter target activated ability from an artifact, creature, enchantment, or land. That permanent's activated abilities can't be activated this turn. (Mana abilities can't be targeted.)\nDraw a card.
End
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by jeffwadsworth » 19 Jan 2012, 15:37
Unless I am going blind, I do not see a RememberTargets$ True in your script.moomarc wrote:Scripting Interdict, I've run into a RememberObjects problem for the effect. Using Targeted remembers the actual ability countered, not the source card. What would the correct parameter be? I've tried TargetedCard and TargetedSource, but both add nothing to the remembered list on the effect.
- Interdict | Open
- Code: Select all
Name:Interdict
ManaCost:1 U
Types:Instant
Text:no text
A:SP$ Counter | Cost$ 1 U | TargetType$ Activated | TgtPrompt$ Select target activated ability from an artifact, creature, enchantment, or land. | ValidTgts$ Artifact,Creature,Enchantment,Land | ForgetOtherTargets$ True | SubAbility$ DBEffect | SpellDescription$ Counter target activated ability from an artifact, creature, enchantment, or land. That permanent's activated abilities can't be activated this turn. (Mana abilities can't be targeted.)
SVar:DBEffect:DB$ Effect | Name$ Interdict Effect | StaticAbilities$ STCantBeActivated | RememberObjects$ Targeted | SubAbility$ DBDraw
SVar:STCantBeActivated:Mode$ CantBeActivated | ValidCard$ Permanent.IsRemembered
SVar:DBDraw:DB$Draw | NumCards$ 1 | SpellDescription$ Draw a card.
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/interdict.jpg
SetInfo:TMP|Uncommon|http://magiccards.info/scans/en/tp/69.jpg
Oracle:Counter target activated ability from an artifact, creature, enchantment, or land. That permanent's activated abilities can't be activated this turn. (Mana abilities can't be targeted.)\nDraw a card.
End
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by moomarc » 19 Jan 2012, 16:10
I copied this method from another card (although I can't remember which) it does remember the ability targeted so I don't think that's the problem. But I'll try it and see if it helps. Thanksjeffwadsworth wrote:Unless I am going blind, I do not see a RememberTargets$ True in your script.moomarc wrote:Scripting Interdict, I've run into a RememberObjects problem for the effect. Using Targeted remembers the actual ability countered, not the source card. What would the correct parameter be? I've tried TargetedCard and TargetedSource, but both add nothing to the remembered list on the effect.
- Interdict | Open
- Code: Select all
Name:Interdict
ManaCost:1 U
Types:Instant
Text:no text
A:SP$ Counter | Cost$ 1 U | TargetType$ Activated | TgtPrompt$ Select target activated ability from an artifact, creature, enchantment, or land. | ValidTgts$ Artifact,Creature,Enchantment,Land | ForgetOtherTargets$ True | SubAbility$ DBEffect | SpellDescription$ Counter target activated ability from an artifact, creature, enchantment, or land. That permanent's activated abilities can't be activated this turn. (Mana abilities can't be targeted.)
SVar:DBEffect:DB$ Effect | Name$ Interdict Effect | StaticAbilities$ STCantBeActivated | RememberObjects$ Targeted | SubAbility$ DBDraw
SVar:STCantBeActivated:Mode$ CantBeActivated | ValidCard$ Permanent.IsRemembered
SVar:DBDraw:DB$Draw | NumCards$ 1 | SpellDescription$ Draw a card.
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/interdict.jpg
SetInfo:TMP|Uncommon|http://magiccards.info/scans/en/tp/69.jpg
Oracle:Counter target activated ability from an artifact, creature, enchantment, or land. That permanent's activated abilities can't be activated this turn. (Mana abilities can't be targeted.)\nDraw a card.
End
Edit: Your brilliance has the card working now.

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by moomarc » 20 Jan 2012, 09:45
Quick question; what's the preferred method for equipment's additional static abilities? Currently it's a 50/50 split between AttachedBy and EquippedBy. Does it make any difference?
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by Sloth » 20 Jan 2012, 10:01
EquippedBy is waaaay better, if the equipment becomes a creature and Necrotic Ooze is equipped with Runed Stalactite while you have Shapesharer and Dominating Licid in the graveyard then Necrotic Ooze can use the Dominating Licid ability and (when it's on the stack) use the Shapesharer's ability to become the equipment and ...ok, i shut up.moomarc wrote:Quick question; what's the preferred method for equipment's additional static abilities? Currently it's a 50/50 split between AttachedBy and EquippedBy. Does it make any difference?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Who is online
Users browsing this forum: No registered users and 29 guests