fix parade crit calculation
This commit is contained in:
parent
9d4e8f7c9e
commit
b58d0c9ec7
24
src/main.mjs
24
src/main.mjs
@ -101,7 +101,7 @@ Hooks.once("init", async function() {
|
||||
Handlebars.registerHelper({
|
||||
DSA41_input: (field_name, options) => {
|
||||
field_name = field_name.toString();
|
||||
|
||||
|
||||
let fields = field_name.startsWith("system.") ? options.data.root.document.system.schema.fields : options.data.root.document.schema.fields;
|
||||
let field = foundry.utils.getProperty(fields, field_name.replace(/^(system\.)/, "").replaceAll(".", ".fields."));
|
||||
|
||||
@ -578,8 +578,11 @@ class DSA41_CharacterData extends TypeDataModel {
|
||||
this.computed.num_waffen += 1;
|
||||
let computed = this.computed.kampf.waffen[item._id] = {
|
||||
item: item,
|
||||
attacke: 0,
|
||||
parade: 0,
|
||||
|
||||
attacke: 0,
|
||||
parade: 0,
|
||||
parade_crit: 0,
|
||||
|
||||
trefferpunkte: "",
|
||||
trefferpunkte_display: "",
|
||||
|
||||
@ -630,9 +633,10 @@ class DSA41_CharacterData extends TypeDataModel {
|
||||
computed.schild_parade += schild.system.schild.modifikator_parade;
|
||||
}
|
||||
|
||||
computed.attacke = computed.basis_attacke + computed.talent_attacke + computed.modifikator_attacke + computed.parierwaffe_attacke + computed.schild_attacke + Math.min(computed.tp_kk, 0);
|
||||
computed.parade = computed.basis_parade + computed.talent_parade + computed.modifikator_parade + computed.parierwaffe_parade + computed.schild_parade + Math.min(computed.tp_kk, 0);
|
||||
|
||||
computed.attacke = computed.basis_attacke + computed.talent_attacke + computed.modifikator_attacke + computed.parierwaffe_attacke + computed.schild_attacke + Math.min(computed.tp_kk, 0);
|
||||
computed.parade = computed.basis_parade + computed.talent_parade + computed.modifikator_parade + computed.parierwaffe_parade + computed.schild_parade + Math.min(computed.tp_kk, 0);
|
||||
computed.parade_crit = Math.round(computed.parade / 2);
|
||||
|
||||
computed.trefferpunkte = get_minified_formula(item.system.nahkampfwaffe.basis + (computed.tp_kk != 0 ? " + " + computed.tp_kk : ""));
|
||||
computed.trefferpunkte_display = computed.trefferpunkte.replace(/[\+\-]/, (op) => "<br>" + op);
|
||||
}
|
||||
@ -1108,13 +1112,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
const data = await DSA41_Dialog.wait("Parade", { window: { title: title }, item: item });
|
||||
|
||||
let flavor = game.i18n.localize("DSA41.roll_types." + roll_type);
|
||||
if (typeof success_value !== 'undefined') {
|
||||
flavor += " <= " + (Number(success_value) + data.modifikator);
|
||||
}
|
||||
|
||||
if (data.crit == "on") {
|
||||
roll_formula = "round((" + roll_formula + ") / 2)";
|
||||
}
|
||||
flavor += " <= " + (Number((data.crit == "on") ? item.parade_crit : item.parade) + data.modifikator);
|
||||
|
||||
let roll = new Roll(roll_formula, this.document.system);
|
||||
roll.toMessage({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user