forked from public/foundryvtt-reve-de-dragon
RollV2, tchat et appel chance
gestion des appels à la chance pour tout jet V2 correction de soucis forçage du jet continuation des messages de défense
This commit is contained in:
@@ -46,7 +46,7 @@ import { PAS_DE_DRACONIC, POSSESSION_SANS_DRACONIC } from "./item/base-items.js"
|
|||||||
import { RdDRollResult } from "./rdd-roll-result.js";
|
import { RdDRollResult } from "./rdd-roll-result.js";
|
||||||
import { RdDInitiative } from "./initiative.mjs";
|
import { RdDInitiative } from "./initiative.mjs";
|
||||||
import RollDialog from "./roll/roll-dialog.mjs";
|
import RollDialog from "./roll/roll-dialog.mjs";
|
||||||
import { OptionsAvancees, ROLL_DIALOG_V2 } from "./settings/options-avancees.js";
|
import { OptionsAvancees, ROLL_DIALOG_V2, ROLL_DIALOG_V2_TEST } from "./settings/options-avancees.js";
|
||||||
|
|
||||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
||||||
|
|
||||||
@@ -3049,7 +3049,7 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _rollArtV2(oeuvreId, callbackAction = async (rd) => await this._resultArtV2(rd)) {
|
async _rollArtV2(oeuvreId) {
|
||||||
const oeuvre = this.items.get(oeuvreId)
|
const oeuvre = this.items.get(oeuvreId)
|
||||||
const rollData = {
|
const rollData = {
|
||||||
title: `Interpretation de ${oeuvre.name} par ${this.name}`,
|
title: `Interpretation de ${oeuvre.name} par ${this.name}`,
|
||||||
@@ -3066,23 +3066,12 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
}
|
}
|
||||||
await RollDialog.create(rollData, {
|
await RollDialog.create(rollData, {
|
||||||
onRollDone: (dialog) => {
|
onRollDone: (dialog) => {
|
||||||
this._onCloseRollDialog()
|
if (!OptionsAvancees.isUsing(ROLL_DIALOG_V2_TEST))
|
||||||
dialog.close()
|
dialog.close()
|
||||||
},
|
}
|
||||||
customChatMessage: true,
|
|
||||||
callbacks: [callbackAction]
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move vers ChatRollResult
|
|
||||||
async _resultArtV2(artData) {
|
|
||||||
const niveau = artData.oeuvre.system.niveau ?? 0
|
|
||||||
const baseQualite = (artData.rolled.isSuccess ? niveau : artData.competence.system.niveau)
|
|
||||||
artData.qualiteFinale = Math.min(baseQualite, niveau) + artData.rolled.ptQualite
|
|
||||||
//this.$onRollCompetence(artData)
|
|
||||||
await RdDRollResult.displayRollData(artData, this.name, `chat-resultat-${artData.art}.hbs`)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollOeuvre(id) {
|
async rollOeuvre(id) {
|
||||||
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
|
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
|
||||||
|
@@ -197,8 +197,12 @@ export class ChatUtility {
|
|||||||
|
|
||||||
static async onCreateChatMessage(chatMessage, options, id) {
|
static async onCreateChatMessage(chatMessage, options, id) {
|
||||||
if (chatMessage.isAuthor) {
|
if (chatMessage.isAuthor) {
|
||||||
await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
|
await ChatUtility.setTimestamp(chatMessage)
|
||||||
await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, { showLink: false }) })
|
await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, { showLink: false }) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async setTimestamp(chatMessage) {
|
||||||
|
await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,9 @@ export class Misc {
|
|||||||
return ((n % m) + m) % m;
|
return ((n % m) + m) % m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inRange(value, min,max){
|
||||||
|
return Math.max(min, Math.min(value, max))
|
||||||
|
}
|
||||||
static sum() {
|
static sum() {
|
||||||
return (a, b) => Number(a) + Number(b);
|
return (a, b) => Number(a) + Number(b);
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ export class RdDBonus {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static dmg(rollData, actor, isEntiteIncarnee = false) {
|
static dmg(rollData, actor, isEntiteIncarnee = false) {
|
||||||
const dmgArme = RdDBonus.dmgArme(rollData.arme, rollData.arme?.system.dommagesReels)
|
const dmgArme = RdDBonus.dmgArme(rollData.arme, rollData.arme?.system.dommagesReels)
|
||||||
const forceRequise = RdDItemArme.valeurMain(rollData.arme?.system.force ?? 0, RdDItemArme.getMainAttaque(rollData.competence))
|
const forceRequise = rollData.arme ? RdDItemArme.valeurMain(rollData.arme.system.force ?? 0, RdDItemArme.getMainAttaque(rollData.competence)) : 0
|
||||||
let dmg = {
|
let dmg = {
|
||||||
total: 0,
|
total: 0,
|
||||||
dmgArme: dmgArme,
|
dmgArme: dmgArme,
|
||||||
|
@@ -18,7 +18,8 @@ import { RdDInitiative } from "./initiative.mjs";
|
|||||||
import RollDialog from "./roll/roll-dialog.mjs";
|
import RollDialog from "./roll/roll-dialog.mjs";
|
||||||
import { PART_DEFENSE } from "./roll/roll-part-defense.mjs";
|
import { PART_DEFENSE } from "./roll/roll-part-defense.mjs";
|
||||||
import { RollDialogAdapter } from "./roll/roll-dialog-adapter.mjs";
|
import { RollDialogAdapter } from "./roll/roll-dialog-adapter.mjs";
|
||||||
import { DIFF, ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll/roll-constants.mjs";
|
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll/roll-constants.mjs";
|
||||||
|
import { OptionsAvancees, ROLL_DIALOG_V2_TEST } from "./settings/options-avancees.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
const premierRoundInit = [
|
const premierRoundInit = [
|
||||||
@@ -402,19 +403,19 @@ export class RdDCombat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static registerChatCallbacks(html) {
|
static registerChatCallbacks(html) {
|
||||||
for (let button of [
|
for (let button of [
|
||||||
'.defense-button',
|
'.button-defense',
|
||||||
'.parer-button',
|
'.button-parade',
|
||||||
'.esquiver-button',
|
'.button-esquive',
|
||||||
|
'.button-encaisser',
|
||||||
'.particuliere-attaque',
|
'.particuliere-attaque',
|
||||||
'.encaisser-button',
|
|
||||||
'.appel-chance-defense',
|
'.appel-chance-defense',
|
||||||
'.appel-destinee-defense',
|
'.appel-destinee-defense',
|
||||||
'.appel-chance-attaque',
|
'.appel-chance-attaque',
|
||||||
'.appel-destinee-attaque',
|
'.appel-destinee-attaque',
|
||||||
'.echec-total-attaque',
|
'.echec-total-attaque',
|
||||||
'.appel-chance',
|
// '.appel-chance',
|
||||||
'.chat-encaissement',
|
// '.chat-encaissement',
|
||||||
'.resister-recul',
|
// '.resister-recul',
|
||||||
]) {
|
]) {
|
||||||
$(html).on("click", button, event => {
|
$(html).on("click", button, event => {
|
||||||
const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(
|
const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(
|
||||||
@@ -474,11 +475,11 @@ export class RdDCombat {
|
|||||||
|
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case '.particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value);
|
case '.particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value);
|
||||||
case '.defense-button': return this.defenseV2(attackerRoll);
|
case '.button-defense': return this.defenseV2(attackerRoll);
|
||||||
|
|
||||||
case '.parer-button': return this.parade(attackerRoll, armeParadeId);
|
case '.button-parade': return this.parade(attackerRoll, armeParadeId);
|
||||||
case '.esquiver-button': return this.esquive(attackerRoll, compId, competence);
|
case '.button-esquive': return this.esquive(attackerRoll, compId, competence);
|
||||||
case '.encaisser-button': return this.encaisser(attackerRoll, defenderRoll);
|
case '.button-encaisser': return this.encaisser(attackerRoll, defenderRoll);
|
||||||
case '.echec-total-attaque': return this._onEchecTotal(attackerRoll);
|
case '.echec-total-attaque': return this._onEchecTotal(attackerRoll);
|
||||||
|
|
||||||
case '.appel-chance-attaque': return this.attacker.rollAppelChance(
|
case '.appel-chance-attaque': return this.attacker.rollAppelChance(
|
||||||
@@ -488,11 +489,9 @@ export class RdDCombat {
|
|||||||
() => this.defenseChanceuse(attackerRoll, defenderRoll),
|
() => this.defenseChanceuse(attackerRoll, defenderRoll),
|
||||||
() => this.afficherOptionsDefense(attackerRoll, defenderRoll, { defenseChance: true }));
|
() => 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),
|
() => this.attaqueSignificative(attackerRoll));
|
||||||
() => { });
|
|
||||||
case '.appel-destinee-defense': return this.defender.appelDestinee(
|
case '.appel-destinee-defense': return this.defender.appelDestinee(
|
||||||
() => this.defenseDestinee(defenderRoll),
|
() => this.defenseDestinee(defenderRoll));
|
||||||
() => { });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -969,10 +968,8 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async defenseV2(attackerRoll) {
|
async defenseV2(attackerRoll) {
|
||||||
|
|
||||||
// this._prepareParade(attackerRoll, arme, competence);
|
// this._prepareParade(attackerRoll, arme, competence);
|
||||||
const rollData =
|
await this.doRollDefense({
|
||||||
{
|
|
||||||
ids: {
|
ids: {
|
||||||
actorId: this.defender.id,
|
actorId: this.defender.id,
|
||||||
actorTokenId: this.defenderTokenId,
|
actorTokenId: this.defenderTokenId,
|
||||||
@@ -982,24 +979,26 @@ export class RdDCombat {
|
|||||||
type: { allowed: ['defense'], current: 'defense' },
|
type: { allowed: ['defense'], current: 'defense' },
|
||||||
attackerRoll: RollDialogAdapter.mapActionAttaque(attackerRoll),
|
attackerRoll: RollDialogAdapter.mapActionAttaque(attackerRoll),
|
||||||
passeArme: attackerRoll.passeArme,
|
passeArme: attackerRoll.passeArme,
|
||||||
}
|
|
||||||
|
|
||||||
await RollDialog.create(rollData, {
|
|
||||||
onRollDone: (dialog) => {
|
|
||||||
// dialog.close()
|
|
||||||
},
|
|
||||||
customChatMessage: true,
|
|
||||||
callbacks: [async (roll) => {
|
|
||||||
this.removeChatMessageActionsPasseArme(roll.passeArme)
|
|
||||||
// defense: esquive / arme de parade / competence de défense
|
|
||||||
if (!RdDCombat.isParticuliere(roll)) {
|
|
||||||
await roll.active.actor.incDecItemUse(roll.current[PART_DEFENSE].defense?.id,)
|
|
||||||
}
|
|
||||||
await this._onDefense(roll)
|
|
||||||
}]
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async doRollDefense(rollData) {
|
||||||
|
await RollDialog.create(rollData, {
|
||||||
|
onRollDone: (dialog) => {
|
||||||
|
if (!OptionsAvancees.isUsing(ROLL_DIALOG_V2_TEST))
|
||||||
|
dialog.close()
|
||||||
|
},
|
||||||
|
customChatMessage: true,
|
||||||
|
callbacks: [async (roll) => {
|
||||||
|
this.removeChatMessageActionsPasseArme(roll.passeArme);
|
||||||
|
// defense: esquive / arme de parade / competence de défense
|
||||||
|
if (!RdDCombat.isParticuliere(roll)) {
|
||||||
|
await roll.active.actor.incDecItemUse(roll.current[PART_DEFENSE].defense?.id);
|
||||||
|
}
|
||||||
|
await this._onDefense(roll);
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_prepareParade(attackerRoll, armeParade, competenceParade) {
|
_prepareParade(attackerRoll, armeParade, competenceParade) {
|
||||||
@@ -1369,6 +1368,3 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function newFunction(attackerRoll) {
|
|
||||||
return attackerRoll.diffLibre;
|
|
||||||
}
|
|
||||||
|
@@ -86,6 +86,7 @@ import { RdDCombatManager, RdDCombat } from "./rdd-combat.js"
|
|||||||
import { Migrations } from './migrations.js'
|
import { Migrations } from './migrations.js'
|
||||||
|
|
||||||
import RollDialog from "./roll/roll-dialog.mjs"
|
import RollDialog from "./roll/roll-dialog.mjs"
|
||||||
|
import ChatRollResult from "./roll/chat-roll-result.mjs"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RdD system
|
* RdD system
|
||||||
@@ -292,6 +293,7 @@ export class SystemReveDeDragon {
|
|||||||
TMRRencontres.init()
|
TMRRencontres.init()
|
||||||
ExportScriptarium.init()
|
ExportScriptarium.init()
|
||||||
RollDialog.init()
|
RollDialog.init()
|
||||||
|
ChatRollResult.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
initSettings() {
|
initSettings() {
|
||||||
@@ -346,18 +348,7 @@ export class SystemReveDeDragon {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static async setupAccueil() {
|
|
||||||
let exists = game.scenes.find(j => j.name == "Accueil RdD");
|
|
||||||
if (!exists) {
|
|
||||||
const scenes = await SystemCompendiums.loadCompendium("foundryvtt-reve-de-dragon.scenes-rdd")
|
|
||||||
let newDocuments = scenes.filter(i => i.name == "Accueil RdD");
|
|
||||||
await game.scenes.documentClass.create(newDocuments);
|
|
||||||
game.scenes.find(i => i.name == "Accueil RdD").activate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async onReady() {
|
async onReady() {
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Foundry VTT Initialization */
|
/* Foundry VTT Initialization */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@@ -376,7 +367,8 @@ export class SystemReveDeDragon {
|
|||||||
StatusEffects.onReady()
|
StatusEffects.onReady()
|
||||||
RdDDice.onReady()
|
RdDDice.onReady()
|
||||||
RollDialog.onReady()
|
RollDialog.onReady()
|
||||||
RdDStatBlockParser.parseStatBlock()
|
ChatRollResult.onReady()
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Affiche/Init le calendrier */
|
/* Affiche/Init le calendrier */
|
||||||
game.system.rdd.calendrier.display()
|
game.system.rdd.calendrier.display()
|
||||||
@@ -389,7 +381,17 @@ export class SystemReveDeDragon {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemReveDeDragon.setupAccueil()
|
this.setupAccueil()
|
||||||
|
}
|
||||||
|
|
||||||
|
async setupAccueil() {
|
||||||
|
let exists = game.scenes.find(j => j.name == "Accueil RdD");
|
||||||
|
if (!exists) {
|
||||||
|
const scenes = await SystemCompendiums.loadCompendium("foundryvtt-reve-de-dragon.scenes-rdd")
|
||||||
|
let newDocuments = scenes.filter(i => i.name == "Accueil RdD");
|
||||||
|
await game.scenes.documentClass.create(newDocuments);
|
||||||
|
game.scenes.find(i => i.name == "Accueil RdD").activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@@ -157,7 +157,7 @@ export class RdDResolutionTable {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static significativeRequise(chances) {
|
static significativeRequise(chances) {
|
||||||
chances.roll = Math.floor(chances.score / 2);
|
chances.roll = Math.min(chances.part + 1, chances.sign)
|
||||||
foundry.utils.mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
|
foundry.utils.mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ export class RdDResolutionTable {
|
|||||||
static computeReussite(chances, roll, diviseur) {
|
static computeReussite(chances, roll, diviseur) {
|
||||||
const reussite = reussites.find(x => x.condition(chances, roll))
|
const reussite = reussites.find(x => x.condition(chances, roll))
|
||||||
if (diviseur > 1 && reussite.isSuccess) {
|
if (diviseur > 1 && reussite.isSuccess) {
|
||||||
if (chances > roll * diviseur){
|
if (chances > roll * diviseur) {
|
||||||
return reussiteInsuffisante
|
return reussiteInsuffisante
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,16 @@
|
|||||||
import { ChatUtility } from "../chat-utility.js"
|
import { ChatUtility } from "../chat-utility.js"
|
||||||
import RollDialog from "./roll-dialog.mjs"
|
import RollDialog from "./roll-dialog.mjs"
|
||||||
import { RdDCarac } from "../rdd-carac.js";
|
import { RdDCarac } from "../rdd-carac.js"
|
||||||
|
import { RdDCombat } from "../rdd-combat.js"
|
||||||
|
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll-constants.mjs"
|
||||||
|
import { RdDResolutionTable } from "../rdd-resolution-table.js"
|
||||||
|
|
||||||
export class ChatRollResult {
|
export default class ChatRollResult {
|
||||||
|
static init() {
|
||||||
|
ChatRollResult.instance = new ChatRollResult()
|
||||||
|
|
||||||
|
Hooks.on('renderChatLog', (log, html, chatLog) => ChatRollResult.instance.chatListeners(html))
|
||||||
|
}
|
||||||
|
|
||||||
static onReady() {
|
static onReady() {
|
||||||
foundry.applications.handlebars.loadTemplates({
|
foundry.applications.handlebars.loadTemplates({
|
||||||
@@ -14,10 +22,7 @@ export class ChatRollResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async display(roll) {
|
async display(roll) {
|
||||||
roll.show = roll.show || {};
|
this.prepareDisplay(roll)
|
||||||
roll.show.chance = this.isAppelChancePossible(roll)
|
|
||||||
roll.show.encaissement = this.isShowEncaissement(roll)
|
|
||||||
roll.show.recul = this.isShowReculChoc(roll)
|
|
||||||
|
|
||||||
const chatMessage = await ChatUtility.createChatWithRollMode(
|
const chatMessage = await ChatUtility.createChatWithRollMode(
|
||||||
{
|
{
|
||||||
@@ -26,14 +31,18 @@ export class ChatRollResult {
|
|||||||
roll.active.actor,
|
roll.active.actor,
|
||||||
roll.current?.rollmode?.key
|
roll.current?.rollmode?.key
|
||||||
)
|
)
|
||||||
if (roll.show.chance) {
|
const save = RollDialog.saveParts(roll)
|
||||||
const save = RollDialog.saveParts(roll)
|
ChatUtility.setMessageData(chatMessage, 'rollData', save)
|
||||||
console.log("Store message roll", save)
|
|
||||||
ChatUtility.setMessageData(chatMessage, 'rollData', save)
|
|
||||||
}
|
|
||||||
return chatMessage
|
return chatMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepareDisplay(roll) {
|
||||||
|
roll.show = roll.show || {}
|
||||||
|
roll.show.chance = this.isAppelChancePossible(roll)
|
||||||
|
roll.show.encaissement = this.isShowEncaissement(roll)
|
||||||
|
roll.show.recul = this.isShowReculChoc(roll)
|
||||||
|
}
|
||||||
|
|
||||||
isAppelChancePossible(roll) {
|
isAppelChancePossible(roll) {
|
||||||
return roll.active.actor.isPersonnage() &&
|
return roll.active.actor.isPersonnage() &&
|
||||||
roll.rolled.isEchec &&
|
roll.rolled.isEchec &&
|
||||||
@@ -46,14 +55,87 @@ export class ChatRollResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isShowReculChoc(roll) {
|
isShowReculChoc(roll) {
|
||||||
return roll.rolled.isEchec &&
|
const attaque = roll.attackerRoll
|
||||||
roll.attackerRoll &&
|
return attaque &&
|
||||||
!roll.current.defense.isEsquive &&
|
(roll.rolled.isEchec || !roll.current.defense.isEsquive) &&
|
||||||
(roll.attackerRoll.particuliere == 'force' || 'charge' == attackerRoll.tactique?.key)
|
(attaque.particuliere == 'force' || 'charge' == attaque.tactique?.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
async buildRollHtml(roll) {
|
async buildRollHtml(roll) {
|
||||||
const template = `systems/foundryvtt-reve-de-dragon/templates/roll/result/chat-${roll.type.current}.hbs`
|
const template = `systems/foundryvtt-reve-de-dragon/templates/roll/result/chat-${roll.type.current}.hbs`
|
||||||
return await foundry.applications.handlebars.renderTemplate(template, roll)
|
return await foundry.applications.handlebars.renderTemplate(template, roll)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async chatListeners(html) {
|
||||||
|
$(html).on("click", '.appel-chance', event => this.onClickAppelChance(event))
|
||||||
|
$(html).on("click", '.appel-destinee', event => this.onClickAppelDestinee(event))
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickAppelChance(event) {
|
||||||
|
const chatMessage = ChatUtility.getChatMessage(event)
|
||||||
|
const savedRoll = ChatUtility.getMessageData(chatMessage, 'rollData')
|
||||||
|
const actor = game.actors.get(savedRoll.ids.actorId)
|
||||||
|
actor.rollAppelChance(
|
||||||
|
() => this.onAppelChanceSuccess(savedRoll, chatMessage),
|
||||||
|
() => this.onAppelChanceEchec(savedRoll, chatMessage))
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
getCombat(roll) {
|
||||||
|
switch (roll.type.current) {
|
||||||
|
case ROLL_TYPE_DEFENSE:
|
||||||
|
return RdDCombat.rddCombatForAttackerAndDefender(roll.ids.opponentId, roll.ids.opponentTokenId, roll.ids.actorId)
|
||||||
|
case ROLL_TYPE_ATTAQUE:
|
||||||
|
return RdDCombat.rddCombatForAttackerAndDefender(roll.ids.actorId, roll.ids.actorTokenId, roll.ids.opponentId)
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
onAppelChanceSuccess(savedRoll, chatMessage) {
|
||||||
|
const reRoll = foundry.utils.duplicate(savedRoll)
|
||||||
|
reRoll.type.retry = true
|
||||||
|
// TODO: annuler les effets
|
||||||
|
switch (reRoll.type.current) {
|
||||||
|
case ROLL_TYPE_DEFENSE:
|
||||||
|
this.getCombat(reRoll)?.doRollDefense(reRoll)
|
||||||
|
break
|
||||||
|
case ROLL_TYPE_ATTAQUE:
|
||||||
|
this.getCombat(reRoll)?.doRollAttaque(reRoll)
|
||||||
|
break
|
||||||
|
default: {
|
||||||
|
RollDialog.create(reRoll)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChatUtility.removeChatMessageId(chatMessage.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
async onAppelChanceEchec(savedRoll, chatMessage) {
|
||||||
|
savedRoll.type.retry = true
|
||||||
|
await this.updateChatMessage(chatMessage, savedRoll)
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateChatMessage(chatMessage, savedRoll) {
|
||||||
|
ChatUtility.setMessageData(chatMessage, 'rollData', savedRoll)
|
||||||
|
const copy = foundry.utils.duplicate(savedRoll)
|
||||||
|
RollDialog.loadRollData(copy)
|
||||||
|
this.prepareDisplay(copy)
|
||||||
|
chatMessage.update({ content: await this.buildRollHtml(copy) })
|
||||||
|
chatMessage.render(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickAppelDestinee(event) {
|
||||||
|
const chatMessage = ChatUtility.getChatMessage(event)
|
||||||
|
const savedRoll = ChatUtility.getMessageData(chatMessage, 'rollData')
|
||||||
|
const actor = game.actors.get(savedRoll.ids.actorId)
|
||||||
|
|
||||||
|
actor.appelDestinee(async () => {
|
||||||
|
const reRoll = foundry.utils.duplicate(savedRoll)
|
||||||
|
reRoll.type.retry = true
|
||||||
|
RdDResolutionTable.significativeRequise(reRoll.rolled)
|
||||||
|
await this.updateChatMessage(chatMessage, savedRoll)
|
||||||
|
})
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@@ -41,9 +41,7 @@ export class RollBasicParts {
|
|||||||
initFrom(rollData) {
|
initFrom(rollData) {
|
||||||
return {
|
return {
|
||||||
selected: {},
|
selected: {},
|
||||||
type: {
|
type: rollData.type,
|
||||||
current: rollData.type.current
|
|
||||||
},
|
|
||||||
ids: {
|
ids: {
|
||||||
sceneId: rollData.ids.sceneId,
|
sceneId: rollData.ids.sceneId,
|
||||||
actorId: rollData.active.id,
|
actorId: rollData.active.id,
|
||||||
|
@@ -25,7 +25,7 @@ import { RollPartMeditation } from "./roll-part-meditation.mjs";
|
|||||||
import { RollPartMoral } from "./roll-part-moral.mjs";
|
import { RollPartMoral } from "./roll-part-moral.mjs";
|
||||||
import { RollPartOpponent } from "./roll-part-opponent.mjs";
|
import { RollPartOpponent } from "./roll-part-opponent.mjs";
|
||||||
import { RollPartSurEnc } from "./roll-part-surenc.mjs";
|
import { RollPartSurEnc } from "./roll-part-surenc.mjs";
|
||||||
import { RollPartTricher } from "./roll-part-tricher.mjs";
|
import { PART_TRICHER, RollPartTricher } from "./roll-part-tricher.mjs";
|
||||||
import { RollPartTache } from "./roll-part-tache.mjs";
|
import { RollPartTache } from "./roll-part-tache.mjs";
|
||||||
import { RollPartOeuvre } from "./roll-part-oeuvre.mjs";
|
import { RollPartOeuvre } from "./roll-part-oeuvre.mjs";
|
||||||
import { RollPartSort } from "./roll-part-sort.mjs";
|
import { RollPartSort } from "./roll-part-sort.mjs";
|
||||||
@@ -38,7 +38,7 @@ import { RollPartDefense } from "./roll-part-defense.mjs";
|
|||||||
import { RollDialogAdapter } from "./roll-dialog-adapter.mjs";
|
import { RollDialogAdapter } from "./roll-dialog-adapter.mjs";
|
||||||
import { ROLLDIALOG_SECTION } from "./roll-part.mjs";
|
import { ROLLDIALOG_SECTION } from "./roll-part.mjs";
|
||||||
import { ROLL_TYPE_COMP } from "./roll-constants.mjs";
|
import { ROLL_TYPE_COMP } from "./roll-constants.mjs";
|
||||||
import { ChatRollResult } from "./chat-roll-result.mjs";
|
import ChatRollResult from "./chat-roll-result.mjs";
|
||||||
|
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
|
||||||
@@ -286,6 +286,8 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
ROLL_PARTS.filter(p => p.isActive(rollData))
|
ROLL_PARTS.filter(p => p.isActive(rollData))
|
||||||
.forEach(p => p.storeClean(rollData, target))
|
.forEach(p => p.storeClean(rollData, target))
|
||||||
target.attackerRoll = rollData.attackerRoll
|
target.attackerRoll = rollData.attackerRoll
|
||||||
|
target.rolled = rollData.rolled
|
||||||
|
target.result = rollData.result
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,8 +319,8 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getActiveParts() {
|
static getActiveParts(rollData) {
|
||||||
return ROLL_PARTS.filter(p => p.isActive(this.rollData))
|
return ROLL_PARTS.filter(p => p.isActive(rollData))
|
||||||
}
|
}
|
||||||
|
|
||||||
// get title() {
|
// get title() {
|
||||||
@@ -353,12 +355,12 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
))
|
))
|
||||||
|
|
||||||
Promise.all(
|
Promise.all(
|
||||||
this.getActiveParts().map(async p => await p._onRender(this, context, options))
|
RollDialog.getActiveParts(this.rollData).map(async p => await p._onRender(this, context, options))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAjustements(rollData = this.rollData) {
|
static getAjustements(rollData) {
|
||||||
return this.getActiveParts()
|
return RollDialog.getActiveParts(rollData)
|
||||||
.map(p => p.getAjustements(rollData))
|
.map(p => p.getAjustements(rollData))
|
||||||
.reduce((a, b) => a.concat(b))
|
.reduce((a, b) => a.concat(b))
|
||||||
.sort((a, b) => a.diff == undefined ? 1 : b.diff == undefined ? -1 : 0)
|
.sort((a, b) => a.diff == undefined ? 1 : b.diff == undefined ? -1 : 0)
|
||||||
@@ -373,19 +375,19 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
|
|
||||||
const types = ALL_ROLL_TYPES.filter(m => m.isAllowed(rollData) && m.visible(rollData))
|
const types = ALL_ROLL_TYPES.filter(m => m.isAllowed(rollData) && m.visible(rollData))
|
||||||
.map(m => m.toTypeData(rollData))
|
.map(m => m.toTypeData(rollData))
|
||||||
BASIC_PARTS.loadSurprises(this.rollData, this.getSelectedType().code)
|
BASIC_PARTS.loadSurprises(rollData, this.getSelectedType().code)
|
||||||
this.rollData.type.label = this.getSelectedType()?.title(this.rollData)
|
rollData.type.label = this.getSelectedType()?.title(rollData)
|
||||||
//TOCHECK: set type.label ?
|
//TOCHECK: set type.label ?
|
||||||
const visibleRollParts = this.getActiveParts()
|
const visibleRollParts = RollDialog.getActiveParts(rollData)
|
||||||
visibleRollParts.forEach(p => p.applyExternalImpacts(visibleRollParts, rollData))
|
visibleRollParts.forEach(p => p.applyExternalImpacts(visibleRollParts, rollData))
|
||||||
|
|
||||||
this.setSpecialComp(visibleRollParts);
|
this.setSpecialComp(visibleRollParts);
|
||||||
|
|
||||||
visibleRollParts.forEach(p => p.prepareContext(rollData))
|
visibleRollParts.forEach(p => p.prepareContext(rollData))
|
||||||
|
|
||||||
this.calculAjustements()
|
RollDialog.calculAjustements(rollData)
|
||||||
|
|
||||||
const templates = this.getActiveParts().map(p => p.toTemplateData())
|
const templates = RollDialog.getActiveParts(rollData).map(p => p.toTemplateData())
|
||||||
const context = await super._prepareContext()
|
const context = await super._prepareContext()
|
||||||
return foundry.utils.mergeObject(
|
return foundry.utils.mergeObject(
|
||||||
{
|
{
|
||||||
@@ -399,14 +401,14 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
const specialComp = visibleRollParts.map(p => p.getSpecialComp(this.rollData))
|
const specialComp = visibleRollParts.map(p => p.getSpecialComp(this.rollData))
|
||||||
.reduce((a, b) => a.concat(b))
|
.reduce((a, b) => a.concat(b))
|
||||||
if (specialComp.length > 0) {
|
if (specialComp.length > 0) {
|
||||||
const rollPartComp = this.getActiveParts()
|
const rollPartComp = RollDialog.getActiveParts(this.rollData)
|
||||||
.find(it => it.code == PART_COMP);
|
.find(it => it.code == PART_COMP);
|
||||||
rollPartComp?.setSpecialComp(this.rollData, specialComp)
|
rollPartComp?.setSpecialComp(this.rollData, specialComp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calculAjustements(rollData = this.rollData) {
|
static calculAjustements(rollData) {
|
||||||
rollData.ajustements = this.getAjustements(rollData)
|
rollData.ajustements = RollDialog.getAjustements(rollData)
|
||||||
rollData.ajustements.forEach(it => it.isDiff = it.diff != undefined)
|
rollData.ajustements.forEach(it => it.isDiff = it.diff != undefined)
|
||||||
rollData.current.totaldiff = rollData.ajustements
|
rollData.current.totaldiff = rollData.ajustements
|
||||||
.map(adj => adj.diff)
|
.map(adj => adj.diff)
|
||||||
@@ -419,12 +421,12 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
}
|
}
|
||||||
|
|
||||||
async roll() {
|
async roll() {
|
||||||
|
// ROLL_PARTS.filter(p => p.isActive(this.rollData))
|
||||||
|
// .forEach(p => p.validate(this.rollData))
|
||||||
|
|
||||||
const roll = RollDialog.saveParts(this.rollData)
|
const roll = RollDialog.saveParts(this.rollData)
|
||||||
RollDialog.$prepareRollData(roll)
|
RollDialog.loadRollData(roll)
|
||||||
this.calculAjustements(roll)
|
roll.current.resultat = this.rollData.current[PART_TRICHER]?.resultat ?? -1
|
||||||
roll.current.resultat = this.rollData.current.resultat
|
|
||||||
roll.v2 = true
|
|
||||||
roll.rolled = await this.$rollDice(roll)
|
roll.rolled = await this.$rollDice(roll)
|
||||||
roll.result = this.getSelectedType(roll).getResult(roll)
|
roll.result = this.getSelectedType(roll).getResult(roll)
|
||||||
console.info('RollDialog.roll:', roll)
|
console.info('RollDialog.roll:', roll)
|
||||||
@@ -434,12 +436,18 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
this.rollOptions.onRollDone(this)
|
this.rollOptions.onRollDone(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static loadRollData(roll) {
|
||||||
|
RollDialog.$prepareRollData(roll)
|
||||||
|
RollDialog.calculAjustements(roll)
|
||||||
|
roll.v2 = true
|
||||||
|
}
|
||||||
|
|
||||||
async defaultCallback(rollData, rolled) {
|
async defaultCallback(rollData, rolled) {
|
||||||
await rollData.active.actor.appliquerAjoutExperience(rollData)
|
await rollData.active.actor.appliquerAjoutExperience(rollData)
|
||||||
await rollData.active.actor.appliquerAppelMoral(rollData)
|
await rollData.active.actor.appliquerAppelMoral(rollData)
|
||||||
}
|
}
|
||||||
|
|
||||||
async $rollDice(rollData) {
|
async $rollDice(rollData) {
|
||||||
return await RollDialogAdapter.rollDice(rollData, this.rollTitle(rollData));
|
return await RollDialogAdapter.rollDice(rollData, this.rollTitle(rollData))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { SYSTEM_RDD } from "../constants.js";
|
import { SYSTEM_RDD } from "../constants.js";
|
||||||
|
import { Misc } from "../misc.js";
|
||||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
||||||
|
|
||||||
const CONDITIONS = "conditions"
|
const CONDITIONS = "conditions"
|
||||||
@@ -50,7 +51,7 @@ export class RollPartConditions extends RollPart {
|
|||||||
const current = this.getCurrent(rollData)
|
const current = this.getCurrent(rollData)
|
||||||
current.min = game.settings.get(SYSTEM_RDD, this.settingMin())
|
current.min = game.settings.get(SYSTEM_RDD, this.settingMin())
|
||||||
current.max = game.settings.get(SYSTEM_RDD, this.settingMax())
|
current.max = game.settings.get(SYSTEM_RDD, this.settingMax())
|
||||||
current.value = current.value ?? 0
|
current.value = Misc.inRange(current.value ?? 0, current.min, current.max)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAjustements(rollData) {
|
getAjustements(rollData) {
|
||||||
@@ -63,12 +64,13 @@ export class RollPartConditions extends RollPart {
|
|||||||
|
|
||||||
async _onRender(rollDialog, context, options) {
|
async _onRender(rollDialog, context, options) {
|
||||||
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
||||||
|
|
||||||
input?.addEventListener("change", e => {
|
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
|
||||||
const current = this.getCurrent(rollDialog.rollData)
|
}
|
||||||
current.value = parseInt(e.currentTarget.value)
|
|
||||||
rollDialog.render()
|
onInputChange(event, rollDialog) {
|
||||||
})
|
this.getCurrent(rollDialog.rollData).value = parseInt(event.currentTarget.value)
|
||||||
|
rollDialog.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
import { DIFF, DIFFS, ROLL_TYPE_MEDITATION, ROLL_TYPE_OEUVRE, ROLL_TYPE_SORT, ROLL_TYPE_TACHE } from "./roll-constants.mjs";
|
import { DIFF, DIFFS, ROLL_TYPE_MEDITATION, ROLL_TYPE_OEUVRE, ROLL_TYPE_SORT, ROLL_TYPE_TACHE } from "./roll-constants.mjs";
|
||||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
||||||
|
import { Misc } from "../misc.js";
|
||||||
|
|
||||||
export const PART_DIFF = "diff"
|
export const PART_DIFF = "diff"
|
||||||
|
|
||||||
@@ -41,8 +42,8 @@ export class RollPartDiff extends RollPart {
|
|||||||
{
|
{
|
||||||
type: diffType.key,
|
type: diffType.key,
|
||||||
label: diffType?.label ?? '',
|
label: diffType?.label ?? '',
|
||||||
value: current.value ?? 0,
|
|
||||||
disabled: !diffType.libre,
|
disabled: !diffType.libre,
|
||||||
|
value: Misc.inRange(current.value ?? 0, -10, diffType.max),
|
||||||
min: -10,
|
min: -10,
|
||||||
max: diffType.max
|
max: diffType.max
|
||||||
},
|
},
|
||||||
@@ -67,11 +68,12 @@ export class RollPartDiff extends RollPart {
|
|||||||
async _onRender(rollDialog, context, options) {
|
async _onRender(rollDialog, context, options) {
|
||||||
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
||||||
|
|
||||||
input?.addEventListener("change", e => {
|
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
|
||||||
this.getCurrent(rollDialog.rollData).value = parseInt(e.currentTarget.value)
|
|
||||||
rollDialog.render()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onInputChange(event, rollDialog) {
|
||||||
|
this.getCurrent(rollDialog.rollData).value = parseInt(event.currentTarget.value)
|
||||||
|
rollDialog.render()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { Misc } from "../misc.js"
|
||||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
|
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
|
||||||
|
|
||||||
export const PART_TRICHER = "tricher"
|
export const PART_TRICHER = "tricher"
|
||||||
@@ -11,21 +12,20 @@ export class RollPartTricher extends RollPart {
|
|||||||
|
|
||||||
prepareContext(rollData) {
|
prepareContext(rollData) {
|
||||||
const current = this.getCurrent(rollData)
|
const current = this.getCurrent(rollData)
|
||||||
if (current.resultat == undefined) {
|
current.resultat = Misc.inRange(current.resultat == undefined ? -1 : current.resultat, -1, 100)
|
||||||
current.resultat = -1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAjustements(rollData) {
|
getAjustements(rollData) {
|
||||||
rollData.current.resultat = this.getCurrent(rollData).resultat
|
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onRender(rollDialog, context, options) {
|
async _onRender(rollDialog, context, options) {
|
||||||
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
||||||
|
|
||||||
input?.addEventListener("change", e => {
|
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
|
||||||
this.getCurrent(rollDialog.rollData).resultat = parseInt(e.currentTarget.value)
|
}
|
||||||
})
|
|
||||||
|
onInputChange(event, rollDialog) {
|
||||||
|
this.getCurrent(rollDialog.rollData).resultat = parseInt(event.currentTarget.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import { Misc } from "../misc.js"
|
|
||||||
|
|
||||||
export const ROLLDIALOG_SECTION = {
|
export const ROLLDIALOG_SECTION = {
|
||||||
ACTION: 'action',
|
ACTION: 'action',
|
||||||
CARAC: 'carac',
|
CARAC: 'carac',
|
||||||
@@ -86,6 +84,9 @@ export class RollPart {
|
|||||||
loadRefs(rollData) { }
|
loadRefs(rollData) { }
|
||||||
|
|
||||||
prepareContext(rollData) { }
|
prepareContext(rollData) { }
|
||||||
|
|
||||||
|
/** permet de sauvegarder dans rollData les informations (cas des champs edit) */
|
||||||
|
validate(rollData) {}
|
||||||
|
|
||||||
/** ---- cross roll-part filtering ---- */
|
/** ---- cross roll-part filtering ---- */
|
||||||
applyImpact(rollData, filter) { }
|
applyImpact(rollData, filter) { }
|
||||||
@@ -108,14 +109,4 @@ export class RollPart {
|
|||||||
|
|
||||||
async _onRender(rollDialog, context, options) { }
|
async _onRender(rollDialog, context, options) { }
|
||||||
|
|
||||||
addResult(rollData) {
|
|
||||||
const result = this.getResult(rollData)
|
|
||||||
if (result){
|
|
||||||
rollData.result[this.code] = result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getResult(rollData){
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -3,9 +3,11 @@ import { Misc } from "../misc.js"
|
|||||||
|
|
||||||
export const EXPORT_CSV_SCRIPTARIUM = 'export-csv-scriptarium'
|
export const EXPORT_CSV_SCRIPTARIUM = 'export-csv-scriptarium'
|
||||||
export const ROLL_DIALOG_V2 = 'roll-dialog-v2'
|
export const ROLL_DIALOG_V2 = 'roll-dialog-v2'
|
||||||
|
export const ROLL_DIALOG_V2_TEST = 'roll-dialog-v2-test'
|
||||||
|
|
||||||
const OPTIONS_AVANCEES = [
|
const OPTIONS_AVANCEES = [
|
||||||
{ group: 'Fenêtres', name: ROLL_DIALOG_V2, descr: "Utiliser les nouvelles fenêtres de jet", default: false },
|
{ group: 'Fenêtres', name: ROLL_DIALOG_V2, descr: "Utiliser les nouvelles fenêtres de jet", default: false },
|
||||||
|
{ group: 'Fenêtres', name: ROLL_DIALOG_V2_TEST, descr: "Mode de test des nouvelles fenêtres", default: false },
|
||||||
{ group: 'Menus', name: EXPORT_CSV_SCRIPTARIUM, descr: "Proposer le menu d'export csv Scriptarium", default: false },
|
{ group: 'Menus', name: EXPORT_CSV_SCRIPTARIUM, descr: "Proposer le menu d'export csv Scriptarium", default: false },
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ export class OptionsAvancees extends FormApplication {
|
|||||||
return formData
|
return formData
|
||||||
}
|
}
|
||||||
|
|
||||||
static getSettingKey(name){
|
static getSettingKey(name) {
|
||||||
return `${SYSTEM_RDD}.${this._getId(name)}`
|
return `${SYSTEM_RDD}.${this._getId(name)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if (settings-get 'rdd-advanced-roll-dialog-v2')}}
|
{{#if (settings-get 'rdd-advanced-roll-dialog-v2')}}
|
||||||
<a class='chat-card-button defense-button'
|
<a class='chat-card-button button-defense'
|
||||||
data-attackerId='{{attackerId}}'
|
data-attackerId='{{attackerId}}'
|
||||||
data-attackerTokenId='{{attackerToken.id}}'
|
data-attackerTokenId='{{attackerToken.id}}'
|
||||||
data-defenderTokenId='{{defenderToken.id}}'
|
data-defenderTokenId='{{defenderToken.id}}'
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<br>
|
<br>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each armes as |arme key|}}
|
{{#each armes as |arme key|}}
|
||||||
<a class='chat-card-button parer-button'
|
<a class='chat-card-button button-parade'
|
||||||
data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderToken.id}}' data-attackerTokenId='{{../attackerToken.id}}'
|
data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderToken.id}}' data-attackerTokenId='{{../attackerToken.id}}'
|
||||||
data-armeid='{{arme._id}}'>
|
data-armeid='{{arme._id}}'>
|
||||||
Parer avec {{arme.name}}
|
Parer avec {{arme.name}}
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
<br>
|
<br>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if mainsNues}}
|
{{#if mainsNues}}
|
||||||
<a class='chat-card-button parer-button'
|
<a class='chat-card-button button-parade'
|
||||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'
|
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'
|
||||||
data-armeid='{{arme._id}}' data-competence='{{arme.system.competence}}'>
|
data-armeid='{{arme._id}}' data-competence='{{arme.system.competence}}'>
|
||||||
Parer à mains nues à {{diffLibre}}{{#if arme.nbUsage}} (Utilisations : {{arme.nbUsage}}){{/if}}
|
Parer à mains nues à {{diffLibre}}{{#if arme.nbUsage}} (Utilisations : {{arme.nbUsage}}){{/if}}
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (ne attaqueCategorie 'tir')}}
|
{{#if (ne attaqueCategorie 'tir')}}
|
||||||
{{#each esquives as |esquive key|}}
|
{{#each esquives as |esquive key|}}
|
||||||
<a class='chat-card-button esquiver-button'
|
<a class='chat-card-button button-esquive'
|
||||||
data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderToken.id}}' data-attackerTokenId='{{../attackerToken.id}}'
|
data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderToken.id}}' data-attackerTokenId='{{../attackerToken.id}}'
|
||||||
data-compid='{{esquive._id}}' data-competence='{{esquive.name}}'>
|
data-compid='{{esquive._id}}' data-competence='{{esquive.name}}'>
|
||||||
{{esquive.name}}
|
{{esquive.name}}
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<a class='chat-card-button encaisser-button'
|
<a class='chat-card-button button-encaisser'
|
||||||
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'>
|
data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderToken.id}}' data-attackerTokenId='{{attackerToken.id}}'>
|
||||||
Encaisser à {{plusMoins dmg.total}}
|
Encaisser à {{plusMoins dmg.total}}
|
||||||
{{#if (eq dmg.mortalite 'non-mortel')~}}
|
{{#if (eq dmg.mortalite 'non-mortel')~}}
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
{{log this}}
|
{{log this}}
|
||||||
<div class="roll-chat">
|
<div class="roll-chat">
|
||||||
<div class="chat-img">
|
<div class="chat-img">
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
{{#if show.encaissement}}
|
{{#if show.encaissement}}
|
||||||
<a class='chat-card-button encaisser-button'
|
<a class='chat-card-button button-encaisser'
|
||||||
data-actorId='{{ids.actorId}}'
|
{{!-- data-actorId='{{ids.actorId}}'
|
||||||
data-actorTokenId='{{ids.actorTokenId}}'
|
data-actorTokenId='{{ids.actorTokenId}}'
|
||||||
data-opponentId='{{ids.opponentId}}'
|
data-opponentId='{{ids.opponentId}}'
|
||||||
data-opponentTokenId='{{ids.opponentTokenId}}'
|
data-opponentTokenId='{{ids.opponentTokenId}}' --}}
|
||||||
data-tooltip="Encaisser à {{plusMoins attackerRoll.dmg.total}} {{#if (eq attackerRoll.dmg.mortalite 'non-mortel')~}}(non-mortel){{/if}}"
|
data-tooltip="Encaisser à {{plusMoins attackerRoll.dmg.total}} {{#if (eq attackerRoll.dmg.mortalite 'non-mortel')~}}(non-mortel){{/if}}"
|
||||||
>
|
>
|
||||||
<img src="systems/foundryvtt-reve-de-dragon/assets/ui/encaisser.svg"/> Encaisser à {{plusMoins attackerRoll.dmg.total}}
|
<img src="systems/foundryvtt-reve-de-dragon/assets/ui/encaisser.svg"/> Encaisser à {{plusMoins attackerRoll.dmg.total}}
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<input name="{{code}}" type="checkbox" {{#if current.checked}}checked{{/if}}/>
|
<input name="{{code}}" type="checkbox"
|
||||||
|
{{#if current.checked}}checked{{/if}}
|
||||||
|
{{#if rollData.type.retry}}disabled{{/if}}/>
|
||||||
<label for="{{code}}" data-tooltip="Moral: {{plusMoins refs.moral}}">
|
<label for="{{code}}" data-tooltip="Moral: {{plusMoins refs.moral}}">
|
||||||
{{#if current.icon}}{{{current.icon}}}{{/if}}{{refs.label}}
|
{{#if current.icon}}{{{current.icon}}}{{/if}}{{refs.label}}
|
||||||
</label>
|
</label>
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
<input name="{{code}}" type="checkbox" {{#if current.checked}}checked{{/if}}/>
|
<input name="{{code}}" type="checkbox"
|
||||||
|
{{#if current.checked}}checked{{/if}}
|
||||||
|
{{#if rollData.type.retry}}disabled{{/if}}/>
|
||||||
<label for="{{code}}">{{refs.label}}</label>
|
<label for="{{code}}">{{refs.label}}</label>
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
<input name="{{code}}" type="checkbox" {{#if current.checked}}checked{{/if}}/>
|
<input name="{{code}}" type="checkbox"
|
||||||
|
{{#if current.checked}}checked{{/if}}
|
||||||
|
{{#if rollData.type.retry}}disabled{{/if}}/>
|
||||||
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
||||||
<label for="{{code}}">{{either current.label refs.label}} : {{plusMoins current.value}}</label>
|
<label for="{{code}}">{{either current.label refs.label}} : {{plusMoins current.value}}</label>
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<input name="{{code}}" type="checkbox" {{#if current.checked}}checked{{/if}}/>
|
<input name="{{code}}" type="checkbox"
|
||||||
|
{{#if current.checked}}checked{{/if}}
|
||||||
|
{{#if rollData.type.retry}}disabled{{/if}}/>
|
||||||
<label for="{{code}}">
|
<label for="{{code}}">
|
||||||
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
||||||
{{current.label}}
|
{{current.label}}
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
<span>: {{current.item.name}}</span>
|
|
Reference in New Issue
Block a user