Skip to content

Commit

Permalink
Add startingBonusRolls on feature and background
Browse files Browse the repository at this point in the history
  • Loading branch information
maqloner committed May 6, 2022
1 parent ad1aa3c commit 6d82e43
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 4 deletions.
Binary file added icons/classes/tall-tale/angler-fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/classes/tall-tale/crab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/classes/tall-tale/electric-eel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/classes/tall-tale/jellyfish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/classes/tall-tale/octopus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/classes/tall-tale/sea-turtle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/classes/tall-tale/shark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/classes/tall-tale/the-great-old-one.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@
"PB.Starting": "Starting",
"PB.StartingBonusItemInvalid": "Item must exist in a compendium pack to be able to be used as a starting bonus item.",
"PB.StartingBonusItems": "Starting Bonus Items",
"PB.StartingBonusRolls": "Starting Bonus Rolls",

"PB.StartingMacro": "Starting Macro",
"PB.StartingItems": "Starting Items",
"PB.StartingRolls": "Starting Rolls",
Expand Down
2 changes: 0 additions & 2 deletions module/combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const rollIndividualInitiative = async (actor) => {
if (game.combats && game.combat) {
const combatant = game.combat.combatants.find((i) => i.data.actorId === actor.id);
if (combatant) {
console.log('rolling combat init');
game.combat.rollInitiative(combatant.id);
return;
}
Expand Down Expand Up @@ -69,7 +68,6 @@ export class PBCombat extends Combat {
}

isFriendlyCombatant(combatant) {
console.log("isFriendlyCombatant", combatant);
if (combatant._token) {
// v8 compatible
return combatant._token.data.disposition === 1;
Expand Down
17 changes: 17 additions & 0 deletions module/scvm/scvmfactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ export const findStartingBonusItems = async (features) => {
return results;
};

export const findStartingBonusRollsItems = async (features) => {
let results = [];
for (const feature of features) {
if (feature.data.data.startingBonusRolls) {
results = results.concat(await rollRollItems(feature.data.data.startingBonusRolls));
}
}
return results;
};

export const handleActorGettingBetterItems = async (actor) => {
const actorClass = actor.getClass();
const baseClass = await actor.getBaseClass();
Expand Down Expand Up @@ -346,6 +356,12 @@ export const rollScvmForClass = async (clazz) => {
background
]);

const startingBonusRollItems = await findStartingBonusRollsItems([
...(features || []),
...(startingRollItems || []),
background
]);

const description = generateDescription(clazz, baseTables);

const allDocs = [
Expand All @@ -356,6 +372,7 @@ export const rollScvmForClass = async (clazz) => {
...(startingRollItems || []),
...(startingItems || []),
...(startingBonusItems || []),
...(startingBonusRollItems || []),
clazz,
];

Expand Down
5 changes: 5 additions & 0 deletions packs/class-buccaneer.db
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
{"_id":"faput8RkeUiNkwzx","name":"Crack Shot","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>All ranged attacks are DR10. <strong>If taken again, DR8.</strong></p>","featureType":"Class","maxQuantity":2,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":""},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{}}
{"_id":"lgzHS7vSvM7xgDOv","name":"Wildlife Tracker","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>When tracking, you always know your target&rsquo;s direction from your current location, and can tell approximately how long ago it left. Can only be taken once.</p>","featureType":"Class","maxQuantity":1,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":""},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{}}
{"_id":"vKcCqgp5tTmwYaWd","name":"Focused Aim","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>Attacks to hit an enemy you have already shot at this combat are DR8. <strong>If taken again: they also deal d4 extra damage.</strong></p>","featureType":"Class","maxQuantity":2,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":""},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{}}
{"_id":"a44UBgayTh0aBtcy","name":"Fast Reloader","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>You can reload and shoot in the same turn. Can only be taken once.</p>","featureType":"Class","maxQuantity":1,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":"","startingBonusRolls":"pirateborg.class-pirateborg;Generic Item"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{"core":{"sourceId":"Item.AxeYPFRnlVp2Z2Fv"}}}
{"_id":"a44UBgayTh0aBtcy","name":"Fast Reloader","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>You can reload and shoot in the same turn. Can only be taken once.</p>","featureType":"Class","maxQuantity":1,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":"","startingBonusRolls":"pirateborg.rolls-character-creation;d12 Arcane Rituals"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{"core":{"sourceId":"Item.AxeYPFRnlVp2Z2Fv"}}}
{"_id":"a44UBgayTh0aBtcy","name":"Fast Reloader","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>You can reload and shoot in the same turn. Can only be taken once.</p>","featureType":"Class","maxQuantity":1,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":"","startingBonusRolls":"pirateborg.rolls-character-creation;d12 Arcane rituals"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{"core":{"sourceId":"Item.AxeYPFRnlVp2Z2Fv"}}}
{"_id":"a44UBgayTh0aBtcy","name":"Fast Reloader","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>You can reload and shoot in the same turn. Can only be taken once.</p>","featureType":"Class","maxQuantity":1,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":"","startingBonusRolls":"pirateborg.rolls-character-creation;d20 Arcane rituals"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{"core":{"sourceId":"Item.AxeYPFRnlVp2Z2Fv"}}}
{"_id":"a44UBgayTh0aBtcy","name":"Fast Reloader","type":"feature","img":"systems/pirateborg/icons/misc/class-feature.png","data":{"description":"<p>You can reload and shoot in the same turn. Can only be taken once.</p>","featureType":"Class","maxQuantity":1,"quantity":1,"actionMacro":"pirateborg.macros-pirateborg;Generic Item","actionMacroLabel":"Use","startingBonusItems":"","startingBonusRolls":""},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"pdXclp2r5tiEF79G":3},"flags":{"core":{"sourceId":"Item.AxeYPFRnlVp2Z2Fv"}}}
6 changes: 4 additions & 2 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@
"description": "",
"startingGold": "2d6 * 10",
"quantity": 1,
"startingBonusItems": ""
"startingBonusItems": "",
"startingBonusRolls": ""
},
"feature": {
"description": "",
Expand All @@ -139,7 +140,8 @@
"quantity": 1,
"actionMacro": "",
"actionMacroLabel": "",
"startingBonusItems": ""
"startingBonusItems": "",
"startingBonusRolls": ""
},
"class": {
"description": "",
Expand Down
5 changes: 5 additions & 0 deletions templates/item/background-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ <h1 class="item-name">
<label>{{localize "PB.StartingBonusItems"}}:</label>
<textarea name="data.startingBonusItems" placeholder="compendium;item" rows="4">{{data.data.startingBonusItems}}</textarea>
</div>

<div class="form-group">
<label>{{localize "PB.StartingBonusRolls"}}:</label>
<textarea name="data.startingBonusRolls" placeholder="compendium;table;count" rows="4">{{data.data.startingBonusRolls}}</textarea>
</div>
</div>
</section>
</form>
5 changes: 5 additions & 0 deletions templates/item/feature-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ <h4 class="item-type">{{item.type}}</h4>
<label>{{localize "PB.StartingBonusItems"}}:</label>
<textarea name="data.startingBonusItems" placeholder="compendium;item" rows="4">{{data.data.startingBonusItems}}</textarea>
</div>

<div class="form-group">
<label>{{localize "PB.StartingBonusRolls"}}:</label>
<textarea name="data.startingBonusRolls" placeholder="compendium;table;count" rows="4">{{data.data.startingBonusRolls}}</textarea>
</div>
</div>
</section>
</form>

0 comments on commit 6d82e43

Please sign in to comment.