One of Mob Attack Tool's features is to automatically interpret how the multiattack ability works of monsters. I wrote an algorithm to accomplish this, which you can find in multiattack.js.
The algorithm currently doesn't always parse the correct number of weapons, or it selects only some of the weapons that are part of the multiattack. In some cases it even selects the wrong weapons. This is currently the case for lycanthrope monsters (so werewolves, wererats, werebears, wereboars and weretigers), veteran, bandit captain, the erinyes, and so on.
There are 142 monsters in the SRD with the multiattack ability and I have not systematically checked which ones the algorithm works for and for which ones it doesn't. I suspect there to be at least a dozen, possibly several dozen multiattack descriptions that the algorithm interprets incorrectly. You might wonder why I don't just add a big table of monsters and check by name. The reason is that many DMs change or make their own monsters, and I want Mob Attack Tool to correctly interpret the multiattack descriptions in these cases too.
To state the goal clearly: I would like to improve the accuracy of the algorithm, especially for monsters with a lower Challenge Rating (CR). I welcome pull requests that make the algorithm interpret more multiattack descriptions correctly, without it becoming worse at interpreting the descriptions it currently is good at interpreting. (Edit: Please note that it doesn't need to be perfect. I'm already really happy if 2 or 3 of the "Bad" examples from the examples below are interpreted correctly.)
I don't have specific style guides to follow, since I barely know of their existence. I'm not a professional programmer, after all. As long as I can generally interpret what your code is doing, I'll be more than content. In fact, I'll probably learn more from you than the other way around!
Examples
Click on the expandable section below to see some examples. In the "Good" examples, the algorithm worked as intended. In the "Bad" examples, the algorithm got something wrong.
Table of examples
| Good examples |
Bad examples |
|
|
|
|
|
|
|
|
|
|
Multiattack description data
The "training data" I used to design the current algorithm is based on the multiattack descriptions of all the monsters in Systems Reference Document (SRD) of D&D5e. The dnd5e system for Foundry VTT contains a compendium of these monsters.
You can specifically extract these descriptions using this macro in a Foundry VTT game world that uses the dnd5e system:
// read compendium
const compendiumName = 'dnd5e.monsters';
const compMonsters = await game.packs.get(compendiumName).getDocuments();
// extract multiattack descriptions (this may take a few seconds)
let multiattackCollection = [];
for (let monster of compMonsters) {
if (monster.items.filter(i => i.name.startsWith("Multiattack")).length > 0) {
multiattackCollection.push({name: monster.name, multiattack: monster.items.filter(i => i.name.startsWith("Multiattack"))[0].data.data.description.value});
}
}
console.log(multiattackCollection);
// create a new item and set the multiattack description data as a flag on that item
const data = [{name: "Multiattack data", type: "weapon"}];
const created = await Item.create(data);
await game.items.getName("Multiattack data").setFlag("mob-attack-tool","multiattackData",multiattackCollection);
The macro above creates a new item called "Multiattack data". Right-click the item and select "Export Data" to obtain a JSON file. You'll find the multiattack descriptions in that JSON file.
For the sake of convenience, I'll also add a txt-file with the descriptions: dnd5eSRDmultiattackDescriptions.txt
One of Mob Attack Tool's features is to automatically interpret how the multiattack ability works of monsters. I wrote an algorithm to accomplish this, which you can find in multiattack.js.
The algorithm currently doesn't always parse the correct number of weapons, or it selects only some of the weapons that are part of the multiattack. In some cases it even selects the wrong weapons. This is currently the case for lycanthrope monsters (so werewolves, wererats, werebears, wereboars and weretigers), veteran, bandit captain, the erinyes, and so on.
There are 142 monsters in the SRD with the multiattack ability and I have not systematically checked which ones the algorithm works for and for which ones it doesn't. I suspect there to be at least a dozen, possibly several dozen multiattack descriptions that the algorithm interprets incorrectly. You might wonder why I don't just add a big table of monsters and check by name. The reason is that many DMs change or make their own monsters, and I want Mob Attack Tool to correctly interpret the multiattack descriptions in these cases too.
To state the goal clearly: I would like to improve the accuracy of the algorithm, especially for monsters with a lower Challenge Rating (CR). I welcome pull requests that make the algorithm interpret more multiattack descriptions correctly, without it becoming worse at interpreting the descriptions it currently is good at interpreting. (Edit: Please note that it doesn't need to be perfect. I'm already really happy if 2 or 3 of the "Bad" examples from the examples below are interpreted correctly.)
I don't have specific style guides to follow, since I barely know of their existence. I'm not a professional programmer, after all. As long as I can generally interpret what your code is doing, I'll be more than content. In fact, I'll probably learn more from you than the other way around!
Examples
Click on the expandable section below to see some examples. In the "Good" examples, the algorithm worked as intended. In the "Bad" examples, the algorithm got something wrong.
Table of examples
Multiattack description data
The "training data" I used to design the current algorithm is based on the multiattack descriptions of all the monsters in Systems Reference Document (SRD) of D&D5e. The dnd5e system for Foundry VTT contains a compendium of these monsters.
You can specifically extract these descriptions using this macro in a Foundry VTT game world that uses the dnd5e system:
The macro above creates a new item called "Multiattack data". Right-click the item and select "Export Data" to obtain a JSON file. You'll find the multiattack descriptions in that JSON file.
For the sake of convenience, I'll also add a txt-file with the descriptions: dnd5eSRDmultiattackDescriptions.txt