v2.0.0 (#8)
* Squashed commit of the following: commit0bfa224daeAuthor: 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 commit35a6b0fae9Author: Byroks <byroks@gmail.com> Date: Mon Nov 27 19:48:56 2023 +0100 v1.3.1 commitdb21ca93b0Author: 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
This commit is contained in:
@@ -11,6 +11,7 @@ const preloadTemplates = async (): Promise<Handlebars.TemplateDelegate<any>[]> =
|
||||
"sheets/character/skills.hbs",
|
||||
"sheets/character/gear.hbs",
|
||||
"sheets/character/spells.hbs",
|
||||
"sheets/character/kampfkuenste.hbs",
|
||||
"sheets/character/effects.hbs",
|
||||
"sheets/item/rolls.hbs",
|
||||
"chat/roll-m5.hbs",
|
||||
|
||||
@@ -170,6 +170,7 @@ export interface M5CharacterCalculatedData {
|
||||
effects: {};
|
||||
};
|
||||
spells: {};
|
||||
kampfkuenste: {};
|
||||
}
|
||||
|
||||
export function enumKeys<O extends object, K extends keyof O = keyof O>(obj: O): K[] {
|
||||
|
||||
@@ -25,7 +25,17 @@ export class M5Character extends Actor {
|
||||
}
|
||||
|
||||
derivedData(
|
||||
skip: { mods?: boolean; skills?: boolean; weapons?: boolean; defensiveWeapons?: boolean; armor?: boolean; items?: boolean; spells?: boolean; effects?: boolean } = {}
|
||||
skip: {
|
||||
mods?: boolean;
|
||||
skills?: boolean;
|
||||
weapons?: boolean;
|
||||
defensiveWeapons?: boolean;
|
||||
armor?: boolean;
|
||||
items?: boolean;
|
||||
spells?: boolean;
|
||||
effects?: boolean;
|
||||
kampfkuenste?: boolean;
|
||||
} = {}
|
||||
): M5CharacterCalculatedData {
|
||||
let ret: M5CharacterCalculatedData = {
|
||||
level: 0,
|
||||
@@ -73,6 +83,7 @@ export class M5Character extends Actor {
|
||||
effects: {},
|
||||
},
|
||||
spells: {},
|
||||
kampfkuenste: {},
|
||||
} as M5CharacterCalculatedData;
|
||||
|
||||
const context = this as any;
|
||||
@@ -274,6 +285,22 @@ export class M5Character extends Actor {
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.kampfkuenste) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "kampfkunst")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
ret.kampfkuenste[item.id] = {
|
||||
label: item.name,
|
||||
isKido: item.system.isKido,
|
||||
type: item.system.type,
|
||||
variante: item.system.variante,
|
||||
calc: item.system.calc,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export class M5Item extends Item {
|
||||
];
|
||||
|
||||
if (character) {
|
||||
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true });
|
||||
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(itemId) !== -1) {
|
||||
pairs = pairs.concat(actorCalc.skillMods[itemId]);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export class M5Item extends Item {
|
||||
calc.combatSkills = null;
|
||||
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true });
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
if (actorCalc) {
|
||||
calc.ew += actorCalc.stats.attackBonus.value;
|
||||
calc.combatSkills = actorCalc.skills.combat;
|
||||
@@ -89,7 +89,7 @@ export class M5Item extends Item {
|
||||
calc.combatSkills = null;
|
||||
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true });
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
if (actorCalc) {
|
||||
calc.ew += actorCalc.stats.defense.value + actorCalc.stats.defenseBonus.value;
|
||||
calc.combatSkills = actorCalc.skills.combat;
|
||||
@@ -108,11 +108,32 @@ export class M5Item extends Item {
|
||||
} else if (itemType === "spell") {
|
||||
calc.fw = 0;
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true });
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
if (actorCalc) {
|
||||
calc.ew = actorCalc.stats.spellCasting.value;
|
||||
}
|
||||
}
|
||||
} else if (itemType === "kampfkunst") {
|
||||
calc.fw = 0;
|
||||
calc.bonus = 0;
|
||||
calc.ew = 0;
|
||||
calc.generalSkills = null;
|
||||
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
if (actorCalc) {
|
||||
calc.generalSkills = actorCalc.skills.general;
|
||||
}
|
||||
|
||||
const skill = character.getItem(itemData.skillId);
|
||||
if (skill) {
|
||||
skill.prepareDerivedData();
|
||||
const skillData = skill.system;
|
||||
calc.ew = skillData.calc.ew;
|
||||
calc.fw = skillData.fw + calc.bonus;
|
||||
itemData.rolls.formulas[0].label = skill.name;
|
||||
}
|
||||
}
|
||||
} else if (itemType === "item" || itemType === "effect") {
|
||||
calc.mods = {};
|
||||
Object.keys(itemData?.mods).forEach((key) => {
|
||||
@@ -135,7 +156,7 @@ export class M5Item extends Item {
|
||||
}
|
||||
case M5ModType.SKILL: {
|
||||
if (character) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true });
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
if (actorCalc) {
|
||||
let category = (game as Game).i18n.localize("midgard5.skill");
|
||||
Object.keys(actorCalc.skills.general).forEach((skillId) => {
|
||||
|
||||
@@ -245,6 +245,27 @@ export class M5Roll {
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.resistanceMind"));
|
||||
}
|
||||
|
||||
static async initativeRoll(actor: any) {
|
||||
let newInitiative; // the initiative value for the combatant
|
||||
|
||||
// ...
|
||||
// The intnitiative value is calculated here
|
||||
// ...
|
||||
|
||||
let combatant = game["combat"].getCombatantByActor(actor._id);
|
||||
if (!combatant) {
|
||||
await game["combat"].createEmbeddedDocuments("Combatant", [{ actorId: actor._id }]);
|
||||
combatant = game["combat"].getCombatantByActor(actor._id);
|
||||
}
|
||||
|
||||
const initiatives = {
|
||||
_id: combatant._id,
|
||||
initiative: actor.system.calc.attributes.gw.value,
|
||||
};
|
||||
|
||||
await game["combat"].updateEmbeddedDocuments("Combatant", [initiatives]);
|
||||
}
|
||||
|
||||
static resistanceBody(actor: any) {
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
rollData.i = {
|
||||
|
||||
@@ -206,7 +206,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||
const item = this.actor.items.get(li.dataset.itemId);
|
||||
|
||||
// limit transfer on personal weapons/armour/gear
|
||||
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell", "effect"].includes(item.type)) {
|
||||
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell", "effect", "kampfkunst"].includes(item.type)) {
|
||||
const dragData = {
|
||||
type: "Transfer",
|
||||
actorId: this.actor.id,
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
"name": "midgard5",
|
||||
"title": "Midgard 5. Edition",
|
||||
"description": "The German RPG Midgard 5. Edition",
|
||||
"version": "1.3.1",
|
||||
"version": "2.0.0",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "11",
|
||||
@@ -89,8 +89,8 @@
|
||||
"primaryTokenAttribute": "lp",
|
||||
"secondaryTokenAttribute": "ap",
|
||||
"url": "https://github.com/Byroks/foundry-vtt-system-midgard5",
|
||||
"manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v1.3.1/system.json",
|
||||
"download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v1.3.1/midgard5-v1.3.1.zip",
|
||||
"manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.0.0/system.json",
|
||||
"download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.0.0/midgard5-v2.0.0.zip",
|
||||
"initiative": "@c.calc.attributes.gw.value",
|
||||
"license": "LICENSE.txt"
|
||||
}
|
||||
+52
-1
@@ -145,7 +145,7 @@
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
"types": ["skill", "weapon", "defensiveWeapon", "armor", "spell", "item", "effect"],
|
||||
"types": ["skill", "weapon", "defensiveWeapon", "armor", "spell", "kampfkunst", "item", "effect"],
|
||||
"templates": {
|
||||
"itemDescription": {
|
||||
"description": ""
|
||||
@@ -232,6 +232,38 @@
|
||||
"geist": "midgard5.spell-target-geist",
|
||||
"koerper": "midgard5.spell-target-koerper"
|
||||
}
|
||||
},
|
||||
"kampfkunstSelection": {
|
||||
"kampfkunstTypeSelection": {
|
||||
"angriff": "midgard5.kampfkunst-type-angriff",
|
||||
"verteidigung": "midgard5.kampfkunst-type-verteidigung",
|
||||
"finte": "midgard5.kampfkunst-type-finte",
|
||||
"geist": "midgard5.kampfkunst-type-geist",
|
||||
"schießkunst": "midgard5.kampfkunst-type-schießkunst",
|
||||
"fechten": "midgard5.kampfkunst-type-fechten"
|
||||
},
|
||||
"kidoTypeSelection": {
|
||||
"angriff": "midgard5.kido-type-angriff",
|
||||
"verteidigung": "midgard5.kido-type-verteidigung",
|
||||
"finte": "midgard5.kido-type-finte",
|
||||
"leib": "midgard5.kido-type-leib"
|
||||
},
|
||||
"kampfkunstVarianteSelection": {
|
||||
"anstuermen": "midgard5.kampfkunst-variante-anstuermen",
|
||||
"attackieren": "midgard5.kampfkunst-variante-attackieren",
|
||||
"entwaffnen": "midgard5.kampfkunst-variante-entwaffnen"
|
||||
},
|
||||
"kidoVarianteSelection": {
|
||||
"none": "midgard5.spell-process-none",
|
||||
"anspringen": "midgard5.kido-variante-anspringen",
|
||||
"attackieren": "midgard5.kido-variante-attackieren",
|
||||
"entwaffnen": "midgard5.kido-variante-entwaffnen",
|
||||
"werfen": "midgard5.kido-variante-werfen",
|
||||
"ausweichen": "midgard5.kido-variante-ausweichen",
|
||||
"blockieren": "midgard5.kido-variante-blockieren",
|
||||
"bewegen": "midgard5.kido-variante-bewegen",
|
||||
"kontrollieren": "midgard5.kido-variante-kontrollieren"
|
||||
}
|
||||
}
|
||||
},
|
||||
"skill": {
|
||||
@@ -343,6 +375,25 @@
|
||||
"output": ""
|
||||
},
|
||||
"calc": {}
|
||||
},
|
||||
"kampfkunst": {
|
||||
"templates": ["itemDescription", "kampfkunstSelection"],
|
||||
"bonus": 0,
|
||||
"type": "",
|
||||
"variante": "",
|
||||
"isKido": false,
|
||||
"ap": "",
|
||||
"rolls": {
|
||||
"formulas": {
|
||||
"0": {
|
||||
"formula": "1d20 + @i.calc.ew + @i.bonus",
|
||||
"label": "Kampfkunst",
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"output": ""
|
||||
},
|
||||
"calc": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user