Skip to content

Commit

Permalink
Merge pull request #35 from TheGiddyLimit/feature/more-items-conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGiddyLimit authored Aug 28, 2022
2 parents 78dddd8 + 8f58b74 commit d93fe2b
Show file tree
Hide file tree
Showing 13 changed files with 732 additions and 36 deletions.
16 changes: 9 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ There is a lot of 5e content to automate, so all contribution is welcomed and ap

### Coordination

We organise on the [5eTools Discord server](https://discord.gg/5etools).
We organise on the [5etools Discord server](https://discord.gg/5etools).

Although we will respond to issues and pull requests here, the easiest way to get a quick response or report minor typos/bugs is to message the **#plutonium-addon-automation** channel. Come join us if you'd like to help out! (*Especially* join us if you plan to fill out a lot of data at once—helps avoid wasted effort.)

Expand All @@ -34,9 +34,10 @@ Although we will respond to issues and pull requests here, the easiest way to ge
## Setting up

Run these precursory steps when you first set up:

1) Install [Node.js](https://nodejs.org/en/).
2) Clone this repo locally.
3) Run `npm i` within the your local repo.
3) Run `npm i` within your local repo.

### Building locally

Expand All @@ -50,13 +51,13 @@ Use `npm t` to verify the data files against the schema.

## Development guide

There isn't yet a tutorial to explain the data format. However, you can likely work most of it out by looking at examples. Familiarity with [5eTools' homebrew](https://github.com/TheGiddyLimit/homebrew) format and Foundry's data structure (including for [dnd5e](https://github.com/foundryvtt/dnd5e/wiki/Roll-Formulas), [DAE](https://gitlab.com/tposney/dae/-/blob/master/Readme.md#supported-fields-for-dnd5e), etc.) is very helpful.
There isn't yet a tutorial to explain the data format. However, you can likely work most of it out by looking at examples. Familiarity with [5etools' homebrew](https://github.com/TheGiddyLimit/homebrew) format and Foundry's data structure (including for [dnd5e](https://github.com/foundryvtt/dnd5e/wiki/Roll-Formulas), [DAE](https://gitlab.com/tposney/dae/-/blob/master/Readme.md#supported-fields-for-dnd5e), etc.) is very helpful.

### Data layout

The `module/data/` directory is laid out as follows:
- Each 'entity type' (the array names in 5eTools' JSON format—`"monster"`, `"spell"`, `"classFeature"`, etc.) is given its own directory.
- Within that directory, a `__core.json` file contains data for all entities which are natively available on 5eTools (i.e. without loading homebrew).
- Each 'entity type' (the array names in 5etools' JSON format—`"monster"`, `"spell"`, `"classFeature"`, etc.) is given its own directory.
- Within that directory, a `__core.json` file contains data for all entities which are natively available on 5etools (i.e. without loading homebrew).
- Within the same directory, each homebrew source has its own file named `<brewSourceJson>.json` (e.g. `WJMAiS.json` for *Wildjammer: More Adventures in Space*). If a homebrew source has multiple datatypes, one file per datatype is required (excluding datatypes without automation).

### Macros
Expand All @@ -66,6 +67,7 @@ Many facets of automation must be handled with macros. These are attached using
In the [`macro-item/`](./macro-item) directory is a directory for each datatype. Save your (well-formatted, commented) macro code as a Javascript file in one of these directories, structured as an async function named `macro`, with filename `<sourceJson>_<item-name-lowercase-hyphenated>.js` (e.g. `XGE_toll-the-dead.js`). **Note that the first and last lines of the file**—the ones that turn the macro into an async function—**are stripped on compilation into the module's data**.

You can create a new macro file using the `npm run mt --` command. The directory (`-d`) should match that of the JSON file into which the macro will be built.

```bash
npm run mt -- -d <directory> -s <jsonSource> -n <entity name>
# example: npm run mt -- -d spell -s PHB -n "toll the dead"
Expand All @@ -89,7 +91,7 @@ In the interests of consistency and user experience, we have some guidelines to
1) **We play D&D 5e.**
- Always assume the default ruleset.
- If you can do some fancy (invisible) macro work to support variant rules, go ahead, but never compromise core function.
2) **Maximum eficiency; minimum effort.**
2) **Maximum efficiency; minimum effort.**
- If something can be automated reliably, it should.
- If something can't be automated reliably, it shouldn't.
- Avoid automating only half of an item's effects without somehow informing the user of this.
Expand All @@ -103,4 +105,4 @@ In the interests of consistency and user experience, we have some guidelines to
4) **KISS: keep it simple, sweetie.**
- Avoid using macros except when absolutely necessary, and make sure they're readable and maintainable.
- Certainly avoid referencing anything outside the item that you can't guarantee will be present.
- Plutonium should only import one item per game-mechanic name. If a single class feature or spell has multiple, indepdendent functions (e.g. the paladin class' Lay on Hands feature), activating that item should prompt the user to choose the function (via a [macro](https://github.com/TheGiddyLimit/plutonium-addon-automation/issues/26)).
- Plutonium should only import one item per game-mechanic name. If a single class feature or spell has multiple, independent functions (e.g. the paladin class' Lay on Hands feature), activating that item should prompt the user to choose the function (via a [macro](https://github.com/TheGiddyLimit/plutonium-addon-automation/issues/26)).
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ As above, *Plutonium Add-on: Automation* is designed for the extensive automatio
## Required set-up

You **must** configure some modules in a specific way, or the automation won't work. Configure the following:

- _**DFreds Convenient Effects** > Modify Status Effects_ — select either `Replace` (preferred) or `Add`.
- _**Midi QoL** > Midi QoL config > Workflow > Apply Convenient Effects_ — select `Apply Item effects, if absent apply CE`.

If you have [Item Macro](https://github.com/Kekilla0/Item-Macro) active, you also need to configure it as follows:

- _**Item Macro** > Override default macro execution_ — uncheck this.
- _**Item Macro** > Character Sheet Hook_ — uncheck this.
- (If installed) _**[Token Action HUD](https://github.com/Drental/fvtt-tokenactionhud)** > Item-Macro: item macro, original item, or both_ — select `Show the original item`. (Note this is a user setting, so ensure that each user does this or use a module such as [Force Client Settings](https://gitlab.com/kimitsu_desu/force-client-settings) to guarantee it.)

## Contributing

Please see [`CONTRIBUTING.md`](./CONTRIBUTING.md).
Please see [`CONTRIBUTING.md`](./CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion module/data/_generated/index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"classFeature":{"PHB":{"Rogue":{"3":{"TCE":{"Steady Aim":0}}}}},"feat":{"PHB":{"Heavy Armor Master":1,"War Caster":1}},"item":{"DMG":{"Sentinel Shield":2}},"optionalfeature":{"TCE":{"Fire Rune":3}},"raceFeature":{"GiddyRace":{"Awakened Skeleton":{"GiddyRace":{"Skeletal":4}}}},"spell":{"GiddySpell":{"Collapse Astronomical Body":5,"Create Void":5},"WJMAiS":{"Hold Helm":6},"PHB":{"Blade Ward":7,"Heroism":7,"Hold Person":7,"Tongues":7,"True Strike":7},"TCE":{"Mind Sliver":7},"SCC":{"Silvery Barbs":7},"XGE":{"Toll the Dead":7}},"subclassFeature":{"PHB":{"Wizard":{"TCE":{"Bladesinging":{"2":{"TCE":{"Bladesong":8}}}}}}},"_file":{"0":"classFeature/__core.json","1":"feat/__core.json","2":"item/__core.json","3":"optionalfeature/__core.json","4":"raceFeature/GiddyRace.json","5":"spell/GiddySpell.json","6":"spell/WJMAiS.json","7":"spell/__core.json","8":"subclassFeature/__core.json"}}
{"classFeature":{"PHB":{"Monk":{"2":{"PHB":{"Patient Defense":0}},"18":{"PHB":{"Empty Body":0}}},"Barbarian":{"1":{"PHB":{"Rage":0}}},"Rogue":{"3":{"TCE":{"Steady Aim":0}}}}},"feat":{"PHB":{"Heavy Armor Master":1,"Inspiring Leader":1,"War Caster":1}},"item":{"DMG":{"Sentinel Shield":2}},"optionalfeature":{"TCE":{"Fire Rune":3}},"raceFeature":{"GiddyRace":{"Awakened Skeleton":{"GiddyRace":{"Skeletal":4}}},"PHB":{"Elf":{"PHB":{"Fey Ancestry":5}}}},"spell":{"GiddySpell":{"Collapse Astronomical Body":6,"Create Void":6},"WJMAiS":{"Hold Helm":7},"PHB":{"Aura of Purity":8,"Bane":8,"Barkskin":8,"Beacon of Hope":8,"Blade Ward":8,"Bless":8,"Blur":8,"Darkvision":8,"Fly":8,"Greater Invisibility":8,"Haste":8,"Heroism":8,"Hold Person":8,"Invisibility":8,"Sanctuary":8,"Tongues":8,"True Strike":8,"Vicious Mockery":8},"XGE":{"Frostbite":8,"Toll the Dead":8},"TCE":{"Mind Sliver":8,"Tasha's Caustic Brew":8},"SCC":{"Silvery Barbs":8}},"subclassFeature":{"PHB":{"Wizard":{"TCE":{"Bladesinging":{"2":{"TCE":{"Bladesong":9}}}}}}},"_file":{"0":"classFeature/__core.json","1":"feat/__core.json","2":"item/__core.json","3":"optionalfeature/__core.json","4":"raceFeature/GiddyRace.json","5":"raceFeature/__core.json","6":"spell/GiddySpell.json","7":"spell/WJMAiS.json","8":"spell/__core.json","9":"subclassFeature/__core.json"}}
199 changes: 199 additions & 0 deletions module/data/classFeature/__core.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,204 @@
{
"classFeature": [
{
"name": "Empty Body",
"source": "PHB",
"className": "Monk",
"classSource": "PHB",
"level": 18,
"effects": [
{
"flags": {
"core": {
"statusId": "Empty Body"
},
"dae": {
"specialDuration": [
"shortRest"
]
}
},
"changes": [
{
"key": "macro.CE",
"mode": "CUSTOM",
"value": "Invisible",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "acid",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "bludgeoning",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "cold",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "fire",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "lightning",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "necrotic",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "piercing",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "poison",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "psychic",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "radiant",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "slashing",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "thunder",
"priority": "20"
}
],
"duration": {
"seconds": 60
}
}
]
},
{
"name": "Patient Defense",
"source": "PHB",
"className": "Monk",
"classSource": "PHB",
"level": 2,
"effects": [
{
"changes": [
{
"key": "flags.midi-qol.grants.disadvantage.attack.all",
"mode": "OVERRIDE",
"value": "1",
"priority": "20"
},
{
"key": "flags.midi-qol.advantage.ability.save.dex",
"mode": "OVERRIDE",
"value": "1",
"priority": "20"
}
],
"duration": {
"seconds": 7
},
"flags": {
"dae": {
"specialDuration": [
"turnStartSource",
"shortRest"
]
}
}
}
]
},
{
"name": "Rage",
"source": "PHB",
"className": "Barbarian",
"classSource": "PHB",
"level": 1,
"effects": [
{
"flags": {
"dae": {
"specialDuration": [
"shortRest"
]
}
},
"changes": [
{
"key": "data.bonuses.mwak.damage",
"mode": "ADD",
"value": "floor(0.132 * @classes.barbarian.levels + 1.93)",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "slashing",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "piercing",
"priority": "20"
},
{
"key": "data.traits.dr.value",
"mode": "ADD",
"value": "bludgeoning",
"priority": "20"
},
{
"key": "flags.midi-qol.advantage.ability.save.str",
"mode": "OVERRIDE",
"value": "1",
"priority": "20"
},
{
"key": "flags.midi-qol.advantage.ability.check.str",
"mode": "OVERRIDE",
"value": "1",
"priority": "20"
}
],
"duration": {
"seconds": 60
}
}
]
},
{
"name": "Steady Aim",
"source": "TCE",
Expand Down
15 changes: 15 additions & 0 deletions module/data/feat/__core.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
}
]
},
{
"name": "Inspiring Leader",
"source": "PHB",
"effects": [
{
"flags": {
"dae": {
"specialDuration": [
"shortRest"
]
}
}
}
]
},
{
"name": "War Caster",
"source": "PHB",
Expand Down
23 changes: 23 additions & 0 deletions module/data/raceFeature/__core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"raceFeature": [
{
"name": "Fey Ancestry",
"source": "PHB",
"raceName": "Elf",
"raceSource": "PHB",
"effects": [
{
"changes": [
{
"key": "data.traits.ci.value",
"mode": "ADD",
"value": "unconscious",
"priority": "20"
}
],
"transfer": true
}
]
}
]
}
Loading

0 comments on commit d93fe2b

Please sign in to comment.