It is currently 29 Apr 2024, 05:22
   
Text Size

Adding similar cards

Post MTG Forge Related Programming Questions Here

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

Re: Adding similar cards

Postby Rob Cashwalker » 18 Oct 2009, 02:39

Looks good as far as the code goes. But there's a block of code that handles these types of cards, all you have to do is add the name to the if-block header, and then into the rest of the if-blocks for the appropriate boosts.

This is another prime example of a function that I haven't gotten around to making into a keyword, if you think you have the guts. I wrote the monster block of code before Rares did the first Pump keyword.

Keep in mind that the canPlayAI isn't a guarantee the computer will play the spell, but I think I've heard the same complaint from others about the other similar cards. To be honest, now that I've had more experience with the code, I suspect the AI code is wrong in the first place.
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: Adding similar cards

Postby zerker2000 » 18 Oct 2009, 05:13

Any AI which is hard-coded into the cards is horrible by definition(you should have heard my computer scientist stepdad's reaction when he found out that was how it worked), the question is how good this AI is at beating the average MTGForge user(cont.: after being beaten by it the first five times he played forge :D).
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: Adding similar cards

Postby Marek14 » 18 Oct 2009, 07:47

Chris H. wrote:A new spell:

(NOTE: In my tests I could not get the computer to cast this spell even though it was attacking with four 1/1 creatures. I copied the AI code from the block of code which covers most of these cards. I modified the code from Titanic Ultimatum for the rest of this spell. I also tried the test with Glorious Charge and the computer once again failed to cast this spell even though it was attacking with four creatures.)

Isn't Marshalling Cry supposed to have flashback as well?
Marek14
Tester
 
Posts: 2761
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 297 times

Re: Adding similar cards

Postby Chris H. » 18 Oct 2009, 10:47

Marek14 wrote:Isn't Marshalling Cry supposed to have flashback as well?
`
Yeah, I included the Flashback in the code. You have to scroll to the very bottom of the spell's method to see it ... it is just a simple tack-on so to speak. :)
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: Adding similar cards

Postby Chris H. » 18 Oct 2009, 11:02

Rob Cashwalker wrote:Looks good as far as the code goes. But there's a block of code that handles these types of cards, all you have to do is add the name to the if-block header, and then into the rest of the if-blocks for the appropriate boosts.

This is another prime example of a function that I haven't gotten around to making into a keyword, if you think you have the guts. I wrote the monster block of code before Rares did the first Pump keyword.

Keep in mind that the canPlayAI isn't a guarantee the computer will play the spell, but I think I've heard the same complaint from others about the other similar cards. To be honest, now that I've had more experience with the code, I suspect the AI code is wrong in the first place.
`
I have been working on another keyword, but I am having a terrible time figuring out how to parse various fields of data. Variable number of fields is also giving me a hard time.

I have this little trick up my sleeve planned for this keyword. I wanted to see if I could pass to the keyword a field that would in essence tell the keyword to tack on a flashback or buyback for example. Parsing the fields is killing me and I am not having much luck looking at the complicated keywords that you have written. I may just need to give it more time.

In my case, it is not a lack of guts, It is a lack of skill, knowledge and ability. I am still reading the Java tutorial and my work on the code is kind of similar to the exercises that we see at the end of the chapter in a school's text book. :roll:
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: Adding similar cards

Postby Marek14 » 18 Oct 2009, 13:09

Found a card that should be easy: Parallel Evolution. It's the same thing Rhys the Redeemed does, except it works on all tokens, not just yours.
Marek14
Tester
 
Posts: 2761
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 297 times

Re: Adding similar cards

Postby Chris H. » 18 Oct 2009, 14:43

Marek14 wrote:Found a card that should be easy: Parallel Evolution. It's the same thing Rhys the Redeemed does, except it works on all tokens, not just yours.
There appears to be several Flashback cards that are similar to existing code. They would not be to hard to add.

There is a much longer list of spells that require a target, like Coffin Purge and Morgue Theft. They would have to be handled in the same situation as the two cards that Dennis added Flashback in the 10-18 version.

If I can finish the Raise Dead keyword, I may then try to add the Morgue Theft spell. :wink:
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: Adding similar cards

Postby DennisBergkamp » 18 Oct 2009, 17:30

Ah, yes the flashback part of Morgue Theft should be easy (can be done the conventional way, there's no targeting involved).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Adding similar cards

Postby zerker2000 » 18 Oct 2009, 17:47

Chris H. wrote:In my case, it is not a lack of guts, It is a lack of skill, knowledge and ability. I am still reading the Java tutorial and my work on the code is kind of similar to the exercises that we see at the end of the chapter in a school's text book. :roll:
Hey, I never even read that thing all the way through, and if you can understand/use ints, Strings, booleans, ArrayLists, and basic looping/branching, it's more useful looking at forge classfiles. These come up way more often than pure java, most of the ones you'll use obviously have lots of examples in cardFactory(and I am willing to explain how any of the forge classes work, though it might take some time for me to figure out if it's not one of the common ones). If you feel like you're doing exercises, try making a card that has a mechanic you haven't made before (e.g. Tombstone Stairwell). It will probably take some time, but it certainly won't feel like a book exercise :).
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: Adding similar cards

Postby Chris H. » 18 Oct 2009, 17:59

DennisBergkamp wrote:Ah, yes the flashback part of Morgue Theft should be easy (can be done the conventional way, there's no targeting involved).
`
Hmm, are you saying the "Return target creature from the graveyard ..." can be done the simple way? It would be cool if it worked out OK, but I would try the long way if it is required. Just need to finish the spReturnGraveyardHandCreature keyword first. This way I will be familiar with the SpellAbility section of the code.
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: Adding similar cards

Postby Chris H. » 18 Oct 2009, 18:06

zerker2000 wrote:Hey, I never even read that thing all the way through, and if you can understand/use ints, Strings, booleans, ArrayLists, and basic looping/branching, it's more useful looking at forge classfiles. These come up way more often than pure java, most of the ones you'll use obviously have lots of examples in cardFactory(and I am willing to explain how any of the forge classes work, though it might take some time for me to figure out if it's not one of the common ones). If you feel like you're doing exercises, try making a card that has a mechanic you haven't made before (e.g. Tombstone Stairwell). It will probably take some time, but it certainly won't feel like a book exercise :).
`
I was not complaining about book exercises. Reading a textbook by itself was never enough for me. I tended to do all of the exercises and not just the ones the teacher assigned to the class.

Of course, at my advanced age, my school days are a distant memory. :wink:
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: Adding similar cards

Postby zerker2000 » 18 Oct 2009, 18:13

Chris H. wrote:
DennisBergkamp wrote:Ah, yes the flashback part of Morgue Theft should be easy (can be done the conventional way, there's no targeting involved).
`
Hmm, are you saying the "Return target creature from the graveyard ..." can be done the simple way? It would be cool if it worked out OK, but I would try the long way if it is required. Just need to finish the spReturnGraveyardHandCreature keyword first. This way I will be familiar with the SpellAbility section of the code.
I think he is saying that flashback is easy to add in once you have the keyword. As for the keyword, have you looked at e.g. Tradewind Rider code? I think its "tap two creatures" code could be modified to target a creature in the graveyard instead, and the "field to hand" code be modified to return from graveyard instead.
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

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 99 guests


Who is online

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

Login Form