Page 69 of 141

Re: Card Development Questions

PostPosted: 31 Oct 2011, 21:45
by jeffwadsworth
Here is my attempted java code for getting the total number of colored creatures on the controllers battlefield. My java knowledge is next to NULL.

| Open
if (sq[0].contains("ColoredCreatures")) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
someCards = someCards.filter(CardListFilter.CREATURES);

final String[] colors = { "GREEN", "WHITE", "RED", "BLUE", "BLACK" };

for (int i = 0; i < colors.length; i++) {
if (!someCards.getColor(colors[i]).isEmpty()) {
n++;
}
}
return CardFactoryUtil.doXMath(n, m, c);
}


EDIT: The colors are lower-case...wow, that was a waste of time.

Re: Card Development Questions

PostPosted: 31 Oct 2011, 22:29
by slapshot5
Try this:

Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();

return CardFactoryUtil.doXMath(list(), m, c);
}
-slapshot5

Re: Card Development Questions

PostPosted: 31 Oct 2011, 22:50
by jeffwadsworth
slapshot5 wrote:Try this:

Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();

return CardFactoryUtil.doXMath(list(), m, c);
}
-slapshot5
The code is supposed to work like the Domain code for land. This counts the creatures of the same color more than once. I will fool around with it. Thanks.

Re: Card Development Questions

PostPosted: 01 Nov 2011, 04:17
by jeffwadsworth
Cheers.

Re: Card Development Questions

PostPosted: 01 Nov 2011, 04:35
by slapshot5
jeffwadsworth wrote:
slapshot5 wrote:Try this:

Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();

return CardFactoryUtil.doXMath(list(), m, c);
}
-slapshot5
The code is supposed to work like the Domain code for land. This counts the creatures of the same color more than once. I will fool around with it. Thanks.
Oh. Have a look at Constant.Color.ONLY_COLORS and check capitalization when comparing colors. It is inconsistent at best, and it makes a difference.

-slapshot5

Re: Card Development Questions

PostPosted: 01 Nov 2011, 04:45
by jeffwadsworth
slapshot5 wrote:
jeffwadsworth wrote:
slapshot5 wrote:Try this:

Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();

return CardFactoryUtil.doXMath(list(), m, c);
}
-slapshot5
The code is supposed to work like the Domain code for land. This counts the creatures of the same color more than once. I will fool around with it. Thanks.
Oh. Have a look at Constant.Color.ONLY_COLORS and check capitalization when comparing colors. It is inconsistent at best, and it makes a difference.

-slapshot5
Yeah, it is lowercase for the colors. For some reason, I thought it was uppercase.

Re: Card Development Questions

PostPosted: 01 Nov 2011, 05:09
by jeffwadsworth
Wow. I never thought summing up some variables would be such a big deal.

| Open
SVar:Y:Count$ColoredCreatures
SVar:Z:Count$Domain
SVar:X:Count$SVar:Y/Plus.Z


This does not work. Of course, I am simply trying to sum Y and Z. Any ideas?

Re: Card Development Questions

PostPosted: 01 Nov 2011, 06:38
by Hellfish
SVar for xCounting isn't used like that. Try this:
Code: Select all
SVar:X:SVar$Y/Plus.Z

Re: Card Development Questions

PostPosted: 01 Nov 2011, 10:30
by moomarc
Just finished Tombstone Stairwell =D> . Firstly, I realised why I thought we could cheat the token destruction if it leaves play by destroying all Tombspawn tokens. It's a World Enchantment so I don't think there could ever be more than one Tombstone Stairwell in play. But I stuck to non-hacked solution anyway. :mrgreen:
Code: Select all
Name:Tombstone Stairwell
ManaCost:2 B B
Types:World Enchantment
Text:no text
K:Cumulative upkeep:1 B
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | TriggerZones$ Battlefield | IsPresent$ Card.Self | Execute$ TrigTokenYou | TriggerDescription$ At the beginning of each upkeep, if CARDNAME is on the battlefield, each player puts a 2/2 black Zombie creature token with haste named Tombspawn onto the battlefield for each creature card in his or her graveyard.
SVar:TrigTokenYou:DB$Token | TokenAmount$ X | TokenName$ Tombspawn | TokenTypes$ Creature,Zombie | TokenOwner$ You | TokenColors$ Black | TokenPower$ 2 | TokenToughness$ 2 | TokenKeywords$ Haste | SubAbility$ TrigTokenOpp | RememberTokens$ True
SVar:TrigTokenOpp:DB$Token | TokenAmount$ Y | TokenName$ Tombspawn | TokenTypes$ Creature,Zombie | TokenOwner$ Opponent | TokenColors$ Black | TokenPower$ 2 | TokenToughness$ 2 | TokenKeywords$ Haste | RememberTokens$ True
SVar:X:Count$TypeInYourYard.Creature
SVar:Y:Count$TypeInOppYard.Creature
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Player | TriggerZones$ Battlefield | Execute$ DestroyRemembered | TriggerDescription$ At the beginning of each end step or when CARDNAME leaves the battlefield, destroy all tokens put onto the battlefield with CARDNAME. They can't be regenerated.
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DestroyRemembered | Secondary$ True | TriggerDescription$ At the beginning of each end step or when CARDNAME leaves the battlefield, destroy all tokens put onto the battlefield with CARDNAME. They can't be regenerated.
SVar:DestroyRemembered:DB$DestroyAll | Cost$ 0 | ValidCards$ Creature.IsRemembered | NoRegen$ True | SubAbility$ DBCleanUp
SVar:DBCleanUp:DB$Cleanup | ClearRemembered$ True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/tombstone_stairwell.jpg
SetInfo:MIR|Rare|http://magiccards.info/scans/en/mr/47.jpg
End
Let me know if anyone sees a problem. Worked as expected in all the test scenarios I tried.

Edit: @Jeff - I saw you sneaking Pure Reflection out from under my nose from my not-so-secret todo list [-X Just kidding. Thanks. I've uncommented it's token download link.

Re: Card Development Questions

PostPosted: 01 Nov 2011, 10:48
by Iran
Any chance to have Splice onto Arcane in Forge?

Thanks

Re: Card Development Questions

PostPosted: 01 Nov 2011, 12:37
by moomarc
Alrighty... on to Saproling Burst. The basic card is
Code: Select all
Name:Saproling Burst
ManaCost:4 G
Types:Enchantment
Text:no text
K:Fading:7
A:AB$ Token | Cost$ SubCounter<1/FADE> | TokenAmount$ 1 | TokenName$ Saproling | TokenTypes$ Creature,Saproling | TokenOwner$ You | TokenColors$ Green | TokenPower$ X | TokenToughness$ X |  RememberTokens$ True | SpellDescription$ Put a green Saproling creature token onto the battlefield. It has "This creature's power and toughness are each equal to the number of fade counters on CARDNAME."
SVar:X:Count$CardCounters.FADE
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DestroyRemembered | TriggerDescription$ When CARDNAME leaves the battlefield, destroy all tokens put onto the battlefield with CARDNAME. They can't be regenerated.
SVar:DestroyRemembered:DB$DestroyAll | Cost$ 0 | ValidCards$ Creature.IsRemembered | NoRegen$ True | SubAbility$ DBCleanUp
SVar:DBCleanUp:DB$Cleanup | ClearRemembered$ True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/saproling_burst.jpg
End
The obvious problem though is that the tokens' P/T doesn't change as Saproling Burst loses fade counters. Is there a proper way to link the tokens' P/T to a specific card/UID?

Edit: I tried adding the following to try achieve the desired effect, but I've obviously missed something seeing as it's not working. Basically its a state based static trigger that animates all remembered saprolings with P/T=Current number of fade counters.
Code: Select all
T:Mode$ Always | TriggerZones$ Battlefield | Static$ True
SVar:SpecialAnimate:AB$Animate | Cost$ 0 | ValidCard$ Creature.IsRemembered | Power$ Y | Toughness$ Y | Permanent$ True
SVar:Y:Count$CardCounters.FADE

Re: Card Development Questions

PostPosted: 01 Nov 2011, 15:56
by jeffwadsworth
moomarc wrote:Edit: @Jeff - I saw you sneaking Pure Reflection out from under my nose from my not-so-secret todo list [-X Just kidding. Thanks. I've uncommented it's token download link.
I stole it like a thief in the night. I just go down the list of cards on the Wiki page. That page was a secret to me until now...much like Sol's Myr Battlesphere cost fix.

As for the Saproling Burst, I do not believe it can be scripted right now. The tokens would have to have a staticability that would check the SB for its fade counters, etc. What if you have two or more. I believe you would need a way to reference the SB in script.

Sloth, thanks for cleaning up my silly text mistake. Won't happen again.

Re: Card Development Questions

PostPosted: 01 Nov 2011, 22:44
by Roujin
Hi there,
I've just recently found this great program, played the quest mode a LOT the last few days :lol:
Now I wanted to test play a deck idea, but found that some of the cards I wanted to use are not yet implemented in Forge.

So I had a go at the card scripting API, and tried to implement Aphetto Dredging.
Unfortunately it does not work correctly.
Here's my current script:
Code: Select all
Name:Aphetto Dredging
ManaCost:3 B
Types:Sorcery
Text:no text
A:SP$ ChooseType | Cost$ 3 B | Defined$ You | Type$ Creature | SubAbility$ SVar=DBReturn | SpellDescription$ Choose a creature type. Return up to three target creature cards from your graveyard to your hand.
SVar:DBReturn:DB$ ChangeZone | Cost$ 0 | TargetMin$ 0 | TargetMax$ 3 | TgtPrompt$ Choose up to three target creatures of chosen type in your graveyard | ValidTgts$ Creature.YouCtrl+ChosenType | Origin$ Graveyard | Destination$ Hand
SVar:Rarity:Common
End
The problem is that as soon as I click the card, I get promptet to choose the up to three creatures from my graveyard. I can choose any creatures here, regardless of their type.
The choosing of a creature type only happens when the spell resolves. This does not have any effect currently.

A rule explanation found here http://magiccards.info/pds/en/28.html says
10/4/2004: You need to choose the creature type before choosing the targets.
Is there any way to do this currently in forge? Or have I wasted my time on a card that's currently impossible to implement due to technical restrictions?

The other cards I was missing for my deck are True Believer, Daru Spiritualist, Whipgrass Entangler, Test of Faith and Mindstorm Crown. Can anyone at a glance rule out any of these that are not currently possible to implement? (before I waste my time (again?) :D)


PS: just browsed the trunk source code and found out true believer was implemented since the latest release (which I'm using)

Re: Card Development Questions

PostPosted: 02 Nov 2011, 01:38
by jeffwadsworth
Most of those cards are scriptable. Learning is rarely a waste of time.

Re: Card Development Questions

PostPosted: 02 Nov 2011, 02:23
by friarsol
Aphetto Dredging is a strange card. I don't think I've ever seen Targeting wording like that before, and I'm not sure any other card even has that language.

Mindstorm Crown and Daru Spiritualist should be fine. I don't think the other two can be done. Whipgrass Entangler is closer to being possible, but I don't think it quite works. Test of Faith has no way of knowing if it's ability was the ability that prevented the damage to give counters. (I refer to this as the Scars of the Veteran requirement)