Mod applies to roll not total
Changes: + modifier wird auf den wurf gerechnet und nicht auf das gesamt ergebniss (Wichtig für d100 würfe + Zeig modifier hinter dem wurf label an
This commit is contained in:
parent
05bed77ce5
commit
4ce31a97df
|
|
@ -416,7 +416,7 @@
|
|||
"chat": {
|
||||
"luckPoint": "Glückspunkt",
|
||||
"destiny": "Schicksalsgunst",
|
||||
"modify": "Nachträglich +2",
|
||||
"modify": "Nachträglich",
|
||||
"cancel": "Abbrechen",
|
||||
"roll": "Würfeln",
|
||||
"reroll": "Neuwürfeln",
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ Hooks.on("getChatLogEntryContext", function (html, options) {
|
|||
const message = (game as Game).messages.get(li.attr("data-message-id"));
|
||||
|
||||
// All must be true to show the reroll dialogue
|
||||
return game["user"].character.id === (game as Game).actors.get(message["speaker"].actor).id && !message["flags"].rerolled;
|
||||
return (game["user"].isGM || game["user"].character?.id === (game as Game).actors.get(message["speaker"].actor)?.id) && !message["flags"].rerolled;
|
||||
},
|
||||
callback: (li) => reroll(li),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ export class M5Roll {
|
|||
.map((rollName, index) => {
|
||||
indexMap.set(index, rollName);
|
||||
const formula = this.data.rolls[rollName];
|
||||
formula.formula = index === 0 ? formula.formula + " + " + this.data.b.modifier : formula.formula;
|
||||
formula.formula = index === 0 ? formula.formula.replace(/(\d*d\d*)/, `{$1 + ${this.data.b.modifier}}`) : formula.formula;
|
||||
const roll = new Roll(formula.formula, this.data);
|
||||
return roll;
|
||||
});
|
||||
|
||||
console.log(rolls);
|
||||
this.pool = PoolTerm.fromRolls(rolls);
|
||||
console.log("evaluate", this._evaluated, this.pool);
|
||||
return this.pool.evaluate({ async: true }).then((results) => {
|
||||
|
|
@ -110,14 +110,13 @@ export class M5Roll {
|
|||
if (!this._evaluated) await this.evaluate();
|
||||
|
||||
const rMode = checkOptions["rollMode"] || (game as Game).settings.get("core", "rollMode");
|
||||
|
||||
const chatData = {
|
||||
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
|
||||
content: await this.render(),
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.actor }),
|
||||
sound: CONFIG.sounds.dice,
|
||||
roll: Roll.fromTerms([this.pool]),
|
||||
flags: { data: this.data },
|
||||
flags: { data: this.data, rerolled: false, faces: this.pool.dice.map((x) => x.faces) },
|
||||
};
|
||||
|
||||
let foo = ChatMessage.applyRollMode(chatData, rMode);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import { M5Roll } from "./M5Roll";
|
|||
export const reroll = async (roll) => {
|
||||
const message = (game as Game).messages.get(roll.attr("data-message-id"));
|
||||
const actor = (game as Game).actors.get(message["speaker"].actor);
|
||||
// const die
|
||||
|
||||
const template = "systems/midgard5/templates/chat/reroll-dialog.hbs";
|
||||
const html = await renderTemplate(template, { sg: actor.system.sg, gp: actor.system.gp });
|
||||
console.log(message["flags"].faces[0]);
|
||||
// Button defining
|
||||
let buttons = {};
|
||||
buttons = {
|
||||
|
|
@ -22,7 +24,7 @@ export const reroll = async (roll) => {
|
|||
},
|
||||
modify: {
|
||||
icon: '<i class="fas fa-plus"></i>',
|
||||
label: (game as Game).i18n.localize("midgard5.chat.modify"),
|
||||
label: (game as Game).i18n.localize("midgard5.chat.modify") + " +" + (message["flags"].faces[0] === 100 ? 10 : 2),
|
||||
callback: () => rerollDie("modify", "gp"),
|
||||
},
|
||||
cancel: {
|
||||
|
|
@ -77,7 +79,7 @@ export const reroll = async (roll) => {
|
|||
for (var key in flagData.rolls) {
|
||||
if (!!flagData.rolls[key]) {
|
||||
rollData.rolls[key] = {
|
||||
formula: key === "0" ? flagData.rolls[key]?.result + " + 2" : flagData.rolls[key]?.result,
|
||||
formula: key === "0" ? flagData.rolls[key]?.result + " + " + (message["flags"].faces[0] === 100 ? 10 : 2) : flagData.rolls[key]?.result,
|
||||
enabled: flagData.rolls[key]?.enabled,
|
||||
label: flagData.rolls[key]?.label,
|
||||
result: "",
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
{{#each rolls as |roll index|}}
|
||||
{{#if roll.enabled}}
|
||||
<tr class="roll-row {{roll.css}}">
|
||||
<td>{{roll.label}}</td>
|
||||
<td>{{roll.label}} {{#if (eq index '0')}} {{#if (gt ../b.modifier 0)}}+{{../b.modifier}}{{/if}}{{#if (gt 0 ../b.modifier)}}{{../b.modifier}}{{/if}}{{/if}}</td>
|
||||
<td class="roll-result">
|
||||
<span class="roll-total {{#if (contains roll.label "Schaden")}}apply damage{{/if}}{{#if (contains roll.label "Heilung")}}apply heal{{/if}}">{{roll.totalStr}}</span>
|
||||
<span class="roll-detail">{{roll.result}}</span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue