It is currently 07 Sep 2025, 21:38
   
Text Size

spRaiseDead

Post MTG Forge Related Programming Questions Here

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

Re: spRaiseDead

Postby Chris H. » 23 Oct 2009, 17:32

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.
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, 18:48

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.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: spRaiseDead

Postby Chris H. » 23 Oct 2009, 21:31

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));
      }
   }
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, 21:42

Yes.

(cards.get(i).getType().contains("creatureType") will not return cards with changeling. However, cards.get(i).getType("creatureType") does.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: spReturnGraveyardHandCreature

Postby Rob Cashwalker » 24 Oct 2009, 03:37

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.
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. » 24 Oct 2009, 11:37

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.
Last edited by Chris H. on 03 Nov 2009, 17:22, 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 silly freak » 24 Oct 2009, 15:49

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
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: spRaiseDead

Postby Chris H. » 24 Oct 2009, 19:11

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:
Last edited by Chris H. on 03 Nov 2009, 17:22, 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 silly freak » 24 Oct 2009, 20:27

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?
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: spRaiseDead

Postby Chris H. » 24 Oct 2009, 22:00

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.
Last edited by Chris H. on 03 Nov 2009, 17:22, 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. » 25 Oct 2009, 01:48

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:
Last edited by Chris H. on 03 Nov 2009, 17:23, 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 DennisBergkamp » 25 Oct 2009, 02:02

Nice, so did you get Changeling in spells working? I could probably hack it in if you haven't :)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: spRaiseDead

Postby Chris H. » 25 Oct 2009, 02:17

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.
Last edited by Chris H. on 03 Nov 2009, 17:23, 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 » 25 Oct 2009, 02:46

Great, I think it's time for a new version soon :mrgreen:
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: spReturnGraveyardHandCreature

Postby silly freak » 25 Oct 2009, 10:27

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
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 66 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 66 users online :: 0 registered, 0 hidden and 66 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 66 guests

Login Form