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

Can't create effects using Ability Modifiers (and others) #172

Closed
draconas1 opened this issue Feb 11, 2022 · 6 comments
Closed

Can't create effects using Ability Modifiers (and others) #172

draconas1 opened this issue Feb 11, 2022 · 6 comments

Comments

@draconas1
Copy link
Collaborator

Blame a chap on discord for leading me down this rabbit hole.

Creating an effect that uses an @variable, e.g. @details.tier

That works fine. And so does @abilities.str.value

However the more likely use @abilities.str.mod does not.

I tracked this down. The replacer (apply function in dnd4eBeta.js) calls owner.getRollData() That we have an override that is kinda pointless, but was very good for debugging. When this is called, the actor is in a "pristine" state - prepareData() has not been run, therefore it does not have any mod values, as they are dynamically computed - it only has data that is saved (e.g. stuff that is in the template). the only available strength values are the value, and the text for a roll.

This will apply I think to any value that is dynamically calculated rather than stored.

The solution to this is definitely not to call prepareData() in the getRollData() method, as that causes an infinite loop.

@draconas1
Copy link
Collaborator Author

draconas1 commented Feb 12, 2022

I'm fixing this right now. Also fixing several minor things. Docuemnting it here for the PR as I go along:

Ability modifier calculations moved into a separate method that is called by prepareData and prepareChatData. This does not cause an infinite loop.
Polymorph removed from prepareData()

added the shortcut @xmod variables from power replacer to actors getChatDa\ta mewthod so they work in effects

created several new @variables:
@heroic, @paragon, @Epic which return 1 if in the appropreate tier, 0 otherwise
@heroicOrParagon & @paragonOrEpic which return 1 if in the appropreate 2 tiers, 0 otherwise.
Should help dice effects for upgrading powers.

All class features have had their number of surges calculationc hanged from maths, which was javascript, and therefore wrong, to @Conmod. Javascript type system strikes again, so if your conmod was actually x.5 the maths showed the 0.5 because javascript tries to be helpful and converts integer division into a float for you. This is why I hate javascript. It is a silly language.

All class feature effects for HP changed from "add" to "override" otherwise, because auto calc hp fields are saved with the character, adding features to a character who has ever poked autocalc is both hilarious and very wrong, leading to characters with 10000HP.

Dragonborn racial fixed #166

I know humans suck, but not giving them their racial defence bonus was really mean. Think of all the poor humans who have died for the lack of +1 ref!

When entering all the SRD weapons, I somehow missed the "2 handed" weapon property, which is a bummer because that's what the example fighter class feature uses! Added that.

I ahve now fallen down a rabbit hole regarding high crit weapons and that the critBonusField can't have a nested formula.

@draconas1
Copy link
Collaborator Author

Discovered that foundry dice formula sometimes does not put formula back in the right shape. A few spaces missing here and there

@draconas1
Copy link
Collaborator Author

High crit weapons fixed to have their extra damage dice referred to via variables so they just always work.

@draconas1
Copy link
Collaborator Author

Basic attacks adjusted to use @Epic for their damage formula

@draconas1
Copy link
Collaborator Author

@powmax updated to process formula in the base weapon damage correctly, like @powDamage

draconas1 added a commit to draconas1/dnd4eBeta that referenced this issue Feb 12, 2022
Actor ChatData for Effects
SRD Compendium fixes
Example Compendium fixes
I feel down a formula hole and couldn't get out
draconas1 added a commit to draconas1/dnd4eBeta that referenced this issue Feb 12, 2022
Actor ChatData for Effects
SRD Compendium fixes
Example Compendium fixes
I feel down a formula hole and couldn't get out
@draconas1 draconas1 mentioned this issue Feb 12, 2022
@draconas1
Copy link
Collaborator Author

Closed in 0.2.63

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

1 participant