Skip to content

Commit

Permalink
Playtest fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sadovsf committed Jun 11, 2021
1 parent 32ce156 commit 73e590e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
4 changes: 2 additions & 2 deletions module/actor/sheet/actorSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default class SGActorSheet extends ActorSheet {
const itemBulk = item.data.bulk || 0;
const itemCount = (item.isStack ? item.data.quantity : 1);
curBulk += itemBulk * itemCount;
if (item.type == "weapon") {
if (item.type == "weapon" && item.data.ammo) {
const ammoBulk = item.data.ammo.bulk;
const ammoCount = item.data.ammo.value;
curBulk += ammoBulk * ammoCount;
Expand All @@ -181,7 +181,7 @@ export default class SGActorSheet extends ActorSheet {
data.items = inventory;
data.currentBulk = curBulk;
data.currentBulkPerc = Math.min((curBulk / maxBulk) * 100, 100);
data.isOverloaded = curBulk > data.data.bulk;
data.isOverloaded = curBulk > maxBulk;
data.maxBulk = maxBulk;
}

Expand Down
3 changes: 2 additions & 1 deletion module/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ SGRPG.attackTypes = {
psychic: "Psychic",
blunt: "Blunt",
force: "Force",
slashing: "Slashing"
slashing: "Slashing",
electric: "Electric"
};

SGRPG.sizes = {
Expand Down
28 changes: 19 additions & 9 deletions module/item/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default class ItemSg extends Item {
}

async rollAttack() {
const abilityName = this.data.data.attackAbility;
const hasAmmo = this.data.data.ammo.value !== null;

if (! this.actor) {
Expand All @@ -44,11 +43,12 @@ export default class ItemSg extends Item {
return ui.notifications.warn("No more ammo for this item!");
}

const abilityMod = this.actor.data.data.attributes[abilityName].mod;
const abilityName = this.data.data.attackAbility;
const abilityMod = parseInt(this.actor.data.data.attributes[abilityName].mod);
const isProf = this.data.data.isProficient;

let rollMacro = "1d20 + " + this.data.data.toHit;
if (abilityMod != 0) {
if (parseInt(abilityMod) != 0) {
rollMacro += " + " + abilityMod;
}
if (isProf != 0) {
Expand Down Expand Up @@ -81,7 +81,14 @@ export default class ItemSg extends Item {
}

async rollDamage() {
const dmgRoll = this.data.data.dmg;
const abilityName = this.data.data.attackAbility;
const abilityMod = this.actor.data.data.attributes[abilityName].mod;
let dmgRoll = this.data.data.dmg;

if (parseInt(abilityMod) != 0) {
dmgRoll += " + " + abilityMod;
}

const r = new CONFIG.Dice.DamageRoll(dmgRoll, this.actor.data.data);

const configured = await r.configureDialog({
Expand Down Expand Up @@ -245,12 +252,15 @@ export default class ItemSg extends Item {
const labels = [];

if ( item.type === "weapon" ) {
if (item.data.ammo && item.data.ammo.target) {
// Items consumes some ammo, push reload action informations if any.
if (item.data.ammo.reload) {
labels.push("Reload: " + item.data.ammo.reload);
if (item.data.ammo && item.data.ammo.target) {
// Items consumes some ammo, push reload action informations if any.
if (item.data.ammo.reload) {
labels.push("Reload: " + item.data.ammo.reload);
}
}
if (item.data.details.special?.length) {
labels.push(item.data.details.special);
}
}
}
return labels;
}
Expand Down
2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sgrpg",
"title": "Stargate RPG",
"description": "Many details here.",
"version": "1.0.1-alpha",
"version": "1.1.0-alpha",
"templateVersion": 2,
"author": "Filip Sádovský",
"minimumCoreVersion": "0.8.6",
Expand Down
2 changes: 1 addition & 1 deletion template.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prof": 2,
"initiative": 0,
"moxie": 0,
"bulk": 8,
"bulk": 16,
"ac": 10,
"speed": 6,

Expand Down

0 comments on commit 73e590e

Please sign in to comment.