It is currently 21 May 2025, 23:08
   
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 friarsol » 11 Feb 2013, 20:30

Max mtg wrote:What about making a separate api for unless? It gets more and more parameters
I'm not sure what you mean by this Unless isn't really an effect, it's more like a conditional of an effect.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Max mtg » 12 Feb 2013, 02:04

friarsol wrote:
Max mtg wrote:What about making a separate api for unless? It gets more and more parameters
I'm not sure what you mean by this Unless isn't really an effect, it's more like a conditional of an effect.
I mean A:SP$ Unless | PayCost$ 2 | Payer$ You | IfPaid$ SubAbTrue | Else$ SubAbFalse | AIHint$ ... |

Charm is also more like a conditional (it's like switch operator in java), yet it has its own api. This 'unless' is like 'if' operator.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Card Development Questions

Postby Rooger » 12 Feb 2013, 04:18

moomarc wrote:Looks fantastic Rooger. Any chance you could send me the open photoshop file for the background so I can modify it for a 4:3 resolution?
I assume you are talking about the skin, i will post in the skins thread the psd, thanks btw ;)

swordshine wrote:For Flickerform, remember the enchanted creature and all auras attached, then use an effect to trigger at the end step.
I was looking for cards that do the same but couldn't find any, can you guide me on how to do it, i've read the forge's wiki but was unlucky to find the info to do it :(
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Card Development Questions

Postby swordshine » 12 Feb 2013, 08:06

Rooger wrote:
swordshine wrote:For Flickerform, remember the enchanted creature and all auras attached, then use an effect to trigger at the end step.
I was looking for cards that do the same but couldn't find any, can you guide me on how to do it, i've read the forge's wiki but was unlucky to find the info to do it :(
Obzedat uses such effect. This can be scripted by delayed trigger probably. Flickerform should remember the enchanted creature first, using "Pump | RememberObjects$ Enchanted ", then auras are "Aura.AttachedTo Creature.IsRemembered". Sounds tricky :)
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby swordshine » 12 Feb 2013, 09:14

Max mtg wrote:I mean A:SP$ Unless | PayCost$ 2 | Payer$ You | IfPaid$ SubAbTrue | Else$ SubAbFalse | AIHint$ ... |
Charm is also more like a conditional (it's like switch operator in java), yet it has its own api. This 'unless' is like 'if' operator.
I used storesvar and conditioncheck to script cards like Rhystic Syphon.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Rooger » 13 Feb 2013, 07:30

swordshine wrote:
Rooger wrote:
swordshine wrote:For Flickerform, remember the enchanted creature and all auras attached, then use an effect to trigger at the end step.
I was looking for cards that do the same but couldn't find any, can you guide me on how to do it, i've read the forge's wiki but was unlucky to find the info to do it :(
Obzedat uses such effect. This can be scripted by delayed trigger probably. Flickerform should remember the enchanted creature first, using "Pump | RememberObjects$ Enchanted ", then auras are "Aura.AttachedTo Creature.IsRemembered". Sounds tricky :)
Yeah that sounds too complicated for a newbie like me i'll leave it to anyone more able ahah i almost had an heart attack when i saw the Obzedat code lol, i'm currently trying to code Spellshift but there are some things i'm failing to get. Here is the code i have so far:

Code: Select all
A:SP$ Counter | Cost$ 3 U | TargetType$ Spell | ValidTgts$ Instant,Sorcery | TgtPrompt$ Select target Instant or Sorcery Spell | SubAbility$ DBDig | SpellDescription$ Counter target instant or sorcery spell. Its controller reveals cards from the top of his or her library until he or she reveals an instant or sorcery card. That player may cast that card without paying its mana cost. Then he or she shuffles his or her library.
SVar:DBDig:DB$ DigUntil | Defined$ TargetedController | Valid$ Sorcery | ValidDescription$ sorcery | FoundDestination$ Battlefield | RevealedDestination$ Library | Shuffle$ True
The thing is that (a) i tried to set the valid$ in the dbdig svar to Sorcery,Instant as well as the ValidDescription$ to sorcery,instant but nothing happened, i was able to counter my spell and search my library but that's it nothing happens after you see the library, (b) the way it is now i can find the next Sorcery only but it finds it and plays it to the battlefield as it was supposed to do but the sorcery don't cast it's effect it just goes to the battlefield doing nothing, (c) this happens whether i want it or not but the card description says that you can choose to cast it or not, the card is shuffled back to library if you choose not to cast the revealed card, not sure how to do this. I based my code on Polymorph but we are talking about instant and sorcery spells here, not creature spells, so it might need a few extra lines of code i'm missing. Any help is appreciated ;)
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Card Development Questions

Postby swordshine » 13 Feb 2013, 15:40

I've completed the basic script of Flickerform, but it cannot work with Copy Enchantment. "10/1/2005: If the enchanted creature was also enchanted by Copy Enchantment, Copy Enchantment will come back onto the battlefield attached to that permanent. As Copy Enchantment returns to the battlefield, its controller may choose any enchantment on the battlefield for it to copy. It can't copy Flickerformor any other Aura returning to the battlefield at the same time. If it copies a non-Aura enchantment, it will become unattached from the permanent and remain on the battlefield." I'm not sure if it is a long-existed issue for Copy Enchantment.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby friarsol » 13 Feb 2013, 16:22

Potential Forgotten Ancient script:

1. Trigger on upkeep
2. Repeat as an option as long as Self has +1/+1 counters on it (AI should stop repeating if there aren't any creatures it wants to put counters on)
3. Choose a non-remembered creature and remember it (AI should only choose "useful" creatures he controls)
4. Choose a number (0 - Number of Counters on Ancient)
5. Move X counters from Ancient to Chosen creature
6. Clear ChosenCreature and ChosenNumber
7(After repeat finishes). Clear Remembered

Originally I was going to write a pseudo-script, but I'm not at my codebase, so it's harder for me to look up the exact APIs/parameters.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby swordshine » 14 Feb 2013, 14:16

Is Rite of Ruin scriptable using GenericChoice? Seems like six different orders. It might be a little complicated because sacrificing one type of cards must be done at the same time. "Sacrifice | Defined$ Each" cannot do this, should probably use choosecard, rememberchosem, and sacrificeall remembered.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby friarsol » 14 Feb 2013, 15:20

swordshine wrote:Is Rite of Ruin scriptable using GenericChoice? Seems like six different orders. It might be a little complicated because sacrificing one type of cards must be done at the same time. "Sacrifice | Defined$ Each" cannot do this, should probably use choosecard, rememberchosem, and sacrificeall remembered.
It sounds like that could work. It may be a little awkward, but the only stuff we have that's related to Ordering is inside certain effects (like RearrangeTopOfLibrary etc)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby swordshine » 18 Feb 2013, 11:15

friarsol wrote:Potential Forgotten Ancient script:

1. Trigger on upkeep
2. Repeat as an option as long as Self has +1/+1 counters on it (AI should stop repeating if there aren't any creatures it wants to put counters on)
3. Choose a non-remembered creature and remember it (AI should only choose "useful" creatures he controls)
4. Choose a number (0 - Number of Counters on Ancient)
5. Move X counters from Ancient to Chosen creature
6. Clear ChosenCreature and ChosenNumber
7(After repeat finishes). Clear Remembered

Originally I was going to write a pseudo-script, but I'm not at my codebase, so it's harder for me to look up the exact APIs/parameters.
Done.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby swordshine » 19 Feb 2013, 11:21

swordshine wrote:I've completed the basic script of Flickerform, but it cannot work with Copy Enchantment. "10/1/2005: If the enchanted creature was also enchanted by Copy Enchantment, Copy Enchantment will come back onto the battlefield attached to that permanent. As Copy Enchantment returns to the battlefield, its controller may choose any enchantment on the battlefield for it to copy. It can't copy Flickerformor any other Aura returning to the battlefield at the same time. If it copies a non-Aura enchantment, it will become unattached from the permanent and remain on the battlefield." I'm not sure if it is a long-existed issue for Copy Enchantment.
I've tested other cards using "ChangeZoneAll | Destination$ Battlefield", e.g. Faith's Reward. It turns out Copy Enchantment can enchant the simultaneously entered card, but other auras cannot. I'll commit Flickerform.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby swordshine » 19 Feb 2013, 12:10

http://www.slightlymagic.net/forum/viewtopic.php?f=52&t=9147&p=108243&hilit=Bane+Alley+Broker#p108243
I think the basic script of Bane Alley Broker is correct and I updated it to a new version, though the display issue is still remaining.
Bane Alley Broker | Open
Name:Bane Alley Broker
ManaCost:1 U B
Types:Creature Human Rogue
Text:no text
PT:0/3
A:AB$ Draw | Cost$ T | NumCards$ 1 | SubAbility$ DBExile | SpellDescription$ Draw a card, then exile a card from your hand face down.
SVar:DBExile:DB$ ChangeZone | Origin$ Hand | Destination$ Exile | ChangeType$ Card | ChangeNum$ 1 | ExileFaceDown$ True | Mandatory$ True | RememberChanged$ True
S:Mode$ Continuous | Affected$ Card.IsRemembered+YouOwn | AffectedZone$ Exile | AddHiddenKeyword$ You may look at this card. | Description$ You may look at cards exiled with CARDNAME.
S:Mode$ Continuous | Affected$ Card.IsRemembered+OppOwn | AffectedZone$ Exile | AddHiddenKeyword$ Your opponent may look at this card.
A:AB$ ChooseCard | Cost$ U B T | Defined$ You | Amount$ 1 | Mandatory$ True | ChoiceTitle$ Choose a card to put into your hand | Choices$ Card.IsRemembered | ChoiceZone$ Exile | SubAbility$ MoveChosen | SpellDescription$ Return a card exiled with CARDNAME to its owner's hand.
SVar:MoveChosen:DB$ ChangeZone | Origin$ Exile | Destination$ Hand | Defined$ ChosenCard
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | Static$ True | ValidCard$ Card.Self | Execute$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/bane_alley_broker.jpg
SetInfo:GTC|Uncommon|http://magiccards.info/scans/en/gtc/145.jpg
Oracle:{T}: Draw a card, then exile a card from your hand face down.\nYou may look at cards exiled with Bane Alley Broker.\n{U}{B}, {T}: Return a card exiled with Bane Alley Broker to its owner's hand.
End

I have no idea to fix the display issue. Maybe just add a note to Text: "#Please click the exile zone to see the faced down cards before you activate the second ability".
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Sloth » 19 Feb 2013, 21:18

swordshine wrote:I think the basic script of Bane Alley Broker is correct and I updated it to a new version, though the display issue is still remaining.
The "You may look at this card." keyword isn't really working as it should at the moment (it actually permanently changes the face down state when the card is shown). The current structure of the code is not really suitable to fix the keyword.
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 » 20 Feb 2013, 09:57

Trying to script Razor Boomerang in an AI-friendly way (avoiding Pump:RememberObjects as the base ability) so I need to remember the unattached card by getting it from the sa's paidList. I've added the necessary code in AbilityUtils:HandleRemembering for RememberCostCards for "Unattached". I've also put in this.addListToHash(ability,"Unattach"); for human and AI, but it only works for the human. For the AI, it crashes at
Code: Select all
final List<Card> paidListUnattached = sa.getPaidList("Unattached");
Edit: Nevermind! #-o I just had the AI's addListToHash using "Attach".
-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

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 13 guests


Who is online

In total there are 13 users online :: 0 registered, 0 hidden and 13 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 13 guests

Login Form