Compare commits

...
9 Commits
Author SHA1 Message Date
Byroks 8a3c632c7d Merge branch 'develop' 2023-12-15 21:36:50 +01:00
Byroks 91f12b11da v2.3.1 2023-12-15 21:36:33 +01:00
ByroksandGitHub bfa51605bc Add Consumable Items (#62)
Changes:
 + add Quantity value for items
 + add plus and minus buttons for list
 + add roll button if item contains formulas
 + decrease quantity by 1 if rolled
2023-12-15 21:34:32 +01:00
ByroksandGitHub c313d3448c Add Roll Modification (#61)
Changes:
 + add roll Mod (only for attributes)
 + check for roll mods when rolling on attributes
2023-12-15 20:40:23 +01:00
ByroksandGitHub 31cfd52131 Add currency to character sheet (#60)
Changes:
 + add fields to track currency
 + show value of standard items
2023-12-15 20:39:29 +01:00
Byroks 7fe52cf52a Merge branch 'develop' 2023-12-13 18:55:13 +01:00
Byroks f4a2338075 Merge branch 'develop' 2023-12-06 16:13:30 +01:00
Byroks 024f0b9c42 Squashed commit of the following:
commit 250fc499ae
Author: Byroks <byroks@gmail.com>
Date:   Thu Nov 30 16:17:04 2023 +0100

    v2.1.0

commit 28595e7dd0
Author: Byroks <byroks@gmail.com>
Date:   Thu Nov 30 15:50:59 2023 +0100

    Make Items with mods equippable (#11)

    Changes:
     + Items that can influence you stats are equippable
     + only equipped items influence your stats
     + Armor now influences your stats
     + move mods into a partial for easier changes

commit 8095785fc2
Author: Byroks <byroks@gmail.com>
Date:   Wed Nov 29 10:14:49 2023 +0100

    Movement stat (#10)

    Changes:
     + make movement stat work and be moddable by effects

commit e141839055
Merge: 14e005c 0bfa224
Author: Byroks <byroks@gmail.com>
Date:   Tue Nov 28 19:50:38 2023 +0100

    Merge branch 'main' into develop

commit 14e005cb0a
Author: Byroks <byroks@gmail.com>
Date:   Tue Nov 28 19:48:14 2023 +0100

    v2.0.0

commit c635c54f24
Author: Byroks <byroks@gmail.com>
Date:   Tue Nov 28 19:42:38 2023 +0100

    Dev Kampfkünste Items & Integration (#7)

    Changes:
     + add kampfkuenste template
     + add kampfkuenste tab
     + make kampfkuenste rollable
     + update localization

commit e27f4209e5
Author: Byroks <byroks@gmail.com>
Date:   Mon Nov 27 20:05:20 2023 +0100

    Squashed commit of the following:

    commit 0bfa224dae
    Author: Byroks <byroks@gmail.com>
    Date:   Mon Nov 27 19:56:05 2023 +0100

        V1.3.1 (#6)

        * v1.3.1

        * v1.3.1

        * update .gitingore

    commit 35a6b0fae9
    Author: Byroks <byroks@gmail.com>
    Date:   Mon Nov 27 19:48:56 2023 +0100

        v1.3.1

    commit db21ca93b0
    Author: Byroks <byroks@gmail.com>
    Date:   Sun Nov 26 13:13:13 2023 +0100

        subtract ap when casting spell

        Changes:
         + subtract AP when casting a spell
2023-11-30 16:19:25 +01:00
ByroksandGitHub 16df142d45 v2.0.0 (#8)
* Squashed commit of the following:

commit 0bfa224dae
Author: Byroks <byroks@gmail.com>
Date:   Mon Nov 27 19:56:05 2023 +0100

    V1.3.1 (#6)

    * v1.3.1

    * v1.3.1

    * update .gitingore

commit 35a6b0fae9
Author: Byroks <byroks@gmail.com>
Date:   Mon Nov 27 19:48:56 2023 +0100

    v1.3.1

commit db21ca93b0
Author: Byroks <byroks@gmail.com>
Date:   Sun Nov 26 13:13:13 2023 +0100

    subtract ap when casting spell

    Changes:
     + subtract AP when casting a spell

* Dev Kampfkünste Items & Integration (#7)

Changes:
 + add kampfkuenste template
 + add kampfkuenste tab
 + make kampfkuenste rollable
 + update localization

* v2.0.0
2023-11-28 19:50:56 +01:00
12 changed files with 154 additions and 40 deletions
+7 -2
View File
@@ -91,6 +91,10 @@
"midgard5.origin": "Heimat", "midgard5.origin": "Heimat",
"midgard5.faith": "Glaube", "midgard5.faith": "Glaube",
"midgard5.currency-gold": "Gold",
"midgard5.currency-silver": "Silber",
"midgard5.currency-copper": "Kupfer",
"midgard5.exp-overall": "Erfahrungsschatz", "midgard5.exp-overall": "Erfahrungsschatz",
"midgard5.exp-available": "Erfahrungspunkte", "midgard5.exp-available": "Erfahrungspunkte",
"midgard5.grace": "Göttliche Gnade", "midgard5.grace": "Göttliche Gnade",
@@ -197,8 +201,8 @@
"midgard5.enduranceBonus": "Ausdauerbonus", "midgard5.enduranceBonus": "Ausdauerbonus",
"midgard5.lpProtection": "Rüstungsschutz (LP)", "midgard5.lpProtection": "Rüstungsschutz (LP)",
"midgard5.apProtection": "Rüstungsschutz (AP)", "midgard5.apProtection": "Rüstungsschutz (AP)",
"midgard5.perception" : "Wahrnehmung", "midgard5.perception": "Wahrnehmung",
"midgard5.drinking" : "Trinken", "midgard5.drinking": "Trinken",
"midgard5.new-skill": "Neue Fertigkeit", "midgard5.new-skill": "Neue Fertigkeit",
"midgard5.special": "Spezial", "midgard5.special": "Spezial",
@@ -287,6 +291,7 @@
"midgard5.kido-variante-kontrollieren": "Kontrollieren", "midgard5.kido-variante-kontrollieren": "Kontrollieren",
"midgard5.mod-operation-add100": "Addieren (max 100)", "midgard5.mod-operation-add100": "Addieren (max 100)",
"midgard5.mod-operation-roll": "Wurf Modifikation",
"midgard5.mod-operation-add": "Addieren", "midgard5.mod-operation-add": "Addieren",
"midgard5.mod-operation-set": "Basiswert", "midgard5.mod-operation-set": "Basiswert",
"midgard5.mod-operation-fixed": "Fester Wert", "midgard5.mod-operation-fixed": "Fester Wert",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "foundry-system-midgard5", "name": "foundry-system-midgard5",
"version": "2.3.0", "version": "2.3.1",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
+2 -1
View File
@@ -85,7 +85,7 @@ export enum M5Stats {
PROTECTION_LP = "lpProtection", PROTECTION_LP = "lpProtection",
PROTECTION_AP = "apProtection", PROTECTION_AP = "apProtection",
PERCEPTION = "perception", PERCEPTION = "perception",
DRINKING = "drinking" DRINKING = "drinking",
} }
export enum M5ModType { export enum M5ModType {
@@ -96,6 +96,7 @@ export enum M5ModType {
export enum M5ModOperation { export enum M5ModOperation {
ADD_100 = "add100", ADD_100 = "add100",
ROLL = "roll",
ADD = "add", ADD = "add",
SET = "set", SET = "set",
FIXED = "fixed", FIXED = "fixed",
+14 -2
View File
@@ -67,9 +67,9 @@ export class M5Character extends Actor {
brawlFw: 0, brawlFw: 0,
poisonResistance: { value: 0, mods: [] }, poisonResistance: { value: 0, mods: [] },
enduranceBonus: 0, enduranceBonus: 0,
perception: {value: 0, mods: []}, perception: { value: 0, mods: [] },
perceptionFW: 0, perceptionFW: 0,
drinking: {value: 0, mods: []}, drinking: { value: 0, mods: [] },
drinkingFW: 0, drinkingFW: 0,
}, },
skillMods: {}, skillMods: {},
@@ -171,12 +171,24 @@ export class M5Character extends Actor {
if (item.system.magic) { if (item.system.magic) {
label += "*"; label += "*";
} }
let rollable = false;
// console.log(item.system.rolls.formulas.map((p) => p.enabled));
for (let key in item.system.rolls.formulas) {
rollable = item.system.rolls.formulas[key].enabled;
if (rollable) {
break;
}
}
ret.gear.items[item.id] = { ret.gear.items[item.id] = {
label: label, label: label,
magic: item.system.magic, magic: item.system.magic,
calc: item.system.calc, calc: item.system.calc,
equipped: item.system?.equipped, equipped: item.system?.equipped,
value: item.system.value || 0,
currency: item.system.currency || "",
quantity: item.system.quantity || 0,
rollExist: rollable,
}; };
}); });
} }
-1
View File
@@ -258,7 +258,6 @@ export class M5Item extends Item {
} }
const roll = new M5Roll(rollData, this.actor, item.name); const roll = new M5Roll(rollData, this.actor, item.name);
console.log(roll);
return roll.toMessage(); return roll.toMessage();
} else { } else {
ChatMessage.create({ ChatMessage.create({
+16 -27
View File
@@ -1,6 +1,6 @@
import { Evaluated } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/client/dice/roll"; import { Evaluated } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/client/dice/roll";
import { M5Character } from "../actors/M5Character"; 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"; import { stat } from "fs";
export class M5Roll { export class M5Roll {
@@ -115,31 +115,20 @@ export class M5Roll {
return ChatMessage.create(chatData); 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) { static fromAttributeValue(actor: any, attributeKey: string, attributeValue: number) {
const rollData = actor.getRollData() as M5RollData; 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.i = attributeValue;
rollData.rolls["0"] = { rollData.rolls["0"] = {
formula: "@i - 1d100", formula: "@i - 1d100 - @c",
enabled: true, enabled: true,
label: (game as Game).i18n.localize("midgard5.pw"), label: (game as Game).i18n.localize("midgard5.pw"),
result: "", result: "",
@@ -208,7 +197,7 @@ export class M5Roll {
static perception(actor: any) { static perception(actor: any) {
const rollData = actor.getRollData() as M5RollData; const rollData = actor.getRollData() as M5RollData;
rollData.rolls["0"] = { rollData.rolls["0"] = {
formula: "1d20 + @c.calc.stats.perception.value + @c.calc.stats.perceptionFW", formula: "1d20 + @c.calc.stats.perception.value + @c.calc.stats.perceptionFW",
enabled: true, enabled: true,
@@ -219,13 +208,13 @@ export class M5Roll {
dice: {}, dice: {},
css: "", css: "",
} as M5RollResult; } as M5RollResult;
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.perception")); return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.perception"));
} }
static drinking(actor: any) { static drinking(actor: any) {
const rollData = actor.getRollData() as M5RollData; const rollData = actor.getRollData() as M5RollData;
rollData.rolls["0"] = { rollData.rolls["0"] = {
formula: "1d20 + @c.calc.stats.drinking.value + @c.calc.stats.drinkingFW", formula: "1d20 + @c.calc.stats.drinking.value + @c.calc.stats.drinkingFW",
enabled: true, enabled: true,
@@ -236,7 +225,7 @@ export class M5Roll {
dice: {}, dice: {},
css: "", css: "",
} as M5RollResult; } as M5RollResult;
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.drinking")); return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.drinking"));
} }
+54
View File
@@ -97,6 +97,60 @@ export default class M5CharacterSheet extends ActorSheet {
item.sheet.render(true); item.sheet.render(true);
}); });
html.find(".quantity-increase").on("click", async (event) => {
let row = event.target.parentElement;
let itemId = row.dataset["item"];
while (!itemId) {
row = row.parentElement;
if (!row) return;
itemId = row.dataset["item"];
}
const context = this.actor as any;
const item = context.items.get(itemId);
if (!item.system.quantity) {
item.system.quantity = 0;
}
item.system.quantity += 1;
this.render();
});
html.find(".quantity-decrease").on("click", async (event) => {
let row = event.target.parentElement;
let itemId = row.dataset["item"];
while (!itemId) {
row = row.parentElement;
if (!row) return;
itemId = row.dataset["item"];
}
const context = this.actor as any;
const item = context.items.get(itemId);
if (item.system.quantity > 0) {
item.system.quantity -= 1;
}
this.render();
});
html.find(".roll-consumable-item").on("click", async (event) => {
let row = event.target.parentElement;
let itemId = row.dataset["item"];
while (!itemId) {
row = row.parentElement;
if (!row) return;
itemId = row.dataset["item"];
}
const context = this.actor as any;
const item = context.items.get(itemId);
if (item.system.quantity > 0) {
item.system.quantity -= 1;
}
await item.roll();
this.render();
});
html.find(".item-delete").on("click", async (event) => { html.find(".item-delete").on("click", async (event) => {
let row = event.target.parentElement; let row = event.target.parentElement;
let itemId = row.dataset["item"]; let itemId = row.dataset["item"];
+3 -3
View File
@@ -3,7 +3,7 @@
"name": "midgard5", "name": "midgard5",
"title": "Midgard 5. Edition", "title": "Midgard 5. Edition",
"description": "The German RPG Midgard 5. Edition", "description": "The German RPG Midgard 5. Edition",
"version": "2.3.0", "version": "2.3.1",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "11", "verified": "11",
@@ -154,8 +154,8 @@
"primaryTokenAttribute": "lp", "primaryTokenAttribute": "lp",
"secondaryTokenAttribute": "ap", "secondaryTokenAttribute": "ap",
"url": "https://github.com/Byroks/foundry-vtt-system-midgard5", "url": "https://github.com/Byroks/foundry-vtt-system-midgard5",
"manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.0/system.json", "manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.1/system.json",
"download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.0/midgard5-v2.3.0.zip", "download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.1/midgard5-v2.3.1.zip",
"initiative": "@c.calc.attributes.gw.value", "initiative": "@c.calc.attributes.gw.value",
"license": "LICENSE.txt" "license": "LICENSE.txt"
} }
+4 -1
View File
@@ -16,7 +16,10 @@
"caste": "", "caste": "",
"occupation": "", "occupation": "",
"origin": "", "origin": "",
"faith": "" "faith": "",
"gold": 0,
"silver": 0,
"copper": 0
} }
}, },
"characterBars": { "characterBars": {
+32
View File
@@ -1,3 +1,20 @@
<table>
<thead>
<tr>
<th class="title" style="text-align: center">{{localize "midgard5.currency-gold"}}</th>
<th class="title" style="text-align: center">{{localize "midgard5.currency-silver"}}</th>
<th class="title" style="text-align: center">{{localize "midgard5.currency-copper"}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fixed-value"><input type="number" name="data.info.gold" value="{{data.info.gold}}"></td>
<td class="fixed-value"><input type="number" name="data.info.silver" value="{{data.info.silver}}"></td>
<td class="fixed-value"><input type="number" name="data.info.copper" value="{{data.info.copper}}"></td>
</tr>
</tbody>
</table>
<table> <table>
<thead> <thead>
<tr> <tr>
@@ -106,10 +123,14 @@
<thead> <thead>
<tr> <tr>
<th class="title">{{localize "TYPES.Item.item"}}</th> <th class="title">{{localize "TYPES.Item.item"}}</th>
<th class="title center">{{localize "midgard5.item-quantity"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title"></th>
<th class="title"></th> <th class="title"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tr>
{{#each data.calc.gear.items as |item itemId|}} {{#each data.calc.gear.items as |item itemId|}}
<tr data-item="{{itemId}}"> <tr data-item="{{itemId}}">
<td class="padding"> <td class="padding">
@@ -118,6 +139,17 @@
<span class="spell-process">{{localize "midgard5.equipped"}}</span> <span class="spell-process">{{localize "midgard5.equipped"}}</span>
{{/if}} {{/if}}
</td> </td>
<td>
<i class="fa fa-minus-circle quantity-decrease" style="cursor: pointer"></i>
<span>{{item.quantity}}</span>
<i class="fa fa-plus-circle quantity-increase" style="cursor: pointer"></i>
</td>
<td style="text-align: start">
{{#unless (or (eq item.value 0) (eq item.currency ""))}}
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}}
</td>
<td class="fixed-value">{{#if item.rollExist}}<button class="roll-button roll-consumable-item"></button>{{/if}}</td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td> <td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr> </tr>
{{/each}} {{/each}}
+19 -1
View File
@@ -19,15 +19,33 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr>
<td>
<div class="flexrow">
<span>{{localize "midgard5.item-quantity"}}</span>
<input id="data.quantity" type="number" name="data.quantity" value="{{data.quantity}}">
</div>
</td>
</tr>
<tr> <tr>
<td> <td>
<div class="flexrow"> <div class="flexrow">
<span>{{localize "midgard5.item-value"}}</span> <span>{{localize "midgard5.item-value"}}</span>
<input name="data.value" type="text" value="{{data.value}}" data-dtype="Number" /> <input name="data.value" type="number" value="{{data.value}}" data-dtype="Number" />
<select class="select-mod-operation" name="data.currency" data-type="String">
{{#select data.currency}}
<option value=""></option>
<option value="copper">{{localize "midgard5.currency-copper"}}</option>
<option value="silver">{{localize "midgard5.currency-silver"}}</option>
<option value="gold">{{localize "midgard5.currency-gold"}}</option>
{{/select}}
</select>
</div> </div>
</td> </td>
</tr> </tr>
</table> </table>
{{> "systems/midgard5/templates/sheets/item/rolls.hbs"}}
{{> "systems/midgard5/templates/sheets/partial/mod.hbs" mods=data.mods calc=data.calc}} {{> "systems/midgard5/templates/sheets/partial/mod.hbs" mods=data.mods calc=data.calc}}
+2 -1
View File
@@ -36,6 +36,7 @@
{{#select mod.operation}} {{#select mod.operation}}
{{#if (eq mod.type "attribute")}} {{#if (eq mod.type "attribute")}}
<option value="add100">{{localize "midgard5.mod-operation-add100"}}</option> <option value="add100">{{localize "midgard5.mod-operation-add100"}}</option>
<option value="roll">{{localize "midgard5.mod-operation-roll"}}</option>
{{/if}} {{/if}}
<option value="add">{{localize "midgard5.mod-operation-add"}}</option> <option value="add">{{localize "midgard5.mod-operation-add"}}</option>
<option value="set">{{localize "midgard5.mod-operation-set"}}</option> <option value="set">{{localize "midgard5.mod-operation-set"}}</option>
@@ -48,7 +49,7 @@
</td> </td>
<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> </td>
</tr> </tr>
{{/each}} {{/each}}