Skip to content

Commit c8529c6

Browse files
authored
Merge pull request #7 from orffen/devel
r2 merge
2 parents 1c75af5 + f02fd07 commit c8529c6

File tree

9 files changed

+52
-16
lines changed

9 files changed

+52
-16
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ Initiative automatically includes the character's Dexterity modifier. The charac
1616

1717
The system does not yet automatically reset initiative at the end of each combat round, but this can be manually done in FoundryVTT's initiative tracker.
1818

19+
### Roll Formulas
20+
21+
To add ability bonuses/penalties to roll formulas (damage or special ability), you can use `@str.bonus`. Replace `str` with `int`, `wis`, `dex`, `con` or `cha`. You can use the full ability with just `@str`, for example if you wanted to do something like `d20<=@str`. `@lvl` is available as short-hand for the character level.
22+
23+
### Character Special Abilities
24+
25+
Special Abilities are a flexible item type with just a description and a roll formula. They can be used for thief abilities (formula: d100), open doors checks (d6), or even just as text (formula left blank). Clicking the icon in the list will either roll the formula if present, or output the description to the chat window.
26+
1927
### Monster Special Abilities
2028

21-
The monster sheet has a "special abilities" field. This field should be 0, 1, or 2, depending on how many asterisks appear after the monster's hit dice value. XP values for monsters are automatically calculated.
29+
The monster sheet has a "special abilities" field. This field should be 0, 1, or 2, depending on how many asterisks appear after the monster's hit dice value. XP values and attack bonus for monsters are automatically calculated.
2230

2331
## License
2432

module/sheets/actor-sheet.mjs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@ export class BasicFantasyRPGActorSheet extends ActorSheet {
119119
let carriedWeight = {
120120
"value": 0,
121121
_addWeight (moreWeight, quantity) {
122+
if (!quantity || quantity == '' || Number.isNaN(quantity) || quantity < 0) {
123+
return; // check we have a valid quantity, and do nothing if we do not
124+
}
122125
let q = Math.floor(quantity / 10);
123-
if (!Number.isNaN(parseInt(moreWeight))) {
124-
this.value += parseInt(moreWeight) * quantity;
126+
if (!Number.isNaN(parseFloat(moreWeight))) {
127+
this.value += parseFloat(moreWeight) * quantity;
125128
} else if (moreWeight === '*' && q > 0) {
126129
this.value += q;
127130
}
@@ -163,7 +166,7 @@ export class BasicFantasyRPGActorSheet extends ActorSheet {
163166
context.armors = armors;
164167
context.spells = spells;
165168
context.features = features;
166-
context.carriedWeight = carriedWeight.value;
169+
context.carriedWeight = Math.floor(carriedWeight.value); // we discard fractions of weight when we update the sheet
167170
}
168171

169172
/* -------------------------------------------- */
@@ -194,6 +197,17 @@ export class BasicFantasyRPGActorSheet extends ActorSheet {
194197
li.slideUp(200, () => this.render(false));
195198
});
196199

200+
// Prepare Spells
201+
html.find('.spell-prepare').click(ev => {
202+
const change = event.currentTarget.dataset.change;
203+
if (parseInt(change)) {
204+
const li = $(ev.currentTarget).parents(".item");
205+
const item = this.actor.items.get(li.data("itemId"));
206+
let newValue = item.data.data.prepared.value + parseInt(change);
207+
item.update({"data.prepared.value": newValue});
208+
}
209+
});
210+
197211
// Active Effect management
198212
html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.actor));
199213

styles/basicfantasyrpg.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,17 @@
386386
.basicfantasyrpg .sheet-body .editor,
387387
.basicfantasyrpg .sheet-body .tab,
388388
.basicfantasyrpg .sheet-body .tab .editor {
389-
height: 100%;
389+
height: calc(100% - 2px);
390+
}
391+
392+
.basicfantasyrpg .sheet-body .tab.biography {
393+
max-height: calc(100% - 53px);
390394
}
391395

392396
.basicfantasyrpg .editor-content {
393397
font-family: "Soutane", "Century Gothic", "TeX Gyre Adventor", var(--font-primary);
394398
font-size: 18px;
399+
overflow-y: hidden;
395400
}
396401

397402
.basicfantasyrpg .tox .tox-editor-container {

system.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "basicfantasyrpg",
33
"title": "Basic Fantasy RPG",
44
"description": "The Basic Fantasy RPG system for FoundryVTT!",
5-
"version": "r1",
5+
"version": "r2",
66
"minimumCoreVersion": "0.8.9",
77
"compatibleCoreVersion": "9",
88
"author": "Orffen",
@@ -23,6 +23,6 @@
2323
"secondaryTokenAttribute": null,
2424
"url": "https://github.com/orffen/basicfantasyrpg",
2525
"manifest": "https://raw.githubusercontent.com/orffen/basicfantasyrpg/main/system.json",
26-
"download": "https://github.com/orffen/basicfantasyrpg/archive/refs/tags/r1.zip",
26+
"download": "https://github.com/orffen/basicfantasyrpg/archive/refs/tags/r2.zip",
2727
"license": "LICENSE.txt"
2828
}

templates/actor/actor-monster-sheet.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" place
1717
</div>
1818

1919
<div class="resource flex-group-center">
20-
<label for="data.hitDice" class="resource-label">{{localize data.hitDice.abbr}} / {{localize data.specialAbility.label}}</label>
20+
<label for="data.hitDice" class="resource-label"><a class="rollable" data-roll="{{data.hitDice.number}}+{{data.hitDice.size}}+{{data.hitDice.mod}}" data-label="{{localize data.hitDice.label}}">{{localize data.hitDice.abbr}} / {{localize data.specialAbility.label}}</a></label>
2121
<div class="resource-content flexrow flex-center flex-between">
2222
<input type="number" name="data.hitDice.number" value="{{data.hitDice.number}}" data-dtype="Number"/>
2323
<input type="text" name="data.hitDice.size" value="{{data.hitDice.size}}" data-dtype="String"/>
@@ -33,14 +33,14 @@ <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" place
3333
<div class="resources grid grid-4col">
3434

3535
<div class="resource flex-group-center">
36-
<label for="data.numberAppearing.value" class="resource-label">{{localize data.numberAppearing.label}}</label>
36+
<label for="data.numberAppearing.value" class="resource-label"><a class="rollable" data-roll="{{data.numberAppearing.value}}" data-label="{{localize data.numberAppearing.label}}">{{localize data.numberAppearing.label}}</a></label>
3737
<div class="resource-content flexrow flex-center flex-between">
3838
<input type="text" name="data.numberAppearing.value" value="{{data.numberAppearing.value}}" data-dtype="String"/>
3939
</div>
4040
</div>
4141

4242
<div class="resource flex-group-center">
43-
<label for="data.morale.value" class="resource-label">{{localize data.morale.label}}</label>
43+
<label for="data.morale.value" class="resource-label"><a class="rollable" data-roll="2d6" data-label="{{localize data.morale.label}} ({{data.morale.value}})">{{localize data.morale.label}}</a></label>
4444
<div class="resource-content flexrow flex-center flex-between">
4545
<input type="number" name="data.morale.value" value="{{data.morale.value}}" data-dtype="Number"/>
4646
</div>
@@ -92,6 +92,7 @@ <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" place
9292
{{!-- For the main combat list, span the right two columns --}}
9393
<section class="main grid-span-2">
9494
{{> "systems/basicfantasyrpg/templates/actor/parts/actor-combat.html"}}
95+
{{> "systems/basicfantasyrpg/templates/actor/parts/actor-features.html"}}
9596
</section>
9697

9798
</section>
@@ -106,3 +107,4 @@ <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" place
106107
</section>
107108
</form>
108109

110+
<!-- <script>document.getElementsByName('data.attackBonus.value')[0].disabled = true;</script> -->

templates/actor/parts/actor-combat.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="resource flex-group-center">
1111
<label for="data.attackBonus.value" class="resource-label">{{localize data.attackBonus.abbr}}</label>
1212
<div class="resource-content flexrow flex-center flex-between">
13-
<input type="number" name="data.attackBonus.value" value="{{data.attackBonus.value}}" data-dtype="Number"/>
13+
<input type="number" name="data.attackBonus.value" value="{{data.attackBonus.value}}" data-dtype="Number" {{#if (eq actor.type "monster")}}disabled{{/if}}/>
1414
</div>
1515
</div>
1616

@@ -50,7 +50,7 @@ <h4>{{weapon.name}}</h4>
5050
<a class="rollable" data-roll-type="weapon" data-attack="melee"><img src="icons/skills/melee/strike-sword-gray.webp" title="{{localize 'BASICFANTASYRPG.Melee'}} {{localize 'BASICFANTASYRPG.Attack'}}" width="24" height="24"/></a>
5151
<a class="rollable" data-roll-type="weapon" data-attack="ranged"><img src="icons/skills/ranged/arrow-flying-gray-brown.webp" title="{{localize 'BASICFANTASYRPG.Ranged'}} {{localize 'BASICFANTASYRPG.Attack'}}" width="24" height="24"/></a>
5252
<span class="flexshrink">/</span>
53-
<a class="rollable" data-roll-type="damage" data-roll="{{weapon.data.damage.value}}" data-label="{{weapon.name}} {{localizeLowerCase weapon.data.damage.label}}"><img src="icons/skills/melee/shield-damaged-broken-blue.webp" title="{{weapon.data.damage.value}} {{weapon.data.damage.value}}" width="24" height="24"/></a>
53+
<a class="rollable" data-roll-type="damage" data-roll="{{weapon.data.damage.value}}" data-label="{{weapon.name}} {{localizeLowerCase weapon.data.damage.label}}"><img src="icons/skills/melee/shield-damaged-broken-blue.webp" title="{{weapon.data.damage.value}}" width="24" height="24"/></a>
5454
</div>
5555
<div class="item-controls">
5656
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>

templates/actor/parts/actor-features.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ol class="items-list">
22
<li class="item flexrow items-header">
33
<div class="item-name">{{localize 'ITEM.TypeFeature'}}</div>
4-
<div class="item-formula">{{localize 'BASICFANTASYRPG.Formula'}}</div>
4+
<div class="item-detail">{{localize 'BASICFANTASYRPG.Formula'}}</div>
55
<div class="item-controls">
66
<a class="item-control item-create" title="Create item" data-type="feature"><i class="fas fa-plus"></i> {{localize 'BASICFANTASYRPG.Add'}}</a>
77
</div>

templates/actor/parts/actor-items.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@
5353
<div class="item-image">
5454
<a class="rollable" data-roll-type="item"><img src="{{item.img}}" title="{{item.name}}" width="24" height="24"/></a>
5555
</div>
56-
<h4>{{item.name}}</h4>
56+
<h4>{{item.data.quantity.value}} {{item.name}}</h4>
57+
</div>
58+
<div class="item-prop grid grid-2col">
59+
<div class="flex-left align-right">{{item.data.weight.value}} lbs.</div>
60+
<div class="flex-right">{{item.data.price.value}}</div>
5761
</div>
58-
<div class="item-prop">{{item.data.weight.value}}</div>
5962
<div class="item-controls">
6063
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
6164
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>

templates/actor/parts/actor-spells.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
</div>
2828
<h4>{{item.name}}</h4>
2929
</div>
30-
<div class="item-prop">{{localize item.data.prepared.label}}: {{item.data.prepared.value}}</div>
30+
<div class="item-prop grid grid-3col">
31+
<div class="flex-group-right"><a class="item-control spell-prepare" data-change="-1"><i class="fas fa-minus"></i></a></div>
32+
<div class="flex-group-center">{{item.data.prepared.value}}</div>
33+
<div class="flex-group-left"><a class="item-control spell-prepare" data-change="+1"><i class="fas fa-plus"></i></a></div>
34+
</div>
3135
<div class="item-controls">
3236
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
3337
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>

0 commit comments

Comments
 (0)