It is currently 24 Apr 2024, 03:15
   
Text Size

spRaiseDead

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: spReturnGraveyardHandCreature

Postby zerker2000 » 20 Oct 2009, 06:58

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").
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: spReturnGraveyardHandCreature

Postby Marek14 » 20 Oct 2009, 10:07

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.
Marek14
Tester
 
Posts: 2761
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 297 times

Re: spRaiseDead

Postby Chris H. » 20 Oct 2009, 10:49

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;
}
Last edited by Chris H. on 03 Nov 2009, 17:19, edited 1 time in total.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spRaiseDead

Postby Chris H. » 20 Oct 2009, 10:59

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.
Last edited by Chris H. on 03 Nov 2009, 17:19, edited 1 time in total.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spReturnGraveyardHandCreature

Postby Chris H. » 20 Oct 2009, 17:14

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
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spReturnGraveyardHandCreature

Postby Rob Cashwalker » 20 Oct 2009, 18:09

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.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: spRaiseDead

Postby Chris H. » 22 Oct 2009, 14:52

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.
Last edited by Chris H. on 03 Nov 2009, 17:19, edited 2 times in total.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spReturnGraveyardHandCreature

Postby Rob Cashwalker » 22 Oct 2009, 16:32

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.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: spRaiseDead

Postby Chris H. » 23 Oct 2009, 01:26

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.
Last edited by Chris H. on 03 Nov 2009, 17:20, edited 1 time in total.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spRaiseDead

Postby Chris H. » 23 Oct 2009, 14:29

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:
Last edited by Chris H. on 03 Nov 2009, 17:20, edited 1 time in total.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spReturnGraveyardHandCreature

Postby Rob Cashwalker » 23 Oct 2009, 15:13

What's your valid target string?
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: spRaiseDead

Postby Chris H. » 23 Oct 2009, 15:23

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.
Last edited by Chris H. on 03 Nov 2009, 17:20, edited 1 time in total.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spReturnGraveyardHandCreature

Postby Rob Cashwalker » 23 Oct 2009, 16:19

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.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: spRaiseDead

Postby Chris H. » 23 Oct 2009, 16:51

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?
Last edited by Chris H. on 03 Nov 2009, 17:21, edited 1 time in total.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: spReturnGraveyardHandCreature

Postby DennisBergkamp » 23 Oct 2009, 17:12

Yes, "getType(String cardType)" will also return cards with changeling.
As for spells having changeling, I *think* this works correctly in forge.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 57 guests

cron

Who is online

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

Login Form