Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
0.98.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Rughalt committed Dec 24, 2021
1 parent 73a3ee7 commit db6487b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
19 changes: 14 additions & 5 deletions module/actor/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4931,7 +4931,7 @@ export class ActorPF extends Actor {
let combat = game.combat;
if (!combat) {
if (game.user.isGM && canvas.scene) {
combat = await game.combats.object.create({ scene: canvas.scene._id, active: true });
combat = await game.combats.documentClass.create({ scene: canvas.scene._id, active: true });
} else {
ui.notifications.warn(game.i18n.localize("COMBAT.NoneActive"));
return null;
Expand All @@ -4946,16 +4946,17 @@ export class ActorPF extends Actor {
arr.push({ tokenId: t.id, hidden: t.data.hidden });
return arr;
}, []);
await combat.createEmbeddedEntity("Combatant", createData);
await combat.createEmbeddedDocuments("Combatant", createData);
}

// Iterate over combatants to roll for
const combatantIds = combat.combatants.reduce((arr, c) => {
if (c.actor.id !== this.id || (this.isToken && c.tokenId !== this.token.id)) return arr;
if (c.actor.id !== this.id || (this.isToken && c.data.tokenId !== this.token.id)) return arr;
if (c.initiative && !rerollInitiative) return arr;
arr.push(c._id);
arr.push(c.id);
return arr;
}, []);
}, []);

return combatantIds.length ? combat.rollInitiative(combatantIds, initiativeOptions) : combat;
}

Expand Down Expand Up @@ -6647,6 +6648,14 @@ export class ActorPF extends Actor {
return [];
}


async deleteEmbeddedEntity(documentName, data, options = {}) {
console.warn("The Document#updateEmbeddedEntity method has been renamed to Document#updateEmbeddedDocuments. Support for the old method name was removed in 0.9.0");
data = data instanceof Array ? data : [data];
options.massUpdate = true;
return this.deleteEmbeddedEntity(documentName, data, options);
}

async createEmbeddedEntity(embeddedName, createData, options = {}) {
let noArray = false;
if (!(createData instanceof Array)) {
Expand Down
1 change: 0 additions & 1 deletion module/combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ export class CombatPF extends Combat {
*/
async _processCurrentCombatant() {
try {
this.combatant?.actor?.expireActiveEffects();
} catch (error) {
console.error(error);
}
Expand Down
2 changes: 1 addition & 1 deletion module/item/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -2716,7 +2716,7 @@ export class ItemPF extends Item {
else if (p[1]) {
for (let damageType of CACHE.DamageTypes.values()) {
let identifiers = damageType.data.data.identifiers;
if (identifiers.some(i => i.toLowerCase() === p[1].toLowerCase()))
if (identifiers.some(i => i[0].toLowerCase() === p[1].toLowerCase()))
p[2] = damageType.data.data.uniqueId;
}
}
Expand Down
1 change: 1 addition & 0 deletions packs/damage-types.db
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
{"_id":"ejPjVSp2bIqcINlE","name":"Sonic","type":"damage-type","img":"systems/D35E/icons/damage-type/description/sonic.png","data":{"originVersion":97,"description":{"value":""},"uniqueId":"energy-sonic","slug":"damage","damageType":"energy","isPiercing":false,"isBludgeoning":false,"isSlashing":false,"identifiers":[["Sonic"]],"customReferenceId":"","createdBy":"","damage":{"parts":[]},"attackParts":[],"conditionals":[],"changes":[],"combatChanges":[],"contextNotes":[],"specialActions":[],"activateActions":[],"deactivateActions":[],"container":"None","containerWeightless":false,"identifiedName":"Sonic"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"VIfT2pClvTXfstmc":3},"flags":{"core":{"sourceId":"Item.BuQxdMpievDSzIZx"}}}
{"_id":"l9zlOZObRtFli2sl","name":"Divine","type":"damage-type","img":"systems/D35E/icons/damage-type/description/divine.png","data":{"originVersion":97,"description":{"value":""},"uniqueId":"energy-divine","slug":"damage","damageType":"energy","isPiercing":false,"isBludgeoning":false,"isSlashing":false,"identifiers":[["Divine"]],"customReferenceId":"","createdBy":"","damage":{"parts":[]}},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"VIfT2pClvTXfstmc":3},"flags":{"core":{"sourceId":"Item.BuQxdMpievDSzIZx"}}}
{"_id":"mUqNblkX3mwDS7vT","name":"Piercing or Slashing","type":"damage-type","img":"systems/D35E/icons/damage-type/description/piercing-or-slashing.png","data":{"originVersion":97,"description":{"value":""},"uniqueId":"damage-piercing-or-slashing","slug":"damage","damageType":"type","isPiercing":true,"isBludgeoning":false,"isSlashing":true,"identifiers":[["Piercing or Slashing"],["P or S"],["Slashing or Piercing"],["S or P"],["P and S"],["S and P"]],"customReferenceId":"","createdBy":"","damage":{"parts":[]},"attackParts":[],"conditionals":[],"changes":[],"combatChanges":[],"contextNotes":[],"specialActions":[],"activateActions":[],"deactivateActions":[],"container":"None","containerWeightless":false,"identifiedName":"Piercing or Slashing"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"VIfT2pClvTXfstmc":3},"flags":{"core":{"sourceId":"Item.BuQxdMpievDSzIZx"}}}
{"_id":"ES7yLCDLAbCDXbXx","name":"Electricity","type":"damage-type","img":"systems/D35E/icons/damage-type/description/electric.png","data":{"description":{"value":""},"uniqueId":"energy-electric","slug":"damage","damageType":"energy","isPiercing":false,"isBludgeoning":false,"isSlashing":false,"identifiers":[["Electric"],["Electricity"]],"customReferenceId":"","createdBy":"","originVersion":98,"damage":{"parts":[]},"attackParts":[],"conditionals":[],"changes":[],"combatChanges":[],"contextNotes":[],"specialActions":[],"activateActions":[],"deactivateActions":[],"container":"None","containerWeightless":false,"identifiedName":"Electricity"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"VIfT2pClvTXfstmc":3},"flags":{"core":{"sourceId":"Item.BuQxdMpievDSzIZx"}}}
6 changes: 2 additions & 4 deletions packs/templates.db

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "D35E",
"title": "3.5e SRD",
"description": "Implementation of 3.5 edition System Reference Document for Foundry VTT. Aiming to provide 100% SRD coverage.",
"version": "0.98.7",
"version": "0.98.8",
"author": "Rughalt",
"templateVersion": 2,
"scripts": [],
Expand Down

0 comments on commit db6487b

Please sign in to comment.