Compare commits

...

6 Commits

6 changed files with 46 additions and 18 deletions

View File

@@ -3071,29 +3071,43 @@ export class RdDActor extends RdDBaseActor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
rollArme(arme) { getArmeCompetence(arme, competenceName) {
let comp = arme.system[competenceName]
if (!comp || comp.name == "") {
comp = arme.system[competenceName]
}
if ( !comp || comp.name == "") {
comp = arme.system[competenceName]
}
return comp
}
/* -------------------------------------------- */
rollArme(arme, competenceName = "competence") {
let compToUse = this.getArmeCompetence(arme, competenceName)
if (!Targets.hasTargets()) { if (!Targets.hasTargets()) {
RdDConfirm.confirmer({ RdDConfirm.confirmer({
settingConfirmer: "confirmer-combat-sans-cible", settingConfirmer: "confirmer-combat-sans-cible",
content: `<p>Voulez vous faire un jet de compétence ${arme.system.competence} sans choisir de cible valide? content: `<p>Voulez vous faire un jet de compétence ${competenceName} sans choisir de cible valide?
<br>Tous les jets de combats devront être gérés à la main <br>Tous les jets de combats devront être gérés à la main
</p>`, </p>`,
title: 'Ne pas utiliser les automatisation de combat', title: 'Ne pas utiliser les automatisation de combat',
buttonLabel: "Pas d'automatisation", buttonLabel: "Pas d'automatisation",
onAction: async () => { onAction: async () => {
this.rollCompetence(arme.system.competence, { tryTarget: false }) this.rollCompetence(compToUse, { tryTarget: false })
} }
}); });
return; return;
} }
Targets.selectOneToken(target => { Targets.selectOneToken(target => {
if (Targets.isTargetEntite(target)) { if (Targets.isTargetEntite(target)) {
ui.notifications.warn(`Vous ne pouvez pas attaquer une entité non incarnée avec votre ${arme.name}!!!!`); ui.notifications.warn(`Vous ne pouvez pas attaquer une entité non incarnée avec votre ${arme.name}!!!!`);
return; return;
} }
const competence = this.getCompetence(compToUse)
const competence = this.getCompetence(arme.system.competence) //console.log("RollArme", competence, arme)
if (competence.isCompetencePossession()) { if (competence.isCompetencePossession()) {
return RdDPossession.onAttaquePossession(target, this, competence); return RdDPossession.onAttaquePossession(target, this, competence);
} }

View File

@@ -114,7 +114,7 @@ export class DialogChronologie extends Dialog {
heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()), heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()),
minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(), minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(),
}, },
dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val() dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val().replace('T', ' ')
} }
} }

View File

@@ -1,8 +1,8 @@
export class RdDHotbar { export class RdDHotbar {
static async addToHotbar(item, slot) { static async createItemMacro(item, slot, armeCompetence = undefined) {
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`; let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}"` + ((armeCompetence) ? `, "${armeCompetence}");` : `);`);
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command)); let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
if (!macro) { if (!macro) {
macro = await Macro.create({ macro = await Macro.create({
@@ -15,6 +15,25 @@ export class RdDHotbar {
await game.user.assignHotbarMacro(macro, slot); await game.user.assignHotbarMacro(macro, slot);
} }
static async addToHotbar(item, slot) {
if (item?.type == "arme") { // Used to manage weapons with multiple skills
if (item.system.competence != "") {
await this.createItemMacro(item, slot, "competence")
slot++
}
if (item.system.lancer != "") {
await this.createItemMacro(item, slot, "lancer")
slot++
}
if (item.system.tir != "") {
await this.createItemMacro(item, slot, "lancer")
slot++
}
} else {
await this.createItemMacro(item, slot)
}
}
/** /**
* Create a macro when dropping an entity on the hotbar * Create a macro when dropping an entity on the hotbar
* Item - open roll dialog for item * Item - open roll dialog for item
@@ -44,7 +63,7 @@ export class RdDHotbar {
} }
/** Roll macro */ /** Roll macro */
static rollMacro(itemName, itemType, bypassData) { static rollMacro(itemName, itemType, competenceName) {
const speaker = ChatMessage.getSpeaker(); const speaker = ChatMessage.getSpeaker();
let actor; let actor;
if (speaker.token) actor = game.actors.tokens[speaker.token]; if (speaker.token) actor = game.actors.tokens[speaker.token];
@@ -58,7 +77,7 @@ export class RdDHotbar {
// Trigger the item roll // Trigger the item roll
switch (item.type) { switch (item.type) {
case "arme": case "arme":
return actor.rollArme(item); return actor.rollArme(item, competenceName);
case "competence": case "competence":
return actor.rollCompetence(itemName); return actor.rollCompetence(itemName);
} }

View File

@@ -106,11 +106,6 @@ export class RdDCalendrier extends Application {
return buttons return buttons
} }
/*async maximize() {
await super.maximize()
this.render(true)
}*/
async close() { } async close() { }
async onUpdateSetting(setting, update, options, id) { async onUpdateSetting(setting, update, options, id) {

View File

@@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "11.0.17", "version": "11.0.19",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.17.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.19.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": { "compatibility": {

View File

@@ -1,6 +1,6 @@
{{#if use.moral}} {{#if use.moral}}
<span> <span>
Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}} Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du désespoir{{/if}}
{{#if (eq perteMoralEchec 'dissolution')}}et échoué, cous marquez un point de dissolution!. {{#if (eq perteMoralEchec 'dissolution')}}et échoué, cous marquez un point de dissolution!.
{{else if (eq perteMoralEchec 'perte')}}et échoué, votre moral baisse à {{moral}}. {{else if (eq perteMoralEchec 'perte')}}et échoué, votre moral baisse à {{moral}}.
{{else}}et réussi, votre moral reste de {{moral}}. {{else}}et réussi, votre moral reste de {{moral}}.