Ajout/upgrade des arts obscurs
This commit is contained in:
@@ -38,14 +38,15 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
||||
limited: this.object.limited,
|
||||
skills: this.actor.getSkills(),
|
||||
utileSkillsMental :this.actor.organizeUtileSkills("mental"),
|
||||
utileSkillsPhysical :this.actor.organizeUtileSkills("physical"),
|
||||
futileSkills :this.actor.organizeFutileSkills(),
|
||||
utileSkillsMental: this.actor.organizeUtileSkills("mental"),
|
||||
utileSkillsPhysical: this.actor.organizeUtileSkills("physical"),
|
||||
competencesMagie: HeritiersUtility.getCompetencesMagie(),
|
||||
futileSkills: this.actor.organizeFutileSkills(),
|
||||
contacts: this.actor.organizeContacts(),
|
||||
armes: foundry.utils.duplicate(this.actor.getWeapons()),
|
||||
monnaies: foundry.utils.duplicate(this.actor.getMonnaies()),
|
||||
pouvoirs: foundry.utils.duplicate(this.actor.getPouvoirs()),
|
||||
fee: foundry.utils.duplicate(this.actor.getFee() || {} ),
|
||||
fee: foundry.utils.duplicate(this.actor.getFee() || {}),
|
||||
protections: foundry.utils.duplicate(this.actor.getArmors()),
|
||||
combat: this.actor.getCombatValues(),
|
||||
equipements: foundry.utils.duplicate(this.actor.getEquipments()),
|
||||
@@ -57,12 +58,12 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
pvMalus: this.actor.getPvMalus(),
|
||||
heritage: game.settings.get("fvtt-les-heritiers", "heritiers-heritage"),
|
||||
initiative: this.actor.getFlag("world", "last-initiative") || -1,
|
||||
description: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.description, {async: true}),
|
||||
revesetranges: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.revesetranges, {async: true}),
|
||||
secretsdecouverts: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.secretsdecouverts, {async: true}),
|
||||
questions: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.questions, {async: true}),
|
||||
habitat: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.habitat, {async: true}),
|
||||
playernotes: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.playernotes, {async: true}),
|
||||
description: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.description, { async: true }),
|
||||
revesetranges: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.revesetranges, { async: true }),
|
||||
secretsdecouverts: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.secretsdecouverts, { async: true }),
|
||||
questions: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.questions, { async: true }),
|
||||
habitat: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.habitat, { async: true }),
|
||||
playernotes: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.biodata.playernotes, { async: true }),
|
||||
magieList: this.actor.prepareMagie(),
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
@@ -126,7 +127,7 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
let itemId = li.data("item-id")
|
||||
const item = this.actor.items.get( itemId )
|
||||
const item = this.actor.items.get(itemId)
|
||||
item.sheet.render(true)
|
||||
})
|
||||
// Delete Inventory Item
|
||||
@@ -136,8 +137,8 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
})
|
||||
html.find('.edit-item-data').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
let itemId = li.data("item-id")
|
||||
let itemType = li.data("item-type")
|
||||
let itemId = li.data("item-id")
|
||||
let itemType = li.data("item-type")
|
||||
let itemField = $(ev.currentTarget).data("item-field")
|
||||
let dataType = $(ev.currentTarget).data("dtype")
|
||||
let value = ev.currentTarget.value
|
||||
@@ -154,7 +155,7 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
html.find('.quantity-modify').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
const value = Number($(event.currentTarget).data("quantite-value"))
|
||||
this.actor.incDecQuantity( li.data("item-id"), value );
|
||||
this.actor.incDecQuantity(li.data("item-id"), value);
|
||||
})
|
||||
|
||||
html.find('.roll-initiative').click((event) => {
|
||||
@@ -175,32 +176,32 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
})
|
||||
html.find('.roll-competence').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
let compId = li.data("item-id")
|
||||
let compId = li.data("item-id")
|
||||
this.actor.rollCompetence(compId)
|
||||
})
|
||||
html.find('.roll-sort').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
let sortId = li.data("item-id")
|
||||
let sortId = li.data("item-id")
|
||||
this.actor.rollSort(sortId)
|
||||
})
|
||||
html.find('.roll-attaque-arme').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
let armeId = li.data("item-id")
|
||||
let armeId = li.data("item-id")
|
||||
this.actor.rollAttaqueArme(armeId)
|
||||
})
|
||||
html.find('.roll-attaque-brutale-arme').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
let armeId = li.data("item-id")
|
||||
let armeId = li.data("item-id")
|
||||
this.actor.rollAttaqueBrutaleArme(armeId)
|
||||
})
|
||||
html.find('.roll-attaque-charge-arme').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
let armeId = li.data("item-id")
|
||||
let armeId = li.data("item-id")
|
||||
this.actor.rollAttaqueChargeArme(armeId)
|
||||
})
|
||||
html.find('.roll-assomer-arme').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
let armeId = li.data("item-id")
|
||||
let armeId = li.data("item-id")
|
||||
this.actor.rollAssomerArme(armeId)
|
||||
})
|
||||
|
||||
@@ -215,6 +216,14 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
|
||||
html.find('.item-add').click((event) => {
|
||||
const itemType = $(event.currentTarget).data("type")
|
||||
if (itemType == "sort") {
|
||||
// Get data-sort-competence
|
||||
let sortCompetence = $(event.currentTarget).data("sort-competence");
|
||||
if (sortCompetence) {
|
||||
this.actor.createEmbeddedDocuments('Item', [{ name: `Nouveau ${itemType} de ${sortCompetence}`, type: itemType, system: { competence: sortCompetence } }], { renderSheet: true })
|
||||
return
|
||||
}
|
||||
}
|
||||
this.actor.createEmbeddedDocuments('Item', [{ name: `Nouveau ${itemType}`, type: itemType }], { renderSheet: true })
|
||||
})
|
||||
|
||||
@@ -224,7 +233,7 @@ export class HeritiersActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
});
|
||||
html.find('.item-equip').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
this.actor.equipItem( li.data("item-id") );
|
||||
this.actor.equipItem(li.data("item-id"));
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
|
@@ -17,8 +17,8 @@ export class HeritiersActor extends Actor {
|
||||
/**
|
||||
* Override the create() function to provide additional SoS functionality.
|
||||
*
|
||||
* This overrided create() function adds initial items
|
||||
* Namely: Basic skills, money,
|
||||
* This overrided create() function adds initial items
|
||||
* Namely: Basic skills, money,
|
||||
*
|
||||
* @param {Object} data Barebones actor data which this function adds onto.
|
||||
* @param {Object} options (Unused) Additional options which customize the creation workflow.
|
||||
@@ -203,6 +203,28 @@ export class HeritiersActor extends Actor {
|
||||
item.specList = specList.toString()
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
organizeMagicSkills() {
|
||||
let comp = {}
|
||||
for (let key in game.system.lesheritiers.config.competenceProfil) {
|
||||
if (game.system.lesheritiers.config.competenceProfil[key].kind == "magical")
|
||||
comp[key] = { skills: [], niveau: 0 }
|
||||
}
|
||||
for (let item of this.items) {
|
||||
if (item.type == "competence") {
|
||||
if (item.system.categorie == "utile" && comp[item.system.profil]) {
|
||||
this.prepareUtileSkill(item)
|
||||
comp[item.system.profil].skills.push(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let key in comp) {
|
||||
HeritiersUtility.sortArrayObjectsByName(comp[key].skills)
|
||||
}
|
||||
return Object.fromEntries(Object.entries(comp).sort())
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
organizeUtileSkills(kind = "mental") {
|
||||
let comp = {}
|
||||
@@ -224,6 +246,7 @@ export class HeritiersActor extends Actor {
|
||||
}
|
||||
return Object.fromEntries(Object.entries(comp).sort())
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
organizeContacts() {
|
||||
let contactList = {}
|
||||
@@ -301,7 +324,7 @@ export class HeritiersActor extends Actor {
|
||||
this.update({ 'system.magie.pointsame.max': pointsAmes })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.prepareData();
|
||||
}
|
||||
|
||||
@@ -687,7 +710,7 @@ export class HeritiersActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async rollSort(sortId) {
|
||||
let sort = this.items.get(sortId)
|
||||
let comp = this.items.find(it => it.type =="competence" && it.name.toLowerCase() == sort.system.competence.toLowerCase())
|
||||
let comp = this.items.find(it => it.type == "competence" && it.name.toLowerCase() == sort.system.competence.toLowerCase())
|
||||
if (!comp) {
|
||||
ui.notifications.warn("Compétence de magie associée non trouvée !")
|
||||
return
|
||||
@@ -698,12 +721,21 @@ export class HeritiersActor extends Actor {
|
||||
rollData.sort = foundry.utils.duplicate(sort)
|
||||
rollData.sdValue = HeritiersUtility.getSDSortValue(sort.system.niveau)
|
||||
rollData.sortPointsAme = sort.system.niveau
|
||||
rollData.caracKey = sort.system.carac
|
||||
if (sort.system.carac2 != "none") {
|
||||
// get the best carac between carac1 and carac2
|
||||
if (this.system.caracteristiques[sort.system.carac1].value > this.system.caracteristiques[sort.system.carac2].value) {
|
||||
rollData.caracKey = sort.system.carac1
|
||||
} else {
|
||||
rollData.caracKey = sort.system.carac2
|
||||
}
|
||||
rollData.caracMessage = "Ce sort peut être lancé avec " + game.system.lesheritiers.config.caracList[sort.system.carac1] + " ou " + game.system.lesheritiers.config.caracList[sort.system.carac2] + ". La meilleure caractéristique a été selectionnée."
|
||||
}
|
||||
console.log("RollData", rollData)
|
||||
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||
rollDialog.render(true)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollAttaqueArme(armeId) {
|
||||
let arme = this.items.get(armeId)
|
||||
|
@@ -107,10 +107,10 @@ Hooks.once("ready", function () {
|
||||
});
|
||||
}
|
||||
|
||||
import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter=>{
|
||||
import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter => {
|
||||
console.log("ClassCounter loaded", moduleCounter)
|
||||
moduleCounter.ClassCounter.registerUsageCount()
|
||||
}).catch(err=>
|
||||
}).catch(err =>
|
||||
console.log("No stats available, giving up.")
|
||||
)
|
||||
welcomeMessage();
|
||||
|
@@ -26,7 +26,7 @@ const __facesAdjacentes = {
|
||||
10: [8, 4, 3, 7]
|
||||
},
|
||||
"d12": {
|
||||
1:[2, 3, 4, 5, 6],
|
||||
1: [2, 3, 4, 5, 6],
|
||||
2: [1, 6, 8, 12, 3],
|
||||
3: [1, 4, 11, 12, 2],
|
||||
4: [1, 5, 10, 11, 3],
|
||||
@@ -164,7 +164,7 @@ export class HeritiersUtility {
|
||||
let message = game.messages.get(messageId)
|
||||
let rollData = message.getFlag("world", "heritiers-roll")
|
||||
let actor = this.getActorFromRollData(rollData)
|
||||
if ( await actor.incDecTricherie(-2) ) {
|
||||
if (await actor.incDecTricherie(-2)) {
|
||||
rollData.forcedValue = Number($(event.currentTarget).data("dice-value"))
|
||||
HeritiersUtility.rollHeritiers(rollData)
|
||||
}
|
||||
@@ -404,7 +404,7 @@ export class HeritiersUtility {
|
||||
rollData.finalResult -= 5 + rollValue // Remove also the dice result has it has been added already
|
||||
}
|
||||
}
|
||||
if ( !rollData.forcedValue) {
|
||||
if (!rollData.forcedValue) {
|
||||
rollData.adjacentFaces = foundry.utils.duplicate(__facesAdjacentes[rollData.mainDice][rollData.diceValue])
|
||||
}
|
||||
}
|
||||
@@ -485,7 +485,7 @@ export class HeritiersUtility {
|
||||
|
||||
let actor = this.getActorFromRollData(rollData)
|
||||
|
||||
if ( rollData.mode == "pouvoir" && actor.getPouvoirUsage(rollData.pouvoir._id) < rollData.pouvoirPointsUsage) {
|
||||
if (rollData.mode == "pouvoir" && actor.getPouvoirUsage(rollData.pouvoir._id) < rollData.pouvoirPointsUsage) {
|
||||
ui.notifications.warn("Pas assez de points d'usage pour ce pouvoir.")
|
||||
return
|
||||
}
|
||||
@@ -550,7 +550,7 @@ export class HeritiersUtility {
|
||||
}
|
||||
}
|
||||
|
||||
if ( !rollData.noRoll) {
|
||||
if (!rollData.noRoll) {
|
||||
let myRoll = await new Roll(rollData.diceFormula).roll()
|
||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
rollData.roll = foundry.utils.duplicate(myRoll)
|
||||
@@ -846,4 +846,56 @@ export class HeritiersUtility {
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
static loadSort() {
|
||||
// Create afolder in the item directory if it doesn't exist
|
||||
if (!game.folders.getName("Magie du Clan")) {
|
||||
Folder.create({
|
||||
name: "Magie du Clan",
|
||||
type: "Item",
|
||||
color: "#3b1361"
|
||||
});
|
||||
}
|
||||
|
||||
// Load the srcdata/sorts-druidisme.json file
|
||||
return fetch("systems/fvtt-les-heritiers/srcdata/sort_magieduclan.json")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log("Sorts Magie du Clan loaded:", data);
|
||||
this.sortDruidisme = data;
|
||||
// Loop through the spell and create the "sort "item based on the JSON content
|
||||
data.forEach(spell => {
|
||||
spell.name = spell.name;
|
||||
spell.type = "sort";
|
||||
spell.system = {
|
||||
niveau: spell.niveau,
|
||||
competence: spell.competence,
|
||||
carac1: spell.carac1,
|
||||
carac2: spell.carac2,
|
||||
description: spell.description,
|
||||
ingredients: spell.ingredients,
|
||||
portee: spell.portee,
|
||||
duree: spell.duree,
|
||||
concentration: spell.concentration,
|
||||
critique: spell.critique,
|
||||
resistance: spell.resistance,
|
||||
coutactivation: spell.coutactivation
|
||||
};
|
||||
spell.img = "systems/fvtt-les-heritiers/assets/icons/sort.webp";
|
||||
spell.folder = game.folders.getName("Magie du Clan").id;
|
||||
|
||||
// Create the item in the world
|
||||
Item.create(spell)
|
||||
.then(item => {
|
||||
console.log("Sort created:", item);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error creating sort item:", error);
|
||||
});
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error loading druidism spells:", error);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user