Waffen haben eigene Vor&Nachteile
This commit is contained in:
1 parent
b940e8f251
commit
ce70c63918
5 files changed
+39
-6
No files matched your search
@@ -8,7 +8,8 @@ function defineSchema() {
|
||||
equipped: new fields.BooleanField({ inital: false }),
|
||||
fertigkeit: new fields.StringField({ initial: "system.skills.kampf.nahkampf" }),
|
||||
spezialisierung: new fields.StringField({ initial: "" }),
|
||||
customRoll: new fields.StringField({ initial: "" })
|
||||
customRoll: new fields.StringField({ initial: "" }),
|
||||
angriffMod: new fields.NumberField({ initial: 0, required: true, step: 1 }),
|
||||
};
|
||||
|
||||
return Object.assign(baseData, extendData);
|
||||
|
||||
@@ -114,7 +114,6 @@ export class M6CharacterSheet extends M6ActorSheet {
|
||||
});
|
||||
|
||||
context.itemTypes = await super._getItems();
|
||||
console.warn(context);
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ export async function prepWeapons(actor) {
|
||||
bonusValue:
|
||||
skill.bonuses.find((x) => x.name === weapon.system.spezialisierung)?.level + 1 || "",
|
||||
img: weapon.img,
|
||||
angriffMod: weapon.system.angriffMod,
|
||||
skillPath: weapon.system.fertigkeit,
|
||||
path: weapon.system.fertigkeit,
|
||||
id: weapon.id,
|
||||
|
||||
@@ -37,6 +37,7 @@ export async function roll(event, target) {
|
||||
let damageRoll = "";
|
||||
let preSelectedSpez = "";
|
||||
let rollFlavor = "";
|
||||
let itemVorteil = 0;
|
||||
|
||||
if (itemType === "zauber") {
|
||||
skill = await foundry.utils.getProperty(actor, "system.skills.magie.zaubern");
|
||||
@@ -45,10 +46,10 @@ export async function roll(event, target) {
|
||||
rollFlavor = `${game.i18n.localize("Midgard6.Zaubern")}: ${item.name}`;
|
||||
} else if (itemType === "weapon") {
|
||||
skill = await foundry.utils.getProperty(actor, item.system.fertigkeit);
|
||||
console.warn(skill);
|
||||
damageRoll = _applyBonusDamage(actor, item.system.schaden, item.system.fertigkeit);
|
||||
preSelectedSpez = item.system.spezialisierung;
|
||||
rollFlavor = `${game.i18n.localize("Midgard6.Angriff")}: ${item.name}`;
|
||||
itemVorteil = item.system.angriffMod;
|
||||
} else {
|
||||
const cleanPath = dataset.path.replace(".value", "");
|
||||
skill = foundry.utils.getProperty(actor, cleanPath);
|
||||
@@ -57,7 +58,7 @@ export async function roll(event, target) {
|
||||
|
||||
if (!skill) return ui.notifications.error("Zugehörige Fertigkeit nicht gefunden.");
|
||||
|
||||
const vorteil = (skill.vorteil || 0) - (skill.nachteil || 0);
|
||||
const vorteil = (skill.vorteil || 0) - (skill.nachteil || 0) + itemVorteil;
|
||||
|
||||
const dialogResult = await rollDialog({
|
||||
name: item ? item.name : dataset.name,
|
||||
@@ -179,7 +180,9 @@ export async function rollDialog(rollDialogRequest) {
|
||||
}
|
||||
display.placeholder = mainRoll + spezText;
|
||||
});
|
||||
if (radio.dataset.value == vorteil) radio.click();
|
||||
//Wähle richtigen button aus, auch wenn vorteil wert größer oder kleiner +-1 ist
|
||||
if (vorteil < 0 && radio.dataset.value == -1) radio.click();
|
||||
else if (vorteil > 0 && radio.dataset.value == 1) radio.click();
|
||||
});
|
||||
|
||||
dialogHTML.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
|
||||
|
||||
Reference in new issue
Block a user