Skip to content

Commit 1e13cf7

Browse files
committed
feat: added arcanum summoned slot
1 parent 0038a58 commit 1e13cf7

19 files changed

+290
-194
lines changed

module/documents/actors/actor.mjs

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,67 @@ export class FUActor extends Actor {
214214

215215
*allApplicableEffects() {
216216
for (const effect of super.allApplicableEffects()) {
217-
const applicableTypes = ['armor', 'shield', 'weapon', 'accessory'];
218-
if (effect.parent instanceof FUItem) {
219-
const itemId = effect.parent.id;
220-
const itemType = effect.parent.type;
217+
const applicableTypes = ['armor', 'shield', 'weapon', 'accessory', 'classFeature'];
218+
const vehicleTypes = ['projectfu.vehicle', 'projectfu.supportModule', 'projectfu.weaponModule', 'projectfu.armorModule'];
219+
const arcanumTypes = ['projectfu.arcanum', 'projectfu-playtest.arcanum2'];
220+
const item = effect.parent;
221+
222+
if (item instanceof FUItem) {
223+
const itemId = item.id;
224+
const itemType = item.type;
225+
const featureType = item.system.featureType;
226+
const actor = item.actor;
221227

222228
// Check if the item is one of the applicable types
223-
if (applicableTypes.includes(itemType)) {
229+
if (!applicableTypes.includes(itemType)) continue;
230+
231+
// Handle weapons and shields if weapons modules are active
232+
if ((itemType === 'weapon' || itemType === 'shield') && actor?.system.vehicle?.weaponsActive) {
233+
continue;
234+
}
235+
236+
// Handle armor if armor modules are active
237+
if (itemType === 'armor' && actor?.system.vehicle?.armorActive) {
238+
continue;
239+
}
240+
241+
// Handle class features based on vehicle configuration
242+
if (itemType === 'classFeature' && vehicleTypes.includes(featureType)) {
243+
const vehicle = actor?.system?.vehicle;
244+
const isEmbarked = vehicle?.embarked;
245+
let itemExistsInVehicle = false;
246+
247+
if (featureType === 'projectfu.supportModule' && Array.isArray(vehicle?.supports)) {
248+
itemExistsInVehicle = vehicle.supports.some((support) => support.id === itemId);
249+
} else if (featureType === 'projectfu.weaponModule' && Array.isArray(vehicle?.weapons)) {
250+
itemExistsInVehicle = vehicle.weapons.some((weapon) => weapon.id === itemId);
251+
} else if (featureType === 'projectfu.armorModule') {
252+
itemExistsInVehicle = vehicle?.armor?.id === itemId;
253+
} else if (featureType === 'projectfu.vehicle') {
254+
itemExistsInVehicle = vehicle?.vehicle?.id === itemId;
255+
}
256+
257+
// Continue to the next effect if the item shouldn't transfer its effects
258+
if (!isEmbarked || !itemExistsInVehicle || (item.transferEffects && !item.transferEffects())) {
259+
// console.log('Skipping effect due to non-embarked status or item not being part of vehicle.');
260+
continue;
261+
}
262+
} else if (itemType === 'classFeature' && arcanumTypes.includes(featureType)) {
263+
const currentArcanumId = actor?.system.equipped?.arcanum;
264+
265+
// Check if the item is the currently active arcanum
266+
if (itemId !== currentArcanumId) {
267+
continue;
268+
}
269+
} else {
270+
// Handle regular items using the equipped data model
224271
const equipData = this.system.equipped;
225272
if (!equipData.transferEffects(itemId)) {
226273
continue;
227274
}
228275
}
229276
}
277+
// Yield effect if it passes all checks
230278
yield effect;
231279
}
232280
}

module/documents/actors/common/equip-data-model.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export class EquipDataModel extends foundry.abstract.DataModel {
77
offHand: new StringField({ nullable: true }),
88
accessory: new StringField({ nullable: true }),
99
phantom: new StringField({ nullable: true }),
10+
arcanum: new StringField({ nullable: true }),
1011
};
1112
}
1213

module/documents/items/classFeature/arcanist/arcanum-data-model.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,17 @@ export class ArcanumDataModel extends RollableClassFeatureDataModel {
3535
}
3636

3737
static async getAdditionalData(model) {
38+
// Extract the ID from model.item
39+
const itemId = model.item?._id;
40+
41+
// Get the current active arcanum ID
42+
const actorArcanumId = model.actor?.system.equipped.arcanum || null;
43+
3844
// Provide any additional data needed for the template rendering
3945
return {
4046
enrichedMerge: await TextEditor.enrichHTML(model.merge),
4147
enrichedDismiss: await TextEditor.enrichHTML(model.dismiss),
48+
active: itemId === actorArcanumId,
4249
};
4350
}
4451

module/documents/items/classFeature/pilot/armor-module-data-model.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export class ArmorModuleDataModel extends RollableClassFeatureDataModel {
6666
}
6767
}
6868

69-
transferEffects() {
70-
return this.actor.system.vehicle.embarked && this.actor.system.vehicle.armor === this.item;
71-
}
69+
// transferEffects() {
70+
// return this.actor.system.vehicle.embarked && this.actor.system.vehicle.armor === this.item;
71+
// }
7272

7373
static async roll(model, item) {
7474
const actor = model.parent.parent.actor;

module/documents/items/classFeature/pilot/support-module-data-model.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class SupportModuleDataModel extends ClassFeatureDataModel {
3434
};
3535
}
3636

37-
transferEffects() {
38-
return this.actor.system.vehicle.embarked && this.actor.system.vehicle.supports.includes(this.item);
39-
}
37+
// transferEffects() {
38+
// return this.actor.system.vehicle.embarked && this.actor.system.vehicle.supports.includes(this.item);
39+
// }
4040
}

module/documents/items/classFeature/pilot/weapon-module-data-model.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class WeaponModuleDataModel extends RollableClassFeatureDataModel {
148148
}
149149
}
150150

151-
transferEffects() {
152-
return this.actor.system.vehicle.embarked && this.actor.system.vehicle.weapons.includes(this.item);
153-
}
151+
// transferEffects() {
152+
// return this.actor.system.vehicle.embarked && this.actor.system.vehicle.weapons.includes(this.item);
153+
// }
154154
}

module/documents/items/shield/shield-data-model.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class ShieldDataModel extends foundry.abstract.TypeDataModel {
128128
};
129129
}
130130

131-
transferEffects() {
132-
return !this.parent.actor?.system.vehicle.weaponsActive;
133-
}
131+
// transferEffects() {
132+
// return !this.parent.actor?.system.vehicle.weaponsActive;
133+
// }
134134
}

module/documents/items/weapon/weapon-data-model.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ export class WeaponDataModel extends foundry.abstract.TypeDataModel {
165165
}
166166
}
167167

168-
transferEffects() {
169-
return !this.parent.actor?.system.vehicle.weaponsActive;
170-
}
168+
// transferEffects() {
169+
// return !this.parent.actor?.system.vehicle.weaponsActive;
170+
// }
171171

172172
/**
173173
* @param {KeyboardModifiers} modifiers

module/sheets/actor-standard-sheet.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,21 @@ export class FUStandardActorSheet extends ActorSheet {
914914
html.find('[data-action=toggleWeaponModule][data-item-id]').on('click', updatePilotVehicle('updateActiveWeaponModules').bind(this));
915915
html.find('[data-action=toggleSupportModule][data-item-id]').on('click', updatePilotVehicle('updateActiveSupportModules').bind(this));
916916

917+
const updateArcanistArcanum = (event) => {
918+
const itemId = event.currentTarget.dataset.itemId;
919+
const currentArcanumId = this.actor.system.equipped.arcanum;
920+
921+
// Check if the clicked item is already the active arcanum
922+
const newArcanumId = currentArcanumId === itemId ? null : itemId;
923+
924+
// Update the arcanum slot
925+
this.actor.update({
926+
'system.equipped.arcanum': newArcanumId,
927+
});
928+
};
929+
930+
html.find('[data-action=toggleActiveArcanum][data-item-id]').on('click', updateArcanistArcanum.bind(this));
931+
917932
html.find('a[data-action=spendMetaCurrency]').on('click', () => this.actor.spendMetaCurrency());
918933

919934
html.find('span[data-action="clearTempEffects"]').click(this._onClearTempEffects.bind(this));

src/packs/skills/classFeature_Arcanum_of_the_Forge_BhLHFeKBx3zZRZD5.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"effects": [
2323
{
24+
"origin": "Compendium.projectfu.skills.Item.BhLHFeKBx3zZRZD5",
2425
"duration": {
2526
"rounds": 1,
2627
"startTime": null,
@@ -30,42 +31,41 @@
3031
"startRound": null,
3132
"startTurn": null
3233
},
33-
"disabled": true,
34+
"disabled": false,
3435
"name": "Merged: Forge",
35-
"_id": "apumDgChbamKpz3m",
36+
"img": "systems/projectfu/styles/static/compendium/classes/arcanist/arcanum/arcanum-of-the-forge.png",
37+
"_id": "288fLvNbYksITV4Q",
38+
"type": "base",
39+
"system": {},
3640
"changes": [
3741
{
38-
"key": "system.affinities.fire.bonus",
39-
"mode": 5,
40-
"value": "1",
42+
"key": "system.affinities.fire",
43+
"mode": 0,
44+
"value": "upgrade",
4145
"priority": null
4246
}
4347
],
4448
"description": "<ul><li><p>You have Resistance to <strong>fire</strong> damage.</p></li><li><p>Any <strong>fire</strong> damage you deal ignores Resistances. </p></li></ul>",
49+
"tint": "#ffffff",
4550
"transfer": true,
4651
"statuses": [],
52+
"sort": 0,
4753
"flags": {
4854
"projectfu": {
4955
"CrisisInteraction": "none"
5056
}
5157
},
52-
"tint": "#ffffff",
5358
"_stats": {
54-
"coreVersion": "12.330",
55-
"systemId": null,
56-
"systemVersion": null,
57-
"createdTime": null,
58-
"modifiedTime": null,
59-
"lastModifiedBy": null,
6059
"compendiumSource": null,
61-
"duplicateSource": null
60+
"duplicateSource": null,
61+
"coreVersion": "12.331",
62+
"systemId": "projectfu",
63+
"systemVersion": "#{VERSION}#",
64+
"createdTime": 1725596736998,
65+
"modifiedTime": 1725596846135,
66+
"lastModifiedBy": "dobQfkKFj2NK96cc"
6267
},
63-
"img": "modules/fabula-ultima-core-rulebook/artwork/class/Arcana/Arcanum%20of%20the%20Forge%20.png",
64-
"type": "base",
65-
"system": {},
66-
"origin": null,
67-
"sort": 0,
68-
"_key": "!items.effects!BhLHFeKBx3zZRZD5.apumDgChbamKpz3m"
68+
"_key": "!items.effects!BhLHFeKBx3zZRZD5.288fLvNbYksITV4Q"
6969
}
7070
],
7171
"ownership": {

0 commit comments

Comments
 (0)