Skip to content

Commit

Permalink
Merge pull request #12 from dmizrahi/v9
Browse files Browse the repository at this point in the history
V9 compatibility
  • Loading branch information
RaySSharma authored Apr 24, 2022
2 parents 6647baf + 0dd5202 commit 561032b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions encounter-builder/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "encounter-builder",
"title": "5e Encounter Builder",
"description": "Adds an application to determine encounter difficulty, based on the Kobold Fight Club.",
"version": "0.2.2",
"minimumCoreVersion": "0.5.0",
"compatibleCoreVersion": "0.6.6",
"version": "0.3.0",
"minimumCoreVersion": "9",
"compatibleCoreVersion": "9",
"author": "RaySSharma",
"scripts": ["./src/encounter-builder.js", "./src/builder-form.js"],
"styles": ["./css/encounter-builder.css"],
Expand Down
18 changes: 10 additions & 8 deletions encounter-builder/src/builder-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ EB.CRtoXP = {
0: 10, 0.125: 25, 0.25: 50, 0.5: 100, 1: 200, 2: 450, 3: 700, 4: 1100, 5: 1800, 6: 2300, 7: 2900, 8: 3900, 9: 5000, 10: 5900, 11: 7200, 12: 8400, 13: 10000, 14: 11500, 15: 13000, 16: 15000, 17: 18000, 18: 20000, 19: 22000, 20: 25000, 21: 33000, 22: 41000, 23: 50000, 24: 62000, 25: 75000, 26: 90000, 27: 105000, 28: 120000, 29: 135000, 30: 155000

};
EB.encounterMultipliers = [0.5, 1.0, 1.5, 2.0, 2.0, 2.0, 2.0, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0, 4.0, 5.0];
EB.encounterMultipliers = [0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0];
EB.encounterMultiByNbMonsters = [0.5, 1.0, 1.5, 2.0, 2.0, 2.0, 2.0, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0, 4.0, 5.0];
EB.dailyXPBudget = [300, 600, 1200, 1700, 3500, 4000, 5000, 6000, 7500, 9000, 10500, 11500, 13500, 15000, 18000, 20000, 25000, 27000, 30000, 40000];
EB.difficultyToTreatPC = "deadly";

Expand Down Expand Up @@ -147,23 +148,24 @@ class EncounterBuilderApplication extends Application {
multiplier = 5.0;
}
else if (numOpponents > 0) {
multiplier = EB.encounterMultipliers[this.opponents.length + 1];
multiplier = EB.encounterMultiByNbMonsters[this.opponents.length + 1];
}
}
else if (numAllies > 5) {
if (numOpponents > 15) {
multiplier = 4.0;
}
else if (numOpponents > 0) {
multiplier = EB.encounterMultipliers[this.opponents.length - 1];
multiplier = EB.encounterMultiByNbMonsters[this.opponents.length];
multiplier = EB.encounterMultipliers[EB.encounterMultipliers.findIndex(multi => multi === multiplier) - 1];
}
}
else {
if (numOpponents > 15) {
multiplier = 4.0;
}
else if (numOpponents > 0) {
multiplier = EB.encounterMultipliers[this.opponents.length];
multiplier = EB.encounterMultiByNbMonsters[this.opponents.length];
}
}

Expand Down Expand Up @@ -211,17 +213,17 @@ class EncounterBuilderApplication extends Application {
async _onDropGeneral(event) {
let data;
data = JSON.parse(event.dataTransfer.getData("text/plain"));
if (data.type !== game.actors.entity) {
if (data.type !== game.actors.documentName) {
throw new Error(game.i18n.localize("EB.EntityError"));
}

const app = game.users.apps.find(e => e.id === game.i18n.localize("EB.id"));
let actor;
if (data.pack) {
actor = await game.actors.importFromCollection(data.pack, data.id)
actor = await Actor.fromDropData(data);
}
else {
actor = game.actors.get(data.id)
actor = game.actors.get(data.id);
}
return [app, actor]
}
Expand Down Expand Up @@ -381,4 +383,4 @@ class EncounterBuilderApplication extends Application {
app.render();
}

}
}

0 comments on commit 561032b

Please sign in to comment.