Merge pull request 'Fin des liens "jet de dés"' (#738) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: #738
This commit is contained in:
commit
a4b474970c
23
changelog.md
23
changelog.md
@ -1,18 +1,17 @@
|
||||
# 12.0
|
||||
## 12.0.34 - la tête d'Astrobazzarh
|
||||
- on peut ajouter des liens "jet de dés" dans les journaux texte
|
||||
- on peut ajouter des liens "jet de dés" dans les descriptions, notes, ...
|
||||
- les liens "jet de dés" peuvent être utilisés pour un acteur, ou les items de l'acteurs
|
||||
- les liens "jet avec caractéristiques" s'appliquent:
|
||||
- à tous les tokens sélectionnés
|
||||
- sinon, à l'acteur propriétaire d'un Item
|
||||
- sinon, au personnage du joueur
|
||||
|
||||
- support de liens "jets de dés"
|
||||
- on peut ajouter des liens "jet de dés" dans les journaux, descriptions, notes, maladresses, ...
|
||||
- avec la syntaxe `@roll[...]` on peut ajouter le lien vers:
|
||||
- un jet de caractéristique/compétence `@roll[carac/competence/difficulte]` / `@roll[carac/difficulte]` / `@roll[carac/competence]`
|
||||
- une formule foundry `@roll[2d6]` pour lancer 2d6
|
||||
- une manipulation alchimique `@roll[couleur vert-bleu]`
|
||||
- les liens "jet avec caractéristiques" s'appliquent:
|
||||
- à tous les tokens sélectionnés
|
||||
- sinon, à l'acteur propriétaire (dans le cas d'un Item) ou à l'acteur courant
|
||||
- sinon, au personnage du joueur
|
||||
- on peut poster les liens dans le tchat pour proposer un jet aux joueurs
|
||||
- gestion des blocs secrets dans les descriptions
|
||||
- on peut ajouter des liens "jet de dés" pour appeler une formule dés de foundry
|
||||
- les liens "manipulation alchimiques" peuvent être dans les descriptions, notes, ...
|
||||
- les "manipulation alchimiques" fonctionnent comme tous les autres jets
|
||||
|
||||
|
||||
## 12.0.33 - la vieillesse d'Astrobazzarh
|
||||
- retour de l'expérience pour les joueurs
|
||||
|
@ -19,7 +19,7 @@ import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
|
||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
|
||||
import { RdDItemRace } from "./item/race.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll.js";
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
@ -49,6 +49,8 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
|
||||
}], { renderSheet: true })
|
||||
)
|
||||
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
|
||||
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
|
||||
|
||||
|
||||
if (this.options.vueDetaillee) {
|
||||
// On carac change
|
||||
|
@ -5,7 +5,7 @@ import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { Monnaie } from "../item-monnaie.js";
|
||||
import { RdDItem, ITEM_TYPES } from "../item.js";
|
||||
import { RdDItemCompetenceCreature } from "../item-competencecreature.js";
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll.js";
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
|
78
module/apps/rdd-text-roll-editor.js
Normal file
78
module/apps/rdd-text-roll-editor.js
Normal file
@ -0,0 +1,78 @@
|
||||
import "./xregexp-all.js";
|
||||
import { SystemCompendiums } from "../settings/system-compendiums.js";
|
||||
import { ACTOR_TYPES } from "../item.js";
|
||||
import { TextRollAlchimie } from "./textroll/text-roll-alchimie.js";
|
||||
import { TextRollCaracCompetence } from "./textroll/text-roll-carac-competence.js";
|
||||
import { TextRollFormula } from "./textroll/text-roll-formula.js";
|
||||
import { TextRollManager } from "./textroll/text-roll-formatter.js";
|
||||
|
||||
const TEXT_ROLL_MANAGERS = [
|
||||
new TextRollAlchimie(),
|
||||
new TextRollCaracCompetence(),
|
||||
new TextRollFormula()];
|
||||
|
||||
export class RdDTextEditor {
|
||||
static registerChatCallbacks(html) {
|
||||
html.on("click", '.roll-text', async event => await RdDTextEditor.rollText(event))
|
||||
}
|
||||
|
||||
static async enrichHTML(text, object, options = {}) {
|
||||
const context = {
|
||||
text, object,
|
||||
options,
|
||||
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
|
||||
}
|
||||
|
||||
for (let manager of TEXT_ROLL_MANAGERS) {
|
||||
context.code = manager.code
|
||||
context.template = manager.template
|
||||
context.text = await manager.onReplaceRoll(context);
|
||||
}
|
||||
|
||||
// TEXT_ROLL_MANAGERS.forEach(async manager => await RdDTextEditor._applyReplaceAll(manager, context))
|
||||
return await TextEditor.enrichHTML(context.text, {
|
||||
relativeTo: object,
|
||||
secrets: object?.isOwner,
|
||||
async: true
|
||||
})
|
||||
}
|
||||
|
||||
static async _applyReplaceAll(manager, context) {
|
||||
context.code = manager.code
|
||||
context.template = manager.template
|
||||
context.text = await manager.onReplaceRoll(context);
|
||||
return context.text
|
||||
}
|
||||
|
||||
static getEventElement(event) {
|
||||
return $(event.currentTarget)?.parents(".roll-text-link");
|
||||
}
|
||||
|
||||
static async rollText(event, actor) {
|
||||
const code = TextRollManager.getNode(event)?.data('code')
|
||||
const manager = TEXT_ROLL_MANAGERS.find(it => it.code == code)
|
||||
if (manager) {
|
||||
await manager.onRollText(event, actor)
|
||||
}
|
||||
}
|
||||
|
||||
static async chatRollText(event) {
|
||||
const node = TextRollManager.getNode(event);
|
||||
if (node) {
|
||||
const code = node.data('code')
|
||||
const param = node.data('json')
|
||||
const manager = TEXT_ROLL_MANAGERS.find(it => it.code == code)
|
||||
|
||||
const text = await TextRollManager.createRollText(
|
||||
{
|
||||
code,
|
||||
template: manager.template,
|
||||
options: { showLink: false }
|
||||
},
|
||||
param)
|
||||
ChatMessage.create({
|
||||
content: text
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
@ -1,224 +0,0 @@
|
||||
import "./xregexp-all.js";
|
||||
import { RdDCarac } from "../rdd-carac.js";
|
||||
import { SystemCompendiums } from "../settings/system-compendiums.js";
|
||||
import { RdDItemCompetence } from "../item-competence.js";
|
||||
import { ACTOR_TYPES, ITEM_TYPES } from "../item.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDAlchimie } from "../rdd-alchimie.js";
|
||||
|
||||
const REGEX_ALCHIMIE_TERMES = "(?<termes>(\\w|-)+)"
|
||||
const REGEX_ALCHIMIE_MANIP = "(?<manip>(couleur|consistance))"
|
||||
const XREGEXP_ROLL_ALCHIMIE = XRegExp("@roll\\[" + REGEX_ALCHIMIE_MANIP + "\\s+" + REGEX_ALCHIMIE_TERMES + "\\]", 'giu')
|
||||
const XREGEXP_ROLL_ALCHIMIE_MANIP = XRegExp("@" + REGEX_ALCHIMIE_MANIP + "\\{" + REGEX_ALCHIMIE_TERMES + "\\}", 'giu')
|
||||
|
||||
const REGEXP_ROLL_CARAC_COMP = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?(/(?<diff>[\\+\\-]?\\d+))?"
|
||||
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
|
||||
|
||||
const REGEXP_ROLL_FORMULA = "(?<formula>[^\\[\\]]+)"
|
||||
const XREGEXP_ROLL_FORMULA = XRegExp("@roll\\[" + REGEXP_ROLL_FORMULA + "\\]", 'giu')
|
||||
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets d'alchimie
|
||||
*/
|
||||
class TextRollAlchimie {
|
||||
static async onRollText(event, actor) {
|
||||
actor = TextRollAlchimie.getSelectedActor(actor)
|
||||
if (actor) {
|
||||
const recetteId = event.currentTarget.attributes['data-recette-id']?.value
|
||||
const manip = event.currentTarget.attributes['data-manip'].value
|
||||
const termes = event.currentTarget.attributes['data-termes'].value
|
||||
if (recetteId) {
|
||||
await actor.effectuerTacheAlchimie(recetteId, manip, termes)
|
||||
}
|
||||
else {
|
||||
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
|
||||
const diff = RdDAlchimie.getDifficulte(termes)
|
||||
await actor.rollCaracCompetence(carac.code, 'Alchimie', diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static getSelectedActor(actor) {
|
||||
actor = actor ?? RdDUtility.getSelectedActor()
|
||||
if (actor && actor.type == ACTOR_TYPES.personnage) {
|
||||
return actor
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
static async onReplaceRoll(context) {
|
||||
const handler = new TextRollAlchimie(context)
|
||||
context.text = await handler.replaceManipulationAlchimie()
|
||||
}
|
||||
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceManipulationAlchimie() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE, async (rollMatch, i) => await this._replaceOneAlchimie(rollMatch, i))
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE_MANIP, async (rollMatch, i) => await this._replaceOneAlchimie(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async _replaceOneAlchimie(rollMatch, i) {
|
||||
if (rollMatch.termes && rollMatch.manip) {
|
||||
const manip = rollMatch.manip
|
||||
await this._replaceManip(manip, rollMatch, i)
|
||||
}
|
||||
}
|
||||
|
||||
async _replaceManip(manip, rollMatch, i) {
|
||||
const termes = rollMatch.termes
|
||||
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
|
||||
const diff = RdDAlchimie.getDifficulte(termes)
|
||||
const recette = (this.context.object instanceof Item && this.context.object.type == ITEM_TYPES.recettealchimique) ? this.context.object : undefined
|
||||
const replacement = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/apps/link-text-roll-alchimie.hbs`, {
|
||||
manip,
|
||||
termes,
|
||||
recette,
|
||||
carac,
|
||||
diff
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets de caractéristique/compétence depuis
|
||||
* les journaux/descriptions
|
||||
*/
|
||||
class TextRollCaracCompetence {
|
||||
|
||||
static async onRollText(event, actor) {
|
||||
const caracCode = event.currentTarget.attributes['data-carac-code']?.value
|
||||
if (caracCode) {
|
||||
const competence = event.currentTarget.attributes['data-competence']?.value
|
||||
const diff = event.currentTarget.attributes['data-diff']?.value
|
||||
const actors = TextRollCaracCompetence.getSelectedActors(actor)
|
||||
actors.forEach(async it => await TextRollCaracCompetence.doRoll(it, caracCode, competence, diff))
|
||||
}
|
||||
}
|
||||
static async doRoll(actor, caracCode, competence, diff) {
|
||||
caracCode = actor.mapCarac(caracCode)
|
||||
if (competence) {
|
||||
if (actor.type == ACTOR_TYPES.personnage) {
|
||||
await actor.rollCaracCompetence(caracCode, competence, diff)
|
||||
}
|
||||
else {
|
||||
await actor.doRollCaracCompetence(caracCode, competence, diff)
|
||||
}
|
||||
}
|
||||
else {
|
||||
await actor.rollCarac(caracCode, { diff })
|
||||
}
|
||||
}
|
||||
|
||||
static async onReplaceRoll(context) {
|
||||
const handler = new TextRollCaracCompetence(context)
|
||||
context.text = await handler.replaceRollCaracCompetence()
|
||||
}
|
||||
|
||||
static getSelectedActors(actor) {
|
||||
const selected = canvas.tokens.controlled.map(it => it.actor).filter(it => it)
|
||||
if (selected.length > 0) {
|
||||
return selected
|
||||
}
|
||||
actor = actor ?? RdDUtility.getSelectedActor()
|
||||
if (actor) {
|
||||
return [actor]
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceRollCaracCompetence() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_CARAC_COMP, async (rollMatch, i) => await this._replaceOne(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async _replaceOne(rollMatch, i) {
|
||||
const carac = RdDCarac.caracDetails(rollMatch.carac)
|
||||
if (carac) {
|
||||
const competence = rollMatch.competence ? RdDItemCompetence.findCompetence(this.context.competences, rollMatch.competence) : undefined
|
||||
const replacement = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/apps/link-text-roll-carac-competence.hbs`, {
|
||||
carac: carac,
|
||||
competence: competence?.name,
|
||||
diff: rollMatch.diff
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets de dés (formules Foundry)
|
||||
*/
|
||||
class TextRollFoundry {
|
||||
|
||||
static async onReplaceRoll(context) {
|
||||
const handler = new TextRollFoundry(context.text)
|
||||
context.text = await handler.replaceRolls()
|
||||
}
|
||||
|
||||
static async onRollText(event, actor) {
|
||||
const rollFoundry = event.currentTarget.attributes['data-roll-foundry']?.value
|
||||
if (rollFoundry) {
|
||||
const roll = new Roll(rollFoundry)
|
||||
await roll.evaluate()
|
||||
await roll.toMessage()
|
||||
}
|
||||
}
|
||||
|
||||
constructor(text) {
|
||||
this.text = text
|
||||
}
|
||||
|
||||
async replaceRolls() {
|
||||
await XRegExp.forEach(this.text, XREGEXP_ROLL_FORMULA, async (rollMatch, i) => await this._replaceOne(rollMatch, i))
|
||||
return this.text
|
||||
}
|
||||
|
||||
async _replaceOne(rollMatch, i) {
|
||||
if (rollMatch.formula) {
|
||||
const replacement = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/apps/link-text-roll-foundry.hbs`, {
|
||||
formula: rollMatch.formula,
|
||||
})
|
||||
this.text = this.text.replace(rollMatch[0], replacement)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class RdDTextEditor {
|
||||
|
||||
static async enrichHTML(text, object) {
|
||||
const competences = await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage);
|
||||
const context = { text, competences, object }
|
||||
await TextRollAlchimie.onReplaceRoll(context)
|
||||
await TextRollCaracCompetence.onReplaceRoll(context)
|
||||
await TextRollFoundry.onReplaceRoll(context)
|
||||
return await TextEditor.enrichHTML(context.text, {
|
||||
relativeTo: object,
|
||||
secrets: object?.isOwner,
|
||||
async: true
|
||||
})
|
||||
}
|
||||
|
||||
static async rollText(event, actor) {
|
||||
const rollMode = event.currentTarget.attributes['data-roll-mode']?.value;
|
||||
switch (rollMode) {
|
||||
case 'foundry':
|
||||
return await TextRollFoundry.onRollText(event, actor)
|
||||
case 'carac':
|
||||
return await TextRollCaracCompetence.onRollText(event, actor)
|
||||
case 'alchimie':
|
||||
return await TextRollAlchimie.onRollText(event, actor)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
79
module/apps/textroll/text-roll-alchimie.js
Normal file
79
module/apps/textroll/text-roll-alchimie.js
Normal file
@ -0,0 +1,79 @@
|
||||
import "../xregexp-all.js";
|
||||
import { ACTOR_TYPES, ITEM_TYPES } from "../../item.js";
|
||||
import { RdDCarac } from "../../rdd-carac.js";
|
||||
import { RdDUtility } from "../../rdd-utility.js";
|
||||
import { RdDAlchimie } from "../../rdd-alchimie.js";
|
||||
import { TextRollManager } from "./text-roll-formatter.js";
|
||||
|
||||
const REGEX_ALCHIMIE_TERMES = "(?<termes>(\\w|-)+)"
|
||||
const REGEX_ALCHIMIE_MANIP = "(?<manip>(couleur|consistance))"
|
||||
const XREGEXP_ROLL_ALCHIMIE = XRegExp("@roll\\[" + REGEX_ALCHIMIE_MANIP + "\\s+" + REGEX_ALCHIMIE_TERMES + "\\]", 'giu')
|
||||
const XREGEXP_ROLL_ALCHIMIE_MANIP = XRegExp("@" + REGEX_ALCHIMIE_MANIP + "\\{" + REGEX_ALCHIMIE_TERMES + "\\}", 'giu')
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets d'alchimie
|
||||
*/
|
||||
export class TextRollAlchimie {
|
||||
get code() { return 'alchimie' }
|
||||
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-alchimie.hbs` }
|
||||
|
||||
async onReplaceRoll(context) {
|
||||
const handler = new AlchimieTextBuilder(context)
|
||||
return await handler.replaceAll()
|
||||
}
|
||||
|
||||
async onRollText(event, actor) {
|
||||
actor = this.getSelectedActor(actor)
|
||||
if (actor) {
|
||||
const node = TextRollManager.getNode(event)
|
||||
const recetteId = node.data('recetteid')
|
||||
const manip = node.data('manip')
|
||||
const termes = node.data('termes')
|
||||
if (recetteId) {
|
||||
await actor.effectuerTacheAlchimie(recetteId, manip, termes)
|
||||
}
|
||||
else {
|
||||
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
|
||||
const diff = RdDAlchimie.getDifficulte(termes)
|
||||
await actor.rollCaracCompetence(carac.code, 'Alchimie', diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getSelectedActor(actor) {
|
||||
actor = actor ?? RdDUtility.getSelectedActor()
|
||||
if (actor && actor.type == ACTOR_TYPES.personnage) {
|
||||
return actor
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
class AlchimieTextBuilder {
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceAll() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE_MANIP, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async replaceMatch(rollMatch, i) {
|
||||
if (rollMatch.termes && rollMatch.manip) {
|
||||
const manip = rollMatch.manip
|
||||
const termes = rollMatch.termes
|
||||
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
|
||||
const diff = RdDAlchimie.getDifficulte(termes)
|
||||
const recette = (this.context.object instanceof Item && this.context.object.type == ITEM_TYPES.recettealchimique) ? this.context.object : undefined
|
||||
const replacement = await TextRollManager.createRollText(this.context,
|
||||
{
|
||||
code: this.context.code,
|
||||
manip, termes, carac, diff, recetteid: recette?.id,
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
88
module/apps/textroll/text-roll-carac-competence.js
Normal file
88
module/apps/textroll/text-roll-carac-competence.js
Normal file
@ -0,0 +1,88 @@
|
||||
import "../xregexp-all.js";
|
||||
import { ACTOR_TYPES } from "../../item.js";
|
||||
import { RdDCarac } from "../../rdd-carac.js";
|
||||
import { RdDItemCompetence } from "../../item-competence.js";
|
||||
import { RdDUtility } from "../../rdd-utility.js";
|
||||
import { TextRollManager } from "./text-roll-formatter.js";
|
||||
|
||||
const REGEXP_ROLL_CARAC_COMP = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?(/(?<diff>[\\+\\-]?\\d+))?"
|
||||
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets de caractéristique/compétence depuis
|
||||
* les journaux/descriptions
|
||||
*/
|
||||
export class TextRollCaracCompetence {
|
||||
get code() { return 'carac' }
|
||||
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-carac-competence.hbs` }
|
||||
|
||||
async onReplaceRoll(context) {
|
||||
const handler = new CaracCompetenceTextBuilder(context)
|
||||
return await handler.replaceAll()
|
||||
}
|
||||
|
||||
async onRollText(event, actor) {
|
||||
const node = TextRollManager.getNode(event)
|
||||
const caracCode = node.data('carac-code')
|
||||
if (caracCode) {
|
||||
const competence = node.data('competence')
|
||||
const diff = node.data('diff')
|
||||
const actors = this.getSelectedActors(actor)
|
||||
actors.forEach(async it => await this.doRoll(it, caracCode, competence, diff))
|
||||
}
|
||||
}
|
||||
|
||||
async doRoll(actor, caracCode, competence, diff) {
|
||||
caracCode = actor.mapCarac(caracCode)
|
||||
if (competence) {
|
||||
if (actor.type == ACTOR_TYPES.personnage) {
|
||||
await actor.rollCaracCompetence(caracCode, competence, diff)
|
||||
}
|
||||
else {
|
||||
await actor.doRollCaracCompetence(caracCode, competence, diff)
|
||||
}
|
||||
}
|
||||
else {
|
||||
await actor.rollCarac(caracCode, { diff })
|
||||
}
|
||||
}
|
||||
|
||||
getSelectedActors(actor) {
|
||||
const selected = canvas.tokens.controlled.map(it => it.actor).filter(it => it)
|
||||
if (selected.length > 0) {
|
||||
return selected
|
||||
}
|
||||
actor = actor ?? RdDUtility.getSelectedActor()
|
||||
if (actor) {
|
||||
return [actor]
|
||||
}
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
class CaracCompetenceTextBuilder {
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceAll() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_CARAC_COMP, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async replaceMatch(rollMatch, i) {
|
||||
const carac = RdDCarac.caracDetails(rollMatch.carac)
|
||||
if (carac) {
|
||||
const competence = rollMatch.competence ? RdDItemCompetence.findCompetence(this.context.competences, rollMatch.competence) : undefined
|
||||
const replacement = await TextRollManager.createRollText(this.context,
|
||||
{
|
||||
code: this.context.code,
|
||||
carac: carac,
|
||||
competence: competence?.name,
|
||||
diff: rollMatch.diff,
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
module/apps/textroll/text-roll-formatter.js
Normal file
13
module/apps/textroll/text-roll-formatter.js
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
export class TextRollManager {
|
||||
|
||||
static async createRollText(context, param) {
|
||||
return await renderTemplate(context.template, {
|
||||
param, options: context.options
|
||||
})
|
||||
}
|
||||
|
||||
static getNode(event) {
|
||||
return $(event.currentTarget)?.parents(".roll-text-link");
|
||||
}
|
||||
}
|
51
module/apps/textroll/text-roll-formula.js
Normal file
51
module/apps/textroll/text-roll-formula.js
Normal file
@ -0,0 +1,51 @@
|
||||
import "../xregexp-all.js";
|
||||
import { TextRollManager } from "./text-roll-formatter.js";
|
||||
|
||||
const REGEXP_ROLL_FORMULA = "(?<formula>[^\\[\\]]+)"
|
||||
const XREGEXP_ROLL_FORMULA = XRegExp("@roll\\[" + REGEXP_ROLL_FORMULA + "\\]", 'giu')
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets de dés (formules Foundry)
|
||||
*/
|
||||
export class TextRollFormula {
|
||||
get code() { return 'formula' }
|
||||
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-formula.hbs` }
|
||||
|
||||
async onReplaceRoll(context) {
|
||||
const handler = new FormulaTextBuilder(context)
|
||||
return await handler.replaceAll()
|
||||
}
|
||||
|
||||
async onRollText(event, actor) {
|
||||
const node = TextRollManager.getNode(event)
|
||||
const rollFormula = node.data('roll-formula')
|
||||
if (rollFormula) {
|
||||
const roll = new Roll(rollFormula)
|
||||
await roll.evaluate()
|
||||
await roll.toMessage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FormulaTextBuilder {
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceAll() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_FORMULA,
|
||||
async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async replaceMatch(rollMatch, i) {
|
||||
if (rollMatch.formula) {
|
||||
const replacement = await TextRollManager.createRollText(this.context,
|
||||
{
|
||||
code: this.context.code,
|
||||
formula: rollMatch.formula,
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
import { RdDBaseActor } from "../actor/base-actor.js";
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
|
||||
const INFO_COEUR = 'info-coeur';
|
||||
|
||||
|
@ -13,7 +13,7 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { ACTOR_TYPES, ITEM_TYPES, RdDItem } from "./item.js";
|
||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
@ -207,6 +207,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
this.html.find('input[name="system.cacher_points_de_tache"]').change(async event => await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked }));
|
||||
|
||||
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
|
||||
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
|
||||
|
||||
if (this.actor) {
|
||||
this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(RdDSheetUtility.getItem(event, this.actor), this.actor, this.getActionRenderItem()));
|
||||
|
@ -106,7 +106,7 @@ export class RdDItemSigneDraconique extends RdDItem {
|
||||
}
|
||||
|
||||
static async randomSigneDescription() {
|
||||
return await RdDRollTables.drawTextFromRollTable("Signes draconiques", false);
|
||||
return await RdDRollTables.drawTextFromRollTable("Signes draconiques", {toChat:false});
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll.js";
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
|
||||
import { SYSTEM_RDD } from "../constants.js";
|
||||
import { Misc } from "../misc.js";
|
||||
|
||||
@ -24,5 +24,6 @@ export class RdDJournalSheet extends JournalTextPageSheet {
|
||||
super.activateListeners(html);
|
||||
|
||||
html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
|
||||
html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
|
||||
}
|
||||
}
|
@ -472,15 +472,15 @@ export class RdDCombat {
|
||||
/* -------------------------------------------- */
|
||||
static registerChatCallbacks(html) {
|
||||
for (let button of [
|
||||
'#parer-button',
|
||||
'#esquiver-button',
|
||||
'#particuliere-attaque',
|
||||
'#encaisser-button',
|
||||
'#appel-chance-defense',
|
||||
'#appel-destinee-defense',
|
||||
'#appel-chance-attaque',
|
||||
'#appel-destinee-attaque',
|
||||
'#echec-total-attaque',
|
||||
'.parer-button',
|
||||
'.esquiver-button',
|
||||
'.particuliere-attaque',
|
||||
'.encaisser-button',
|
||||
'.appel-chance-defense',
|
||||
'.appel-destinee-defense',
|
||||
'.appel-chance-attaque',
|
||||
'.appel-destinee-attaque',
|
||||
'.echec-total-attaque',
|
||||
]) {
|
||||
html.on("click", button, event => {
|
||||
const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(
|
||||
@ -539,22 +539,22 @@ export class RdDCombat {
|
||||
const compId = event.currentTarget.attributes['data-compid']?.value;
|
||||
|
||||
switch (button) {
|
||||
case '#particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value);
|
||||
case '#parer-button': return this.parade(attackerRoll, armeParadeId);
|
||||
case '#esquiver-button': return this.esquive(attackerRoll, compId, competence);
|
||||
case '#encaisser-button': return this.encaisser(attackerRoll, defenderRoll);
|
||||
case '#echec-total-attaque': return this._onEchecTotal(attackerRoll);
|
||||
case '.particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value);
|
||||
case '.parer-button': return this.parade(attackerRoll, armeParadeId);
|
||||
case '.esquiver-button': return this.esquive(attackerRoll, compId, competence);
|
||||
case '0encaisser-button': return this.encaisser(attackerRoll, defenderRoll);
|
||||
case '.echec-total-attaque': return this._onEchecTotal(attackerRoll);
|
||||
|
||||
case '#appel-chance-attaque': return this.attacker.rollAppelChance(
|
||||
case '.appel-chance-attaque': return this.attacker.rollAppelChance(
|
||||
() => this.attaqueChanceuse(attackerRoll),
|
||||
() => this._onEchecTotal(attackerRoll));
|
||||
case '#appel-chance-defense': return this.defender.rollAppelChance(
|
||||
case '.appel-chance-defense': return this.defender.rollAppelChance(
|
||||
() => this.defenseChanceuse(attackerRoll, defenderRoll),
|
||||
() => this.afficherOptionsDefense(attackerRoll, defenderRoll, { defenseChance: true }));
|
||||
case '#appel-destinee-attaque': return this.attacker.appelDestinee(
|
||||
case '.appel-destinee-attaque': return this.attacker.appelDestinee(
|
||||
() => this.attaqueSignificative(attackerRoll),
|
||||
() => { });
|
||||
case '#appel-destinee-defense': return this.defender.appelDestinee(
|
||||
case '.appel-destinee-defense': return this.defender.appelDestinee(
|
||||
() => this.defenseDestinee(defenderRoll),
|
||||
() => { });
|
||||
}
|
||||
@ -967,7 +967,6 @@ export class RdDCombat {
|
||||
async _onAttaqueEchec(rollData) {
|
||||
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
|
||||
await RdDResolutionTable.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.html');
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -76,7 +76,7 @@ import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.
|
||||
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
|
||||
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
|
||||
import { RdDJournalSheet } from "./journal/journal-sheet.js"
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll.js"
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"
|
||||
|
||||
/**
|
||||
* RdD system
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { CompendiumTable, CompendiumTableHelpers, SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
|
||||
export class RdDRollTables {
|
||||
@ -28,8 +29,8 @@ export class RdDRollTables {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async drawTextFromRollTable(tableName, toChat) {
|
||||
const drawResult = await RdDRollTables.genericGetTableResult(tableName, toChat);
|
||||
static async drawTextFromRollTable(tableName, options = {}) {
|
||||
const drawResult = await RdDRollTables.genericGetTableResult(tableName, options.toChat);
|
||||
return drawResult.text;
|
||||
}
|
||||
|
||||
@ -101,9 +102,10 @@ export class RdDRollTables {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getMaladresse(options = { toChat: false, arme: false }) {
|
||||
return await RdDRollTables.drawTextFromRollTable(
|
||||
const maladresse = await RdDRollTables.drawTextFromRollTable(
|
||||
options.arme ? "Maladresse armé" : "Maladresses non armé",
|
||||
options.toChat);
|
||||
options);
|
||||
return await RdDTextEditor.enrichHTML(maladresse, undefined, {showLink:false})
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js";
|
||||
import { RDD_CONFIG } from "./constants.js";
|
||||
import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
import { RdDCarac } from "./rdd-carac.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// This table starts at 0 -> niveau -10
|
||||
@ -289,6 +290,7 @@ export class RdDUtility {
|
||||
Handlebars.registerHelper('grammar-apostrophe', (article, str) => Grammar.apostrophe(article, str));
|
||||
Handlebars.registerHelper('grammar-un', str => Grammar.articleIndetermine(str));
|
||||
Handlebars.registerHelper('grammar-accord', (genre, ...args) => Grammar.accord(genre, args));
|
||||
Handlebars.registerHelper('json-stringify', object => JSON.stringify(object))
|
||||
|
||||
// math
|
||||
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
|
||||
@ -695,6 +697,7 @@ export class RdDUtility {
|
||||
RdDCombat.registerChatCallbacks(html)
|
||||
RdDEmpoignade.registerChatCallbacks(html)
|
||||
RdDCoeur.registerChatCallbacks(html)
|
||||
RdDTextEditor.registerChatCallbacks(html)
|
||||
|
||||
// Gestion spécifique message passeurs
|
||||
html.on("click", '.tmr-passeur-coord a', event => {
|
||||
|
@ -19,7 +19,7 @@ system:
|
||||
<p>Si un personnage ainsi rendu dérisoire participe à un combat, il peut
|
||||
tenter une fois par round de lancer une plaisanterie en guise d’attaque
|
||||
(tout en esquivant/parant normalement). Il joue pour cela @roll[APPARENCE/Comédie]
|
||||
à -@roll[1d4] (ce d4 résume les conditions ponctuelles plus ou moins propices, et
|
||||
à @roll[-1d4] (ce d4 résume les conditions ponctuelles plus ou moins propices, et
|
||||
il est en fait soustrait du bonus de +4 conféré par le sort). Puis selon la
|
||||
réussite, on obtient un ajustement :</p>
|
||||
|
||||
|
@ -22,8 +22,9 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Ami bousculé : Le compagnon bousculé doit réussir Empathie/Vigilance à
|
||||
-1d6 ou être en demi-surprise jusqu’à la fin du round suivant.
|
||||
Ami bousculé : Le compagnon bousculé doit réussir
|
||||
@roll[Empathie/Vigilance] à @roll[-1d6] ou être en
|
||||
demi-surprise jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -39,7 +40,7 @@ results:
|
||||
- _id: APqyDePFzBaROB6i
|
||||
flags: {}
|
||||
type: text
|
||||
text: 'Chute : Encaissement à -1d6 sur la table des Coups non mortels.'
|
||||
text: 'Chute : Encaissement à @roll[-1d6] sur la table des Coups non mortels.'
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -72,7 +73,7 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Arme choquée : L’arme utilisée joue un jet de Résistance à -2d6 et perd ce
|
||||
Arme choquée : L’arme utilisée joue un jet de Résistance à @roll[-2d6] et perd ce
|
||||
nombre de points de résistance en cas d’échec.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
@ -90,7 +91,7 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Déséquilibré : Réussir Agilité/Vigilance à -1d6 ou être en demi-surprise
|
||||
Déséquilibré : Réussir @roll[Agilité/Vigilance] à @roll[-1d6] ou être en demi-surprise
|
||||
jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
@ -107,7 +108,7 @@ results:
|
||||
- _id: GOYmqZj1Lnc0cKO9
|
||||
flags: {}
|
||||
type: text
|
||||
text: 'Faux mouvement : Perte de 2d6 points d’endurance.'
|
||||
text: 'Faux mouvement : Perte de @roll[2d6] points d’endurance.'
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -124,7 +125,7 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Déséquilibré : Réussir Agilité/Vigilance à -1d6 ou être en demi-surprise
|
||||
Déséquilibré : Réussir @roll[Agilité/Vigilance] à @roll[-1d6] ou être en demi-surprise
|
||||
jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
@ -142,7 +143,7 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Arme choquée : L’arme utilisée joue un jet de Résistance à -2d6 et perd ce
|
||||
Arme choquée : L’arme utilisée joue un jet de Résistance à @roll[-2d6] et perd ce
|
||||
nombre de points de résistance en cas d’échec.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
@ -175,7 +176,7 @@ results:
|
||||
- _id: c61AFRaP9poCmr9B
|
||||
flags: {}
|
||||
type: text
|
||||
text: 'Chute : Encaissement à -1d6 sur la table des Coups non mortels.'
|
||||
text: 'Chute : Encaissement à @roll[-1d6] sur la table des Coups non mortels.'
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -192,8 +193,9 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Ami bousculé : Le compagnon bousculé doit réussir Empathie/Vigilance à
|
||||
-1d6 ou être en demi-surprise jusqu’à la fin du round suivant.
|
||||
Ami bousculé : Le compagnon bousculé doit réussir
|
||||
@roll[Empathie/Vigilance] à @roll[-1d6] ou être en
|
||||
demi-surprise jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
|
@ -22,8 +22,9 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Ami bousculé : Le compagnon bousculé doit réussir Empathie/Vigilance à
|
||||
-1d6 ou être en demi-surprise jusqu’à la fin du round suivant.
|
||||
Ami bousculé : Le compagnon bousculé doit réussir
|
||||
@roll[Empathie/Vigilance] à @roll[-1d6] ou être en
|
||||
demi-surprise jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -39,7 +40,7 @@ results:
|
||||
- _id: 1DtaMqWygL8BjZjw
|
||||
flags: {}
|
||||
type: text
|
||||
text: 'Chute : Encaissement à -1d6 sur la table des Coups non mortels.'
|
||||
text: 'Chute : Encaissement à @roll[-1d6] sur la table des Coups non mortels.'
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -56,7 +57,8 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Déséquilibré : Réussir Agilité/Vigilance à -1d6 ou être en demi-surprise
|
||||
Déséquilibré : Réussir @roll[Agilité/Vigilance]
|
||||
à @roll[-1d6] ou être en demi-surprise
|
||||
jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
@ -73,7 +75,7 @@ results:
|
||||
- _id: kyAKakRIPGKr6Gdy
|
||||
flags: {}
|
||||
type: text
|
||||
text: 'Faux mouvement : Perte de 2d6 points d’endurance.'
|
||||
text: 'Faux mouvement : Perte de @roll[2d6] points d’endurance.'
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -90,7 +92,8 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Déséquilibré : Réussir Agilité/Vigilance à -1d6 ou être en demi-surprise
|
||||
Déséquilibré : Réussir @roll[Agilité/Vigilance]
|
||||
à @roll[-1d6] ou être en demi-surprise
|
||||
jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
@ -107,7 +110,7 @@ results:
|
||||
- _id: NY1uI3k3YbJKQddk
|
||||
flags: {}
|
||||
type: text
|
||||
text: 'Chute : Encaissement à -1d6 sur la table des Coups non mortels.'
|
||||
text: 'Chute : Encaissement à @roll[-1d6] sur la table des Coups non mortels.'
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
@ -124,8 +127,9 @@ results:
|
||||
flags: {}
|
||||
type: text
|
||||
text: >-
|
||||
Ami bousculé : Le compagnon bousculé doit réussir Empathie/Vigilance à
|
||||
-1d6 ou être en demi-surprise jusqu’à la fin du round suivant.
|
||||
Ami bousculé : Le compagnon bousculé doit réussir
|
||||
@roll[Empathie/Vigilance] à @roll[-1d6] ou être en
|
||||
demi-surprise jusqu’à la fin du round suivant.
|
||||
img: icons/svg/d20-black.svg
|
||||
weight: 1
|
||||
range:
|
||||
|
@ -1038,10 +1038,20 @@ a.rdd-world-content-link {
|
||||
white-space: nowrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
span.content-link,
|
||||
a.content-link {
|
||||
background: hsla(45, 100%, 80%, 0.2);
|
||||
color: hsla(300, 70%, 20%, 0.8);
|
||||
font-weight: 560;
|
||||
padding: 0.1rem 0.3rem;
|
||||
border: 1px solid var(--color-border-dark-tertiary);
|
||||
border-radius: 0.25rem;
|
||||
white-space: nowrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
|
||||
li label.compteur {
|
||||
display: inline-block;
|
||||
flex-direction: row;
|
||||
@ -1067,15 +1077,6 @@ li label.compteur {
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
a.roll-text.content-link {
|
||||
color: hsla(300, 70%, 40%, 0.5);
|
||||
font-weight: bold;
|
||||
border: 1px solid var(--color-border-dark-tertiary);
|
||||
border-radius: 0.25rem;
|
||||
white-space: nowrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.window-app.sheet .window-content .tooltip:hover .tooltiptext {
|
||||
top: 2rem;
|
||||
left: 2rem;
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "12.0.33",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.33/rddsystem.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.33/system.json",
|
||||
"version": "12.0.34",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.34/rddsystem.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.34/system.json",
|
||||
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
||||
"compatibility": {
|
||||
"minimum": "11",
|
||||
|
@ -1,8 +0,0 @@
|
||||
<span><a class="roll-text content-link"
|
||||
data-roll-mode="alchimie"
|
||||
{{#if recette}}data-recette-id="{{recette.id}}"{{/if}}
|
||||
data-manip="{{manip}}"
|
||||
data-termes="{{termes}}"
|
||||
data-tooltip="{{upperFirst carac.label}}/Alchimie à {{diff}}">
|
||||
{{~manip}} {{termes~}}
|
||||
</a></span>
|
@ -1,9 +0,0 @@
|
||||
<span><a class="roll-text content-link"
|
||||
data-roll-mode="carac"
|
||||
{{#if competence}}data-competence="{{competence}}"{{/if~}}
|
||||
{{#if diff}}data-diff="{{diff}}"{{/if~}}
|
||||
data-carac-code="{{carac.code}}">
|
||||
{{~uppercase carac.label~}}
|
||||
{{#if competence}} / {{upperFirst competence}}{{/if~}}
|
||||
{{#if diff}} à {{diff}}{{/if~}}
|
||||
</a></span>
|
@ -1,5 +0,0 @@
|
||||
<span><a class="roll-text content-link"
|
||||
data-roll-mode="foundry"
|
||||
data-roll-foundry="{{formula}}">
|
||||
{{~formula~}}
|
||||
</a></span>
|
0
templates/apps/textroll/chat-link-text-roll.hbs
Normal file
0
templates/apps/textroll/chat-link-text-roll.hbs
Normal file
13
templates/apps/textroll/link-text-roll-alchimie.hbs
Normal file
13
templates/apps/textroll/link-text-roll-alchimie.hbs
Normal file
@ -0,0 +1,13 @@
|
||||
<span class="content-link roll-text-link"
|
||||
data-code="{{param.code}}"
|
||||
data-json="{{json-stringify param}}"
|
||||
data-manip="{{param.manip}}"
|
||||
data-termes="{{param.termes}}"
|
||||
{{#if recetteid}}data-recetteid="{{param.recetteid}}"{{/if}}>
|
||||
<a class="roll-text" data-tooltip="{{upperFirst param.carac.label}}/Alchimie à {{param.diff}}">
|
||||
{{~param.manip}} {{param.termes~}}
|
||||
</a>
|
||||
{{~#if options.showlink}}
|
||||
<a class="chat-roll-text" data-tooltip="Montrer"><i class="fas fa-comment"></i></a>
|
||||
{{/if~}}
|
||||
</span>
|
14
templates/apps/textroll/link-text-roll-carac-competence.hbs
Normal file
14
templates/apps/textroll/link-text-roll-carac-competence.hbs
Normal file
@ -0,0 +1,14 @@
|
||||
<span class="content-link roll-text-link"
|
||||
data-code="{{param.code}}"
|
||||
data-json="{{json-stringify param}}"
|
||||
data-carac-code="{{param.carac.code}}"
|
||||
{{#if competence}}data-competence="{{param.competence}}"{{/if~}}
|
||||
{{#if diff}}data-diff="{{param.diff}}"{{/if~}}>
|
||||
<a class="roll-text">
|
||||
{{~uppercase param.carac.label~}}
|
||||
{{#if param.competence}} / {{upperFirst param.competence}}{{/if~}}
|
||||
{{#if param.diff}} à {{param.diff}}{{/if~}}</a>
|
||||
{{~#if options.showlink}}
|
||||
<a class="chat-roll-text" data-tooltip="Montrer"><i class="fas fa-comment"></i></a>
|
||||
{{/if~}}
|
||||
</span>
|
9
templates/apps/textroll/link-text-roll-formula.hbs
Normal file
9
templates/apps/textroll/link-text-roll-formula.hbs
Normal file
@ -0,0 +1,9 @@
|
||||
<span class="content-link roll-text-link"
|
||||
data-code="{{param.code}}"
|
||||
data-json="{{json-stringify param}}"
|
||||
data-roll-formula="{{param.formula}}">
|
||||
<a class="roll-text">{{~param.formula~}}</a>
|
||||
{{~#if options.showlink}}
|
||||
<a class="chat-roll-text" data-tooltip="Montrer"><i class="fas fa-comment"></i></a>
|
||||
{{/if~}}
|
||||
</span>
|
@ -3,21 +3,21 @@
|
||||
<br>
|
||||
{{#if (eq attacker.type 'personnage')}}
|
||||
{{#unless essais.attaqueChance}}
|
||||
<a class='chat-card-button' id='appel-chance-attaque'
|
||||
<a class='chat-card-button appel-chance-attaque'
|
||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'>
|
||||
Faire appel à la chance</a>
|
||||
</a>
|
||||
<br>
|
||||
{{/unless}}
|
||||
{{#if (gt attacker.system.compteurs.destinee.value 0)}}
|
||||
<a class='chat-card-button' id='appel-destinee-attaque'
|
||||
<a class='chat-card-button appel-destinee-attaque'
|
||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'>
|
||||
Utiliser la destinée</a>
|
||||
</a>
|
||||
<br>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<a class='chat-card-button' id='echec-total-attaque'
|
||||
<a class='chat-card-button echec-total-attaque'
|
||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'>
|
||||
Tirer la maladresse !
|
||||
</a>
|
||||
|
@ -20,14 +20,14 @@
|
||||
{{#if essais.defense}}
|
||||
{{#unless essais.defenseChance}}
|
||||
{{#if (eq defender.type 'personnage')}}
|
||||
<a class='chat-card-button' id='appel-chance-defense'
|
||||
<a class='chat-card-button appel-chance-defense'
|
||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'>
|
||||
Faire appel à la chance</a>
|
||||
</a>
|
||||
<br>
|
||||
{{/if}}
|
||||
{{#if (and (eq defender.type 'personnage') (gt defender.system.compteurs.destinee.value 0))}}
|
||||
<a class='chat-card-button' id='appel-destinee-defense'
|
||||
<a class='chat-card-button appel-destinee-defense'
|
||||
data-attackerId='{{attackerId}}' data-attackerTokenId='{{attackerToken.id}}' data-defenderTokenId='{{defenderToken.id}}'>
|
||||
Utiliser la destinée</a>
|
||||
</a>
|
||||
@ -36,7 +36,7 @@
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
{{#each armes as |arme key|}}
|
||||
<a class='chat-card-button' id='parer-button'
|
||||
<a class='chat-card-button parer-button'
|
||||
data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderToken.id}}' data-attackerTokenId='{{../attackerToken.id}}'
|
||||
data-armeid='{{arme._id}}'>
|
||||
Parer avec {{arme.name}}
|
||||
@ -52,7 +52,7 @@
|
||||
<br>
|
||||
{{/each}}
|
||||
{{#if mainsNues}}
|
||||
<a class='chat-card-button' id='parer-button'
|
||||
<a class='chat-card-button parer-button'
|
||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'
|
||||
data-armeid='{{arme._id}}' data-competence='{{arme.system.competence}}'>
|
||||
Parer à mains nues à {{diffLibre}}{{#if arme.nbUsage}} (Utilisations : {{arme.nbUsage}}){{/if}}
|
||||
@ -61,7 +61,7 @@
|
||||
{{/if}}
|
||||
{{#if (ne attaqueCategorie 'tir')}}
|
||||
{{#each esquives as |esquive key|}}
|
||||
<a class='chat-card-button' id='esquiver-button'
|
||||
<a class='chat-card-button esquiver-button'
|
||||
data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderToken.id}}' data-attackerTokenId='{{../attackerToken.id}}'
|
||||
data-compid='{{esquive._id}}' data-competence='{{esquive.name}}'>
|
||||
{{esquive.name}}
|
||||
@ -76,7 +76,7 @@
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
<a class='chat-card-button' id='encaisser-button'
|
||||
<a class='chat-card-button encaisser-button'
|
||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'>
|
||||
Encaisser à {{plusMoins dmg.total}}
|
||||
{{#if (eq dmg.mortalite 'non-mortel')~}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user