Add Roll Modification (#61)
Changes: + add roll Mod (only for attributes) + check for roll mods when rolling on attributes
This commit is contained in:
parent
31cfd52131
commit
c313d3448c
|
|
@ -291,6 +291,7 @@
|
|||
"midgard5.kido-variante-kontrollieren": "Kontrollieren",
|
||||
|
||||
"midgard5.mod-operation-add100": "Addieren (max 100)",
|
||||
"midgard5.mod-operation-roll": "Wurf Modifikation",
|
||||
"midgard5.mod-operation-add": "Addieren",
|
||||
"midgard5.mod-operation-set": "Basiswert",
|
||||
"midgard5.mod-operation-fixed": "Fester Wert",
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export enum M5Stats {
|
|||
PROTECTION_LP = "lpProtection",
|
||||
PROTECTION_AP = "apProtection",
|
||||
PERCEPTION = "perception",
|
||||
DRINKING = "drinking"
|
||||
DRINKING = "drinking",
|
||||
}
|
||||
|
||||
export enum M5ModType {
|
||||
|
|
@ -96,6 +96,7 @@ export enum M5ModType {
|
|||
|
||||
export enum M5ModOperation {
|
||||
ADD_100 = "add100",
|
||||
ROLL = "roll",
|
||||
ADD = "add",
|
||||
SET = "set",
|
||||
FIXED = "fixed",
|
||||
|
|
|
|||
|
|
@ -258,7 +258,6 @@ export class M5Item extends Item {
|
|||
}
|
||||
|
||||
const roll = new M5Roll(rollData, this.actor, item.name);
|
||||
console.log(roll);
|
||||
return roll.toMessage();
|
||||
} else {
|
||||
ChatMessage.create({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Evaluated } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/client/dice/roll";
|
||||
import { M5Character } from "../actors/M5Character";
|
||||
import { M5EwResult, M5RollData, M5RollResult, M5SkillUnlearned, M5Stats } from "../M5Base";
|
||||
import { M5EwResult, M5ModOperation, M5ModType, M5RollData, M5RollResult, M5SkillUnlearned, M5Stats } from "../M5Base";
|
||||
import { stat } from "fs";
|
||||
|
||||
export class M5Roll {
|
||||
|
|
@ -115,31 +115,20 @@ export class M5Roll {
|
|||
return ChatMessage.create(chatData);
|
||||
}
|
||||
|
||||
static fromAttribute(actor: any, attributeKey: string) {
|
||||
const character = actor as M5Character;
|
||||
const attribute = character.attribute(attributeKey);
|
||||
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
rollData.i = attribute.value + attribute.bonus;
|
||||
rollData.rolls["0"] = {
|
||||
formula: "@i - 1d100",
|
||||
enabled: true,
|
||||
label: (game as Game).i18n.localize("midgard5.pw"),
|
||||
result: "",
|
||||
total: 0,
|
||||
totalStr: "",
|
||||
dice: {},
|
||||
css: "",
|
||||
} as M5RollResult;
|
||||
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize(`midgard5.actor-${attributeKey}-long`));
|
||||
}
|
||||
|
||||
static fromAttributeValue(actor: any, attributeKey: string, attributeValue: number) {
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
const itemData = actor.items.filter((x) => x.type === "effect").map((y) => y.system.mods);
|
||||
rollData.c = 0;
|
||||
for (let effectKey in itemData) {
|
||||
for (let modkey in itemData[effectKey])
|
||||
if (itemData[effectKey][modkey].type === M5ModType.ATTRIBUTE && itemData[effectKey][modkey].operation === M5ModOperation.ROLL) {
|
||||
rollData.c += itemData[effectKey][modkey].value;
|
||||
}
|
||||
}
|
||||
|
||||
rollData.i = attributeValue;
|
||||
rollData.rolls["0"] = {
|
||||
formula: "@i - 1d100",
|
||||
formula: "@i - 1d100 - @c",
|
||||
enabled: true,
|
||||
label: (game as Game).i18n.localize("midgard5.pw"),
|
||||
result: "",
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
{{#select mod.operation}}
|
||||
{{#if (eq mod.type "attribute")}}
|
||||
<option value="add100">{{localize "midgard5.mod-operation-add100"}}</option>
|
||||
<option value="roll">{{localize "midgard5.mod-operation-roll"}}</option>
|
||||
{{/if}}
|
||||
<option value="add">{{localize "midgard5.mod-operation-add"}}</option>
|
||||
<option value="set">{{localize "midgard5.mod-operation-set"}}</option>
|
||||
|
|
@ -48,7 +49,7 @@
|
|||
</td>
|
||||
|
||||
<td>
|
||||
<input name="data.mods.{{modId}}.value" type="text" value="{{mod.value}}" data-dtype="Number" />
|
||||
<input name="data.mods.{{modId}}.value" type="number" value="{{mod.value}}" data-dtype="Number" />
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue