delete doDrawBack?
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
19 posts
• Page 1 of 2 • 1, 2
delete doDrawBack?
by Sloth » 05 Jun 2011, 15:29
I converted Dream Cache to newer style drawback and I think it was the last card to use the old function. Can we delete doDrawBack in CardFactoryUtil?
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: delete doDrawBack?
by slapshot5 » 05 Jun 2011, 15:36
I say yes. Sol and I were converting a bunch of these a month ago or so. This was one of two leftovers that couldn't be done then. (The other has since been converted I think.)
Sol may have a comment, but my guess is he'd be all for removing that code. It's not like there's AI in there we need to keep.
-slapshot5
Sol may have a comment, but my guess is he'd be all for removing that code. It's not like there's AI in there we need to keep.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: delete doDrawBack?
by friarsol » 05 Jun 2011, 15:46
Yea Dream Cache was the only thing left on the list. So nuke away. As far as AFs goes, we can change the last few lines of Resolve() from (generally)
- Code: Select all
if (af.hasSubAbility()){
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null){
abSub.resolve();
}
else
CardFactoryUtil.doDrawBack(DrawBack, 0, card.getController(), card.getController().getOpponent(), card.getController(), card, tgtCards.get(0), sa);
}
- Code: Select all
AbilityFactory.resolveSubAbility(sa);
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: delete doDrawBack?
by Rob Cashwalker » 05 Jun 2011, 16:02
{sniff} so sad to see it go...
The Force will be with you, Always.
-

Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: delete doDrawBack?
by friarsol » 05 Jun 2011, 16:09
One of these days Rob is going to be yelling at us to get off his lawn.Rob Cashwalker wrote:{sniff} so sad to see it go...
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: delete doDrawBack?
by slapshot5 » 05 Jun 2011, 16:11
I wish I could just click "Like" on this post.friarsol wrote:One of these days Rob is going to be yelling at us to get off his lawn.Rob Cashwalker wrote:{sniff} so sad to see it go...
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: delete doDrawBack?
by Sloth » 05 Jun 2011, 16:16
Can't we do something like a super resolve function now, to not repeat so much code. It should do just the following things:
1. check condition (and maybe fizzling and unless costs)
1a. if true let it resolve (in the corresponding AF).
2. go to super resolve of next subability.
1. check condition (and maybe fizzling and unless costs)
1a. if true let it resolve (in the corresponding AF).
2. go to super resolve of next subability.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: delete doDrawBack?
by friarsol » 05 Jun 2011, 16:26
Yea it's definitely a good idea to go through and simplify as much as the common resolution code as possible.Sloth wrote:Can't we do something like a super resolve function now, to not repeat so much code. It should do just the following things:
1. check condition (and maybe fizzling and unless costs)
1a. if true let it resolve (in the corresponding AF).
2. go to super resolve of next subability.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: delete doDrawBack?
by Rob Cashwalker » 05 Jun 2011, 18:16
I
I don't get it...friarsol wrote:One of these days Rob is going to be yelling at us to get off his lawn.Rob Cashwalker wrote:{sniff} so sad to see it go...
The Force will be with you, Always.
-

Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: delete doDrawBack?
by Sloth » 05 Jun 2011, 19:48
After taking a look at the structure, I think I have to pass implementing this. I can't find a way to add something before the resolve without detroying the nice structure of the ability factory. I just can't code so elegantly. Unless someone gives me a hint or batch of code I can start from I'm gonna drop this.friarsol wrote:Yea it's definitely a good idea to go through and simplify as much as the common resolution code as possible.Sloth wrote:Can't we do something like a super resolve function now, to not repeat so much code. It should do just the following things:
1. check condition (and maybe fizzling and unless costs)
1a. if true let it resolve (in the corresponding AF).
2. go to super resolve of next subability.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: delete doDrawBack?
by friarsol » 05 Jun 2011, 20:01
The hooks need to happen on the MagicStack side, instead of calling sa.resolve() there we would call need to be a call to a AF.resolve(sa) which would do as you suggest, pulling out the appropriate conditional checks, as well as looping through each of the subAbilities afterwards and resolving those. If the SpellAbility didn't have an attached AF, then no need to do any of the AF specific things, and we could just call sa.resolve() straight up from there.Sloth wrote:After taking a look at the structure, I think I have to pass implementing this. I can't find a way to add something before the resolve without detroying the nice structure of the ability factory. I just can't code so elegantly. Unless someone gives me a hint or batch of code I can start from I'm gonna drop this.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: delete doDrawBack?
by Sloth » 05 Jun 2011, 20:56
Thanks Sol. I commited the change. It was really easy with your help.friarsol wrote:The hooks need to happen on the MagicStack side, instead of calling sa.resolve() there we would call need to be a call to a AF.resolve(sa) which would do as you suggest, pulling out the appropriate conditional checks, as well as looping through each of the subAbilities afterwards and resolving those. If the SpellAbility didn't have an attached AF, then no need to do any of the AF specific things, and we could just call sa.resolve() straight up from there.Sloth wrote:After taking a look at the structure, I think I have to pass implementing this. I can't find a way to add something before the resolve without detroying the nice structure of the ability factory. I just can't code so elegantly. Unless someone gives me a hint or batch of code I can start from I'm gonna drop this.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: delete doDrawBack?
by friarsol » 05 Jun 2011, 21:09
Wow that took no time at all. Little things like this will keep our structure clean and the copy-pasted code to a minimum.Sloth wrote:Thanks Sol. I commited the change. It was really easy with your help.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: delete doDrawBack?
by Sloth » 06 Jun 2011, 09:19
My next plan is to add unless costs to this resolve function. The only difference in the existing unless cost mechanic in AF counters is, that the unless cost is checked for each target of the counterspell. There is no counter ability that allows multiple targeted/defined spells and has an unless cost (and the prompt for the human isn't really worked out to support this).
Is it ok to pull out the unless cost from AF counterspell and put an all or nothing unless cost in front of sa.resolve() (like a Condition)? Subabilities would still resolve (for cards like Offering to Asha).
Is it ok to pull out the unless cost from AF counterspell and put an all or nothing unless cost in front of sa.resolve() (like a Condition)? Subabilities would still resolve (for cards like Offering to Asha).
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: delete doDrawBack?
by friarsol » 06 Jun 2011, 11:54
Sloth wrote:My next plan is to add unless costs to this resolve function. The only difference in the existing unless cost mechanic in AF counters is, that the unless cost is checked for each target of the counterspell. There is no counter ability that allows multiple targeted/defined spells and has an unless cost (and the prompt for the human isn't really worked out to support this).
Is it ok to pull out the unless cost from AF counterspell and put an all or nothing unless cost in front of sa.resolve() (like a Condition)? Subabilities would still resolve (for cards like Offering to Asha).
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
19 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 22 guests