Page 49 of 141

Re: Card Development Questions

PostPosted: 18 Jul 2011, 01:58
by friarsol
For everyone writing scripts, I think it'd be better if you didn't try filling in the SetInfo script by hand (we have scripts that automate that). This way we don't have an issue where a card is incorrectly assigned to the wrong set, or worse a card that has some of it's sets but not all of them. The Scripts aren't smart enough to "recheck" Cards that only have partial SetInfo script. At some point I'll take some time to rewrite them using the mtgdata.txt file that we use in PerSetTracking, but until then it's probably best to just leave that completely off, and then when Chris (or anyone else) runs the script it will pick them up.

Re: Card Development Questions

PostPosted: 18 Jul 2011, 08:29
by beholder
jeffwadsworth wrote:Beholder, I can add your card if you wish.
Thanks, but Mana Flare has too many problems imho. It uses the stack while it shouldn't (as it's a triggered mana ability) and the computer never uses the extra mana in its pool (does it even get into it's pool?).

Re: Card Development Questions

PostPosted: 18 Jul 2011, 22:24
by jeffwadsworth
Converted Isleback Spawn:

| Open
Name:Isleback Spawn
ManaCost:5 U U
Types:Creature Kraken
Text:no text
PT:4/8
K:Shroud
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 8 | CheckSVar$ X | SVarCompare$ LEY | Description$ CARDNAME gets +4/+8 as long as a library has twenty or fewer cards in it.
SVar:Y:Number$20
SVar:X:Count$LowestLibrary
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/isleback_spawn.jpg
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/40.jpg
End


Code for Xcount in CardFactoryUtil.java

| Open
// Count$LowestLibrary
if (sq[0].contains("LowestLibrary")) {
return Math.min(AllZone.getHumanLibrary().size(),AllZone.getComputerLibrary().size());
}



I know the int returned is correct, yet the static ability is not given. Any ideas?

Re: Card Development Questions

PostPosted: 19 Jul 2011, 05:32
by Sloth
jeffwadsworth wrote:Converted Isleback Spawn:

| Open
Name:Isleback Spawn
ManaCost:5 U U
Types:Creature Kraken
Text:no text
PT:4/8
K:Shroud
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 8 | CheckSVar$ X | SVarCompare$ LEY | Description$ CARDNAME gets +4/+8 as long as a library has twenty or fewer cards in it.
SVar:Y:Number$20
SVar:X:Count$LowestLibrary
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/isleback_spawn.jpg
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/40.jpg
End


Code for Xcount in CardFactoryUtil.java

| Open
// Count$LowestLibrary
if (sq[0].contains("LowestLibrary")) {
return Math.min(AllZone.getHumanLibrary().size(),AllZone.getComputerLibrary().size());
}



I know the int returned is correct, yet the static ability is not given. Any ideas?
Fixed! Please try again Jeff.

Re: Card Development Questions

PostPosted: 19 Jul 2011, 18:56
by jeffwadsworth
Sloth wrote:
jeffwadsworth wrote:Converted Isleback Spawn:

| Open
Name:Isleback Spawn
ManaCost:5 U U
Types:Creature Kraken
Text:no text
PT:4/8
K:Shroud
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 8 | CheckSVar$ X | SVarCompare$ LEY | Description$ CARDNAME gets +4/+8 as long as a library has twenty or fewer cards in it.
SVar:Y:Number$20
SVar:X:Count$LowestLibrary
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/isleback_spawn.jpg
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/40.jpg
End


Code for Xcount in CardFactoryUtil.java

| Open
// Count$LowestLibrary
if (sq[0].contains("LowestLibrary")) {
return Math.min(AllZone.getHumanLibrary().size(),AllZone.getComputerLibrary().size());
}



I know the int returned is correct, yet the static ability is not given. Any ideas?
Fixed! Please try again Jeff.
Thanks. It still doesn't work for me.

Re: Card Development Questions

PostPosted: 19 Jul 2011, 20:05
by Sloth
jeffwadsworth wrote:Thanks. It still doesn't work for me.
Arg. Submitted my next try. Sorry Jeff.

Re: Card Development Questions

PostPosted: 19 Jul 2011, 22:08
by jeffwadsworth
Sloth wrote:
jeffwadsworth wrote:Thanks. It still doesn't work for me.
Arg. Submitted my next try. Sorry Jeff.
Works perfectly. :D

Re: Card Development Questions

PostPosted: 20 Jul 2011, 22:09
by jeffwadsworth
Tidal Visionary:

| Open
Name:Tidal Visionary
ManaCost:U
Types:Creature Merfolk Wizard
Text:no text
PT:1/1
A:AB$ ChooseColor | Cost$ T | Defined$ You | SubAbility$ DBAnimate | SpellDescription$ Target creature becomes the color of your choice until end of turn.
SVar:DBAnimate:DB$Animate | ValidTgts$ Creature | TgtPrompt$ Select target creature | Colors$ ChosenColor | OverwriteColors$ True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/tidal_visionary.jpg
End


On the battlefield:
Bad Moon
Crusade
2 Memnite

One of the Memnite's is targeted and made white. The Crusade gives both Memnite's +1/+1. Same with turning one black; both get the +1/+1 from the Bad Moon. Tested with a Serra Angel with same result.

Re: Card Development Questions

PostPosted: 21 Jul 2011, 06:38
by iamed2
For my first card I decided to pick a doozy: Clone Shell. It actually requires a minor addition to the code in order to work (in AbilityFactory_Reveal.digResolve(...),
Code: Select all
if (params.containsKey("Imprint"))
    host.addImprinted(chosen);
needs to be added somewhere.
I have it located in somewhere (the wrong place as far as organization goes) right now, and it adds the imprinted card properly so it shows up as Imprinted when you hover over the creature. However, when I destroy it, the list of imprinted cards is now suddenly empty.

Here is my code for the card:
| Open
Name:Clone Shell
ManaCost:5
Types:Artifact Creature Shapeshifter
Text:no text
PT:2/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ Imprint - When CARDNAME enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library in any order.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigReturn | TriggerDescription$ When CARDNAME dies, turn the exiled card face up. If it's a creature card, put it onto the battlefield under your control.
SVar:TrigDig:DB$Dig | DigNum$ 4 | DestinationZone$ Exile | Imprint$ True | DestinationZone2$ Library
SVar:TrigReturn:DB$ChangeZone | Defined$ Imprinted | Origin$ Exile | Destination$ Battlefield
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/clone_shell.jpg
End
Can anyone provide some help? I would love to get this card completed, it is complicated but I believe it can be a good example of the versatility of the card scripting.

Thanks!

Re: Card Development Questions

PostPosted: 21 Jul 2011, 10:09
by Sloth
jeffwadsworth wrote:Tidal Visionary:

| Open
Name:Tidal Visionary
ManaCost:U
Types:Creature Merfolk Wizard
Text:no text
PT:1/1
A:AB$ ChooseColor | Cost$ T | Defined$ You | SubAbility$ DBAnimate | SpellDescription$ Target creature becomes the color of your choice until end of turn.
SVar:DBAnimate:DB$Animate | ValidTgts$ Creature | TgtPrompt$ Select target creature | Colors$ ChosenColor | OverwriteColors$ True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/tidal_visionary.jpg
End


On the battlefield:
Bad Moon
Crusade
2 Memnite

One of the Memnite's is targeted and made white. The Crusade gives both Memnite's +1/+1. Same with turning one black; both get the +1/+1 from the Bad Moon. Tested with a Serra Angel with same result.
I've just tested Disciple of Kangee with 2 x Memnite and they both turn blue, but only the targeted gets flying.

Re: Card Development Questions

PostPosted: 21 Jul 2011, 14:35
by jeffwadsworth
iamed2 wrote:For my first card I decided to pick a doozy: Clone Shell. It actually requires a minor addition to the code in order to work (in AbilityFactory_Reveal.digResolve(...),
Code: Select all
if (params.containsKey("Imprint"))
    host.addImprinted(chosen);
needs to be added somewhere.
I have it located in somewhere (the wrong place as far as organization goes) right now, and it adds the imprinted card properly so it shows up as Imprinted when you hover over the creature. However, when I destroy it, the list of imprinted cards is now suddenly empty.

Here is my code for the card:
| Open
Name:Clone Shell
ManaCost:5
Types:Artifact Creature Shapeshifter
Text:no text
PT:2/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ Imprint - When CARDNAME enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library in any order.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigReturn | TriggerDescription$ When CARDNAME dies, turn the exiled card face up. If it's a creature card, put it onto the battlefield under your control.
SVar:TrigDig:DB$Dig | DigNum$ 4 | DestinationZone$ Exile | Imprint$ True | DestinationZone2$ Library
SVar:TrigReturn:DB$ChangeZone | Defined$ Imprinted | Origin$ Exile | Destination$ Battlefield
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/clone_shell.jpg
End
Can anyone provide some help? I would love to get this card completed, it is complicated but I believe it can be a good example of the versatility of the card scripting.

Thanks!
I can tell you right off the bat that you can not exile cards face-down in script yet.

Re: Card Development Questions

PostPosted: 21 Jul 2011, 14:55
by iamed2
jeffwadsworth wrote:I can tell you right off the bat that you can not exile cards face-down in script yet.
I am aware, but I figured it, like Necropotence, could be at least partially implemented.

Also, you say "yet". In the event that this is added, it would undoubtedly be a simple change.

Re: Card Development Questions

PostPosted: 21 Jul 2011, 16:51
by jeffwadsworth
iamed2 wrote:
jeffwadsworth wrote:I can tell you right off the bat that you can not exile cards face-down in script yet.
I am aware, but I figured it, like Necropotence, could be at least partially implemented.

Also, you say "yet". In the event that this is added, it would undoubtedly be a simple change.
Well, something like: ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Exile | FaceDown$ True

would be likely, but the Exile window would have to be updated to display "facedown card" or something.

Re: Card Development Questions

PostPosted: 25 Jul 2011, 06:40
by slowe
Pyromancer Ascension can be scripted
Code: Select all
Name:Pyromancer Ascension
ManaCost:1 R
Types:Enchantment
Text:no text
T:Mode$ SpellCast | ValidControllingPlayer$ You | ValidCard$ Instant.inYourYard,Sorcery.inYourYard | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigPutCounter | TriggerDescription$ Whenever you cast an instant or sorcery spell that has the same name as a card in your graveyard, you may put a quest counter on CARDNAME.
T:Mode$ SpellCast | ValidControllingPlayer$ You | ValidCard$ Instant,Sorcery | IsPresent$ Card.Self+countersGE2QUEST | OptionalDecider$ You | Execute$ TrigCopySpell | TriggerDescription$ Whenever you cast an instant or sorcery spell while CARDNAME has two or more quest counters on it, you may copy that spell. You may choose new targets for the copy.
SVar:TrigPutCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ QUEST | CounterNum$ 1
SVar:TrigCopySpell:AB$CopySpell | Defined$ TriggeredSpellAbility | Cost$ 0 | OptionalDecider$ You
End
with the addition of this block in Card.hasProperty:
Code: Select all
else if (Property.startsWith("inYourYard")) {
            if (CardFactoryUtil.xCount(this, "NamedInYourYard.CARDNAME") < 1) return false;
        }
("inYourYard" could be something more accurate and unwieldy, like "sameNameinYourYard")

It feels a little too close to hard-coding, as it's pretty unlikely the condition will ever be used by another card ... is this frowned upon?

Regardless, testing it turned up a couple interesting bugs. If a game ends with a spell along with one or more copies of that spell on the stack, the original card will be dead in future games. This is a form of the bug where a card is unplayable and can't be discarded, etc. until Forge is restarted. Initially, I thought it was because there was an issue with cards incorrectly sharing card IDs, but I was just confused because copies don't have their stack description updated to include the right ID.

Re: Card Development Questions

PostPosted: 26 Jul 2011, 01:42
by slapshot5
Hi all,

I'm trying to add Crown of Empires, Throne of Empires and Scepter of Empires. I've got the counting down with additions to xCount and conditions with this stuff in SpellAbility_Conditions:

Code: Select all
if(allM12Empires) {
           Player p = sa.getSourceCard().getController();
           boolean has = AllZoneUtil.isCardInPlay("Crown of Empires", p);
           has &= AllZoneUtil.isCardInPlay("Scepter of Empires", p);
           has &= AllZoneUtil.isCardInPlay("Throne of Empires", p);
           if(!has) return false;
        }
        if(notAllM12Empires) {
           Player p = sa.getSourceCard().getController();
           boolean has = AllZoneUtil.isCardInPlay("Crown of Empires", p);
           has &= AllZoneUtil.isCardInPlay("Scepter of Empires", p);
           has &= AllZoneUtil.isCardInPlay("Throne of Empires", p);
           if(has) return false;
        }
and
Code: Select all
if(params.containsKey("ConditionAllM12Empires"))
            setAllM12Empires(true);
        if(params.containsKey("ConditionNotAllM12Empires"))
            setNotAllM12Empires(true);
I'm trying to do Crown of Empires like this:
Code: Select all
Name:Crown of Empires
ManaCost:2
Types:Artifact
Text:no text
A:AB$ Tap | Cost$ 3 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | ConditionNotAllM12Empires$ True | SubAbility$ DBControl | SpellDescription$ Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires.
SVar:DBControl:DB$ GainControl | Defined$ Targeted | ConditionAllM12Empires$ True
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/crown_of_empires.jpg
End
But, if all 3 are in play, and I use Crown of Empires, the Stack get stuck with "1 to Resolve", but nothing visibly on the stack.

Does anyone have insight into this problem?

Thanks,
slapshot5