Page 2 of 4

Re: spReturnGraveyardHandCreature

PostPosted: 20 Oct 2009, 06:58
by zerker2000
Chris H. wrote:I would like to add Boggart Birth Rite but I would need a separate way of filtering a list of Goblin type creatures. I may try to figure this out, but I have not yet found anything that looks promising in CardFactoryUtil.
Try looking in CardList :) (the line of code would be grave.getType("Goblin").

Re: spReturnGraveyardHandCreature

PostPosted: 20 Oct 2009, 10:07
by Marek14
zerker2000 wrote:
Chris H. wrote:I would like to add Boggart Birth Rite but I would need a separate way of filtering a list of Goblin type creatures. I may try to figure this out, but I have not yet found anything that looks promising in CardFactoryUtil.
Try looking in CardList :) (the line of code would be grave.getType("Goblin").
However, it wouldn't be entirely correct implementation of Boggart Birth Rite, since it doesn't say it has to return a CREATURE. You can use Boggart Birth Rite to return Tarfire or Nameless Inversion, for example.

Re: spRaiseDead

PostPosted: 20 Oct 2009, 10:49
by Chris H.
zerker2000 wrote:Try looking in CardList :) (the line of code would be grave.getType("Goblin").
`
I had a similar idea last night and before I went to bed I did the following and it worked, at least for goblin creatures. I replaced the "Creature" with a string variable in the statement:

list = list.getType(thisCreatureType);

Code: Select all
CardList getGraveCreatures()
{
   PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
   CardList list = new CardList(grave.getCards());
   list = list.getType(thisCreatureType);
   return list;
}

Re: spRaiseDead

PostPosted: 20 Oct 2009, 10:59
by Chris H.
Marek14 wrote:However, it wouldn't be entirely correct implementation of Boggart Birth Rite, since it doesn't say it has to return a CREATURE. You can use Boggart Birth Rite to return Tarfire or Nameless Inversion, for example.
`
I just ran a test using Tarfire with my code and the code will list both the goblin creature and the Tarfire spell as candidates to return. I have no idea how the computer will handle this :?: I will have to run another test.

At this time i have no idea how to handle cards with changeling.

Re: spReturnGraveyardHandCreature

PostPosted: 20 Oct 2009, 17:14
by Chris H.
Chris H. wrote:I just ran a test using Tarfire with my code and the code will list both the goblin creature and the Tarfire spell as candidates to return. I have no idea how the computer will handle this :?: I will have to run another test.

At this time i have no idea how to handle cards with changeling.
`
The computer can now use the Boggart Birth Rite spell to return the Tarfire spell. I found a method in CardFactoryUtil which will return a random card from the constructed list which would just include Goblins and Tarfire.

Changeling is a keyword. This keyword is included with the creatures and the spells that have the Changeling ability. I wonder if there is a way to include Changeling cards with the list that is created in getGraveCreatures(). :-k

Re: spReturnGraveyardHandCreature

PostPosted: 20 Oct 2009, 18:09
by Rob Cashwalker
I would suggest the CardList.getValidCards(String with target restrictions) (or something to that effect) that I included with the DestroyTgt syntax. That way you could target any combination of types or non-types, (like Creature.Zombie) based on the string parsed from the keyword.

Re: spRaiseDead

PostPosted: 22 Oct 2009, 14:52
by Chris H.
Rob Cashwalker wrote:I would suggest the CardList.getValidCards(String with target restrictions) (or something to that effect) that I included with the DestroyTgt syntax. That way you could target any combination of types or non-types, (like Creature.Zombie) based on the string parsed from the keyword.
`
Thank you, Rob.

I have looked at the DestroyTgt code and the CardList file. Looks interesting, I am still trying to figure out how to use the getValidCards() method. The spReturnGraveyardHandOther version of this keyword has not yet been started, but I think it would benefit.

spReturnGraveyardHandOther would be used fpr Regrowth and similar cards. It will need to be able to return target:

any
artifact
enchantment
sorcery
permanent
multicolored
instant
green

card from your graveyard to your hand.

I have not yet started the spReturnGraveyardHandOther keyword version at this time. The spReturnGraveyardHandCreature keyword version is giving me problems. I have Boggart Birth Rite working for the most part. Although I have not yet had any luck in adding cards with the keyword Changeling to the list of cards that we could return.

At some point I will either get it to work or not. I will then try to add the last two fields to this keyword so that it can be used with charm spells.

Re: spReturnGraveyardHandCreature

PostPosted: 22 Oct 2009, 16:32
by Rob Cashwalker
To be honest, I was looking at the code in relation to possible application in the spDamageTgt keyword, and now I'm not sure how that code works either. It's kinda wonky.

Re: spRaiseDead

PostPosted: 23 Oct 2009, 01:26
by Chris H.
I now have CardList.getValidCards() working for the most part with Boggart Birth Rite. It is still buggy as heck, needs a lot more work before it is finished.

When I first tried getValidCards() I had a test deck with no creatures with changeling but it did have Nameless Inversion. Nameless Inversion is not recognized but the Moonglove Changeling that I just added to the deck is recognized.

Re: spRaiseDead

PostPosted: 23 Oct 2009, 14:29
by Chris H.
Chris H. wrote:I now have CardList.getValidCards() working for the most part with Boggart Birth Rite. It is still buggy as heck, needs a lot more work before it is finished.

When I first tried getValidCards() I had a test deck with no creatures with changeling but it did have Nameless Inversion. Nameless Inversion is not recognized but the Moonglove Changeling that I just added to the deck is recognized.
`
I think that I have swatted all of the bugs. :)

Boggart Birth Rite will return Goblin creatures and Goblin spells. It will also return Creatures (only) with changeling.

Spells with changeling are not being recognized as returnable. I now suspect that something is clearing the Changeling keyword for spells. I do not think that I will be able to correct this by myself.

I still need to do some play testing and I need to add the descriptive fields for charms. This keyword is getting close to being finished but I will need some more time to wrap things up. :wink:

Re: spReturnGraveyardHandCreature

PostPosted: 23 Oct 2009, 15:13
by Rob Cashwalker
What's your valid target string?

Re: spRaiseDead

PostPosted: 23 Oct 2009, 15:23
by Chris H.
Rob Cashwalker wrote:What's your valid target string?
`
Code: Select all
CardList getGraveCreatures()
{
   PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
   CardList list = new CardList(grave.getCards());
   String[] targetAsArray = {targetTypeToReturn};
   list = list.getValidCards(targetAsArray);
                                                            
   return list;
}
`
targetAsArray is set to either "Creature" or "Goblin", "Goblin" will return all goblin cards but will only return changeling creatures.

Re: spReturnGraveyardHandCreature

PostPosted: 23 Oct 2009, 16:19
by Rob Cashwalker
looking at the code, I don;t know why it would work for some changelings and not others, because it doesn't check for changeling at all, and I now realize it should.

Re: spRaiseDead

PostPosted: 23 Oct 2009, 16:51
by Chris H.
Rob Cashwalker wrote:looking at the code, I don;t know why it would work for some changelings and not others, because it doesn't check for changeling at all, and I now realize it should.
`
I realize that I am probably getting in over my head. If I understand, getValidCards(String Restrictions[]) calls getType(String cardType) which in turn has an "if(card.getType().contains(cardType)". At the end of all of the ANDs is card.getKeyword().contains("Changeling").

I think the original getType(String cardType) would have returned all of the changeling creatures if my original test deck had contained any at that time. #-o

My original test deck only had the spell Nameless Inversion. I wonder if Dennis had any luck giving spells Changeling when the code was written?

Re: spReturnGraveyardHandCreature

PostPosted: 23 Oct 2009, 17:12
by DennisBergkamp
Yes, "getType(String cardType)" will also return cards with changeling.
As for spells having changeling, I *think* this works correctly in forge.