WIP: Score bonuses on attacks

master
U~man 2020-07-25 20:50:50 +02:00
parent 58cbeb95a9
commit 3283519e4a
3 changed files with 16 additions and 11 deletions

View File

@ -164,7 +164,7 @@ export class OseActorSheet extends ActorSheet {
let actorObject = this.actor; let actorObject = this.actor;
let element = event.currentTarget; let element = event.currentTarget;
let attack = element.parentElement.parentElement.dataset.attack; let attack = element.parentElement.parentElement.dataset.attack;
actorObject.rollAttack({ label: this.actor.name, type: attack }, ev); actorObject.rollAttack({ skipDialog: ev.ctrlKey }, { type: attack });
}); });
html.find(".spells .item-reset").click((ev) => { html.find(".spells .item-reset").click((ev) => {

View File

@ -393,12 +393,12 @@ export class OseActor extends Actor {
if (ascending) { if (ascending) {
rollParts.push(data.thac0.bba.toString()); rollParts.push(data.thac0.bba.toString());
} }
if (attData.type == "missile") { if (options.type == "missile") {
rollParts.push( rollParts.push(
data.scores.dex.mod.toString(), data.scores.dex.mod.toString(),
data.thac0.mod.missile.toString() data.thac0.mod.missile.toString()
); );
} else if (attData.type == "melee") { } else if (options.type == "melee") {
rollParts.push( rollParts.push(
data.scores.str.mod.toString(), data.scores.str.mod.toString(),
data.thac0.mod.melee.toString() data.thac0.mod.melee.toString()
@ -408,14 +408,14 @@ export class OseActor extends Actor {
rollParts.push(attData.item.data.bonus); rollParts.push(attData.item.data.bonus);
} }
let thac0 = data.thac0.value; let thac0 = data.thac0.value;
if (attData.type == "melee") { if (options.type == "melee") {
dmgParts.push(data.scores.str.mod); dmgParts.push(data.scores.str.mod);
} }
const rollData = { const rollData = {
actor: this.data, actor: this.data,
item: attData.item, item: attData.item,
roll: { roll: {
type: attData.type, type: options.type,
thac0: thac0, thac0: thac0,
dmg: dmgParts, dmg: dmgParts,
}, },

View File

@ -65,9 +65,13 @@ export class OseDice {
}; };
// Optionally include a situational bonus // Optionally include a situational bonus
// if (form !== null) data["bonus"] = form.bonus.value; if (form !== null && form.bonus.value) {
if (data.item && data.item.data.bonus) parts.push(data.item.data.bonus); parts.push(form.bonus.value);
}
if (data.item && data.item.data.bonus) {
parts.push(data.item.data.bonus.toString());
}
console.log(parts);
const roll = new Roll(parts.join("+"), data).roll(); const roll = new Roll(parts.join("+"), data).roll();
// Convert the roll to a chat message and return the roll // Convert the roll to a chat message and return the roll
@ -169,8 +173,9 @@ export class OseDice {
}; };
// Optionally include a situational bonus // Optionally include a situational bonus
if (form !== null) data["bonus"] = form.bonus.value; if (form !== null && form.bonus.value) parts.push(form.bonus.value);
if (data["bonus"]) parts.push(data["bonus"]);
if (data.item && data.item.data.bonus) parts.push(data.item.data.bonus);
const roll = new Roll(parts.join("+"), data).roll(); const roll = new Roll(parts.join("+"), data).roll();
const dmgRoll = new Roll(data.roll.dmg.join("+"), data).roll(); const dmgRoll = new Roll(data.roll.dmg.join("+"), data).roll();
@ -243,7 +248,7 @@ export class OseDice {
title = null, title = null,
} = {}) { } = {}) {
let rolled = false; let rolled = false;
console.log(data);
const template = "systems/ose/templates/chat/roll-dialog.html"; const template = "systems/ose/templates/chat/roll-dialog.html";
let dialogData = { let dialogData = {
formula: parts.join(" "), formula: parts.join(" "),