Adding similar cards
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Adding similar cards
by 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.
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.
-
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
by 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 ).
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
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
by Marek14 » 18 Oct 2009, 07:47
Isn't Marshalling Cry supposed to have flashback as well?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.)
Re: Adding similar cards
by 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.
-
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
by 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.
-
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
by 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.
Re: Adding similar cards
by Chris H. » 18 Oct 2009, 14:43
There appears to be several Flashback cards that are similar to existing code. They would not be to hard to add.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 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.
-
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
by 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).
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Adding similar cards
by zerker2000 » 18 Oct 2009, 17:47
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 .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.
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
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
by 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.
-
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
by 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.
-
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
by zerker2000 » 18 Oct 2009, 18:13
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.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.
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
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
27 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 11 guests