Adding a min vaue to ActorResource interface

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Adding a min vaue to ActorResource interface

#1 Post by yufra »

This started when I noticed equilbrium sustains were once again broken by meditating (well not broken, but the sustain cost disappeared). The obvious long-term fix is to add a minimum value to the ActorResource interface and have equilibrium raise that instead of decreasing the maximum as other sustains do. I also have added min/max arguments to the defineResource function, which default to 0 and 100 as currently expected in ToME. Finally I changed all of the postUseTalent sustain changes to actually use incMax/incMin functions instead of directly changing the maximum value. This is because the incMax/incMin functions now bound the current value as well. I think this code was already somewhere else for the decreasing of minimum values, and I will look for it later to remove the redundancy. The first version of the patch can be found here: http://pastebin.com/EpqhHXK5.

I have tested that using Icy Skin from 0 equilibrium properly increases equilibrium to 30, and that you cannot then meditate below 30. After removing Icky Skin you can meditate back down to 0, so that seems to work well. The question is if there are any other bugs introduced in other resources, and I will be testing that soon.
<DarkGod> lets say it's intended

Marcotte
Wyrmic
Posts: 203
Joined: Sat Jan 26, 2008 1:12 am

Re: Adding a min vaue to ActorResource interface

#2 Post by Marcotte »

I thought that this was the intended behavior...

As for adding the min value, it would indeed be very handy for many uses. For instance, a module could want to allow a resource to go negative (like HP in a D&D module where death comes only at -10 HP).

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Adding a min vaue to ActorResource interface

#3 Post by yufra »

Marcotte wrote:I thought that this was the intended behavior...
I assume you are talking about my description of testing Icy Skin. Yes, the test works as intended but if you try this out in beta19 you will see that it does not work that way.
<DarkGod> lets say it's intended

Marcotte
Wyrmic
Posts: 203
Joined: Sat Jan 26, 2008 1:12 am

Re: Adding a min vaue to ActorResource interface

#4 Post by Marcotte »

yufra wrote:
Marcotte wrote:I thought that this was the intended behavior...
I assume you are talking about my description of testing Icy Skin. Yes, the test works as intended but if you try this out in beta19 you will see that it does not work that way.
No, I meant the say that I thought that the beta19 behavior (meditation being able to reset equilibrium to zero while sustains are active) is the intended behavior.

Whether that is true or not, is another question altogether.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Adding a min vaue to ActorResource interface

#5 Post by yufra »

Marcotte wrote: No, I meant the say that I thought that the beta19 behavior (meditation being able to reset equilibrium to zero while sustains are active) is the intended behavior.

Whether that is true or not, is another question altogether.
Ah, I understand now. No, you are not supposed to be able to go below the "sustained equilibrium." The sustained talents are supposed to carry some sort of permanent cost along with them, and in most cases they reduce the total amount of a resource you can have or have a constant resource drain. The behavior in beta19 that you describe is effectively "sustains for free", where you can set it, meditate and now be running around without any permanent cost but having a permanent bonus. Previous versions of this bug have been found and fixed, but it is broken again in beta19. The original post outlined a permanent way to fix this problem as well as extend the ActorResource interface to make such resources easier to handle in the future.
<DarkGod> lets say it's intended

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: Adding a min vaue to ActorResource interface

#6 Post by edge2054 »

This patch broke Paradox (caps it at 100) and I'm guessing it's doing the same to Equilibrium (though I haven't checked and it's much less of an issue).

Marcotte
Wyrmic
Posts: 203
Joined: Sat Jan 26, 2008 1:12 am

Re: Adding a min vaue to ActorResource interface

#7 Post by Marcotte »

I haven't tested it, but changing

Code: Select all

max = max or 100
by

Code: Select all

max = (max == nil) and 100 or max
should do the trick.

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: Adding a min vaue to ActorResource interface

#8 Post by edge2054 »

Tested it. Seems to work good.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Adding a min vaue to ActorResource interface

#9 Post by yufra »

Thanks Marcotte, I sent the patch to DG.
<DarkGod> lets say it's intended

Post Reply