It is currently 30 Oct 2025, 18:55
   
Text Size

Converting cards from Keyword to AbilityFactory

Post MTG Forge Related Programming Questions Here

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

Re: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 03 Dec 2010, 14:49

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
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: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 06 Dec 2010, 18:37

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:
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: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 06 Dec 2010, 18:40

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:
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: Converting cards from Keyword to AbilityFactory

Postby friarsol » 06 Dec 2010, 18:48

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 06 Dec 2010, 21:33

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
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: Converting cards from Keyword to AbilityFactory

Postby Sloth » 06 Dec 2010, 21:39

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).
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Converting cards from Keyword to AbilityFactory

Postby friarsol » 06 Dec 2010, 22:10

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?)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 07 Dec 2010, 00:41

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 |
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: Converting cards from Keyword to AbilityFactory

Postby friarsol » 07 Dec 2010, 00:52

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 08 Dec 2010, 02:38

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.
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: Converting cards from Keyword to AbilityFactory

Postby friarsol » 08 Dec 2010, 03:01

Oh yea I meant to test that today. I'll take a look this evening at some point.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Converting cards from Keyword to AbilityFactory

Postby friarsol » 08 Dec 2010, 05:38

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 08 Dec 2010, 15:20

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.
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: Converting cards from Keyword to AbilityFactory

Postby friarsol » 08 Dec 2010, 16:32

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Converting cards from Keyword to AbilityFactory

Postby Chris H. » 08 Dec 2010, 19:48

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

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: ArchieRoW and 26 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 27 users online :: 1 registered, 0 hidden and 26 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: ArchieRoW and 26 guests

Login Form