Skip to content

Commit

Permalink
0.0.2
Browse files Browse the repository at this point in the history
Merge pull request #7 from DenDrummer/0.0.2
  • Loading branch information
DenDrummer authored Aug 28, 2024
2 parents 8e206a9 + f6200d4 commit 1f2d777
Show file tree
Hide file tree
Showing 13 changed files with 616 additions and 117 deletions.
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 4,
"useTabs": false,
"semi": true,
"trailingComma": "all"
}
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Custom License based on MIT license

Copyright (c) 2024 Den_drummer on the software
Copyright on the used data is subject to their own licences
Copyright on the used data is subject to their own licenses

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -16,7 +16,7 @@ copies or substantial portions of the Software.
Publishing, distributing, sublicensing and/or selling of copies is only
permitted on code found in releases of at least a year old unless given
explicit approval. This is to prevent others "stealing" this project's
efforts, but still alowing others to take over should official support end.
efforts, but still allowing others to take over should official support end.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Classless Skill Tree 5E
*`classless-skill-tree-5e`*

An attempt at a classless skill tree Foundry addon module for DnD 5E inspired by [The Ugly Goblin](https://www.youtube.com/@TheUglyGoblin).
Plans to provide tools for GMs to create their own skill trees or recreate existing ones, and for these skill trees to be added to and/or replacing character sheets.
If given permission, will also include The Ugly Goblin's skill trees as presets.
An attempt at a classless skill tree Foundry addon module for DnD 5E inspired by [The Ugly Goblin](https://www.youtube.com/@TheUglyGoblin).

Plans to provide tools for GMs to create their own skill trees or recreate existing ones, and for these skill trees to be added to and/or replacing character sheets.

If given permission, will also include The Ugly Goblin's skill trees as presets, but the intent is to be fully compatible with it regardless.

In the meantime, I recommend giving their explanation video a watch!
[![Video thumbnail of "I REMOVED Classes from D&D + FREE Adventure" by The Ugly Goblin](https://img.youtube.com/vi/L7ONm4qYaXI/0.jpg)](https://www.youtube.com/watch?v=L7ONm4qYaXI)

This module is currently in VERY early stages, so for now you will have to manually download it yourself if you want to play around with it.
79 changes: 38 additions & 41 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
{
"authors": [
{
"discord": "Den_drummer",
"flags": {},
"name": "Den_drummer"
}
],
"compatibility": {
"minimum": "12",
"verified": "12.330"
},
"description": "An attempt at a classless skill tree addon for 5E inspired by The Ugly Goblin on Youtube.\nPlans to include their skill trees as presets if given permission.",
"documentTypes": {},
"esmodules": [
"scripts/Main.js"
],
"id": "classless-skill-tree-5e",
"languages": [
{
"lang": "en",
"name": "English",
"path": "languages/en.json"
}
],
"relationships": {
"systems": [
{
"compatibility": {
"minimum": "3",
"verified": "3.3.1"
},
"id": "dnd5e",
"type": "system"
}
]
},
"styles": [
"styles/SkillTree.css"
],
"title": "Classless Skill Tree 5e",
"version": "0.0.1"
"authors": [
{
"discord": "Den_drummer",
"flags": {},
"name": "Den_drummer"
}
],
"compatibility": {
"minimum": "12",
"verified": "12.330"
},
"description": "An attempt at a classless skill tree addon for 5E inspired by The Ugly Goblin on Youtube.\nPlans to include their skill trees as presets if given permission.",
"esmodules": ["scripts/Main.js"],
"id": "classless-skill-tree-5e",
"languages": [
{
"lang": "en",
"name": "English",
"path": "languages/en.json",
"flags": {}
}
],
"relationships": {
"systems": [
{
"compatibility": {
"minimum": "3",
"verified": "3.3.1"
},
"id": "dnd5e",
"type": "system"
}
]
},
"styles": ["styles/SkillTree.css"],
"title": "Classless Skill Tree 5e",
"version": "0.0.2",
"url": "https://github.com/DenDrummer/classless-skill-tree-5e"
}
16 changes: 16 additions & 0 deletions scripts/ClassLessSkillTree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* A class representing the Classless Skill Tree 5E module
* @typedef {Object} ClasslessSkillTree5E
* @property {string} ID the full ID, used e.g. for Foundry
* @property {string} SHORT_ID the short ID, used e.g. for logging
* @property {Object} FLAGS (needed for Foundry?)
* @property {Object} TEMPLATES (needed for Foundry?)
*/
export class ClasslessSkillTree5E {
static ID = "classless-skill-tree-5e";
static SHORT_ID = "CST5E";

static FLAGS = {};

static TEMPLATES = {};
}
60 changes: 51 additions & 9 deletions scripts/Main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,59 @@
import { ClasslessSkillTree5E } from "./ClassLessSkillTree.js";
import { RequiredSkill } from "./RequiredSkill.js";
import { SkillNode } from "./SkillNode.js";
import { SkillRequirement } from "./SkillRequirement.js";
import { SkillTree } from "./SkillTree.js";
import { SkillTreeUtils } from "./SkillTreeUtils.js";

SkillTreeUtils.log(false, "Main Loaded!");

console.log("CST5E | Main Loaded!");
Hooks.once("devModeReady", ({ registerPackageDebugFlag }) => {
SkillTreeUtils.log(false, "Dev Mode Ready");
registerPackageDebugFlag(ClasslessSkillTree5E.ID);
});

Hooks.on("init", () => {
console.log("CST5E | Main Initialized!");
// Object.assign(CONFIG.JournalEntryPage.dataModels, {
// "classless-skill-tree-5e": SkillTree
// });
SkillTreeUtils.log(false, "Main Initialized!");
});

Hooks.on("init", () => {
console.log("CST5E | Main Available!");

console.log(new SkillTree());
Hooks.on("ready", () => {
SkillTreeUtils.log(false, "Main Available!");

const testSkillNode = new SkillNode(
"TestNode",
"Test Node",
"This is a test node to see if the Skill Node class works.",
"#FFFFFF",
0,
0,
[]
);

const testDependentNode = new SkillNode(
"DependentNode",
"Dependent Node",
"This is a test node to see if Skill Node requirements work",
"#FFFFFF",
100,
0,
[
new SkillRequirement("OR", [
new RequiredSkill(testSkillNode, 1, "<="),
]),
]
);

const testSkillTree = new SkillTree(
"Test Tree",
"This is a test to see if the Skill Tree class works.",
[testSkillNode, testDependentNode]
);

const errorMessages = testSkillTree.validateTree();
if (errorMessages.length > 0) {
SkillTreeUtils.log(false, "Errors found in the Skill Tree:");
errorMessages.forEach((errorMsg) => {
console.warn(`CST5E | ${errorMsg}`);
});
}
});
27 changes: 27 additions & 0 deletions scripts/MultiSkillRequirement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { SkillRequirement } from "./SkillRequirement.js";

/**
* A class representing a group of requirements of which the specified amount is required to unlock the parent item.
* @typedef {Object} MultiSkillRequirement
* @property {Array<RequiredSkill|SkillRequirement>} requiredItems An array of required items. \
* These items are either a {@link SkillNode} or a {@link RequiredSkill}. \
* This list must contain at least one valid item to be valid.
* @property {number} requiredNumber The number of these items required to unlock the parent item.
*/
export class MultiSkillRequirement extends SkillRequirement {
/**
* Create a requirement group
* @param {Array<RequiredSkill|SkillRequirement>} requiredItems An array of required items. \
* These items are either a {@link SkillNode} or a {@link RequiredSkill}. \
* This list must contain at least one valid item to be valid.
* @param {number} requiredNumber The number of these items required to unlock the parent item. \
* Default: 1
*/
constructor(requiredItems, requiredNumber = 1) {
this.requiredNumber = requiredNumber;
this.requiredItems = requiredItems;

SkillTreeUtils.log(false, "MultiSkillRequirement created");
console.log(this);
}
}
43 changes: 43 additions & 0 deletions scripts/RequiredSkill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { SkillNode } from "./SkillNode.js";

/**
* A class representing a skill being required and at what level(s) the requirement is met.
* @typedef {Object} RequiredSkill
* @property {SkillNode} skill The {@link SkillNode} that is being depended on.
* @property {number} requiredLevel The level the required skill is being compared to. \
* Default: 1
* @property {"<" | "<=" | "==" | ">=" | ">"} requirementType How the current level of the required skill is compared to the required level of said skill. \
* Default: "<="
* @property {boolean} drawLine Whether to draw the line of this node to the required node. \
* Default: true
*/
export class RequiredSkill {
/**
* Create a dependency on a {@link SkillNode} and define at which level(s) this requirement is met.
* @param {SkillNode} skill The {@link SkillNode} that is being depended on.
* @param {number} requiredLevel The level the required skill is being compared to. \
* Defaults: 1
* @param {"<" | "<=" | "==" | ">=" | ">"} requirementType How the current level of the required skill is compared to the required level of said skill. \
* Default: "<="
* @param {boolean} drawLine Whether to draw the line of this node to the required node. \
* Default: true
*/
constructor(
skill,
requiredLevel = 1,
requirementType = "<=",
drawLine = true,
) {
/** @type {SkillNode} */
this.skill = skill;
/** @type {number} */
this.requiredLevel = requiredLevel;
/** @type {"<" | "<=" | "==" | ">=" | ">"} */
this.requirementType = requirementType;
/** @type {boolean} */
this.drawLine = drawLine;

SkillTreeUtils.log(false, "RequiredSkill created");
console.log(this);
}
}
Loading

0 comments on commit 1f2d777

Please sign in to comment.