ToME: the Tales of Maj'Eyal
http://forums.te4.org/

[v1.1.0+] Pragmatic Heroism
http://forums.te4.org/viewtopic.php?f=50&t=43361
Page 1 of 2

Author:  Zizzo [ Sun Jan 18, 2015 3:56 am ]
Post subject:  [v1.1.0+] Pragmatic Heroism

We've all seen it. It's the bane of everyone trying to kill that one orc or vampire that just. won't. die. It's the reason I wouldn't touch heroism infusions or the Last Stand talent. It's spelled "HP: unknown" --- or at least it was, until my new Pragmatic Heroism addon. :wink:

This addon modifies the actor tooltips to show their exactive negative HP, and their exact negative die-at threshold. [There wasn't an obvious angle for the percentage display, so I went with f.i. (-70%) at -30/-100 and (-10%) at -90/-100.] This should work for both the player and NPCs, and with any effect that reduces the die-at threshold to below 0HP.

And this one probably won't be going into ZOmnibus, as I can imagine that some would consider it cheating.

[Technical data:]
Code:
Superload:
  mod.class.Actor:
    tooltip() [to replace "HP: unknown" in the tooltip, obviously]

Author:  Zizzo [ Tue Jan 26, 2016 12:14 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Release v2, just pushed out, adds a nice feature that I had wanted from the start but only just recently got working: when you're below zero life, your life bar now displays your negative life and die-at threshold, as shown below:
Attachment:
negative-life-bar.png
negative-life-bar.png [ 85.82 KiB | Viewed 4226 times ]


The black "life" meter expanding from the right as your life decreases is just an extra flourish. :twisted:

Author:  astralInferno [ Wed Jan 27, 2016 9:57 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

You deserve some kudos for that black life flourish, that's an amazing touch. xD

Author:  Zizzo [ Wed Feb 10, 2016 1:51 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

astralInferno wrote:
You deserve some kudos for that black life flourish, that's an amazing touch. xD

*blush* (bows)

Did just find a bug, though: invisible actors apparently have nil tooltips, which means attempting to modify them is almost certainly going to end badly. :wink: That's fixed in v2a, just pushed out.

Author:  Row [ Wed Feb 10, 2016 3:49 pm ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Quote:
And this one probably won't be going into ZOmnibus, as I can imagine that some would consider it cheating.


How about include it in ZOmnibus, but make it configurable so that it can be turned off. There are more options in ZOmnibus that can be considered cheating, such as always evade all patrols.

Author:  Zizzo [ Thu Feb 11, 2016 1:35 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Row wrote:
How about include it in ZOmnibus, but make it configurable so that it can be turned off. There are more options in ZOmnibus that can be considered cheating, such as always evade all patrols.

A fair point, I suppose; I don't think I was thinking about that sort of thing way back when I first created ZOmnibus. Anyone else have an opinion?

Author:  Zeranamu [ Thu Feb 11, 2016 9:57 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

I've only just started playing, and haven't even experienced being able to go negative HP yet, but I do use the ZOmnibus pack and would say add it. I like stuff, and if it can be turned on or off then I don't see a problem with it.

Author:  Zizzo [ Wed Feb 17, 2016 2:40 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Okay, you've convinced me. :wink: v2b, just pushed out, adds the "Show negative life in tooltips" option under the UI tab of the Game Options dialog — and that's enough to let us merge into ZOmnibus. We Apologize for the Convenience.™ :mrgreen:

Author:  Zizzo [ Sat Feb 20, 2016 5:10 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Aaand greater exposure via ZOmnibus apparently means more stupid bugs found faster… :oops: Pushing out v2b.1 to fix display of shield info in the life bar while you're below zero life. We Apologize for the Error.™

Author:  Row [ Tue Mar 01, 2016 7:22 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

When using classic UI and Plenum tooltip addon, there is no way to tell how much in the negative life you are.
It should display the negative life number also in:
    * classic ui life bar
    * character sheet

Author:  Zizzo [ Wed Mar 02, 2016 1:24 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Row wrote:
When using classic UI and Plenum tooltip addon, there is no way to tell how much in the negative life you are.

Wait, so with Plenum, you're not getting e.g. "HP: -13/-100" in the player's tooltip? Is it still saying "HP: unknown"? I'll need to investigate that. But you're right, support of the Classic UI is something I really should have done by now.

Author:  Zizzo [ Wed Mar 02, 2016 4:18 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Well, supporting the Classic UI turned out not to be quite as hard as I'd feared:

Attachment:
classic-lifebar.png
classic-lifebar.png [ 9.49 KiB | Viewed 3884 times ]


That's going out as v2c. As for Plenum, I think I'm going to need to bring Hachem_Muche in on this…

Author:  Hachem_Muche [ Wed Mar 02, 2016 9:27 pm ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Zizzo, got your poast RE: Plenum Tooltip.

What you're doing with the actor tooltip should work fine on the PTT created tooltip.

Any reason you set your addon weight to 50?

PTT runs at a weight of 150 to make sure the effects of other addon's are taken into account, and because it's not game-breaking if another addon breaks it (It can be disabled from the game menu.).

I think both addon's should be compatible if you set the weight of PH to 151.

Author:  Zizzo [ Thu Mar 03, 2016 3:08 am ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

Hachem_Muche wrote:
Any reason you set your addon weight to 50?

(scratches head) I'm… pretty sure that's what most or all of the other addons I've looked at use. For that matter, I pretty much had to have copied it from somewhere.

Hachem_Muche wrote:
PTT runs at a weight of 150 to make sure the effects of other addon's are taken into account,

See, this is the bit that confuses me. Because the way you've got it implemented currently, you're effectively discarding the effects of other addons and rebuilding the tooltip from scratch (hence the problem, in fact). That's why I offered to have Pragmatic Heroism pass information "downstream" to Plenum, to use in its tooltip reconstruction.

Hachem_Muche wrote:
I think both addon's should be compatible if you set the weight of PH to 151.

I considered that briefly, but Pragmatic is also part of ZOmnibus, so I'd also have to change ZOmnibus' weight, and I shudder to imagine what that might break. :?

Author:  Hachem_Muche [ Fri Mar 04, 2016 8:19 pm ]
Post subject:  Re: [v1.1.0+] Pragmatic Heroism

But why not change the weight of everything?
Sounds like a debugging adventure!

Actually I thought Zomnibus had a way to change the weight of each individual addon.
The default weight for addons (is supposed to be) 100.

PTT does override other addons, because it pretty much replaces the entire tooltip for actors. Another addon (at a higher weight) that tried to modify the normal ToME tooltip would probably break.
Have you tested PH with a higher weight than PTT to confirm it works?

The next (rather sloppy) option I can think of is defining something like a new mod.Actor._life_text(self) function that returns the string you want to display, and then using that in your search and replace code to update actor life in the tooltip. It would then be easy enough to have PTT check for that function and use it.

Also note that if the player really needs to see the negative life of an npc, he can temporarily disable PTT's actor tooltip and the normal tooltip (using PH) will be displayed.

Page 1 of 2 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/