PDA

View Full Version : Effect: DMG:+2 If Failed To Confirm Critical



tdewitt274
March 28th, 2020, 06:25
Hello, All

We have a house rule around our table that gives a +2 to damage on an unconfirmed critical. Is there a way to do this in effects that would be a permanent effect? I saw there was IF conditioning, but I'm not sure how to associate it.

Thanks in advance!

Todd

tdewitt274
March 28th, 2020, 13:41
Or, would it be smarter to modify the ruleset with an extension to add some house rules? (I've looked into it, but not sure I understand where to modify it).

Trenloe
March 28th, 2020, 14:46
IF conditioning won't do this.

You can apply a one-off effect for +2 damage after an unconfirmed critical.

Or, yes, you could look into creating an extension. The issue is that the attack roll is separate from the damage roll.

You'd need to add in an additional flag to indicate that you had an unconfirmed critical in scripts\manager_action_attack.lua - look for the setCritState function to see how this is done for a confirmed critical - it basically sets an entry in the aCritState LUA table.

This table is checked in the scripts\manager_action_damage.lua file when damage is rolled - uses the ActionAttack.isCrit function to determine if there is a critical for the attacker and target pair. If so, then critical damage will be rolled.

tdewitt274
March 28th, 2020, 15:56
Thanks, Trenloe

I did do an effect like you mentioned, so I at least have that.

A couple of follow up questions, if I may. Sorry, lots of code spread over multiple locations that I don't fully understand. I dove into LUA some time back, but never fully understood it.

Is the aCritState a global variable accessible by the manager_action_damage.lua? I would assume (because I haven't dug down that rabbit hole yet) that adding an additional field to the aCritState table (say, a boolean) wouldn't cause too much trouble. But if anything relies on that, then it could result in an incorrectly resolved critical.

Is there a way for the modDamage to access the sResults or msgLong.icon to see if it is a "non-crit"? In reviewing the code, it seems like I can modify the applyAttack() to add another condition in the ELSE for the non-crit.

If this is too technical, I can address it in the appropriate forum.

Thanks!

Todd

Trenloe
March 28th, 2020, 16:08
Is the aCritState a global variable accessible by the manager_action_damage.lua?
It's a global variable within the manager_action_attack.lua script file scope - which is the ActionAttack global script package.

You can refer to that LUA table as ActionAttack.aCritState, or use the handler functions made to access that - isCrit or clearCritState.


I would assume (because I haven't dug down that rabbit hole yet) that adding an additional field to the aCritState table (say, a boolean) wouldn't cause too much trouble. But if anything relies on that, then it could result in an incorrectly resolved critical.
I wouldn't add to aCritState at all, make a new table and the handler functions - they'll be very similar to the three handlers at the bottom of manager_action_attack.lua - setCritState, clearCritState and isCrit.

Don't modify these, create new ones so that you're not interfering with standard functionality for an actual critical. Create a new table called aCritNoConfirm (or whatever you want to call it) then copy the three functions and rename them to setCritNoConfirmState, clearCritNoConfirmState and isCritNoConfirm and modify to use the aCritNoConfirm table instead of aCritState.

Then you can set this in the attack roll if a critical is not confirmed with setCritNoConfirmState(rSource, rTarget); and you could check the flag in manager_action_damage.lua using ActionAttack.isCritNoConfirm(rSource, rTarget)


Is there a way for the modDamage to access the sResults or msgLong.icon to see if it is a "non-crit"? In reviewing the code, it seems like I can modify the applyAttack() to add another condition in the ELSE for the non-crit.
Nope. Because the result of the attack action is completely separate from the damage action - that's why the crit flag is stored in the global script package ActionAttack during the attack roll to be accessed later from the DamageAction process.

tdewitt274
March 28th, 2020, 18:13
Thanks again, Trenloe

I'll give your recommendation a try and see if I can figure it out.

Thanks!

Todd