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

Fix complex exceptions for Breached Defenses such as Magical Silver #185

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

mysurvive
Copy link
Owner

Changes some of the logic in breached defenses to compensate for complex resistance exceptions, such as the Vampire Count's physical resistance (except magical silver).
Complex resistance exceptions are not set up the same way as simple resistance exceptions, so there's quite a bit more digging into the object to find what we need to add all of the proper rule elements to the Breached Defenses effect. This also fixes the dialog box's incorrect "except [object object]" lines that were produced for complex exceptions.
There is still an issue with the Adamantine Golem - it looks like the vorpal rune isn't part of the IWR calculation during a strike... which makes sense since runes are not fully implemented yet. Either way, this solution also handles that problem in the future (why is it ['vorpal-adamantine'] instead of ['vorpal', 'adamantine']????) when runes are implemented.

@mysurvive
Copy link
Owner Author

Resolves #183

@mysurvive mysurvive changed the title Fixes complex exceptions for Breached Defenses such as Magical Silver Fix complex exceptions for Breached Defenses such as Magical Silver Dec 22, 2024
@mysurvive mysurvive merged commit f19c6d0 into main Dec 27, 2024
4 checks passed
@mysurvive mysurvive deleted the Fix_Complex_Bypasses branch December 27, 2024 18:39
Comment on lines -147 to +157
if (e === n.exceptions[n.exceptions.length - 1]) {
s = s + `${e}`;
const bypassable = e.label ? game.i18n.localize(e.label) : e;
if (n.exceptions.length === 1) {
s = s + `${bypassable}`;
} else {
s = s + `${e}, `;
s = s + `${bypassable}, `;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a trailing comma if there are multiple exceptions:
image

The join() method is an easy way to just add commas between items:

s += n.exceptions.map(e => e.label ? game.i18n.localize(e.label) : e).join(', ');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the system IWR object has some labels already, I wonder if it might be easier to just use those everywhere? They don't look quite as nice as the ones with more html markup created for the earlier part of the EV dialog, but it would save a lot of code.

image

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

Successfully merging this pull request may close these issues.

2 participants