It is currently 24 May 2025, 21:50
   
Text Size

Card Development Questions

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Card Development Questions

Postby moomarc » 10 Feb 2012, 15:39

Sloth wrote:
moomarc wrote:Just scripted Soulblast, but for some reason it deals twice the damage it's supposed to. Can anyone see the problem?
I think i've found and fixed the problem. Please try again.
I'm on my way out for the night, but will try in the morning. Thanks for looking into it.
-Marc
User avatar
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

Postby jeffwadsworth » 11 Feb 2012, 02:52

The card Suppress could be added if ValidPlayer$ Targeted was coded.

| Open
Name:Suppress
ManaCost:2 B
Types:Sorcery
Text:no text
A:SP$ ChangeZoneAll | Cost$ 2 B | ValidTgts$ Player | TgtPrompt$ Select target player | ChangeType$ Card | Origin$ Hand | Destination$ Exile | Hidden$ True | ExileFaceDown$ True | RememberChanged$ True | Reveal$ False | SubAbility$ DelTrig | SpellDescription$ Target player exiles all cards from his or her hand face down. At the beginning of the end step of that player's next turn, that player returns those cards to his or her hand.
SVar:DelTrig:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Targeted | Execute$ TrigReturn | Secondary$ True | TriggerDescription$ Return exiled cards to targeted player's hand.
SVar:TrigReturn:AB$ ChangeZone | Cost$ 0 | Defined$ Remembered | Origin$ Exile | Destination$ Hand | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/suppress.jpg
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

Postby ArsenalNut » 11 Feb 2012, 05:01

jeffwadsworth wrote:The card Suppress could be added if ValidPlayer$ Targeted was coded.

| Open
Name:Suppress
ManaCost:2 B
Types:Sorcery
Text:no text
A:SP$ ChangeZoneAll | Cost$ 2 B | ValidTgts$ Player | TgtPrompt$ Select target player | ChangeType$ Card | Origin$ Hand | Destination$ Exile | Hidden$ True | ExileFaceDown$ True | RememberChanged$ True | Reveal$ False | SubAbility$ DelTrig | SpellDescription$ Target player exiles all cards from his or her hand face down. At the beginning of the end step of that player's next turn, that player returns those cards to his or her hand.
SVar:DelTrig:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Targeted | Execute$ TrigReturn | Secondary$ True | TriggerDescription$ Return exiled cards to targeted player's hand.
SVar:TrigReturn:AB$ ChangeZone | Cost$ 0 | Defined$ Remembered | Origin$ Exile | Destination$ Hand | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/suppress.jpg
End
Targeted is not easily coded for ValidPlayer :( However this script works with no code modifications :D
| Open
Name:Suppress
ManaCost:2 B
Types:Sorcery
Text:no text
A:SP$ ChangeZoneAll | Cost$ 2 B | ValidTgts$ Player | TgtPrompt$ Select target player | ChangeType$ Card | Origin$ Hand | Destination$ Exile | Hidden$ True | ExileFaceDown$ True | RememberTargets$ True | RememberChanged$ True | Reveal$ False | SubAbility$ DelTrig | SpellDescription$ Target player exiles all cards from his or her hand face down. At the beginning of the end step of that player's next turn, that player returns those cards to his or her hand.
SVar:DelTrig:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Player.IsRemembered | Execute$ TrigReturn | Secondary$ True | TriggerDescription$ Return exiled cards to targeted player's hand.
SVar:TrigReturn:AB$ ChangeZone | Cost$ 0 | Defined$ Remembered | Origin$ Exile | Destination$ Hand | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/suppress.jpg
End
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Card Development Questions

Postby moomarc » 11 Feb 2012, 08:18

moomarc wrote:
Sloth wrote:
moomarc wrote:Just scripted Soulblast, but for some reason it deals twice the damage it's supposed to. Can anyone see the problem?
I think i've found and fixed the problem. Please try again.
I'm on my way out for the night, but will try in the morning. Thanks for looking into it.
Thanks Sloth. Works great now.

I'm committing with RemAIDeck for now, but it might be worth allowing the AI to use Sacrifice All, then adding
Code: Select all
SVar:NeedsToPlayVar:Y LEZ
SVar:Y:Count$OppLifeTotal/Plus.3
SVar:Z:Count$YourSumPower
. I added the "YourSumPower" to my local CardFactoryUtil, but it seems that the AI never casts with a Sac<All...> cost regardless. The /Plus.3 just allows some leeway for last minute lifegain so that the spell is less likely to be wasted. It would allow the opponent to win some close games where he had initial advantage then lost it, or in those situations where he has the upperhand in creatures but isn't attacking because he would trade too many creatures down or whatever. It should work well as a finisher for stalled games, but I don't know if the AI would then target a threatening creature instead, or still cast it if you have a Platinum Angel or the likes out.
-Marc
User avatar
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

Postby Sloth » 11 Feb 2012, 10:00

moomarc wrote:I'm committing with RemAIDeck for now, but it might be worth allowing the AI to use Sacrifice All, then adding
Code: Select all
SVar:NeedsToPlayVar:Y LEZ
SVar:Y:Count$OppLifeTotal/Plus.3
SVar:Z:Count$YourSumPower
. I added the "YourSumPower" to my local CardFactoryUtil, but it seems that the AI never casts with a Sac<All...> cost regardless. The /Plus.3 just allows some leeway for last minute lifegain so that the spell is less likely to be wasted. It would allow the opponent to win some close games where he had initial advantage then lost it, or in those situations where he has the upperhand in creatures but isn't attacking because he would trade too many creatures down or whatever. It should work well as a finisher for stalled games, but I don't know if the AI would then target a threatening creature instead, or still cast it if you have a Platinum Angel or the likes out.
The AI will not cast Soulblast because it thinks X is zero. We have the same problem with all X variables that depend on a cost paid or a target.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Development Questions

Postby Roujin » 12 Feb 2012, 14:16

Since it was requested in the Card Requests thread and I also like Slivers, I tried scripting Ward Sliver.

First try:
| Open
Name:Ward Sliver
ManaCost:4 W
Types:Creature Sliver
Text:no text
PT:2/2
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ ChooseColor | Static$ True | TriggerDescription$ As CARDNAME enters the battlefield, choose a color.
SVar:ChooseColor:DB$ ChooseColor | Defined$ You
S:Mode$ Continuous | Affected$ Creature.Sliver | AddKeyword$ Protection:Card.ChosenColor:CARDNAME has protection from the chosen color. | Description$ All Slivers have protection from the chosen color.
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/ward_sliver.jpg
End


Unfortunately it doesn't work, the reason probably being that the "ChosenColor" is not copied to the cards the static ability affects, so their Protection:Card.ChosenColor fails because ChosenColor is not defined (except for the Ward Sliver itself).
If I change the script to e.g. Protection:Card.White, it works as expected, giving all slivers protection from white.

So I got a second idea: Make five static abilities, one for each color, and let the user choose between those with the Charm ability. But can this be combined with static abilities? I haven't been able to find an example of this in the already scripted cards.
Roujin
 
Posts: 75
Joined: 01 Nov 2011, 21:58
Has thanked: 6 times
Been thanked: 13 times

Re: Card Development Questions

Postby jeffwadsworth » 12 Feb 2012, 18:34

Testing Neko-Te. Perhaps I am mis-interpeting the "UntilHostLeavesPlay" here. The creature gets the keyword but it does not work. The keyword stays on the creature even after the Neko-Te leaves the battlefield. Does anyone see the issue?

| Open
Name:Neko-Te
ManaCost:3
Types:Artifact Equipment
Text:no text
A:AB$ Attach | Cost$ 2 | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SorcerySpeed$ True | PrecostDesc$ Equip - | SpellDescription$ Attach CARDNAME to target creature you control.
T:Mode$ DamageDone | ValidSource$ Card.AttachedBy | ValidTarget$ Creature | Execute$ TrigNekoTeTap | TriggerZones$ Battlefield | TriggerDescription$ Whenever equipped creature deals damage to a creature, tap that creature. That creature doesn't untap during its controller's untap step for as long as CARDNAME remains on the battlefield.
SVar:TrigNekoTeTap:AB$ Tap | Cost$ 0 | Defined$ TriggeredTarget | SubAbility$ DBNekoTeAnimate
SVar:DBNekoTeAnimate:DB$ Animate | Defined$ TriggeredTarget | Keywords$ CARDNAME doesn't untap during your untap step. | UntilHostLeavesPlay$ True
T:Mode$ DamageDone | ValidSource$ Card.AttachedBy | ValidTarget$ Player | Execute$ TrigNekoTeLoseLife | TriggerZones$ Battlefield | TriggerDescription$ Whenever equipped creature deals damage to a player, that player loses 1 life.
SVar:TrigNekoTeLoseLife:AB$ LoseLife | Cost$ 0 | LifeAmount$ 1 | Defined$ TriggeredTarget
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/neko_te.jpg
End


@Roujin: Make sure you change that Creature.Sliver to just Sliver.
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

Postby Sloth » 12 Feb 2012, 19:02

jeffwadsworth wrote:Testing Neko-Te. Perhaps I am mis-interpeting the "UntilHostLeavesPlay" here. The creature gets the keyword but it does not work. The keyword stays on the creature even after the Neko-Te leaves the battlefield. Does anyone see the issue?

| Open
Name:Neko-Te
ManaCost:3
Types:Artifact Equipment
Text:no text
A:AB$ Attach | Cost$ 2 | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SorcerySpeed$ True | PrecostDesc$ Equip - | SpellDescription$ Attach CARDNAME to target creature you control.
T:Mode$ DamageDone | ValidSource$ Card.AttachedBy | ValidTarget$ Creature | Execute$ TrigNekoTeTap | TriggerZones$ Battlefield | TriggerDescription$ Whenever equipped creature deals damage to a creature, tap that creature. That creature doesn't untap during its controller's untap step for as long as CARDNAME remains on the battlefield.
SVar:TrigNekoTeTap:AB$ Tap | Cost$ 0 | Defined$ TriggeredTarget | SubAbility$ DBNekoTeAnimate
SVar:DBNekoTeAnimate:DB$ Animate | Defined$ TriggeredTarget | Keywords$ CARDNAME doesn't untap during your untap step. | UntilHostLeavesPlay$ True
T:Mode$ DamageDone | ValidSource$ Card.AttachedBy | ValidTarget$ Player | Execute$ TrigNekoTeLoseLife | TriggerZones$ Battlefield | TriggerDescription$ Whenever equipped creature deals damage to a player, that player loses 1 life.
SVar:TrigNekoTeLoseLife:AB$ LoseLife | Cost$ 0 | LifeAmount$ 1 | Defined$ TriggeredTarget
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/neko_te.jpg
End
I've just tested Neko-Te, destroyed it with Vindicate and the keyword was removed. What did you do?

Besides: The keyword should be HIDDEN.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Development Questions

Postby jeffwadsworth » 12 Feb 2012, 19:10

Sloth wrote:
jeffwadsworth wrote:Testing Neko-Te. Perhaps I am mis-interpeting the "UntilHostLeavesPlay" here. The creature gets the keyword but it does not work. The keyword stays on the creature even after the Neko-Te leaves the battlefield. Does anyone see the issue?

| Open
Name:Neko-Te
ManaCost:3
Types:Artifact Equipment
Text:no text
A:AB$ Attach | Cost$ 2 | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SorcerySpeed$ True | PrecostDesc$ Equip - | SpellDescription$ Attach CARDNAME to target creature you control.
T:Mode$ DamageDone | ValidSource$ Card.AttachedBy | ValidTarget$ Creature | Execute$ TrigNekoTeTap | TriggerZones$ Battlefield | TriggerDescription$ Whenever equipped creature deals damage to a creature, tap that creature. That creature doesn't untap during its controller's untap step for as long as CARDNAME remains on the battlefield.
SVar:TrigNekoTeTap:AB$ Tap | Cost$ 0 | Defined$ TriggeredTarget | SubAbility$ DBNekoTeAnimate
SVar:DBNekoTeAnimate:DB$ Animate | Defined$ TriggeredTarget | Keywords$ CARDNAME doesn't untap during your untap step. | UntilHostLeavesPlay$ True
T:Mode$ DamageDone | ValidSource$ Card.AttachedBy | ValidTarget$ Player | Execute$ TrigNekoTeLoseLife | TriggerZones$ Battlefield | TriggerDescription$ Whenever equipped creature deals damage to a player, that player loses 1 life.
SVar:TrigNekoTeLoseLife:AB$ LoseLife | Cost$ 0 | LifeAmount$ 1 | Defined$ TriggeredTarget
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/neko_te.jpg
End
I've just tested Neko-Te, destroyed it with Vindicate and the keyword was removed. What did you do?

Besides: The keyword should be HIDDEN.
It was HIDDEN at first...this is just one of many variations in an attempt to fix it. I will reload the Forge project from scratch. Thanks for testing it. In testing, I used Pillage to remove Neko-Te with and without it being attached to a creature. Also, did the creature stay tapped during the untap step?
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

Postby Roujin » 12 Feb 2012, 21:45

jeffwadsworth wrote:@Roujin: Make sure you change that Creature.Sliver to just Sliver.
Thanks, I assume my posted script would apply to all creatures? I didn't test with non-slivers. (edit: nope, now I get it. It's just that the card says "Slivers" not "Sliver creatures", right?)

Do you have any idea on the part with combining charm + static abilities?
Roujin
 
Posts: 75
Joined: 01 Nov 2011, 21:58
Has thanked: 6 times
Been thanked: 13 times

Re: Card Development Questions

Postby jeffwadsworth » 12 Feb 2012, 22:56

Roujin wrote:
jeffwadsworth wrote:@Roujin: Make sure you change that Creature.Sliver to just Sliver.
Thanks, I assume my posted script would apply to all creatures? I didn't test with non-slivers. (edit: nope, now I get it. It's just that the card says "Slivers" not "Sliver creatures", right?)

Do you have any idea on the part with combining charm + static abilities?
I will look at it once the epic Finkel vs Kibler match is over.
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

Postby friarsol » 13 Feb 2012, 00:27

Roujin wrote:(edit: nope, now I get it. It's just that the card says "Slivers" not "Sliver creatures", right?)

Do you have any idea on the part with combining charm + static abilities?
Right it's granted to Slivers that don't happen to be creatures.

I don't like the idea of using the charm here, since Charm doesn't work very well. Maybe Sloth knows a way to apply the chosen color to the static ability before it's granted, so it's not granting "ChosenColor".
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby moomarc » 13 Feb 2012, 16:55

I just scripted Cleansing Meditation but it seems to be suffering from something that I thought was fixed some time ago: when an aura is returned to the battlefield, it doesn't enchant anything (but also doesn't go to/stay in the grave for not enchanting something.
Cleansing Meditation | Open
Name:Cleansing Meditation
ManaCost:1 W W
Types:Sorcery
Text:no text
A:SP$ DestroyAll | Cost$ 1 W W | ValidCards$ Enchantment | SubAbility$ Threshold | ConditionCheckSVar$ X | ConditionSVarCompare$ LT7 | SpellDescription$ Destroy all enchantments.
SVar:Threshold:DB$ DestroyAll | ValidCards$ Enchantment | SubAbility$ DBChangeZoneAll | ConditionCheckSVar$ X | ConditionSVarCompare$ GE7 | RememberDestroyed$ True | SpellDescription$ Threshold - If seven or more cards are in your graveyard, instead destroy all enchantments, then return all cards in your graveyard destroyed this way to the battlefield.
SVar:DBChangeZoneAll:DB$ ChangeZoneAll | Cost$ 0 | ChangeType$ Card.IsRemembered+YouCtrl | Origin$ Graveyard | Destination$ Battlefield | SubAbility$ DBCleanup
SVar:DBCleanup:DB$Cleanup | ClearRemembered$ True
SVar:X:Count$InYourYard
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/cleansing_meditation.jpg
SetInfo:TOR|Uncommon|http://magiccards.info/scans/en/tr/3.jpg
Oracle:Destroy all enchantments.\nThreshold - If seven or more cards are in your graveyard, instead destroy all enchantments, then return all cards in your graveyard destroyed this way to the battlefield.
End
-Marc
User avatar
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

Postby moomarc » 14 Feb 2012, 11:53

Trying to add Spirit Flare and having some issues. In card like Energy Tap there is no conditional on the subability yet it correctly doesn't resolve if the targeted creature becomes tapped by some other means while its on the stack. This isn't the case for Spirit Flare though, so I tried to add RememberTapped but the target card gets added even if it becomes tapped while the spell is on the stack. The new resolve looks like this:
Code: Select all
    private static void tapResolve(final AbilityFactory af, final SpellAbility sa) {
        final HashMap<String, String> params = af.getMapParams();
        final Card card = sa.getSourceCard();

        final boolean remTapped = params.containsKey("RememberTapped");
        if (remTapped) {
            card.clearRemembered();
        }

        ArrayList<Card> tgtCards;
        final Target tgt = sa.getTarget();
        if (tgt != null) {
            tgtCards = tgt.getTargetCards();
        } else {
            tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa);
        }

        for (final Card tgtC : tgtCards) {
            if (AllZoneUtil.isCardInPlay(tgtC) && ((tgt == null) || tgtC.canBeTargetedBy(sa))) {
                tgtC.tap();
            } if (remTapped) {
                card.addRemembered(tgtC);
            }
        }
    }
I'm guessing that somewhere it needs a tgtC.isUntapped() but I can't find where. I tried (to no avail - except that nothing was remembered this way)
Code: Select all
if (tgtC.isUntapped() && (remTapped)) {
card.addRemembered(tgtC);
}
Can someone see what I've done wrong and perhaps point me in the right direction?

The final script with the RememberTapped changes in place is
Spirit Flare | Open
Name:Spirit Flare
ManaCost:3 W
Types:Instant
Text:no text
K:Flashback 1 W PayLife<3>
A:SP$ Tap | Cost$ 3 W | TgtPrompt$ Select target untapped creature you control | ValidTgts$ Creature.untapped+YouCtrl | SubAbility$ SpiritDmg | RememberTapped$ True | SpellDescription$ Tap target untapped creature you control. If you do, it deals damage equal to its power to target attacking or blocking creature an opponent controls.
SVar:SpiritDmg:DB$DealDamage | ValidTgts$ Creature.attacking+YouDontCtrl,Creature.blocking+YouDontCtrl | TgtPrompt$ Select target attacking or blocking creature an opponent controls | NumDmg$ SpiritStrength | ConditionCheckSVar$ WasTapped | ConditionSVarCompare$ GE1
SVar:SpiritStrength:Targeted$CardPower
SVar:WasTapped:Remembered$Amount
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/spirit_flare.jpg
SetInfo:TOR|Common|http://magiccards.info/scans/en/tr/15.jpg
Oracle:Tap target untapped creature you control. If you do, it deals damage equal to its power to target attacking or blocking creature an opponent controls.\nFlashback-{1}{W}, Pay 3 life. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
End
-Marc
User avatar
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

Postby Sloth » 14 Feb 2012, 12:25

moomarc wrote:Trying to add Spirit Flare and having some issues.
It worked for me. Maybe you added the untapped check after the tapping?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 42 guests


Who is online

In total there are 42 users online :: 0 registered, 0 hidden and 42 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 42 guests

Login Form