It is currently 06 Jun 2024, 08:28
   
Text Size

Ability Factory

Post MTG Forge Related Programming Questions Here

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

Re: Ability Factory

Postby friarsol » 10 Oct 2010, 01:15

Ahh. I thought you had enough done for others to play with it. I'll go in and fix the changes.

Are you done with your changes so my work won't just be overridden again in the SVN?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Ability Factory

Postby Rob Cashwalker » 10 Oct 2010, 01:47

Yeah, I think I've gotten far enough with it.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Ability Factory

Postby Rob Cashwalker » 10 Oct 2010, 02:34

Now, my question to you, is isCurse "universal"? Or is it really specific to just pumps and counters?
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Ability Factory

Postby friarsol » 10 Oct 2010, 02:55

I don't see why it wouldn't be. It's an easy way to tell the AI that he should be targeting Opposing cards instead of his own. I think it would be short-sighted to say "well this only applies to two types of keywords we have now, let's make it more difficult for other keywords in the future to take use of it."

However, we probably don't need a variable for it. We could just have a getter in AbilityFactory that says:

Code: Select all
public boolean isCurse(){
   return mapParams.containsKey("IsCurse");
}
If your goal is to keep the getAbility() function as generic as possible, I think the above solution would be the cleanest way to accomplish that and not gunk up extra code in the sub-functions.

Oh and we should probably also delete DealDamage from the SVN, now that you renamed the file.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Ability Factory

Postby Rob Cashwalker » 10 Oct 2010, 03:13

Hmmm... I get your point... and yet I still feel like that sort of check is better handled in the specific API code.

Here's one way to look at a similar thing:
Discard and DrawCards will both be expecting a parameter like "NumCards" (and/or "NumCardsX"). As might some other effects. However, I would not expect this to be a significant enough parameter to make it part of the AbilityFactory public methods.
I would parse it in the API matching code block, then pass it as a parameter to the AbilityFactory_{API}.getAbility.
At the same rate, why should getAbility or getSpell have to take parameters at all? As of last night, it was because getAbility was static, and DealDamage wasn't being instantiated. Now it is, so I should move the NumDmg parsing to the AbilityFactory_DealDamage constructor. Same would apply for NumCards, and IMHO, isCurse.

It doesn't show up in my local archive, since I renamed it. I don't see a way to delete it on the Google code site. If you can do it, go ahead.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 67 guests


Who is online

In total there are 67 users online :: 0 registered, 0 hidden and 67 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 67 guests

Login Form