It is currently 16 Sep 2025, 23:30
   
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 Apr 2012, 20:09

So what would be the best way to resolve it? Extend ChangeZone with a Flicker AF? That way we could also get some decent AI logic in there.
-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 » 13 Apr 2012, 21:38

How would I go about making Handsize adjustment pumpable? I'm busy with Tamiyo for AVR and everything is perfect except for the unlimited hand size. Here's the base script (with some remnants from attempting to get the keyword working):
Tamiyo, the Moon Sage | Open
Code: Select all
Name:Tamiyo, the Moon Sage
ManaCost:3 U U
Types:Planeswalker Tamiyo
Text:no text
Loyalty:4
A:AB$ Tap | Cost$ AddCounter<1/LOYALTY> | ValidTgts$ Permanent | TgtPrompt$ Choose target permanent. | Planeswalker$ True | SubAbility$ TamiyoPump | SpellDescription$ Tap target permanent. It doesn't untap during its controller's next untap step.
SVar:TamiyoPump:DB$Pump | Defined$ Targeted | Permanent$ True | KW$ HIDDEN This card doesn't untap during your next untap step.
A:AB$ Pump | Cost$ SubCounter<2/LOYALTY> | ValidTgts$ Player | TgtPrompt$ Select target player | StackDescription$ None | Planeswalker$ True | SubAbility$ TamiyoDraw | SpellDescription$  Draw a card for each tapped creature target player controls.
SVar:TamiyoDraw:DB$ Draw | NumCards$ X
SVar:X:Count$Valid Creature.tapped+TargetedPlayerCtrl
A:AB$ Effect | Cost$ SubCounter<5/LOYALTY> | Planeswalker$ True | Ultimate$ True | Name$ Tamiyo, the Moon Sage emblem | Image$ tamiyo_moon_sage_emblem | StaticAbilities$ UnlimitedHand | Triggers$ TamiyoCardToGrave | SVars$ TamiyoReturn | Stackable$ False | Duration$ Permanent | SpellDescription$ You get an emblem with "You have no maximum hand size" and "Whenever a card is put into your graveyard from anywhere, you may return it to your hand."
# SVar:UnlimitedHand:HIDDEN HandSize = INF Self
SVar:UnlimitedHand:Mode$ Continuous | Affected$ Card.YouCtrl | AddKeyword$ HandSize = INF Self | AddHiddenKeyword$ HIDDEN HandSize = INF Self | Description$ You have no maximum hand size.
SVar:TamiyoCardToGrave:Mode$ ChangesZone | Origin$ Any | Destination$ Graveyard | ValidCard$ Card.nonToken+YouCtrl | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TamiyoReturn | TriggerDescription$ Whenever a card is put into your graveyard from anywhere, you may return it to your hand.
SVar:TamiyoReturn:AB$ChangeZone | Cost$ 0 | Defined$ TriggeredCard | Origin$ Graveyard | Destination$ Hand
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/tamiyo_the_moon_sage.jpg
End
I've tried the following:
- Using Keywords param of effect to give it "HandSize = INF Self". All it does is display that as a text string in card info panel.
- Added HiddenKeywords param for effect to grant "HIDDEN HandSize = INF Self". Same as before except that the text string is displayed in the same way as normal HIDDEN keywords.
- Tried using a static ability to add the keyword to the effect. Didn't work because the effect is immutable so returns false in isValid.
- Used the static ability to pump another card for testing (both hidden and normal variations). Doesn't work, just displays the text string as before, so its not just because of an issue with an effect.

Any help would be appreciated.
-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 friarsol » 13 Apr 2012, 22:23

Firstly, try not to use pumps just to target something. Most AFs allow you to target, but still use defined to say who gets the benefit of the SA. If there's something where you can't find, ask about it in this thread and we can check it out. It's a pretty simple way to allow for odd interactions like this.

You should be able to do:
Code: Select all
A:AB$ Draw | Cost$ SubCounter<2/LOYALTY> | ValidTgts$ Player | Planeswalker$ True |  NumCards$ X | Defined$ You | SpellDescription$ Draw a card for each tapped creature target player controls.
SVar:X:Count$Valid Creature.tapped+TargetedPlayerCtrl
As far as your main question, HandSize isn't really grantable right now, since it's a pre-parsed keyword. We had talked about converting it from a Keyword to a Static Ability, but it hasn't quite happened. I know that's mostly Sloth's area of expertise, so maybe once he gets back from his time off, there might be the motivation to convert over. Once they get converted we can also convert Praetor's Counsel to script too.

Sloth (or whoever else gets motivated enough to add this), max hand size only needs to be checked during the cleanup step, so it might be a slightly different addition than more standardized Static Abilities.
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 » 14 Apr 2012, 03:50

Thanks Sol.

With regards to the pumped targeting, it wasn't disregard for this specialized targeting, I was just remembering the specific case of trying to script Keeper of the Mind (I think it was when I was scripting one of these Keepers that Sloth first added the Defined+ValidTgts capability). For that card I'd tried to do exactly what you suggested and couldn't get the right result, but looking at it now I see that its the reverse order so should be perfect.

Looking forward to playing with Tamiyo, so once whoever converts HandSize, if you need help converting the scripts just shout.
-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 friarsol » 14 Apr 2012, 13:14

moomarc wrote:Thanks Sol.

With regards to the pumped targeting, it wasn't disregard for this specialized targeting, I was just remembering the specific case of trying to script Keeper of the Mind (I think it was when I was scripting one of these Keepers that Sloth first added the Defined+ValidTgts capability). For that card I'd tried to do exactly what you suggested and couldn't get the right result, but looking at it now I see that its the reverse order so should be perfect.
Ahh, maybe the logic used to be reversed so it would check for targets first before defaulting to defined, and he switched that?

Anyway, Keeper of the Mind should be able to be scripted the same now that Draw works like the way it had in my head.

Code: Select all
A:AB$ Draw | Cost$ U T | ValidTgts$ Opponent | TgtPrompt$ Choose target opponent with at least two more cards in hand than you | CheckSVar$ X | SVarCompare$ GEY | Defined$ You | NumCards$ 1 | SpellDescription$ Choose target opponent who had at least two more cards in hand than you did as you activated this ability. Draw a card.
SVar:X:Count$InOppHandCount
SVar:Y:Count$InYourHand/Plus.2
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Sloth » 16 Apr 2012, 11:32

friarsol wrote:
moomarc wrote:Thanks Sol.

With regards to the pumped targeting, it wasn't disregard for this specialized targeting, I was just remembering the specific case of trying to script Keeper of the Mind (I think it was when I was scripting one of these Keepers that Sloth first added the Defined+ValidTgts capability). For that card I'd tried to do exactly what you suggested and couldn't get the right result, but looking at it now I see that its the reverse order so should be perfect.
Ahh, maybe the logic used to be reversed so it would check for targets first before defaulting to defined, and he switched that?
Exactly.

friarsol wrote:
Sloth (or whoever else gets motivated enough to add this), max hand size only needs to be checked during the cleanup step, so it might be a slightly different addition than more standardized Static Abilities.
I will think about a HandSize static ability.
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 friarsol » 16 Apr 2012, 15:05

Sloth wrote:I will think about a HandSize static ability.
You wasted no time on that. Hope you enjoyed your time away from Forge.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Sloth » 16 Apr 2012, 16:09

friarsol wrote:
Sloth wrote:I will think about a HandSize static ability.
You wasted no time on that. Hope you enjoyed your time away from Forge.
It was easy to integrate into continuous static abilities (and since max hand size is displayed in the player panel and the AI uses it from time to time the continuous updating is not wasted).

friarsol wrote:
moomarc wrote:Hmmm, I've tried the different methods that might affect the resolution in any way but the problem with Flicker type cards still persists in these two cases. So all I can think is that state based actions aren't checked here in time. One of the other devs will have to say what the best way forward is. I think that exiling a creature might have to trigger a checkStateEffects, but there's probably reasons why this wouldn't work. With regards to the treasonous creature still returning at end of turn I think is due to this as well, but I could be wrong in which case it will also need to be handled differently.
The main issue is the card is coming back as the same game object as it was, instead of coming back as a different game object. Once that's resolved all of these other issues should be fixed. The main issue is LKI and ChangeZone = new Game Object sometimes interfere with each other, which is why one and/or the other seem to be slightly incorrect at all times.
I think i will tackle this again after the next beta release (I tried it once, but failed).
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 moomarc » 16 Apr 2012, 16:56

Thanks Sloth. That was incredibly fast. That little break must have been good! :D

I'm guessing we should hold off on all these flicker type cards for the new set until we get this fixed?
-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 » 17 Apr 2012, 00:04

I've been working on Gisela, Blade of Goldnight for AVR (decided that Avacyn was fighting a losing battle if she didn't get at least one of her legendary cronies around her). The prevention wasn't possible so I got it working with this change to StaticAbilityPrevent:
Code: Select all
if (params.get("Amount").matches("[0-9][0-9]?")) {
    restDamage = restDamage - Integer.parseInt(params.get("Amount"));
} else if (params.get("Amount").matches("HalfUp")) {                //Just added these
    restDamage = restDamage - (int) (Math.ceil(restDamage / 2.0));  //2 lines.
} else {
    restDamage = restDamage - CardFactoryUtil.xCount(hostCard, hostCard.getSVar(params.get("Amount")));
        }
Gisela, Blade of Goldnight | Open
Code: Select all
Name:Gisela, Blade of Goldnight
ManaCost:4 R W W
Types:Legendary Creature Angel
Text:no text
PT:5/5
K:Flying
K:First Strike
R:Event$ DamageDone | ValidSource$ Card | ValidTarget$ Opponent,Permanent.YouDontCtrl | ReplaceWith$ DmgTwice | IsCombat$ False | Description$ If a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead.
R:Event$ DamageDone | ValidSource$ Card | ValidTarget$ Opponent,Permanent.YouDontCtrl | ReplaceWith$ DmgTwiceCombat | IsCombat$ True | Secondary$ True | Description$ If a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead.
SVar:DmgTwice:AB$DealDamage | Cost$ 0 | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | NumDmg$ X
SVar:DmgTwiceCombat:AB$DealDamage | Cost$ 0 | CombatDamage$ True | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | NumDmg$ X
SVar:X:ReplaceCount$DamageAmount/Twice
S:Mode$ PreventDamage | Target$ You,Permanent.YouCtrl | Amount$ HalfUp | Description$ If a source would deal damage to you or a permanent you control, prevent half that damage, rounded up.
SVar:PlayMain1:TRUE
SVar:Picture:http://www.wizards.com/global/images/magic/general/gisela_blade_of_goldnight.jpg
End
I know that throwing a random math util outside of xCount is normally frowned upon, but I couldn't work out how to get the reference damage into xCount so that I could use the existing code. Is there a way or is this this the correct solution (for a change 8-[ )
-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 » 17 Apr 2012, 10:46

moomarc wrote:I've been working on Gisela, Blade of Goldnight for AVR (decided that Avacyn was fighting a losing battle if she didn't get at least one of her legendary cronies around her). The prevention wasn't possible so I got it working with this change to StaticAbilityPrevent:
Code: Select all
if (params.get("Amount").matches("[0-9][0-9]?")) {
    restDamage = restDamage - Integer.parseInt(params.get("Amount"));
} else if (params.get("Amount").matches("HalfUp")) {                //Just added these
    restDamage = restDamage - (int) (Math.ceil(restDamage / 2.0));  //2 lines.
} else {
    restDamage = restDamage - CardFactoryUtil.xCount(hostCard, hostCard.getSVar(params.get("Amount")));
        }
Gisela, Blade of Goldnight | Open
Code: Select all
Name:Gisela, Blade of Goldnight
ManaCost:4 R W W
Types:Legendary Creature Angel
Text:no text
PT:5/5
K:Flying
K:First Strike
R:Event$ DamageDone | ValidSource$ Card | ValidTarget$ Opponent,Permanent.YouDontCtrl | ReplaceWith$ DmgTwice | IsCombat$ False | Description$ If a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead.
R:Event$ DamageDone | ValidSource$ Card | ValidTarget$ Opponent,Permanent.YouDontCtrl | ReplaceWith$ DmgTwiceCombat | IsCombat$ True | Secondary$ True | Description$ If a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead.
SVar:DmgTwice:AB$DealDamage | Cost$ 0 | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | NumDmg$ X
SVar:DmgTwiceCombat:AB$DealDamage | Cost$ 0 | CombatDamage$ True | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | NumDmg$ X
SVar:X:ReplaceCount$DamageAmount/Twice
S:Mode$ PreventDamage | Target$ You,Permanent.YouCtrl | Amount$ HalfUp | Description$ If a source would deal damage to you or a permanent you control, prevent half that damage, rounded up.
SVar:PlayMain1:TRUE
SVar:Picture:http://www.wizards.com/global/images/magic/general/gisela_blade_of_goldnight.jpg
End
I know that throwing a random math util outside of xCount is normally frowned upon, but I couldn't work out how to get the reference damage into xCount so that I could use the existing code. Is there a way or is this this the correct solution (for a change 8-[ )
No problem. Why not? :D
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 mark » 17 Apr 2012, 13:34

I had this one in the wrong thread and were asked to post it here:

I tried to code Gate to the AEther but it does not work, as the revealed card is not shown and I cannot choose if I want to put a valid card onto the battlefield, the card is just drawn. What is wrong?
Code: Select all
Name:Gate to the AEther
ManaCost:6
Types:Artifact
Text:no text
T:Mode$Phase | Phase$ Upkeep | TriggerDescription$ At the beginning of each player's upkeep, that player reveals the top card of his or her library. If it's an artifact, creature, enchantment, or land card, the player may put it onto the battlefield. | TriggerZones$ Battlefield | AB$ Dig | DigNum$ 1 | Reveal$ True | DestinationZone$ Battlefield | ChangeValid$ Artifact | ChangeValid$ Creature | ChangeValid$ Enchantment | ChangeValid$ Land | Optional$ True | Defined$ TriggeredPlayer
SVar:Picture:http://www.wizards.com/global/images/magic/general/gate_to_the_aether.jpg
SetInfo:MRD|Rare|http://magiccards.info/scans/en/mi/174.jpg
Oracle:At the beginning of each player's upkeep, that player reveals the top card of his or her library. If it's an artifact, creature, enchantment, or land card, the player may put it onto the battlefield.
End
mark
 
Posts: 138
Joined: 28 Dec 2011, 11:32
Has thanked: 6 times
Been thanked: 11 times

Re: Card Development Questions

Postby friarsol » 17 Apr 2012, 14:04

mark wrote:
Gate | Open
Name:Gate to the AEther
T:Mode$Phase | Phase$ Upkeep | TriggerDescription$ At the beginning of each player's upkeep, that player reveals the top card of his or her library. If it's an artifact, creature, enchantment, or land card, the player may put it onto the battlefield. | TriggerZones$ Battlefield | AB$ Dig | DigNum$ 1 | Reveal$ True | DestinationZone$ Battlefield | ChangeValid$ Artifact | ChangeValid$ Creature | ChangeValid$ Enchantment | ChangeValid$ Land | Optional$ True | Defined$ TriggeredPlayer
Have you looked at other cards with Trigger effects? I'd compare this one to Dark Confidant.

Code: Select all
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigDig | TriggerDescription$ At the beginning of your upkeep, reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost.
SVar:TrigDig:AB$Dig | Cost$ 0 | DigNum$ 1 | Reveal$ True | ChangeNum$ All | ChangeValid$ Card | DestinationZone$ Hand | RememberChanged$ True | SubAbility$ DBLose
SVar:DBLose:DB$LoseLife | LifeAmount$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$Cleanup | ClearRemembered$ True
do you see how there's an Execute line, and a separate SVar parameter to handle the actual effect? Your script seems to combine all of that on one line (which is incorrect). Also, your ChangeValid line should probably be more like:
ChangeValid$ Artifact,Creature,Enchantment,Land
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 » 17 Apr 2012, 14:54

mark wrote:I tried to code Gate to the AEther but it does not work, as the revealed card is not shown and I cannot choose if I want to put a valid card onto the battlefield, the card is just drawn. What is wrong?
It needed one of the newer trigger controllers to make it work properly (in addition to the things Sol pointed out), and I wasn't sure whether you'd find relevant reference easily enough. So I took the liberty to add the card to svn. Check it out in tomorrow's build to see the final script. Eh, why wait? Here's the final script:
Gate to the AEther | Open
Code: Select all
Name:Gate to the AEther
ManaCost:6
Types:Artifact
Text:no text
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ TrigAetherDig | TriggerController$ TriggeredPlayer | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's upkeep, that player reveals the top card of his or her library. If it's an artifact, creature, enchantment, or land card, the player may put it onto the battlefield.
SVar:TrigAetherDig:DB$ Dig | Defined$ TriggeredPlayer | DigNum$ 1 | Reveal$ True | DestinationZone$ Battlefield | DestinationZone2$ Library | LibraryPosition2$ 0 | ChangeNum$ 1 | Optional$ True | ChangeValid$ Artifact,Creature,Enchantment,Land
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/gate_to_the_aether.jpg
SetInfo:MRD|Rare|http://magiccards.info/scans/en/mi/174.jpg
Oracle:At the beginning of each player's upkeep, that player reveals the top card of his or her library. If it's an artifact, creature, enchantment, or land card, the player may put it onto 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 squee1968 » 21 Apr 2012, 04:33

Some time ago, I scripted Sedge Sliver, but it was rejected because it would give the bonus to slivers that your opponent controlled even if it didn't control a swamp. However, I believe I have a workaround for this issue.

Code: Select all
Name:Sedge Sliver
ManaCost:2 R
Types:Creature Sliver
Text:no text
PT:2/2
S:Mode$ Continuous | Affected$ Creature.Sliver+YouCtrl | AddPower$ 1 | AddToughness$ 1 | CheckSVar$ X | SVarCompare$ GE1 | Description$ All Sliver creatures have "This creature gets +1/+1 as long as you control a Swamp."
S:Mode$ Continuous | Affected$ Creature.Sliver+YouDontCtrl | AddPower$ 1 | AddToughness$ 1 | CheckSVar$ Y | SVarCompare$ GE1 | Secondary$ True | Description$ All Sliver creatures have "This creature gets +1/+1 as long as you control a Swamp."
S:Mode$ Continuous | Affected$ Sliver | AddAbility$ Pump | Description$ All Slivers have "B: Regenerate this permanent."
SVar:X:Count$Valid Swamp.YouCtrl
SVar:Y:Count$Valid Swamp.YouDontCtrl
SVar:Pump:AB$Regenerate | Cost$ B | SpellDescription$ Regenerate CARDNAME.
SVar:BuffedBy:Sliver
SVar:PlayMain1:TRUE
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/sedge_sliver.jpg
End
squee1968
 
Posts: 254
Joined: 18 Nov 2011, 03:28
Has thanked: 110 times
Been thanked: 45 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 43 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 43 users online :: 0 registered, 0 hidden and 43 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 43 guests

Login Form