Removal of isSick
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
6 posts
• Page 1 of 1
Removal of isSick
by friarsol » 20 Sep 2011, 18:05
Max,
Was there any real reason you decided to remove isSick? It seems to me that this was a common utility function that you've decided to remove.. and I can't tell why. Now instead of having the comparison in one location, you have it in multiple locations...
Was there any real reason you decided to remove isSick? It seems to me that this was a common utility function that you've decided to remove.. and I can't tell why. Now instead of having the comparison in one location, you have it in multiple locations...
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Removal of isSick
by Max mtg » 20 Sep 2011, 19:59
isSick() was the same as hasSickness(), except for it extra checked for isCreature. Having both functions is confusing, you cannot decide which to pick unless you check its source code.
isSick was not common at all, there were only 4 ocurrencies, compared to some 10 of already existing calls to hasSickness.
I can restore if you miss it,
hasSickness = !hasKeyword("haste") && sickness;
isSick = !hasKeyword("haste") && sickness && isCreature() = hasSickness() && isCreature();
Speaking about good intentions, I'd like to implement that two sided cards... but found myself unable to understand the whole mechanics behind that transitions between stack, zones, triggers. Tried to remove some excessive code to make the whole thing simplier. Succeeded in AllZoneUtils, but found too little to do with card. Tried with isSick as some obvious target, but that change was not very welcome.
isSick was not common at all, there were only 4 ocurrencies, compared to some 10 of already existing calls to hasSickness.
I can restore if you miss it,
hasSickness = !hasKeyword("haste") && sickness;
isSick = !hasKeyword("haste") && sickness && isCreature() = hasSickness() && isCreature();
Speaking about good intentions, I'd like to implement that two sided cards... but found myself unable to understand the whole mechanics behind that transitions between stack, zones, triggers. Tried to remove some excessive code to make the whole thing simplier. Succeeded in AllZoneUtils, but found too little to do with card. Tried with isSick as some obvious target, but that change was not very welcome.
Last edited by Max mtg on 20 Sep 2011, 20:18, edited 1 time in total.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Removal of isSick
by friarsol » 20 Sep 2011, 20:18
Well, you've been making a big deal about people repeating code, but now you are going about undoing a case where the exact opposite was occurring. So now the handling of Summoning Sickness is more verbose and more difficult to maintain.
I would think the only time hasSickness() should be checked is if a non-creature might be animated. In most cases, isSick() would be preferred. I don't really see how removing this function makes things "simpler" it's just a different way of accessing the same data. If isSick() isn't descriptive enough for you, then change it to something like isAffectedBySickness().
Also, someone (slapshot maybe) already stated they were going to attempt two-sided cards so I'm not sure why you are duplicating that effort.
I would think the only time hasSickness() should be checked is if a non-creature might be animated. In most cases, isSick() would be preferred. I don't really see how removing this function makes things "simpler" it's just a different way of accessing the same data. If isSick() isn't descriptive enough for you, then change it to something like isAffectedBySickness().
Also, someone (slapshot maybe) already stated they were going to attempt two-sided cards so I'm not sure why you are duplicating that effort.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Removal of isSick
by Max mtg » 20 Sep 2011, 21:48
There is already hasSickness, no need for another sickness-checker function.
The only place where isSick was really needed were the Costs, however
Yes, you don't know for sure who has taken that task. Niether do I know, but at least I can always take a try implementing them.
The only place where isSick was really needed were the Costs, however
- Code: Select all
return source.isUntapped() && (!source.hasSickness() || !source.isCreature());
Yes, you don't know for sure who has taken that task. Niether do I know, but at least I can always take a try implementing them.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Removal of isSick
by Hellfish » 20 Sep 2011, 21:55
Slapshot said he was tackling Doublefaced and Flip cards over in the Innistrad scripts thread.
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: Removal of isSick
by slapshot5 » 28 Sep 2011, 01:55
Was going to, but I don't have the time to do it right. If someone else wants to try, go for it. I'm not actively working on it.Hellfish wrote:Slapshot said he was tackling Doublefaced and Flip cards over in the Innistrad scripts thread.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 26 guests