Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spell Library health bars don't register healing when using default Simple5e macros #4

Open
rogue-ronin opened this issue May 26, 2020 · 5 comments

Comments

@rogue-ronin
Copy link

I hope I understand how this is working. I think this is being caused by the spellbook, and isn't a bug in Simple5e.

If I use a spell to damage a PC token, the health bar is displayed. (I like this.)

But if I heal with the Simple5e 'Heal Damage' macro button, the health bar is not updated.

I think Simple5e doesn't use health bars as it doesn't use macros to target damage on other tokens.

This leaves my token with an indicator out of sync with my actual health. When I heal via the spelllbook it works fabulously, of course.

Aloha.

@melek
Copy link

melek commented May 28, 2020

It looks to me that the 'Approximate bar logic' snippet is already in the healDamage macro.

When I tried with the most recent version, I got the correct result; I did have to click the 'Heal' button in the Chat to apply the healing:
image

Are you sure you're using 1.4.1?

@melek
Copy link

melek commented May 28, 2020

I misread your issue initially.. Simple 5e uses the same health bar logic as the spell library. I will test on a fresh copy of Simple5e and update this thread tomorrow to see if I can duplicate the issue.

@rogue-ronin
Copy link
Author

I wrote some clarifying text on Discord. I'm no longer confident that this is a bug in the Spell Library.

@melek
Copy link

melek commented May 28, 2020

Indeed, I think you're right. This is due to the use of the Approximate Bar Logic I use and Merudo mirrored. This logic is deliberately simplistic to be approachable and meant to generally protect precise HP values from being exposed to players by accident.

If you want to have smarter bar logic that will display the correct bar depending on the owners of the tokens, replace the following three lines in the takeDamage and healDamage Lib:SpellLibrary macros:

[h: '<!-- Perform approximate bar logic. -->']
[h, if(!isBarVisible("Health") && eHP < eMaxHP): setBar("Health (Approximate)", eHP / eMaxHP); setBarVisible("Health (Approximate)", 0)]
[h, if(isBarVisible("Health") && HP < eMaxHP): setBar("Health", eHP / eMaxHP); setBarVisible("Health", 0)]

With the following:

[h: "<!-- Perform smart bar logic. -->"]
[h, if(HP < eMaxHP), code: {
	[vPlayerOwners = ""]
	[vOwners = getOwners()]
	[foreach(vPlayer, getAllPlayerNames(), ""), if(!isGM(vPlayer) && listContains(vOwners, vPlayer)): 
		vPlayerOwners = listAppend(vPlayerOwners, vPlayer)]
	[isPlayerToken = max(listCount(vPlayerOwners), isOwnedByAll())]	
	[if(isPlayerToken), code: {
		[setBarVisible("Health (Approximate)", 0)]
		[setBar("Health", eHP / eMaxHP)]
	};{
		[setBarVisible("Health", 0)]
		[setBar("Health (Approximate)", eHP / eMaxHP)]
	}]
};{
	[setBarVisible("Health", 0)]
	[setBarVisible("Health (Approximate)", 0)]
}]

If you prefer this logic everywhere in your campaign to the simpler default logic, you could further replace the bar logic in the Damage NPC and Heal NPC campaign macros, and optionally in your Standard Token Take Damage, Heal Damage, Death Save macros. If you go that route, I would consider creating an 'Update Bars' campaign macro for your game with the above logic and use a call to that in place of the code itself throughout your campaign.

@rogue-ronin
Copy link
Author

Thank you, I will test this out later today and see if I can break it. 😆

I can almost follow this. It's like reading French and getting the context but not the details!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants