Skip to content

Commit

Permalink
✨ Add List of classes associated with spells
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Oct 12, 2023
1 parent 08670ed commit 6e98f76
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions docs/dnd5e/QuteSpell.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ Extension of [Tools5eQuteBase](Tools5eQuteBase.md).

## Attributes

[classes](#classes), [components](#components), [duration](#duration), [fluffImages](#fluffimages), [hasSections](#hassections), [labeledSource](#labeledsource), [level](#level), [name](#name), [range](#range), [ritual](#ritual), [school](#school), [source](#source), [sourceAndPage](#sourceandpage), [tags](#tags), [text](#text), [time](#time), [vaultPath](#vaultpath)
[classList](#classlist), [classes](#classes), [components](#components), [duration](#duration), [fluffImages](#fluffimages), [hasSections](#hassections), [labeledSource](#labeledsource), [level](#level), [name](#name), [range](#range), [ritual](#ritual), [school](#school), [source](#source), [sourceAndPage](#sourceandpage), [tags](#tags), [text](#text), [time](#time), [vaultPath](#vaultpath)


### classes
### classList

List of links to classes that can use this spell. May be incomplete or empty.

### classes

String: rendered list of links to classes that can use this spell. May be incomplete or empty.

### components

Formatted: spell components
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/tools5e/images-spell2md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ aliases: ["{resource.name}"]
{/if}{/each}

{/if}{#if resource.classes }
**Classes**: {resource.classes}
**Classes**: {#each resource.classList}{it} {#if it_hasNext}, {/if}{/each}

{/if}
*Source: {resource.source}*
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class QuteSpell extends Tools5eQuteBase {
public final String components;
/** Formatted: spell range */
public final String duration;
/** List of links to classes that can use this spell. May be incomplete or empty. */
/** String: rendered list of links to classes that can use this spell. May be incomplete or empty. */
public final String classes;
/** List of images for this spell (as {@link dev.ebullient.convert.qute.ImageRef}) */
public final List<ImageRef> fluffImages;
Expand All @@ -53,4 +53,11 @@ public QuteSpell(Tools5eSources sources, String name, String source, String leve
this.classes = classes;
this.fluffImages = fluffImages;
}

/** List of links to classes that can use this spell. May be incomplete or empty. */
public List<String> getClassList() {
return classes == null || classes.isEmpty()
? List.of()
: List.of(classes.split(",\\s*"));
}
}

0 comments on commit 6e98f76

Please sign in to comment.