Page 4 of 5

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 03 Dec 2010, 14:49
by Chris H.
I have finished converting the abUntap and spUntap cards over to the new AF Untap. We still have 4 cards left. Llanowar Druid uses abUntapAll. Mobilize, To Arms! and Vitalize use spUntapAll.

I briefly peeked at the code in AbilityFactory_PermanentState. At the end there is a brief comment setting aside an area for Untap All/Tap All. This being a work in progress the 4 cards listed above can wait until we can finish this section of code. :D

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 06 Dec 2010, 18:37
by Chris H.
Chris H. wrote:I have finished converting the abUntap and spUntap cards over to the new AF Untap.
`
Hmmm, just discovered that we have a small number of cards that still have "K:Untap". :mrgreen:

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 06 Dec 2010, 18:40
by Chris H.
I think that we may be getting close to reaching a point where all of the cards have been converted, although there are still a number to convert.

I was curious and I searched my local copy and found that 1,816 cards now have "A:AB$" or "A:SP$" ... :shock:

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 06 Dec 2010, 18:48
by friarsol
Wow 1800? That's pretty ridiculous considering how long the system has been in place. I wish there was an easier way than combing through code blocks to see how many hardcoded stuff can be converted to AFs.

If anyone notices any glaring bugs in the AF stuff lemme know. I'll be on bug fixing duty since Chris said he wanted to release a new version this week.

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 06 Dec 2010, 21:33
by Chris H.
Actually, it turns out that most of the cards that have been converted were using the scripted form of the keyword. I recently searched the cardsfolder for cards containing spDestroyTgt and abDestroyTgt. It is not too bad ... time consuming and repetitive for the most part.

I would like to release the next beta this weekend. Gives us more time to convert cards and to fix bugs. At some point we need to start moving over the AI from the old scripted keyword code over to the AFs. I noticed the other day that the computer cast a $Discard spell at me and my hand was empty at the time.

I also tried to add this card. It works for the human but the X cost is causing problems for the AI.

Code: Select all
Name:Demonspine Whip
ManaCost:B R
Types:Artifact Equipment
Text:no text
K:eqPump 1:+0/+0
A:AB$Pump | Cost$ X | Defined$ Equipped | NumAtt$ +X | SpellDescription$ Equipped creature gets +X/+0 until end of turn.
SVar:X:Count$xPaid
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/demonspine_whip.jpg
End

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 06 Dec 2010, 21:39
by Sloth
Chris H. wrote:I was curious and I searched my local copy and found that 1,816 cards now have "A:AB$" or "A:SP$" ... :shock:
1800? This is just insane. Great work Chris. And I'm happy to here a new version is planned (I always feel guilty when someone posts that the AI makes stupid attacks).

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 06 Dec 2010, 22:10
by friarsol
Chris H. wrote:Actually, it turns out that most of the cards that have been converted were using the scripted form of the keyword. I recently searched the cardsfolder for cards containing spDestroyTgt and abDestroyTgt. It is not too bad ... time consuming and repetitive for the most part.

I would like to release the next beta this weekend. Gives us more time to convert cards and to fix bugs. At some point we need to start moving over the AI from the old scripted keyword code over to the AFs. I noticed the other day that the computer cast a $Discard spell at me and my hand was empty at the time.

I also tried to add this card. It works for the human but the X cost is causing problems for the AI.

Code: Select all
Name:Demonspine Whip
ManaCost:B R
Types:Artifact Equipment
Text:no text
K:eqPump 1:+0/+0
A:AB$Pump | Cost$ X | Defined$ Equipped | NumAtt$ +X | SpellDescription$ Equipped creature gets +X/+0 until end of turn.
SVar:X:Count$xPaid
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/demonspine_whip.jpg
End
Oh I figured most were just converting older keywords to new ones. I just meant I've definitely noticed cards that are hard-coded in CardFactory that totally can be converted over. Those are the ones that are going to be a pain to find, not a major pain once they are found, but more repetitive conversions like you are doing already.

A few examples are Greater Forgeling and Tradewind Rider. But there are many others.

The AI has been handling the AFs pretty decently from what I've noticed, but there definitely are edge cases that need to be considered and improved. The AI doesn't know how to handle X Payment yet. Paying X should be handled differently for each AF, and for some of them may have to wait until after the AI can activate SAs outside of its main phases to make sense. (Why would you pump your creature before you know if what is blocking it?)

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 07 Dec 2010, 00:41
by Chris H.
Yeah, I am trying to ignore those hard coded cards for as long as I can as they will require more of an effort. I guess that the hard coded Fog type cards will need to be converted.

BTW, I say your recent commit about adding Opponent to ValidCard. I remember holding off of converting the lose life type cards since I felt that they could use this type of option. I assume that I would be able to now use:

Code: Select all
  | ValidTgts$ Opponent | TgtPrompt$ Select target opponent |

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 07 Dec 2010, 00:52
by friarsol
Yep. It was causing an error for someone so decided to fix it. I need to check tomorrow to make sure the AI is using it properly.

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 08 Dec 2010, 02:38
by Chris H.
I converted Breath of Malfegor to look like this:

Code: Select all
Name:Breath of Malfegor
ManaCost:3 B R
Types:Instant
Text:no text
A:SP$DealDamage | Cost$ 3 B R | ValidTgts$ Opponent | NumDmg$ 5 | SpellDescription$ Breath of Malfegor deals 5 damage to each opponent.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/breath_of_malfegor.jpg
SetInfo:ARB|Common|http://magiccards.info/scans/en/arb/35.jpg
End
`
It works for me but the AI refuses to cast the spell. I placed a Channel in my deck and used it to take me down to just 2 life. I figured that this might temp the AI to go for my head, but the AI just sat there.

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 08 Dec 2010, 03:01
by friarsol
Oh yea I meant to test that today. I'll take a look this evening at some point.

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 08 Dec 2010, 05:38
by friarsol
Alright, damage can now use Opponent as a ValidTgt. Just keep posting here if anything seems fishy.

Just so you know Breath of Malfegor is currently incorrect since it does not Target. We're probably fine leaving the targeting in for now, but as soon as we start adding things like giving Player's Shroud we'll have to remember to change this guy to Defined$ Opponent and add the necessary code for that.

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 08 Dec 2010, 15:20
by Chris H.
friarsol wrote:Alright, damage can now use Opponent as a ValidTgt.
`
Thank you.

I thought about the card Breath of Malfegor for some time last night. At the moment it uses

Code: Select all
spDamageTgtP
`
and this appears to be less rules compliant than using

Code: Select all
ValidTgts$ Opponent
`
I guess that we can leave it alone for the moment and add a Defined$ Opponent to AF_Damage at a later date.

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 08 Dec 2010, 16:32
by friarsol
Chris H. wrote:
Code: Select all
spDamageTgtP
`
and this appears to be less rules compliant than using

Code: Select all
ValidTgts$ Opponent
`
I guess that we can leave it alone for the moment and add a Defined$ Opponent to AF_Damage at a later date.
I just did this, since Damage also had some cards using "Affected" that I had planned on moving over to "Defined" anyway.

Re: Converting cards from Keyword to AbilityFactory

PostPosted: 08 Dec 2010, 19:48
by Chris H.
friarsol wrote:I just did this, since Damage also had some cards using "Affected" that I had planned on moving over to "Defined" anyway.
`
Thank you Sol, one more piece to the AF jigsaw puzzle added. :D