Converting cards from Keyword to AbilityFactory
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			69 posts
			 • Page 2 of 5 • 1, 2, 3, 4, 5
		
	
Re: Converting cards from Keyword to AbilityFactory
 by Chris H. » 15 Nov 2010, 00:24
by Chris H. » 15 Nov 2010, 00:24 
It looks like we have finished the spBounceTgt to AF_Bounce conversion. I commented out the spBounceTgt code block but did not delete it. I have not had a chance to see if there is any useful AI that has not yet been transferred.
I am not sure when Sol will feel that it is time to release the next beta. We may want to convert over some of the old cards before we do in order to give the user base more cards to test.
I am not sure where I should devote my attentions this next week.
			
		I am not sure when Sol will feel that it is time to release the next beta. We may want to convert over some of the old cards before we do in order to give the user base more cards to test.
I am not sure where I should devote my attentions this next week.
- 
				 
 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
 by friarsol » 15 Nov 2010, 00:33
by friarsol » 15 Nov 2010, 00:33 
I have two phase related issues right now that were recently reported. I'll take a look this week, but I think we might be ok to release one pretty soon. 
I'm sure there are a few floating issues that just haven't been spotted yet, but probably aren't anything major. I only play on occasion but it's been pretty stable for me.
			
		I'm sure there are a few floating issues that just haven't been spotted yet, but probably aren't anything major. I only play on occasion but it's been pretty stable for me.
- 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
 by Chris H. » 17 Nov 2010, 00:11
by Chris H. » 17 Nov 2010, 00:11 
I am in the process of converting most of the spReturnTgt spells over to SP$Retrieve. I had these three cards ready for testing:
False Mourning
Reclaim
Salvage
and noticed that they did not work. I added Raise Dead to the test deck and re-tested and Raise Dead no longer works although it worked a day or two ago when I committed the conversion.
Many of the SP$Retrieve cards need to use "ValidTgts$ " restriction ".YouCtrl" or the cards that are in the computer's graveyard will also appear in the list of cards to select from.
It looks like some recent mods in r3566 at AbilityFactory_Fetch may have something to do with this situation. I could be wrong.
			
		False Mourning
Reclaim
Salvage
and noticed that they did not work. I added Raise Dead to the test deck and re-tested and Raise Dead no longer works although it worked a day or two ago when I committed the conversion.
Many of the SP$Retrieve cards need to use "ValidTgts$ " restriction ".YouCtrl" or the cards that are in the computer's graveyard will also appear in the list of cards to select from.
It looks like some recent mods in r3566 at AbilityFactory_Fetch may have something to do with this situation. I could be wrong.
- 
				 
 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
 by friarsol » 17 Nov 2010, 00:28
by friarsol » 17 Nov 2010, 00:28 
Retrieve doesn't use TopOfLibrary like Bounce does. It uses Destination$Library and LibraryPosition$0
Edit: And I don't know how to read properly. Hopefully this can be resolved soon
			
		Edit: And I don't know how to read properly. Hopefully this can be resolved soon
- 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
 by Chris H. » 17 Nov 2010, 02:26
by Chris H. » 17 Nov 2010, 02:26 
`friarsol wrote:Retrieve doesn't use TopOfLibrary like Bounce does. It uses Destination$Library and LibraryPosition$0
Edit: And I don't know how to read properly. Hopefully this can be resolved soon
I found the Retrieve code in AbilityFactory_Fetch and discovered the Destination$Library and LibraryPosition$0.
The bug that I noticed was that I would click on the card to cast and I had valid targets in my graveyard and yet nothing would happen. No targeting or pay mana prompts. It acts like there are no valid targets in my graveyard.
I am sure that we will be able to get it fixed before we release the next beta.

- 
				 
 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
 by Sloth » 17 Nov 2010, 07:29
by Sloth » 17 Nov 2010, 07:29 
This might be related to my big ValidCards change. Try again when I fixed the issues I've found with the restriction "Other".
EDIT: Fixed.
			
		EDIT: Fixed.
- 
				 
 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
 by Chris H. » 17 Nov 2010, 13:05
by Chris H. » 17 Nov 2010, 13:05 
`Sloth wrote:This might be related to my big ValidCards change. Try again when I fixed the issues I've found with the restriction "Other".
EDIT: Fixed.
Thank you Sloth. I re-ran my test deck and the SP$Retrieve cards are working again.
- 
				 
 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
 by Chris H. » 18 Nov 2010, 20:45
by Chris H. » 18 Nov 2010, 20:45 
`slapshot5 wrote:agreed. Spaces could be allowed anywhere, so:Hellfish wrote:Having spaces there looks nice, but I'm not sure it should be enforced. So I'm in favor of the trim() approach.
|Destination$Hand|
| Destination$Hand|
| Destination $Hand|
| Destination $ Hand|
| Destination $ Hand |
would all be equally valid.
I think that I have found all of the cards that use the AF sa's and have added spaces to them. The code that I added follows Slapshot's request and these are all allowed:
- Code: Select all
- |Key$Value|
 | Key$Value|
 | Key $Value|
 | Key $ Value|
 | Key $ Value |
 |Key $ Value |
 |Key$ Value |
 |Key$Value |
I standardized on this format:
- Code: Select all
- | Key$ Value |
This keeps the $ attached to the key and helps to denote the fact that it is the key.
- 
				 
 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
 by Chris H. » 18 Nov 2010, 21:30
by Chris H. » 18 Nov 2010, 21:30 
My previous code removed the trailing space character included in the PrecostDesc and the CostDesc. I just merged a fix to this.
			
		- 
				 
 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
 by Chris H. » 20 Nov 2010, 02:06
by Chris H. » 20 Nov 2010, 02:06 
I was in the process of converting some of the spDrawCards keyword-ed cards over to AF_Draw. While play testing Obsessive Search I decided to test the Madness ability. I had 8 cards in hand and waited till EOT. When I discarded Obsessive Search, I was prompted to pay the Madness cost U. I paid and this error exception was displayed.
The Obsessive Search card looks like this:
The error exception:
			
		The Obsessive Search card looks like this:
- Code: Select all
- Name:Obsessive Search
 ManaCost:U
 Types:Instant
 Text:no text
 A:SP$Draw | Cost$ U | NumCards$ 1 | SpellDescription$ Draw a card.
 K:Madness:U
 SVar:Rarity:Common
 SVar:Picture:http://www.wizards.com/global/images/magic/general/obsessive_search.jpg
 End
The error exception:
- Code: Select all
- An error has occured. You can copy/paste this message or save it to a file.
 Please report this, plus what you tried to do, to:
 http://www.slightlymagic.net/forum/viewforum.php?f=26
 If you don't want to register an account, you can mail it directly to
 mtgerror@yahoo.com
 null
 Version:
 Forge -- official beta: $Date: 2010-09-14 08:34:27 -0400 (Tue, 14 Sep 2010) $, SVN revision: $Revision: 2039 $
 OS: Mac OS X Version: 10.6.4 Architecture: x86_64
 Java Version: 1.6.0_22 Vendor: Apple Inc.
 Detailed error trace:
 java.lang.NullPointerException
 at forge.SpellAbility_Requirements.fillRequirements(SpellAbility_Requirements.java:24)
 at forge.GameAction.playSpellAbilityForFree(GameAction.java:2801)
 at forge.GameAction.playCardNoCost(GameAction.java:2788)
 at forge.GameAction$2.resolve(GameAction.java:407)
 at forge.MagicStack.resolveStack(MagicStack.java:467)
 at forge.Phase.passPriority(Phase.java:570)
 at forge.ComputerAI_General.stackResponse(ComputerAI_General.java:278)
 at forge.ComputerAI_General.stack_not_empty(ComputerAI_General.java:243)
 at forge.InputControl.updateInput(InputControl.java:119)
 at forge.GuiInput.update(GuiInput.java:19)
 at java.util.Observable.notifyObservers(Observable.java:142)
 at java.util.Observable.notifyObservers(Observable.java:98)
 at forge.MyObservable.updateObservers(MyObservable.java:9)
 at forge.InputControl.resetInput(InputControl.java:32)
 at forge.Phase.passPriority(Phase.java:561)
 at forge.Input_PassPriority.selectButtonOK(Input_PassPriority.java:35)
 at forge.GuiInput.selectButtonOK(GuiInput.java:35)
 at forge.GuiDisplay3.okButtonActionPerformed(GuiDisplay3.java:1001)
 at forge.GuiDisplay3.access$3(GuiDisplay3.java:1000)
 at forge.GuiDisplay3$26.actionPerformed(GuiDisplay3.java:795)
 at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
 at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
 at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
 at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
 at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
 at java.awt.Component.processMouseEvent(Component.java:6352)
 at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
 at java.awt.Component.processEvent(Component.java:6117)
 at java.awt.Container.processEvent(Container.java:2085)
 at java.awt.Component.dispatchEventImpl(Component.java:4714)
 at java.awt.Container.dispatchEventImpl(Container.java:2143)
 at java.awt.Component.dispatchEvent(Component.java:4544)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4621)
 at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)
 at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)
 at java.awt.Container.dispatchEventImpl(Container.java:2129)
 at java.awt.Window.dispatchEventImpl(Window.java:2478)
 at java.awt.Component.dispatchEvent(Component.java:4544)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
- 
				 
 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
 by friarsol » 20 Nov 2010, 02:36
by friarsol » 20 Nov 2010, 02:36 
I don't want to submit this yet, cause I haven't tested it, but Chris try this and see if it works.
in SpellAbility_Requirements.fillRequirements() right near the top add this null check in between these lines:
			
		in SpellAbility_Requirements.fillRequirements() right near the top add this null check in between these lines:
- Code: Select all
- fromZone = AllZone.getZone(c);
 if (fromZone != null)
 fromZone.remove(c);
- 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
 by Chris H. » 20 Nov 2010, 02:59
by Chris H. » 20 Nov 2010, 02:59 
`friarsol wrote:I don't want to submit this yet, cause I haven't tested it, but Chris try this and see if it works.
Thank you Sol.
I think that I may wait until tomorrow to try this out. It has been a long day and I am starting to tire. And I have a few more cards to test tonight and I will try to merge them before calling it a night.
- 
				 
 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
 by Chris H. » 20 Nov 2010, 20:33
by Chris H. » 20 Nov 2010, 20:33 
`I don't want to submit this yet, cause I haven't tested it, but Chris try this and see if it works.
I see that you found the opportunity to add the fix to the SVN, thank you.
- 
				 
 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
 by Chris H. » 20 Nov 2010, 23:35
by Chris H. » 20 Nov 2010, 23:35 
I cast a Compulsive Research and targeted the computer. The computer draws 3 cards but I have to discard 2 cards unless I discard a land. I am seeing a similar problem with Wistful Thinking and Sign in Blood. Recent changes in the targeting or subAbility code might have something to do with this.
			
		- Code: Select all
- Name:Compulsive Research
 ManaCost:2 U
 Types:Sorcery
 Text:no text
 A:SP$Draw | Cost$ 2 U | NumCards$ 3 | ValidTgts$ Player | TgtPrompt$ Choose a player to draw three cards. Then that player discards two cards unless he or she discards a land card | SpellDescription$ Target player draws three cards. Then that player discards two cards unless he or she discards a land card | SubAbility$ TgtDiscard/2/UnlessDiscardType.Land
 SVar:Rarity:Common
 SVar:Picture:http://www.wizards.com/global/images/magic/general/compulsive_research.jpg
 End
 Name:Wistful Thinking
 ManaCost:2 U
 Types:Sorcery
 Text:no text
 A:SP$Draw | Cost$ 2 U | NumCards$ 2 | ValidTgts$ Player | TgtPrompt$ Choose a player to draw two cards, then discards four cards | SpellDescription$ Target player draws two cards, then discards four cards. | SubAbility$ TgtDiscard/4
 SVar:RemAIDeck:True
 SVar:Rarity:Common
 SVar:Picture:http://www.wizards.com/global/images/magic/general/wistful_thinking.jpg
 End
 Name:Sign in Blood
 ManaCost:B B
 Types:Sorcery
 Text:no text
 A:SP$Draw | Cost$ B B | NumCards$ 2 | ValidTgts$ Player | TgtPrompt$ Choose a player to draw two cards and lose 2 life | SpellDescription$ Target player draws two cards and loses 2 life. | SubAbility$ LoseLifeTgt/2
 SVar:Rarity:Common
 SVar:Picture:http://www.wizards.com/global/images/magic/general/sign_in_blood.jpg
 End
- 
				 
 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
 by friarsol » 21 Nov 2010, 05:12
by friarsol » 21 Nov 2010, 05:12 
The right info wasn't being sent in to the old drawback code. I just submitted a fix that will send in the Targeted player to Drawback and tested with Sign in Blood. I'm guessing that'd do the trick for the rest.
My long term solution is converting Drawback to new SubAbility stuff (once they are ready)
Hooray! Doesn't everyone love converting things?
			
		My long term solution is converting Drawback to new SubAbility stuff (once they are ready)
Hooray! Doesn't everyone love converting things?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
			69 posts
			 • Page 2 of 5 • 1, 2, 3, 4, 5
		
	
Who is online
Users browsing this forum: No registered users and 26 guests
