-
Notifications
You must be signed in to change notification settings - Fork 25
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
New special duration: RestComplete, NextD20Roll deletion fixes, Effect name fix #208
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -428,7 +428,15 @@ export class DemonlordActor extends Actor { | |
for (let effect of this.appliedEffects) { | ||
const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') | ||
if (!(specialDuration?.length > 0)) continue | ||
if (specialDuration === 'NextD20Roll' && effect.changes.find((e) => e.key.includes('system.bonuses.attack.boons'))) await effect?.delete() | ||
if (specialDuration === 'NextD20Roll') { | ||
let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' | ||
if ( | ||
effect.changes.find(e => e.key.includes('system.bonuses.attack.boons.all')) || !effect.changes.length || | ||
effect.changes.find(e => e.key.includes(`system.bonuses.attack.boons.${nAttackAttribute}`)) || | ||
effect.changes.find(e => e.key.includes(`system.bonuses.attack.boons.weapon`)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe needs to be added for spells as well? |
||
) | ||
await effect?.delete() | ||
} | ||
} | ||
|
||
Hooks.call('DL.RollAttack', { | ||
|
@@ -502,7 +510,13 @@ export class DemonlordActor extends Actor { | |
for (let effect of this.appliedEffects) { | ||
const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') | ||
if (!(specialDuration?.length > 0)) continue | ||
if (specialDuration === 'NextD20Roll' && effect.changes.find((e) => e.key.includes('system.bonuses.challenge.boons'))) await effect?.delete() | ||
if (specialDuration === 'NextD20Roll') { | ||
if ( | ||
effect.changes.find(e => e.key.includes('system.bonuses.challenge.boons.all')) || !effect.changes.length || | ||
effect.changes.find(e => e.key.includes(`system.bonuses.challenge.boons.${attribute.key}`)) | ||
) | ||
await effect?.delete() | ||
} | ||
} | ||
|
||
return challengeRoll | ||
|
@@ -578,7 +592,14 @@ export class DemonlordActor extends Actor { | |
for (let effect of this.appliedEffects) { | ||
const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') | ||
if (!(specialDuration?.length > 0)) continue | ||
if (specialDuration === 'NextD20Roll' && attackAttribute !== '' && effect.changes.find((e) => e.key.includes('system.bonuses.attack.boons'))) await effect?.delete() | ||
if (specialDuration === 'NextD20Roll') { | ||
let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' | ||
if ( | ||
effect.changes.find(e => e.key.includes('system.bonuses.attack.boons.all')) || !effect.changes.length || | ||
effect.changes.find(e => e.key.includes(`system.bonuses.attack.boons.${nAttackAttribute}`)) | ||
) | ||
await effect?.delete() | ||
} | ||
} | ||
|
||
} | ||
|
@@ -670,7 +691,15 @@ export class DemonlordActor extends Actor { | |
for (let effect of this.appliedEffects) { | ||
const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') | ||
if (!(specialDuration?.length > 0)) continue | ||
if (specialDuration === 'NextD20Roll' && attackAttribute !== '' && effect.changes.find((e) => e.key.includes('system.bonuses.attack.boons'))) await effect?.delete() | ||
if (specialDuration === 'NextD20Roll') { | ||
let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' | ||
if ( | ||
effect.changes.find(e => e.key.includes('system.bonuses.attack.boons.all')) || !effect.changes.length || | ||
effect.changes.find(e => e.key.includes(`system.bonuses.attack.boons.${nAttackAttribute}`)) || | ||
effect.changes.find(e => e.key.includes(`system.bonuses.attack.boons.spell`)) | ||
) | ||
await effect?.delete() | ||
} | ||
} | ||
|
||
// Add concentration if it's in the spell duration | ||
|
@@ -748,7 +777,7 @@ export class DemonlordActor extends Actor { | |
|
||
let boons = | ||
(parseInt(inputBoons) || 0) + | ||
(this.system.bonuses.attack[attackAttribute] || 0) + | ||
(this.system.bonuses.attack.boons[attackAttribute] || 0) + | ||
(this.system.bonuses.attack.boons.all || 0) + | ||
parseInt(itemData.action?.boonsbanes || 0) | ||
|
||
|
@@ -767,8 +796,15 @@ export class DemonlordActor extends Actor { | |
for (let effect of this.appliedEffects) { | ||
const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') | ||
if (!(specialDuration?.length > 0)) continue | ||
if (specialDuration === 'NextD20Roll' && attackAttribute !== '' && effect.changes.find((e) => e.key.includes('system.bonuses.attack.boons'))) await effect?.delete() | ||
} | ||
if (specialDuration === 'NextD20Roll') { | ||
let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' | ||
if ( | ||
effect.changes.find(e => e.key.includes('system.bonuses.attack.boons.all')) || !effect.changes.length || | ||
effect.changes.find(e => e.key.includes(`system.bonuses.attack.boons.${nAttackAttribute}`)) | ||
) | ||
await effect?.delete() | ||
} | ||
} | ||
} | ||
postItemToChat(this, item, attackRoll, target?.actor, parseInt(inputBoons) || 0) | ||
return attackRoll | ||
|
@@ -911,6 +947,12 @@ export class DemonlordActor extends Actor { | |
if (restTime === 24) this.applyHealing(true) | ||
} | ||
|
||
for (let effect of this.appliedEffects) { | ||
const specialDuration = foundry.utils.getProperty(effect, "flags.specialDuration") | ||
if (!(specialDuration?.length > 0)) continue | ||
if (specialDuration === 'RestComplete') await effect?.delete() | ||
} | ||
|
||
var templateData = { actor: this, restTime, magicRecovery, talentRecovery, healing } | ||
|
||
const chatData = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to move the end
!effect.changes.length === 0
to the top or the bottom. Same for lines 515, 598, 697 and 802.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code checks the same bonuses what each function rollItem/Talent/Weapon/Spell uses, so If you set a bonus to system.bonuses.attack.boons.spell effect will be removed when spell casted.
Same as weapon attack checks only for system.bonuses.attack.boons.${AttackAttribute}, system.bonuses.attack.boons.all and system.bonuses.attack.boons.all and not for system.bonuses.attack.boons.spell.
That is the logic.