Page 3 of 4

Re: spRaiseDead

PostPosted: 23 Oct 2009, 17:32
by Chris H.
DennisBergkamp wrote:Yes, "getType(String cardType)" will also return cards with changeling.
As for spells having changeling, I *think* this works correctly in forge.
I think that I remember a number of conversations in reference to changeling as this keyword was being written. I think you were concentrating on giving it to creatures and I think I mentioned that we had several existing spells that were supposed to have the keyword.

Beyond this, I can not remember much else but the conversations taking place. We may have just added the keyword to the spells and it is only now that a situation has come up where we could actually test whether or not this keyword is being recognized when it comes to spells.

Re: spReturnGraveyardHandCreature

PostPosted: 23 Oct 2009, 18:48
by DennisBergkamp
Ah yes, I remember this conversation too.
Well, this brings up a good question, how do we currently test this functionality (of the changeling keyword in spells) in MTGForge?

I'm pretty sure right now "fetch cards" that fetch a creature type will also get spells that have changeling (Treefolk Harbinger for instance should be able to grab a Wings of Velis Vel).

Another case would be Gilt-Leaf Archdruid... I haven't tested this yet with non-creature spells that have changeling though.

Re: spRaiseDead

PostPosted: 23 Oct 2009, 21:31
by Chris H.
I put together a test deck and tried it out to see what would happen.

When Treefolk Harbinger comes into play, a list is displayed containing not only Treefolk/Forest cards but we also get the three spells with changeling.

I am looking at the code for Treefolk Harbinger and it appears that it is building the list to choose from rather than getting the list from CardList.

Code: Select all
public void execute()
{
   PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
   CardList cards = new CardList(lib.getCards());
   CardList treefolkForests = new CardList();
         
   for (int i=0;i<cards.size();i++)
   {
      if((cards.get(i).getType().contains("Treefolk") || cards.get(i).getKeyword().contains("Changeling"))
              || cards.get(i).getType().contains("Forest"))
      {
                treefolkForests.add(cards.get(i));
      }
   }

Re: spReturnGraveyardHandCreature

PostPosted: 23 Oct 2009, 21:42
by DennisBergkamp
Yes.

(cards.get(i).getType().contains("creatureType") will not return cards with changeling. However, cards.get(i).getType("creatureType") does.

Re: spReturnGraveyardHandCreature

PostPosted: 24 Oct 2009, 03:37
by Rob Cashwalker
CardList.getValidCards() :
Code: Select all
        if (! incR[0].equals("Permanent"))         // Since the cards don't actually say "Permanent"
           tmpList = getType(incR[0]);

        if (incR.length > 1)
.
.
.
                    else
                       if (exR[j].startsWith("non"))   // ... Other Card types
                          r = r && (! c.getType().contains(exR[j].substring(3)));
                       else
                          r = r && (c.getType().contains(exR[j]));
So yeah, the goblins are returned by the very first line, because that's the only restriction. So if the changeling is already dealt with, then I don't know.

Re: spRaiseDead

PostPosted: 24 Oct 2009, 11:37
by Chris H.
I think that I will have to use the code from Treefolk Harbinger to create a list (inside of my keyword) which will include the spells with the changeling keyword.

Last night I added the code to create the spell.setDescription() and the spell.setStackDescription(). I used your last keyword as a template and that helped me to learn a wee bit more. This keyword should be charm ready.

I think that once I get the new list code hacked in that this keyword will be finished. I should have this submitted for Dennis before his next release. I have not had a chance to explore the SVN so I will submit my work here on the forum.

Re: spReturnGraveyardHandCreature

PostPosted: 24 Oct 2009, 15:49
by silly freak
wouldn't it be better to check Changeling in CardList.getType instead of the keyword? i mean, it would take a distinction between, for example, warrior and aura, but that's the cleaner solution in my opinion

Re: spRaiseDead

PostPosted: 24 Oct 2009, 19:11
by Chris H.
silly freak wrote:wouldn't it be better to check Changeling in CardList.getType instead of the keyword? i mean, it would take a distinction between, for example, warrior and aura, but that's the cleaner solution in my opinion
`
Yes, I agree. I spent several days trying to get the CardList.getType() method to work this way. It will return creatures with the changeling keyword but it fails to return spells with the changeling keyword. :(

It might be possible to fix the CardList.getType() method. I was able to modify the code from the Treefolk Harbinger card and my keyword will now return spells with the changeling keyword. 8)

It is a hack, but then again, my keyword is a hack of the original Raise Dead code. :lol:

Re: spReturnGraveyardHandCreature

PostPosted: 24 Oct 2009, 20:27
by silly freak
the Card.getType() list contains all supertypes, types and subtypes, right? and what CardList does is basically to
  • check if the type is contained or
  • if the requested type is a creature type, and the card has changeling
however, the problem is that tribal spells are not recognized...

i'll try that, maybe I get something to work. could you point me to some cards that i can use for testing? cards that check for subtypes, both creature and noncreature, just by means of cardlist?

Re: spRaiseDead

PostPosted: 24 Oct 2009, 22:00
by Chris H.
silly freak wrote:the Card.getType() list contains all supertypes, types and subtypes, right? and what CardList does is basically to
  • check if the type is contained or
  • if the requested type is a creature type, and the card has changeling
however, the problem is that tribal spells are not recognized...

i'll try that, maybe I get something to work. could you point me to some cards that i can use for testing? cards that check for subtypes, both creature and noncreature, just by means of cardlist?
`
With my keyword I need to be able to feed the Card.getType() a string of "Goblin" and the list returned needs to include:

Goblin creature subtypes (Prickly Boggart)
spells with Goblin creature subtype (Tarfire)
Creatures with Changeling keyword (Moonglove Changeling)
spells with Changeling keyword (Nameless Inversion)

Currently, Card.getType() returns three of the four cards above in a list, but fails to include the Nameless Inversion spell.

Re: spRaiseDead

PostPosted: 25 Oct 2009, 01:48
by Chris H.
EDIT:

I have decided to rename this keyword to:

spRaiseDead



This keyword is almost finished.

This keyword will return one or more creatures from your graveyard to your hand. I adjusted the AI when a possible situation came up that could cause some problems for the computer.

The syntax for this keyword:

spRaiseDead:num/Quantifier/Type:SpellDescription:StackDescription

The last two fields are optional if the card is not a charm. This keyword will create the spell and stack descriptions if you do not include the last two fields.

{num} is the number of creatures that are returned. (Required)

{Quantifier} = "Some". Use if card states "Return up to " {num} " target creature cards from your graveyard to your hand."

{Type} is assumed to be all creature types. This field will let you set it to a specific type, such as Goblin, Elf etc.


There should be three new cards that can be added with this keyword.


There are currently four spells cards using the "Raise Dead" code and they can be converted to this keyword:


Disentomb
B
Sorcery
no text
spRaiseDead:1

Raise Dead
B
Sorcery
no text
spRaiseDead:1

Recover
2 B
Sorcery
Draw a card.
spRaiseDead:1
Cantrip

Return to Battle
B
Sorcery
no text
spRaiseDead:1


I will post the code in the near future. I want to make sure that I remove the useless code and comments. :mrgreen:

Re: spReturnGraveyardHandCreature

PostPosted: 25 Oct 2009, 02:02
by DennisBergkamp
Nice, so did you get Changeling in spells working? I could probably hack it in if you haven't :)

Re: spRaiseDead

PostPosted: 25 Oct 2009, 02:17
by Chris H.
DennisBergkamp wrote:Nice, so did you get Changeling in spells working? I could probably hack it in if you haven't :)
`
Yep, I got it working. I copied and modified the treefolk code.

Re: spReturnGraveyardHandCreature

PostPosted: 25 Oct 2009, 02:46
by DennisBergkamp
Great, I think it's time for a new version soon :mrgreen:

Re: spReturnGraveyardHandCreature

PostPosted: 25 Oct 2009, 10:27
by silly freak
the mystery is now solved... it turns out that the changeling spells are missing "Tribal" in cards.txt

i'm correcting this, and will commit the file