Skip to content

Commit 7bd8a0e

Browse files
authored
Add rule elements for active effects (#519)
* Make the checktypes a set * Add triggers for expenses * Add a targeting rule predicate * Provide quantifier option for effect predicate * Let's use CharacterInfo as the name for the event data * Add a rule trigger on effect toggling * Add a prompt for applying damage * Add update resource prompt * Add action to update track * Add dialog prompt for effects that can modify damage types * Add custom icon select dialog * Add damage source option to calculate damage trigger * Add update token action * Add play sound effect action * Add text enrichment to the message rule action * Use a foldout for the REs * Make the damage rule trigger sources a aset * Add action to execute macro * Add render check rule trigger * Add initialize check rule trigger Refactor common section targeted * Add support for update resource to add targeted actions * Add selected option for update resource * Add initialize check trigger support on weapons * Fix remove effect message handler * Add support for instancing effect from fuid to apply effect RE * Filter by check types * Fix up resource request absoluting on request ctor * Support targeting non-check skills * Use colors for resource gain/loss * Fix missing check for inspector * Add damage and resource data models to consumables * Add trigger and action for create consumable * Add a generic traits data model * Add a traits rule predicate * Separate model for traits and trait predicate * Fix up several trait issues * Use new icon set for affinities * Add resource data model for spell * Add various confirmation dialogs for RE window * Fix up resouce usage by spell data * Remove base 64 methods from inline helper * Clean up character info * Simplify the dispatch of the initialize check event * Rename CommonSections.actions * Add register callback for process check hook * Add comments for async hooks * Add effect application data to spell * Fix invoking modifyDamage when no damage is set * Add support for resource + effects in skills * Fix up spell damage validation * Rename to subscollectionfield * Rename the sub document uuid property to guid as it'ss not an actual uuid * Remove the duplicate icons * Add warnings for when players try to apply to non-owned actors * Fix up the array element rendering * Have the spell rule predicate replace the spell rule trigger * Add source info to the apply effect prompt * Start implementing a damage customizer on REs * Consolidate the changes applied by REs into the damage modifiers * Set event hook for the toggles in the dialog * Update the type selection * Add cost data to the damage modifiers * Correct the damage customization check * Add support for elementalist cataclysm
1 parent 22070e8 commit 7bd8a0e

File tree

193 files changed

+8217
-992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+8217
-992
lines changed

lang/en.json

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@
488488
"DamageCollateral": "Collateral Damage",
489489
"DamageTypeCollateral": "Collateral Damage Type",
490490
"DamageType": "Damage Type",
491+
"DamageSource": "Damage Source",
491492
"Damage": "Damage",
492493
"HasDamage": "Has Damage?",
493494
"UseWeaponDamage": "Use Weapon Damage",
@@ -566,6 +567,7 @@
566567
"EnemyTurn": "Enemy Turn",
567568
"Round": "Round",
568569
"SurpriseRound": "Surprise Round",
570+
"StartOfCombat": "Start of Combat",
569571
"StartOfTurn": "Start of Turn",
570572
"EndOfTurn": "End Of Turn",
571573
"EndOfRound": "End of Round",
@@ -689,9 +691,13 @@
689691
"ChatContextRerollFabula": "Invoke Trait to Reroll",
690692
"ChatContextPush": "Invoke Bond to Push",
691693
"ChatContextRerollUltima": "Invoke Trait to Reroll",
694+
"ChatActorOwnershipWarning": "You cannot perform that action on that actor as you do not own it.",
692695
"DialogPushBond": "Bond of ",
693696
"DialogPushAnd": " and ",
694697
"DialogPushWith": " with ",
698+
"DialogRemoveTitle": "Remove",
699+
"DialogRemoveMessage": "Remove <strong>{label}</strong>?",
700+
"DialogClearMessage": "Clear all elements?",
695701
"Success": "Success",
696702
"Critical": "Critical",
697703
"Failure": "Failure",
@@ -937,6 +943,16 @@
937943
"ChatFumbleOpportunity": "The opposition of <strong>{actor}</strong> gets to apply the effects of an opportunity!",
938944
"ChatOpportunitySettingMissing": "Automation for opportunities must be set on the system's homebrew settings",
939945
"ChatPromptCheck": "A check has been prompted to <strong>{verb}</strong> the following clock:",
946+
"ChatApplyEffect": "<strong>{effect}</strong> has been applied by <strong>{source}</source>",
947+
"ChatApplyEffectHint": "Apply <strong>{effect}</strong> to the target.",
948+
"ChatApplyEffectPrompt": "One of the following effects can be applied due to <strong>{source}</strong>.",
949+
"ChatRemoveEffect": "Remove effect",
950+
"ChatRemoveEffectPrompt": "One of the following effects can be removed due to <strong>{source}</strong>.",
951+
"ChatApplyDamagePrompt": "The followings characters have <strong>suffered {amount} {type} damage</strong> due to <strong>{source}</strong>.",
952+
"ChatResourceGainPrompt": "The followings characters have <strong>gained {amount} {type}</strong> due to <strong>{source}</strong>.",
953+
"ChatResourceLossPrompt": "The followings characters have <strong>lost {amount} {type}</strong> due to <strong>{source}</strong>.",
954+
"ChatResourceGainTooltip": "Gain <strong>{amount} {resource}</strong>.",
955+
"ChatResourceLossTooltip": "Lose <strong>{amount} {resource}</strong>.",
940956
"Increment": "Increment",
941957
"Decrement": "Decrement",
942958
"TotalAvailableSkills": "Total Available Skills",
@@ -1586,6 +1602,106 @@
15861602
"ChangeWarning2": "Changing an Item's Fabula Ultima ID might break references to the Item! Proceed with caution and only if you are sure.",
15871603
"ChangeWarning3": "Do you want to proceed?",
15881604
"ChangeWarning1": "Proceed with caution!"
1589-
}
1605+
},
1606+
"EventRelation": "Event Relation",
1607+
"EventRelationHint": "The context in which the the character fits in the event",
1608+
"FactionRelation": "Faction Relation",
1609+
"FactionRelationHint": "The targets' faction relation with the character",
1610+
"Selector": "Selector",
1611+
"SelectorHint": "Determines which characters is the rule element executed on.",
1612+
"Id": "Id",
1613+
"AutomationRuleElements": "Rule Elements",
1614+
"AutomationRuleElementsHint": "Whether to enable rule element automation",
1615+
"RuleElement": "Rule Element",
1616+
"RuleElementOptions": "Rule Elements",
1617+
"RuleElementNew": "Add new rule element",
1618+
"RuleActions": "Rule Actions",
1619+
"RuleActionMessage": "Message",
1620+
"RuleActionApplyDamage": "Apply Damage",
1621+
"RuleActionModifyDamage": "Modify Damage",
1622+
"RuleActionUpdateResource": "Update Resource",
1623+
"RuleActionApplyEffect": "Apply Effect",
1624+
"RuleActionClearEffect": "Clear Effect",
1625+
"RuleActionChangeTraits": "Change Traits",
1626+
"RuleActionModifyCheck": "Modify Check",
1627+
"RuleActionModifyExpense": "Modify Expense",
1628+
"RuleActionNotify": "Notify",
1629+
"RuleActionUpdateTrack": "Update Track",
1630+
"RuleActionUpdateToken": "Update Token",
1631+
"RuleActionPlaySoundEffect": "Play Sound Effect",
1632+
"RuleActionExecuteMacro": "Execute Macro",
1633+
"RuleActionModifyConsumable": "Modify Consumable",
1634+
"RuleTrigger": "Rule Trigger",
1635+
"RuleTriggerCombat": "Combat",
1636+
"RuleTriggerAttack": "Attack",
1637+
"RuleTriggerInitializeCheck": "Initialize Check",
1638+
"RuleTriggerPerformCheck": "Perform Check",
1639+
"RuleTriggerResolveCheck": "Resolve Check",
1640+
"RuleTriggerRenderCheck": "Render Check",
1641+
"RuleTriggerDamage": "Damage",
1642+
"RuleTriggerStatus": "Status",
1643+
"RuleTriggerResourceUpdate": "Resource Update",
1644+
"RuleTriggerResourceExpend": "Resource Expenditure",
1645+
"RuleTriggerCalculateDamage": "Calculate Damage",
1646+
"RuleTriggerToggle": "Toggle",
1647+
"RuleTriggerNotify": "Notify",
1648+
"RuleTriggerCreateConsumable": "Create Consumable",
1649+
"RulePredicates": "Rule Predicates",
1650+
"RulePredicateBond": "Bond",
1651+
"RulePredicateSpell": "Spell",
1652+
"RulePredicateFactionRelation": "Faction Relation",
1653+
"RulePredicateEffect": "Effect",
1654+
"RulePredicateSpecies": "Species",
1655+
"RulePredicateWeapon": "Weapon",
1656+
"RulePredicateResource": "Resource",
1657+
"RulePredicateTargeting": "Targeting",
1658+
"RulePredicateTraits": "Traits",
1659+
"AccuracyCheckRule": "Accuracy Check Rule",
1660+
"Type": "Type",
1661+
"Mode": "Mode",
1662+
"Any": "Any",
1663+
"Initial": "Initial",
1664+
"Ally": "Ally",
1665+
"Enemy": "Enemy",
1666+
"Allies": "Allies",
1667+
"Enemies": "Enemies",
1668+
"Even": "Even",
1669+
"Odd": "Odd",
1670+
"CheckResult": "Check Result",
1671+
"Outcome": "Outcome",
1672+
"True": "True",
1673+
"False": "False",
1674+
"Status": "Status",
1675+
"Change": "Change",
1676+
"Added": "Added",
1677+
"Removed": "Removed",
1678+
"CheckType": "Check Type",
1679+
"Result": "Result",
1680+
"ComparisonOperator": "Comparison Operator",
1681+
"GreaterThan": "Greater Than",
1682+
"LessThan": "Less Than",
1683+
"ExpenseSource": "Expense Source",
1684+
"Quantifier": "Quantifier",
1685+
"Enabled": "Enabled",
1686+
"Update": "Update",
1687+
"Reset": "Reset",
1688+
"Equals": "Equals",
1689+
"SelectDamageType": "Damage Type Selection",
1690+
"Scale": "Scale",
1691+
"Image": "Image",
1692+
"Asset": "Asset",
1693+
"Volume": "Volume",
1694+
"Macro": "Macro",
1695+
"OnApply": "On Apply",
1696+
"OnRoll": "On Roll",
1697+
"Multiplier": "Multiplier",
1698+
"Targeting": "Targeting",
1699+
"Changes": "Changes",
1700+
"Types": "Types",
1701+
"Expense": "Expense",
1702+
"Modifiers": "Modifiers",
1703+
"Variant": "Variant",
1704+
"OverChannel": "Over Channel",
1705+
"IncubationWarning": "The following feature is currently incubating and there may be issues present. Please bear that in mind."
15901706
}
15911707
}

module/checks/accuracy-check.mjs

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { FU, SYSTEM } from '../helpers/config.mjs';
1+
import { SYSTEM } from '../helpers/config.mjs';
22
import { CheckHooks } from './check-hooks.mjs';
3-
import { CHECK_ROLL } from './default-section-order.mjs';
43
import { Flags } from '../helpers/flags.mjs';
54
import { CommonSections } from './common-sections.mjs';
65
import { CommonEvents } from './common-events.mjs';
@@ -97,49 +96,47 @@ const handleWeaponTraitAccuracyBonuses = (check, actor, item) => {
9796

9897
/**
9998
* Hook called to process the result of the roll
100-
* @param {CheckResultV2} check
101-
* @param {FUActor} actor
102-
* @param {FUItem} [item]
99+
* @type ProcessCheckHook
103100
*/
104-
const onProcessCheck = (check, actor, item) => {
101+
const onProcessCheck = (check, actor, item, registerCallback) => {
105102
const { type, critical, fumble } = check;
106103
if (type === 'accuracy') {
107-
const configurer = CheckConfiguration.configure(check);
108-
configurer.modifyTargetedDefense((value) => value ?? 'def');
104+
const config = CheckConfiguration.configure(check);
105+
config.modifyTargetedDefense((value) => value ?? 'def');
109106
// TODO: Refactor alongside magic-checks
110107
if (critical) {
111-
configurer.addTraits('critical');
108+
config.addTraits('critical');
112109
} else if (fumble) {
113-
configurer.addTraits('fumble');
110+
config.addTraits('fumble');
114111
}
115-
configurer.modifyDamage((damage) => {
112+
config.modifyDamage((damage) => {
116113
if (damage) {
117114
const weaponTraits = CheckConfiguration.inspect(check).getWeaponTraits();
118115

119116
// All Damage
120117
const globalBonus = actor.system.bonuses.damage.all;
121118
if (globalBonus) {
122-
damage.modifiers.push({ label: `FU.DamageBonusAll`, value: globalBonus });
119+
damage.addModifier(`FU.DamageBonusAll`, globalBonus);
123120
}
124121
// Attack Type
125122
if (weaponTraits.weaponType) {
126123
const attackTypeBonus = actor.system.bonuses.damage[weaponTraits.weaponType] ?? 0;
127124
if (attackTypeBonus) {
128-
damage.modifiers.push({ label: `FU.DamageBonusType${weaponTraits.weaponType.capitalize()}`, value: attackTypeBonus });
125+
damage.addModifier(`FU.DamageBonusType${weaponTraits.weaponType.capitalize()}`, attackTypeBonus);
129126
}
130127
}
131128
// Weapon Category
132129
if (weaponTraits.weaponCategory) {
133130
const weaponCategoryBonus = actor.system.bonuses.damage[weaponTraits.weaponCategory] ?? 0;
134131
if (weaponCategoryBonus) {
135-
damage.modifiers.push({ label: `FU.DamageBonusCategory${weaponTraits.weaponCategory.capitalize()}`, value: weaponCategoryBonus });
132+
damage.addModifier(`FU.DamageBonusCategory${weaponTraits.weaponCategory.capitalize()}`, weaponCategoryBonus);
136133
}
137134
}
138135

139136
// Damage Type
140137
const damageTypeBonus = actor.system.bonuses.damage[damage.type];
141138
if (damageTypeBonus) {
142-
damage.modifiers.push({ label: `FU.DamageBonus${damage.type.capitalize()}`, value: damageTypeBonus });
139+
damage.addModifier(`FU.DamageBonus${damage.type.capitalize()}`, damageTypeBonus);
143140
}
144141
}
145142
return damage;
@@ -157,26 +154,9 @@ const onProcessCheck = (check, actor, item) => {
157154
function onRenderCheck(data, checkResult, actor, item, flags) {
158155
if (checkResult.type === 'accuracy') {
159156
const inspector = CheckConfiguration.inspect(checkResult);
160-
const checkData = inspector.getCheck();
161-
const damageData = inspector.getExtendedDamageData();
162-
163-
// Push combined data for accuracy and damage
164-
data.push({
165-
order: CHECK_ROLL,
166-
partial: 'systems/projectfu/templates/chat/chat-check-container.hbs',
167-
data: {
168-
check: checkData,
169-
damage: damageData,
170-
translation: {
171-
damageTypes: FU.damageTypes,
172-
damageIcon: FU.affIcon,
173-
},
174-
},
175-
});
176-
177157
/** @type TargetData[] */
178158
const targets = inspector.getTargets();
179-
CommonSections.targeted(data, actor, item, targets, flags, checkData, damageData);
159+
CommonSections.actions(data, actor, item, targets, flags, inspector);
180160
CommonEvents.attack(inspector, actor, item);
181161
(flags[SYSTEM] ??= {})[Flags.ChatMessage.Item] ??= item.toObject();
182162
}

0 commit comments

Comments
 (0)