AbilityFactory TODO list
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: AbilityFactory TODO list
by friarsol » 15 May 2011, 14:54
Yea I think the important thing with CopySpell is being able to choose new targets. Even if all this is doing is porting hardcoded to an AF it should help in the process of generalizing.slapshot5 wrote:Ok. I'll look at AF_CopySpell today. I'm going to use the Kiki argument: "If I just copy Fork, it can't be worse than we already have!"
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: AbilityFactory TODO list
by slapshot5 » 15 May 2011, 15:05
I only ask that I be the one to finally and forever delete all WheneverKeyword code. 

- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AbilityFactory TODO list
by slapshot5 » 15 May 2011, 17:48
I'm not seeing much of a need for custom parameters for AF_CopySpell, except maybe for targeting based on what it targets, like "Copy target instant or sorcery spell that targets you.", but I don't think that would be handled in AF_CopySpell.
Oh, the one I did think of would be for Fork making the copied spell red. But the infrastructure doesn't exist for changing color of SAs. Not sure if the card code can just be copied over to SpellAbility.java and basically work or not.
Anyone know anything differently?
-slapshot5
Oh, the one I did think of would be for Fork making the copied spell red. But the infrastructure doesn't exist for changing color of SAs. Not sure if the card code can just be copied over to SpellAbility.java and basically work or not.
Anyone know anything differently?
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AbilityFactory TODO list
by slapshot5 » 15 May 2011, 18:51
I checked in a first pass of AF_CopySpell. There is no AI. Copying spells without targets will give an exception (Fork/Twincast does the same thing now). Check out Sigil Tracer as a checked-in example.
-slapshot5
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AbilityFactory TODO list
by Hellfish » 15 May 2011, 20:50
Sweet as. Added Echo Mage quite effortlessly 
With some tweaks to Triggered-variables I also managed to add an incorrect, but functioning non-WheneverKeyword Mirari.There are some problems with it, though:
*SpellCast triggers run on SAs being added to the stack, but isn't put on the stack themselves until priority is passed,when the top SA on the stack resolves. This is incorrect.
*Mirari triggers again for copies it made itself, which is incorrect.Technically, spell copies aren't *cast*, they're just put on stack.Either CopySpell should use another way of adding SAs to the stack or the SpellAbilityCast running should be moved.

With some tweaks to Triggered-variables I also managed to add an incorrect, but functioning non-WheneverKeyword Mirari.There are some problems with it, though:
*SpellCast triggers run on SAs being added to the stack, but isn't put on the stack themselves until priority is passed,when the top SA on the stack resolves. This is incorrect.
*Mirari triggers again for copies it made itself, which is incorrect.Technically, spell copies aren't *cast*, they're just put on stack.Either CopySpell should use another way of adding SAs to the stack or the SpellAbilityCast running should be moved.
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: AbilityFactory TODO list
by friarsol » 16 May 2011, 00:02
Does SpellCast check for isCopiedSpell() and is AF_CopySpell properly setting it?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: AbilityFactory TODO list
by friarsol » 16 May 2011, 00:39
I converted Mishra over to AF, although there's definitely some improvements still possible. On the AI side, Mishra should grab a card from the Library first, then the Graveyard, then Hand. For the Human, it should be more clear where each card is currently located so the Player can make the "right" decision. Our Option boxes are pretty inflexible, so I'm not sure how easy to do that. But it's probably easier to tweak that away,
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: AbilityFactory TODO list
by Hellfish » 16 May 2011, 06:36
That was easy.friarsol wrote:Does SpellCast check for isCopiedSpell() and is AF_CopySpell properly setting it?

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: AbilityFactory TODO list
by slapshot5 » 16 May 2011, 12:13
AF_CopySpell just calls CardFactory.copySpellontoStack(Card, Card, boolean) which calls copySpellontoStack(Card, Card, SpellAbility, boolean), which sets c.setCopiedSpell(true);friarsol wrote:Does SpellCast check for isCopiedSpell() and is AF_CopySpell properly setting it?
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AbilityFactory TODO list
by friarsol » 16 May 2011, 15:12
Yep. It sounds like Hellfish was able to fix the issue by adding a check for the Copied Spell in the same location.slapshot5 wrote:AF_CopySpell just calls CardFactory.copySpellontoStack(Card, Card, boolean) which calls copySpellontoStack(Card, Card, SpellAbility, boolean), which sets c.setCopiedSpell(true);friarsol wrote:Does SpellCast check for isCopiedSpell() and is AF_CopySpell properly setting it?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: AbilityFactory TODO list
by friarsol » 18 May 2011, 03:24
Slap, where'd you go? I think WheneverKeyword is ready to be axed (along with a cascading number of helper functions)slapshot5 wrote:I only ask that I be the one to finally and forever delete all WheneverKeyword code.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: AbilityFactory TODO list
by slapshot5 » 18 May 2011, 04:02
Consider it done.friarsol wrote:Slap, where'd you go? I think WheneverKeyword is ready to be axed (along with a cascading number of helper functions)slapshot5 wrote:I only ask that I be the one to finally and forever delete all WheneverKeyword code.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AbilityFactory TODO list
by Chris H. » 18 May 2011, 23:13
`Chris H. wrote:I also want to change over the various ".getController().equals(AllZone.ComputerPlayer)" and ".getController().equals(AllZone.HumanPlayer)" to "getController().isComputer()" and "getController().isHuman()".
I just searched the project and discovered that all but one of the code simplifications that I was planning to make have now been taken care of, wow you have been busy.
Thank you Slapshot.

-
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: AbilityFactory TODO list
by slapshot5 » 18 May 2011, 23:39
Yeah, well, I was digging in stuff anyway, and Find/Replace is your friend.Chris H. wrote:I just searched the project and discovered that all but one of the code simplifications that I was planning to make have now been taken care of, wow you have been busy.
Thank you Slapshot.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AbilityFactory TODO list
by Sloth » 20 May 2011, 16:16
I've added AbilityFactory_PreventDamage.java. A wiki entry will follow.
Example:
Example:
- | Open
- Name:Anoint
ManaCost:W
Types:Instant
Text:no text
A:SP$ PreventDamage | Cost$ W | ValidTgts$ Creature | Amount$ 3 | TgtPrompt$ Select target creature | SpellDescription$ Prevent the next 3 damage that would be dealt to target creature this turn.
SVar:Buyback:3
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/anoint.jpg
End
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Who is online
Users browsing this forum: No registered users and 25 guests