Compare commits

..

35 Commits

Author SHA1 Message Date
cc4cbbc771 Merge pull request 'cherry-pick v12.0.50 vers v13' (#761) from VincentVk/foundryvtt-reve-de-dragon:v13 into v13
Reviewed-on: #761
2025-05-04 19:16:52 +02:00
0850789ed7 Fix fatigue à la descente des TMR
La modification d'un activeEffect déclenche un render, qui
utilise les valeurs courante de l'actor.

Du coup, si l'update de l'actor est fait après:
- le render en cours utilise les anciennes valeurs
- comme un render est en cours, le nouveau render est ignoré

En faisant les changements d'active effect après ceux de l'actor,
l'affichage se fait correctement.,
2025-05-04 18:37:03 +02:00
7a6ccac7fa Merge pull request 'Fix: sommeil avec double rêve' (#758) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: #758
2025-05-04 18:36:54 +02:00
ed64d823ac Merge pull request '12.0.49 - La deuxième lame d'Astrobazzarh' (#757) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: #757
2025-05-04 18:36:36 +02:00
3162264afa Merge pull request '12.0.48 - La chèvre d'Astrobazzarh' (#756) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: #756
2025-05-04 18:36:28 +02:00
e53eda5b42 Correction sur les mise à jour en cascade + correction sur le force rendering après un changement de competence 2025-05-04 18:36:19 +02:00
47a7564a1c Correction sur les mise à jour en cascade + correction sur le force rendering après un changement de competence 2025-05-04 18:36:08 +02:00
f7a6fee51d Amélioration des fermetures de TMR
- un seul message lors de la fermeture au MJ et joueur
- le déclenchement de sort en réserve
2025-05-04 18:35:59 +02:00
0b3f08ef29 correction des raffraîchissement lors du sommeil
On peut de nouveau dormir plusieurs heures

# Conflicts:
#	changelog.md
2025-05-04 18:35:43 +02:00
8df9c8ddf5 Gestion armes naturelles sur defense 2025-05-04 18:35:10 +02:00
4cbe652a91 Renommage révéler/masquer le demi-rêve
# Conflicts:
#	changelog.md
2025-05-04 18:34:58 +02:00
3eb1179c40 Fix: difficulté des médiations
La difficulté des méditations n'augmente plus en cas de réussite
et d'échec normal

# Conflicts:
#	changelog.md
2025-05-04 18:33:35 +02:00
cf185844af Correction sur heures de repos
# Conflicts:
#	module/actor.js
2025-05-04 18:32:21 +02:00
250b936fae Fix erreurs sorts variables
- correction de la sélection de la voie de draconique pour
  sort à voie variable
- en cas de sort avec un coût en rêve numérique, ce n'est pas variable
2025-05-04 18:31:05 +02:00
cd8268f569 Fix possessions 2025-05-04 18:30:49 +02:00
c04e0cec78 Fix récupération sommeil
Les différents updates pouvaient ne pas être visibles lors du sommeil

En forçant un render 20ms après la fin des actions qui impliquent un
sommeil, les mises à jour sont correctes
2025-05-04 18:30:35 +02:00
1d5fe1af71 Corrections automatisations combat
Visiblement des changements sur les callbacks n'avaient pas
été finalisés
2025-05-04 18:27:56 +02:00
e96a627c37 Fix item names 2025-03-04 21:31:51 +01:00
06c3d2f80a Add command to run debug server 2025-02-11 21:29:58 +01:00
d07f5a41e7 Version 13.0.0 on branch 2025-02-10 00:32:52 +01:00
856d038dc9 Start experiment style for monnaie sheet 2025-02-09 22:51:33 +01:00
791593ad38 Fix: jet de caractéristique/difficulté
Les jets avec difficulté ne fonctionnaient plus à cause des armes
 à 1 main / à 2 mains
2025-02-09 22:51:33 +01:00
42179dab1d Merge pull request 'Use less for css' (#750) from VincentVk/foundryvtt-reve-de-dragon:v13 into v13
Reviewed-on: #750
2025-02-09 20:47:46 +01:00
83631cd366 Use less for css 2025-02-09 19:54:08 +01:00
01cf47ad55 Merge pull request 'v13 - Item munition et corrections' (#749) from VincentVk/foundryvtt-reve-de-dragon:v13 into v13
Reviewed-on: #749
2025-02-09 00:31:01 +01:00
d492b37a45 Edition des images d'item SheetV2 2025-02-07 23:27:59 +01:00
ecdcdb69d5 Item munition 2025-02-07 21:56:36 +01:00
8479fdda8a Affichage du coût
- affichage en erreur des monnaies sans valeur (dites "de glipzouk")
- gestion du prix parfois non modifiable
2025-02-07 21:56:36 +01:00
83e57fbbc7 Correction: diminution stress transformé 2025-02-07 21:56:35 +01:00
2d256b1217 Message d'expérience en sort
Adaptation du message d'xp en sort au renommage des voies draconiques
2025-02-07 20:48:19 +01:00
526d38d32e Commande /tirer cachée
Pour les messages sans actor, la méthode getOwners ne marchait
pas. En cas d'absence d'acteur, les gmroll doivent être pour le
joueur courant et les MJs
2025-02-07 20:48:19 +01:00
2ff3dfef89 Merge pull request 'v13 - DataModels & SheetV2 pour les monnaies' (#747) from VincentVk/foundryvtt-reve-de-dragon:v13 into v13
Reviewed-on: #747
2025-02-06 10:42:16 +01:00
f1b6c01cd7 DataModel & SheetV2 pour les items Monnaie 2025-02-06 00:18:09 +01:00
675fe5838e Fix choix particulière 2025-02-05 22:59:02 +01:00
bafdec9924 Correction message min/max de race 2025-02-05 22:58:24 +01:00
140 changed files with 5346 additions and 3135 deletions

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 193 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 163 KiB

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 716 KiB

After

Width:  |  Height:  |  Size: 716 KiB

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

View File

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

View File

Before

Width:  |  Height:  |  Size: 634 KiB

After

Width:  |  Height:  |  Size: 634 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

Before

Width:  |  Height:  |  Size: 637 KiB

After

Width:  |  Height:  |  Size: 637 KiB

View File

@@ -1,5 +1,49 @@
# 12.0
## 12.0.50 - Le sommeil d'Astrobazzarh
- Le don de double rêve n'interrompt plus le sommeil toutes les heures
- la perte de fatigue à la descente des TMR est visible immédiatement
## 12.0.49 - La deuxième lame d'Astrobazzarh
- Corrections
- les défenses particulières sont correctement affichées
- les vieux boucliers (sans catégorie de parade car créés il y a longtemps) peuvent parer...
- Les attaques à distance n'ont pas de difficulté libre
## 12.0.48 - La chèvre d'Astrobazzarh
- le Bandersnatch a une protection de 10
- la consistance chèvre est maintenant possible dans les recettes
alchimiques (et toutes les consistances avec accents)
- un échec au lancement d'un sort pour le mettre en réserve brise
la concentration du haut-rêvant
- Correction: les réussites particulières fonctionnent avec les caractéristiques dérivées
## 12.0.47
- Correction sur les mise à jour en cascade -
- Correction sur le force rendering après un changement de competence
## 12.0.46 - Le double demi d'Astrobazzarh
- correction des raffraîchissement lors du sommeil qui empêchait de dormir
plusieurs heures
- Si la fatigue n'est pas utilisée, les rounds dans les TMR font perdre de l'endurance (au lieu d'en gagner)
- les TMRs se ferment correctement quand la fatigue maximale est dépassée
- le message de lancement de sort en réserve donne la description du sort
- suppression de double-messages lors de la fermeture des TMR
## 12.0.45 - Les errements d'Astrobazzarh, encore
- La difficulté des méditations n'augmente plus en cas de réussite et d'échec normal
- Renommage du Bouton pour révéler/masquer le demi-rêve
## 12.0.44 - Les errements d'Astrobazzarh, suite
- on peut de nouveau dormir et se réveiller reposé
- les possessions utilisent maintenant correctement le rêve actuel
- les sorts variables ne causent plus de soucis de voie pour le lancement de sorts
- les acteurs ayant un sort avec un coût de rêve entier ne sont plus considérés
comme pouvant avoir un rêve variable
## 12.0.42 - Les errements d'Astrobazzarh
- Correction de différentes automatisations de combat incorrectes
- Correction des jets `@roll[vue/-2]` qui tentaient de chercher une compétence -2 (à cause des armes à 1/2 mains)

File diff suppressed because it is too large Load Diff

37
gulpfile.js Normal file
View File

@@ -0,0 +1,37 @@
const gulp = require('gulp');
const less = require('gulp-less');
function onError(err) {
util.log(util.colors.red.bold('[ERROR LESS]:'),util.colors.bgRed(err.message));
this.emit('end');
};
/* ----------------------------------------- */
/* Compile LESS
/* ----------------------------------------- */
function compileLESS() {
return gulp.src("less/foundryvtt-reve-de-dragon.less")
.pipe(less()).on('error',console.log.bind(console))
.pipe(gulp.dest("./css"))
}
const css = gulp.series(compileLESS);
/* ----------------------------------------- */
/* Watch Updates
/* ----------------------------------------- */
const SIMPLE_LESS = ["less/*.less"];
function watchUpdates() {
gulp.watch(SIMPLE_LESS, css);
}
/* ----------------------------------------- */
/* Export Tasks
/* ----------------------------------------- */
exports.default = gulp.series(
gulp.parallel(css),
watchUpdates
);
exports.css = css;
exports.watchUpdates = watchUpdates;

45
less/colors.less Normal file
View File

@@ -0,0 +1,45 @@
:root {
/* =================== 2. DEBUGGING HIGHLIGHTERS ============ */
// --debug-background-color-red: #ff000054;
// --debug-background-color-blue: #1d00ff54;
// --debug-background-color-green: #54ff0054;
// --debug-box-shadow-red: inset 0 0 2px red;
// --debug-box-shadow-blue: inset 0 0 2px blue;
// --debug-box-shadow-green: inset 0 0 2px green;
/* =================== 3. some constants ============ */
--color-controls:rgba(0, 0, 0, 0.9);
--color-controls-light:hsla(0, 0%, 20%, 0.8);
--color-controls-hover:hsla(60, 100%, 75%, 0.7);
--color-control-border-hover:rgba(255, 128, 0, 0.8);
--color-gold: rgba(191, 149, 63, 0.8);
--gradient-gold: linear-gradient(30deg, rgba(191, 149, 63, 0.3), rgba(252, 246, 186, 0.3), rgba(179, 135, 40, 0.3), rgba(251, 245, 183, 0.3), rgba(170, 119, 28, 0.3));
--gradient-silver: linear-gradient(30deg, rgba(61, 55, 93, 0.3), rgba(178, 179, 196, 0.3), rgba(59, 62, 63, 0.6), rgba(206, 204, 199, 0.3), rgba(61, 46, 49, 0.3));
--gradient-green: linear-gradient(30deg, rgba(7, 76, 0, 0.3), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.1), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.3));
--gradient-red: linear-gradient(150deg, rgba(255, 0, 0, 0.3), rgba(255, 200, 128, 0.05),rgba(255, 200, 128, 0.1), rgba(255,10,0,0.3));
--gradient-violet: linear-gradient(150deg, rgba(100, 45, 124, 0.6), rgba(216, 157, 192, 0.3), rgba(177, 157, 216, 0.5), rgba(107, 62, 121, 0.3), rgba(100, 45, 124, 0.6));
--gradient-purple-black: linear-gradient(150deg, rgba(0, 0, 0, 0.7), rgba(100, 45, 124, 0.4), rgba(82, 17, 131, 0.3),rgba(100, 45, 124, 0.4), rgba(0, 0, 0, 0.7));
--gradient-silver-light: linear-gradient(30deg, rgba(61, 55, 93, 0.2), rgba(178, 179, 196, 0.1), rgba(59, 62, 63, 0.2), rgba(206, 204, 199, 0.1), rgba(61, 46, 49, 0.2));
--gradient-daylight: conic-gradient(
from 0deg,
hsla(50, 100%, 80%, 0.7),
hsla(30, 30%, 40%, 0.1) 25%,
hsla(250, 50%, 40%, 0.1) 25%,
hsla(250, 30%, 30%, 0.7) 50%,
hsla(250, 50%, 40%, 0.1) 75%,
hsla(30, 30%, 40%, 0.1) 75%,
hsla(50, 100%, 80%, 0.7)
);
--background-custom-button: linear-gradient(to bottom, rgba(33, 55, 74, 0.988) 5%, rgba(21, 40, 51, 0.671) 100%);
--background-custom-button-hover: linear-gradient(to bottom, rgb(128, 0, 0) 5%, rgb(62, 1, 1) 100%);
--background-control-selected: linear-gradient(to bottom, hsla(0, 100%, 25%, 0.5) 5%, hsla(0, 100%, 12%, 0.5) 100%);
--background-tooltip: hsla(60, 12%, 85%, 0.95);
--color-tooltip:hsla(282, 47%, 33%, 0.9);
--color-tooltip-faint:hsla(282, 47%, 66%, 0.5);
--background-error:hsla(16, 100%, 50%, 0.8);
--color-profile-border: hsla(0, 0%, 80%, 0.05);
}

84
less/fonts.less Normal file
View File

@@ -0,0 +1,84 @@
/* ==================== (A) Fonts ==================== */
@font-face {
font-family: "GoudyAcc";
src: url('../fonts/goudyacc.ttf') format("truetype");
}
@font-face {
font-family: "MedievalSharp";
src: url('../fonts/MedievalSharp.ttf') format("truetype");
}
@font-face {
font-family: "GrenzeGotisch";
src: url('../fonts/GrenzeGotisch-Regular.ttf') format("truetype");
}
@font-face {
font-family: "Fondamento";
src: url('../fonts/Fondamento.ttf') format("truetype");
}
@font-face {
font-family: "CaslonAntique";
src: url('../fonts/CaslonAntique.ttf') format("truetype");
}
@font-face {
font-family: 'HeuresDraconiques';
src:
url('../fonts/heuresdraconiques2.woff') format('woff'),
url('../fonts/heuresdraconiques2.woff2') format('woff2'),
url('../fonts/heuresdraconiques2.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
:root {
/* =================== 1. ACTOR SHEET FONT STYLES =========== */
--window-header-title-font-family: CaslonAntique;
--window-header-title-font-size: 1.6rem;
--window-header-title-font-weight: normal;
--window-header-title-color: #f5f5f5;
--major-button-font-family: CaslonAntique;
--major-button-font-size: 1.4rem;
--major-button-font-weight: normal;
--major-button-color: #dadada;
--tab-header-font-family: CaslonAntique;
--tab-header-font-size: 1.2rem;
--tab-header-font-weight: 700;
--tab-header-color: #403f3e;
--tab-header-color-active: #4a0404;
--actor-input-font-family: CaslonAntique;
--actor-input-font-size: 1.2rem;
--actor-input-font-weight: 500;
--actor-input-color: black;
--actor-label-font-family: CaslonAntique;
--actor-label-font-size: 1.2rem;
--actor-label-font-weight: 700;
--actor-label-color: #464331c4;
}
/* Global styles & Font */
.window-app {
font-family: CaslonAntique;
text-align: justify;
font-size: 1rem;
letter-spacing: 1px;
}
/* Fonts */
.sheet header.sheet-header h1 input,
.window-app .window-header,
#actors .directory-list,
#navigation #scene-list .scene.nav-item {
font-family: "GoudyAcc"
}
/* For title, sidebar character and scene */
.sheet nav.sheet-tabs,
.window-app input,
.sheet header.sheet-header .header-compteurs,
.sheet header.sheet-header .flex-group-center.flex-fatigue,
select, button, .item-checkbox, #sidebar, #players, #navigation #nav-toggle {
font-family: "CaslonAntique"; /* For sheet parts; For nav and title */
}

File diff suppressed because it is too large Load Diff

10
less/item/monnaie.less Normal file
View File

@@ -0,0 +1,10 @@
.application.sheet.fvtt-rdd {
.sheet-common();
section.window-content{
padding: 0rem;
section header.sheet-header {
.sheet-header();
}
}
}

32
less/sheets.less Normal file
View File

@@ -0,0 +1,32 @@
.sheet-common() {
.window-content{
font-family: CaslonAntique;
text-align: justify;
font-size: 1rem;
letter-spacing: 1px;
font-size: calc(var(--font-size-standard) * 1);
color: var(--color-dark-1);
background: var(--background-image-base) no-repeat;
background-size: 100% 100%;
}
}
.sheet-header() {
background: #011d33 url(../assets/ui/bg_header.webp) no-repeat left top;
color: rgba(255, 255, 255, 1);
:is(
input[type="text"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
input[type="date"],
input[type="time"]) {
color: rgba(255, 255, 255, 0.75);
background: rgba(255, 255, 255, 0.1);
border: 0 none;
margin-bottom: 0.2rem;
}
}

View File

@@ -243,7 +243,7 @@ export class RdDActor extends RdDBaseActorSang {
}
await this.resetInfoSommeil()
ChatMessage.create(message);
this.sheet.render(true);
setTimeout(() => this.sheet.render(), 20)
}
async _recuperationSante(message) {
@@ -279,30 +279,34 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async dormirChateauDormant() {
if (!ReglesOptionnelles.isUsing("chateau-dormant-gardien") || !this.system.sommeil || this.system.sommeil.nouveaujour) {
const message = {
whisper: ChatUtility.getOwners(this),
content: ""
};
await this._recuperationSante(message)
await this._recupereMoralChateauDormant(message)
await this._recupereChance()
await this.transformerStress()
await this.retourSeuilDeReve(message)
await this.setBonusPotionSoin(0)
await this.retourSust(message)
await this.$perteReveEnchantementsChateauDormants()
await this.$suppressionLancementsSort()
await RdDCoeur.applyCoeurChateauDormant(this, message)
if (message.content != "") {
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
ChatMessage.create(message);
}
await this.resetInfoSommeil();
this.sheet.render(true);
await this.$dormirChateauDormant();
setTimeout(() => this.sheet.render(), 20)
}
}
async $dormirChateauDormant() {
const message = {
whisper: ChatUtility.getOwners(this),
content: ""
};
await this._recuperationSante(message);
await this._recupereMoralChateauDormant(message);
await this._recupereChance();
await this.transformerStress();
await this.retourSeuilDeReve(message);
await this.setBonusPotionSoin(0);
await this.retourSust(message);
await this.$perteReveEnchantementsChateauDormants();
await this.$suppressionLancementsSort();
await RdDCoeur.applyCoeurChateauDormant(this, message);
if (message.content != "") {
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
ChatMessage.create(message);
}
await this.resetInfoSommeil();
}
async resetInfoSommeil() {
await this.update({
'system.sommeil': {
@@ -442,10 +446,9 @@ export class RdDActor extends RdDBaseActorSang {
message.content += 'Vous ne trouvez pas le sommeil';
}
else {
let jetsReve = [];
let dormi = await this.dormirDesHeures(jetsReve, message, heures, options);
if (jetsReve.length > 0) {
message.content += `Vous récupérez ${jetsReve.map(it => it < 0 ? '0 (réveil)' : it).reduce(Misc.joining("+"))} Points de rêve. `;
let dormi = await this.$dormirDesHeures(message, heures, options);
if (dormi.jetsReve.length > 0) {
message.content += `Vous récupérez ${dormi.jetsReve.map(it => it < 0 ? '0 (réveil)' : it).reduce(Misc.joining("+"))} Points de rêve. `;
}
if (dormi.etat == 'eveil') {
await this.reveilReveDeDragon(message, dormi.heures);
@@ -458,11 +461,9 @@ export class RdDActor extends RdDBaseActorSang {
ChatMessage.create(message);
}
if (options.chateauDormant) {
await this.dormirChateauDormant();
}
else {
this.sheet.render(true);
await this.$dormirChateauDormant();
}
setTimeout(() => this.sheet.render(), 20)
}
async reveilReveDeDragon(message, heures) {
@@ -472,18 +473,18 @@ export class RdDActor extends RdDBaseActorSang {
}
}
async dormirDesHeures(jetsReve, message, heures, options) {
const dormi = { heures: 0, etat: 'dort' };
async $dormirDesHeures(message, heures, options) {
const dormi = { heures: 0, etat: 'dort', jetsReve: [] };
for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) {
await this._recupererEthylisme(message);
await this.$recupererEthylisme(message);
if (options.grisReve) {
await this.recupererFatigue(message);
await this.$recupererFatigue(message);
}
else if (!this.system.sommeil?.insomnie) {
await this.recupererFatigue(message);
dormi.etat = await this.jetRecuperationReve(jetsReve, message);
await this.$recupererFatigue(message);
await this.$jetRecuperationReve(dormi, message);
if (dormi.etat == 'dort' && EffetsDraconiques.isDonDoubleReve(this)) {
dormi.etat = await this.jetRecuperationReve(jetsReve, message);
await this.$jetRecuperationReve(dormi, message);
}
}
}
@@ -491,35 +492,36 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async jetRecuperationReve(jetsReve, message) {
async $jetRecuperationReve(dormi, message) {
if (this.getReveActuel() < this.system.reve.seuil.value) {
let reve = await RdDDice.rollTotal("1dr");
const reve = await RdDDice.rollTotal("1dr")
if (reve >= 7) {
// Rêve de Dragon !
message.content += `Vous faites un <strong>Rêve de Dragon</strong> de ${reve} Points de rêve qui vous réveille! `;
await this.combattreReveDeDragon(reve);
jetsReve.push(-1);
return 'eveil';
dormi.jetsReve.push(-1);
dormi.etat = 'eveil'
return
}
else {
if (!ReglesOptionnelles.isUsing("recuperation-reve")) {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: `Pas de récupération de rêve (${reve} points ignorés)`
});
jetsReve.push(0);
})
dormi.jetsReve.push(0)
}
else {
await this.reveActuelIncDec(reve);
jetsReve.push(reve);
await this.reveActuelIncDec(reve)
dormi.jetsReve.push(reve)
}
}
}
return 'dort';
dormi.etat = 'dort'
}
/* -------------------------------------------- */
async _recupererEthylisme(message) {
async $recupererEthylisme(message) {
if (!ReglesOptionnelles.isUsing("recuperation-ethylisme")) { return; }
let value = Math.min(Number.parseInt(this.system.compteurs.ethylisme.value) + 1, 1);
if (value <= 0) {
@@ -541,7 +543,6 @@ export class RdDActor extends RdDBaseActorSang {
max = Math.floor(max / 2);
}
const manquant = max - this.system.sante.endurance.value;
if (manquant > 0) {
await this.santeIncDec("endurance", manquant);
message.content += `Vous récuperez ${manquant} points d'endurance. `;
@@ -549,15 +550,15 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async recupererFatigue(message) {
async $recupererFatigue(message) {
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
let fatigue = this.system.sante.fatigue.value;
const fatigueMin = this.getFatigueMin();
let fatigue = this.system.sante.fatigue.value
const fatigueMin = this.getFatigueMin()
if (fatigue <= fatigueMin) {
return;
return
}
fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue));
await this.update({ "system.sante.fatigue.value": fatigue });
fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue))
await this.update({ 'system.sante.fatigue.value': fatigue });
if (fatigue == 0) {
message.content += "Vous êtes complêtement reposé. ";
}
@@ -667,19 +668,23 @@ export class RdDActor extends RdDBaseActorSang {
if (!RdDItemRace.checkRacialMax(this, caracName, to)) {
return
}
let updates = {};
if (caracName == LIST_CARAC_PERSONNAGE.reve.code) {
if (to > Misc.toInt(this.system.reve.seuil.value)) {
this.setPointsDeSeuil(to);
}
updates[`system.reve.seuil.value`] = to; // SFA : Direct and packed changes
//this.setPointsDeSeuil(to);
}
}
if (caracName == LIST_CARAC_PERSONNAGE.chance.code) {
if (to > Misc.toInt(this.system.compteurs.chance.value)) {
this.setPointsDeChance(to);
updates[`system.compteurs.chance.value`] = to; // SFA : Direct and packed changes
//this.setPointsDeChance(to);
}
}
let selectedCarac = this.findCaracByName(caracName);
const from = selectedCarac.value
await this.update({ [`system.carac.${caracName}.value`]: to });
updates[`system.carac.${caracName}.value`] = to;
await this.update(updates);
await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName);
}
@@ -783,7 +788,7 @@ export class RdDActor extends RdDBaseActorSang {
const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories());
this.notifyCompetencesTronc(competence, toNiveau);
const fromNiveau = competence.system.niveau;
await competence.update({ 'system.niveau': toNiveau }, { render: false })
await competence.update({ 'system.niveau': toNiveau }, { render: true })
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
}
}
@@ -1047,20 +1052,10 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async deleteRencontreTMRAtPosition() {
const rencontreIds = this.itemTypes[ITEM_TYPES.rencontre].filter(this.filterRencontreTMRDemiReve()).map(it => it.id)
if (rencontreIds.length > 0) {
await this.deleteEmbeddedDocuments('Item', rencontreIds)
}
}
getRencontreTMREnAttente() {
return this.itemTypes[ITEM_TYPES.rencontre].find(this.filterRencontreTMRDemiReve())
}
filterRencontreTMRDemiReve() {
const position = this.getDemiReve()
return it => it.system.coord == position
return this.itemTypes[ITEM_TYPES.rencontre].find(it => it.system.coord == position)
}
/* -------------------------------------------- */
@@ -1770,7 +1765,7 @@ export class RdDActor extends RdDBaseActorSang {
if (reveActuel == 0) { // 0 points de reve
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
}
if (!rollData.isSortReserve) {
if (!rollData.isSortReserve || !rolled.isSuccess) {
this.tmrApp?.close();
}
}
@@ -2116,7 +2111,6 @@ export class RdDActor extends RdDBaseActorSang {
label: "Jet de méditation",
callbacks: [
this.createCallbackExperience(),
{ condition: r => r.rolled.isEPart, action: r => this._meditationEPart(r) },
{ action: r => this._meditationResult(r) }
]
});
@@ -2125,21 +2119,16 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async _meditationResult(meditationRoll) {
this.santeIncDec("fatigue", 2);
if (meditationRoll.rolled.isSuccess) {
await this.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationRoll.meditation, meditationRoll.rolled)]);
}
if (meditationRoll.rolled.isEPart){
await this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
}
await this.santeIncDec("fatigue", 2);
await RdDRollResult.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.hbs');
}
/* -------------------------------------------- */
_meditationEPart(meditationRoll) {
this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
}
/* -------------------------------------------- */
_getSignesDraconiques(coord) {
const type = TMRUtility.getTMRType(coord);

View File

@@ -39,7 +39,12 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
return 0;
}
getFatigueRestante() { return this.getFatigueMax() - this.getFatigueActuelle() }
isCumulFatigueCauseSommeil(cumulFatigue){
return ReglesOptionnelles.isUsing("appliquer-fatigue")
? (this.getFatigueRestante() <= cumulFatigue)
: (this.getEnduranceActuelle() <= cumulFatigue)
}
getFatigueRestante() {return this.getFatigueMax() - this.getFatigueActuelle() }
getFatigueMin() { return this.system.sante.endurance.max - this.system.sante.endurance.value }
malusFatigue() {

View File

@@ -3,7 +3,7 @@ import { Misc } from "../../misc.js"
import { EXPORT_CSV_SCRIPTARIUM, OptionsAvancees } from "../../settings/options-avancees.js"
import { Mapping } from "./mapping.js"
const IMG_SCRIPTARIUM = '<img class="context-menu-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/scriptarium.svg">'
const IMG_SCRIPTARIUM = '<img class="context-menu-img" src="systems/foundryvtt-reve-de-dragon/assets/ui/scriptarium.svg">'
export class ExportScriptarium {

View File

@@ -0,0 +1,4 @@
export { default as RdDItemBaseSheet} from "./common-item-sheet.mjs"
export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs"
export { default as RdDMunitionSheet } from "./munition-sheet.mjs"

View File

@@ -0,0 +1,111 @@
const { HandlebarsApplicationMixin } = foundry.applications.api
import { SYSTEM_RDD } from "../../constants.js"
import { Misc } from "../../misc.js"
import { RdDSheetUtility } from "../../rdd-sheet-utility.js";
export default class RdDItemBaseSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
static preloadHandlebars(...templatesList) {
const handlebars = ["systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"]
templatesList.forEach(templates =>
templates.forEach(t =>
t.handlebars().forEach(h => handlebars.push(h))
)
)
loadTemplates(Misc.distinct(handlebars))
}
static register(sheetClass) {
const itemType = sheetClass.ITEM_TYPE
Items.registerSheet(SYSTEM_RDD, sheetClass, {
label: Misc.typeName('Item', itemType),
types: [itemType],
makeDefault: true
})
}
static registerAll(...sheetClasses) {
const handlebars = ["systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"]
sheetClasses.forEach(sheetClass => {
sheetClass.TEMPLATES.forEach(t =>
t.handlebars().forEach(h => handlebars.push(h))
)
const itemType = sheetClass.ITEM_TYPE
Items.registerSheet(SYSTEM_RDD, sheetClass, {
label: Misc.typeName('Item', itemType),
types: [itemType],
makeDefault: true
})
})
loadTemplates(Misc.distinct(handlebars))
}
static get ITEM_TYPE() { return undefined }
constructor(options = {}) {
super(options)
}
static get TEMPLATES() { return [] }
/** @override */
static DEFAULT_OPTIONS = {
classes: ["fvtt-rdd", "item"],
position: {
width: 600,
height: "auto",
},
form: {
submitOnChange: true,
},
window: {
resizable: true,
},
actions: {
editImage: RdDItemBaseSheet.#onEditImage,
}
}
/** @override */
async _prepareContext() {
return {
item: this.document,
options: RdDSheetUtility.getOptions(this.document, this.isEditable),
fields: this.document.schema.fields,
systemFields: this.document.system.schema.fields,
system: this.document.system,
source: this.document.toObject(),
isEditable: this.isEditable,
}
}
// #region Actions
/**
* Handle changing a Document's image.
*
* @this RdDItemBaseSheet
* @param {PointerEvent} event The originating click event
* @param {HTMLElement} target The capturing HTML element which defined a [data-action]
* @returns {Promise}
* @private
*/
static async #onEditImage(event, target) {
const attr = target.dataset.edit
const current = foundry.utils.getProperty(this.document, attr)
const { img } = this.document.constructor.getDefaultArtwork?.(this.document.toObject()) ?? {}
const fp = new FilePicker({
current,
type: "image",
redirectToRoot: img ? [img] : [],
callback: (path) => {
this.document.update({ [attr]: path })
},
top: this.position.top + 40,
left: this.position.left + 10,
})
return fp.browse()
}
// #endregion
}

View File

@@ -0,0 +1,35 @@
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
import { ITEM_TYPES } from "../../constants.js";
import RdDItemBaseSheet from "./common-item-sheet.mjs";
export default class RdDMonnaieSheet extends RdDItemBaseSheet {
/** @override */
static get ITEM_TYPE() { return ITEM_TYPES.monnaie }
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
/** @override */
static DEFAULT_OPTIONS = Object.assign({},
RdDItemBaseSheet.DEFAULT_OPTIONS,
{
classes: ["fvtt-rdd", "item", "monnaie"],
position: { width: 400 },
window: { contentClasses: ["monnaie-content"] }
})
/** @override */
static PARTS = {
main: {
template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/monnaie.hbs",
},
}
/** @override */
async _prepareContext() {
return Object.assign(
await super._prepareContext(),
await TEMPLATE_DESCRIPTION.prepareContext(this.document),
await TEMPLATE_INVENTAIRE.prepareContext(this.document)
)
}
}

View File

@@ -0,0 +1,34 @@
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
import { ITEM_TYPES } from "../../constants.js";
import RdDItemBaseSheet from "./common-item-sheet.mjs";
export default class RdDMunitionSheet extends RdDItemBaseSheet {
/** @override */
static get ITEM_TYPE() { return ITEM_TYPES.munition }
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
/** @override */
static DEFAULT_OPTIONS = Object.assign({},
RdDItemBaseSheet.DEFAULT_OPTIONS,
{
classes: ["fvtt-rdd", "item", "munition"],
position: { width: 400 },
window: { contentClasses: ["munition-content"] }
})
/** @override */
static PARTS = {
main: {
template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/munition.hbs",
},
}
/** @override */
async _prepareContext() {
return Object.assign(
await super._prepareContext(),
await TEMPLATE_DESCRIPTION.prepareContext(this.document),
await TEMPLATE_INVENTAIRE.prepareContext(this.document)
)
}
}

View File

@@ -5,7 +5,7 @@ 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_TERMES = "(?<termes>([-A-Za-zÀ-ÖØ-öø-ÿ ])+)"
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')

View File

@@ -0,0 +1,8 @@
import { CommonDescription } from "./description.mjs";
import { CommonInventaire } from "./inventaire.mjs";
export const TEMPLATE_DESCRIPTION = new CommonDescription()
export const TEMPLATE_INVENTAIRE = new CommonInventaire()
export const ALL_COMMON_TEMPLATES = [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE]

View File

@@ -0,0 +1,10 @@
/**
* class describing common methods implemented by template parts,
* used for sheet/models/documents
*/
export default class CommonTemplate {
fields() { }
handlebars() { return [] }
actions() { return {} }
async prepareContext(item) { }
}

View File

@@ -0,0 +1,32 @@
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"
import CommonTemplate from "./common-template.mjs"
import { HTMLSTRING } from "./field-types.mjs"
const fields = foundry.data.fields
export class CommonDescription extends CommonTemplate {
fields() {
return {
description: new fields.HTMLField({ ...HTMLSTRING }),
descriptionmj: new fields.HTMLField({ gmOnly: true, ...HTMLSTRING })
}
}
handlebars() {
return [
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-description.hbs",
]
}
actions() {
return {}
}
async prepareContext(item) {
const enriched = {
description: await RdDTextEditor.enrichHTML(item.system.description, item),
descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
}
return { enriched }
}
}

View File

@@ -0,0 +1,9 @@
export const INTEGER = { required: true, nullable: false, min: 0, integer: true }
export const DECIMAL = { required: true, nullable: false, min: 0, integer: false } /* TODO: validation de nombre décimales?*/
export const INTEGER_SIGNED = { required: true, nullable: false, integer: true }
export const DECIMAL_SIGNED = { required: true, nullable: false, integer: false }
export const STRING = { required: true, nullable: false, blank: true, trim: true }
export const HTMLSTRING = { initial: "", required: true, nullable: false, blank: true, textSearch: true }
export const MODEL_ARRAY = { initial: [], required: true, nullable: false }

View File

@@ -0,0 +1,36 @@
import CommonTemplate from "./common-template.mjs"
import { RARETES } from "../item/raretes.js"
import { DECIMAL, INTEGER, INTEGER_SIGNED, MODEL_ARRAY, STRING } from "./field-types.mjs"
const fields = foundry.data.fields
export class CommonInventaire extends CommonTemplate {
fields() {
return {
encombrement: new fields.NumberField({ label: "Encombrement", initial: 0, ...INTEGER }),
quantite: new fields.NumberField({ label: "Quantité", initial: 1, ...INTEGER }),
qualite: new fields.NumberField({ label: "Qualité", initial: 0, ...INTEGER_SIGNED }),
cout: new fields.NumberField({ label: "Coût", initial: 0.0, ...DECIMAL }),
environnement: new fields.ArrayField(
new fields.SchemaField({
milieu: new fields.StringField({ label: "Milieu", initial: "", ...STRING }),
rarete: new fields.StringField({
label: "Rareté", initial: RARETES[0].code, ...STRING,
validate: (value, options) => RARETES.find(it => it.code == value)
}),
frequence: new fields.NumberField({ label: "Fréquence", initial: RARETES[0].frequence, ...INTEGER }),
}),
{ label: "Environnement", ...MODEL_ARRAY }),
}
}
handlebars() {
return [
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"
]
}
async prepareContext(item) {
return {}
}
}

View File

@@ -0,0 +1,2 @@
export { default as RdDItemMonnaie } from "./monnaie.mjs"
export { default as RdDItemMunition } from "./munition.mjs"

View File

@@ -0,0 +1,7 @@
import { RdDItem } from "../item.js";
export default class RdDItemMonnaie extends RdDItem {
static get defaultIcon() {
return 'systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp'
}
}

View File

@@ -0,0 +1,7 @@
import { RdDItem } from "../item.js";
export default class RdDItemMunition extends RdDItem {
static get defaultIcon() {
return 'systems/foundryvtt-reve-de-dragon/icons/objets/fleche.webp'
}
}

View File

@@ -120,13 +120,13 @@ export class RdDItemArme extends Item {
static defenseArmeParade(armeAttaque, armeParade) {
const defCategory = RdDItemArme.getCategorieParade(armeParade)
if (defCategory == 'bouclier') {
if (defCategory == 'boucliers') {
return 'norm'
}
if (armeAttaque.system.competence.toLowerCase().match(/(fléau)/)) {
if (armeAttaque?.system?.competence?.toLowerCase().match(/(fléau)/)) {
return ''
}
if (armeParade.system.tir) {
if (armeParade.system?.tir) {
return ''
}
const attCategory = RdDItemArme.getCategorieParade(armeAttaque)

View File

@@ -14,12 +14,11 @@ import { RdDItem } from "./item.js";
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
import { ItemAction } from "./item/item-actions.js";
import { RdDItemGemme } from "./item/gemme.js";
/**
* Extend the basic ItemSheet for RdD specific items
*/
export class RdDItemSheet extends ItemSheet {
export class RdDItemSheetV1 extends ItemSheet {
static get ITEM_TYPE() {
return undefined
@@ -43,7 +42,7 @@ export class RdDItemSheet extends ItemSheet {
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: [SYSTEM_RDD, "sheet", "item"],
template: RdDItemSheet.defaultTemplate(RdDItemSheet.ITEM_TYPE),
template: RdDItemSheetV1.defaultTemplate(RdDItemSheetV1.ITEM_TYPE),
width: 550,
height: 550
}, { inplace: false });
@@ -51,7 +50,7 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */
get template() {
return RdDItemSheet.defaultTemplate(this.item.type);
return RdDItemSheetV1.defaultTemplate(this.item.type);
}
get title() {
@@ -101,7 +100,7 @@ export class RdDItemSheet extends ItemSheet {
description: await RdDTextEditor.enrichHTML(this.item.system.description, this.item),
descriptionmj: await RdDTextEditor.enrichHTML(this.item.system.descriptionmj, this.item),
isComestible: this.item.getUtilisationCuisine(),
options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable),
options: RdDSheetUtility.mergeDocumentRights({}, this.item, this.isEditable),
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
categories: RdDItem.getCategories(this.item.type),
}
@@ -264,7 +263,7 @@ export class RdDItemSheet extends ItemSheet {
_updateObject(event, formData) {
switch (this.item.type) {
case ITEM_TYPES.sort:
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheet._listCaseTmr(
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheetV1._listCaseTmr(
formData.caseTmrCoord,
formData.caseTmrBonus,
formData.caseTmrAdd
@@ -314,7 +313,7 @@ export class RdDItemSheet extends ItemSheet {
async _onDrop(event) {
// Try to extract the dragData
let dragData = RdDItemSheet.$extractDragData(event);
let dragData = RdDItemSheetV1.$extractDragData(event);
if (!dragData) return false;
const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
if (allowed === false) return false;

View File

@@ -56,6 +56,10 @@ export class RdDItemSort extends Item {
return voies.map(voie => RdDItemCompetence.getVoieDraconic(competencesDraconic, voie))
}
static getBestDraconicSort(competencesDraconic, sort) {
return RdDItemSort.getDraconicsSort(competencesDraconic, sort).sort(Misc.descending(it => it.system.niveau)).find(it=>true)
}
static getOrdreCode(code) {
return (VOIES_DRACONIC.find(it => it.code == code)?.ordre ?? '?')
}
@@ -92,7 +96,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */
static isCoutVariable(sort) {
return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
return sort && !Number.isInteger(sort.system.ptreve) && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
}
/* -------------------------------------------- */

View File

@@ -55,6 +55,10 @@ export class RdDItemRace extends RdDItem {
isMax(actor, code, value = undefined) {
const path = RdDCarac.carac(code)?.path
if (path == undefined) {
// cas des caractéristiques dérivées, pas de max
return false
}
if (value == undefined) {
value = path ? foundry.utils.getProperty(actor, path) : 0
}

View File

@@ -1,14 +1,14 @@
import { HtmlUtility } from "../html-utility.js";
import { RdDItemSheet } from "../item-sheet.js";
import { RdDItemSheetV1 } from "../item-sheet.js";
import { Misc } from "../misc.js";
import { RdDRaretes } from "./raretes.js";
const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
export class RdDItemInventaireSheet extends RdDItemSheet {
export class RdDItemInventaireSheet extends RdDItemSheetV1 {
static get defaultOptions() {
return foundry.utils.mergeObject(RdDItemSheet.defaultOptions, {
return foundry.utils.mergeObject(RdDItemSheetV1.defaultOptions, {
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
}, { inplace: false })
}

View File

@@ -1,6 +1,6 @@
import { RdDItemSheet } from "../item-sheet.js";
import { RdDItemSheetV1 } from "../item-sheet.js";
export class RdDBlessureItemSheet extends RdDItemSheet {
export class RdDBlessureItemSheet extends RdDItemSheetV1 {
static get ITEM_TYPE() { return "blessure" };

View File

@@ -1,7 +1,7 @@
import { RdDRencontre } from "./rencontre.js";
import { RdDItemSheet } from "../item-sheet.js";
import { RdDItemSheetV1 } from "../item-sheet.js";
export class RdDRencontreItemSheet extends RdDItemSheet {
export class RdDRencontreItemSheet extends RdDItemSheetV1 {
static get ITEM_TYPE() { return "rencontre" };

View File

@@ -1,6 +1,6 @@
import { RdDItemSheet } from "../item-sheet.js";
import { RdDItemSheetV1 } from "../item-sheet.js";
export class RdDServiceItemSheet extends RdDItemSheet {
export class RdDServiceItemSheet extends RdDItemSheetV1 {
static get ITEM_TYPE() { return "service" };

View File

@@ -1,12 +1,12 @@
import { RdDItemSheet } from "../item-sheet.js";
import { RdDItemSheetV1 } from "../item-sheet.js";
import { RdDItemSigneDraconique } from "./signedraconique.js";
import { TMRUtility } from "../tmr-utility.js";
/**
* Item sheet pour signes draconiques
* @extends {RdDItemSheet}
* @extends {RdDItemSheetV1}
*/
export class RdDSigneDraconiqueItemSheet extends RdDItemSheet {
export class RdDSigneDraconiqueItemSheet extends RdDItemSheetV1 {
static get ITEM_TYPE() { return "signedraconique" }

View File

@@ -0,0 +1,2 @@
export { default as RdDModelMonnaie } from "./monnaie.mjs"
export { default as RdDModelMunition } from "./munition.mjs"

10
module/models/monnaie.mjs Normal file
View File

@@ -0,0 +1,10 @@
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../common/_module.mjs";
export default class RdDModelMonnaie extends foundry.abstract.TypeDataModel {
static defineSchema() {
return Object.assign({},
TEMPLATE_DESCRIPTION.fields(),
TEMPLATE_INVENTAIRE.fields()
)
}
}

View File

@@ -0,0 +1,10 @@
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../common/_module.mjs";
export default class RdDModelMunition extends foundry.abstract.TypeDataModel {
static defineSchema() {
return Object.assign({},
TEMPLATE_DESCRIPTION.fields(),
TEMPLATE_INVENTAIRE.fields()
)
}
}

View File

@@ -1047,11 +1047,12 @@ export class RdDCombat {
async _onParade(defenderRoll) {
if (RdDCombat.isParticuliere(defenderRoll)) {
return await this._onParadeParticuliere(defenderRoll)
}
if (RdDCombat.isReussite(defenderRoll)) {
return await this._onParadeNormale(defenderRoll)
await this._onParadeNormale(defenderRoll)
if (RdDCombat.isParticuliere(defenderRoll)) {
await this._onParadeParticuliere(defenderRoll)
}
return
}
await this._onParadeEchec(defenderRoll)
}
@@ -1135,11 +1136,12 @@ export class RdDCombat {
}
async _onEsquive(defenderRoll) {
if (RdDCombat.isParticuliere(defenderRoll)) {
return await this._onEsquiveParticuliere(defenderRoll)
}
if (RdDCombat.isReussite(defenderRoll)) {
return await this._onEsquiveNormale(defenderRoll)
await this._onEsquiveNormale(defenderRoll)
if (RdDCombat.isParticuliere(defenderRoll)) {
await this._onEsquiveParticuliere(defenderRoll)
}
return
}
return await this._onEsquiveEchec(defenderRoll)
}

View File

@@ -54,7 +54,7 @@ import { RdDItemSouffle } from "./item/souffle.js"
import { RdDRencontre } from "./item/rencontre.js"
import { RdDItemSheet } from "./item-sheet.js"
import { RdDItemSheetV1 } from "./item-sheet.js"
import { RdDBlessureItemSheet } from "./item/sheet-blessure.js"
import { RdDServiceItemSheet } from "./item/sheet-service.js"
import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js"
@@ -80,6 +80,10 @@ import { RdDItemPotion } from "./item/potion.js"
import { RdDItemGemme } from "./item/gemme.js"
import { RdDGemmeItemSheet } from "./item/sheet-gemme.js"
import * as models from "./models/_module.mjs"
import * as items from "./documents/_module.mjs"
import * as sheets from "./applications/sheets/_module.mjs"
/**
* RdD system
* Author: LeRatierBretonnien
@@ -100,6 +104,8 @@ export class SystemReveDeDragon {
this.RdDHotbar = RdDHotbar
this.RdDStatBlockParser = RdDStatBlockParser
this.itemClasses = {
monnaie: items.RdDItemMonnaie,
munition: items.RdDItemMunition,
armure: RdDItemArmure,
blessure: RdDItemBlessure,
gemme: RdDItemGemme,
@@ -129,6 +135,9 @@ export class SystemReveDeDragon {
/* -------------------------------------------- */
onInit() {
game.system.rdd = this
globalThis.RdD = game.system
this.AppAstrologie = AppAstrologie
console.log(`Initializing Reve de Dragon System Settings`)
@@ -175,6 +184,10 @@ export class SystemReveDeDragon {
console.log(`Initializing Reve de Dragon Documents`)
CONFIG.Actor.documentClass = RdDBaseActor
CONFIG.Item.documentClass = RdDItem
CONFIG.Item.dataModels = {
monnaie: models.RdDModelMonnaie,
munition: models.RdDModelMunition,
}
CONFIG.RDD = {
resolutionTable: RdDResolutionTable.resolutionTable,
carac_array: RdDUtility.getCaracArray(),
@@ -195,12 +208,17 @@ export class SystemReveDeDragon {
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
types: [
"objet", "arme", "armure", "livre", "munition",
"monnaie", "nourritureboisson",
"objet", "arme", "armure", "livre", "nourritureboisson",
],
makeDefault: true
})
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
sheets.RdDItemBaseSheet.registerAll(
sheets.RdDMonnaieSheet,
sheets.RdDMunitionSheet
)
Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, {
types: [
"competence", "competencecreature",
"recettealchimique", "musique", "chant", "danse", "jeu", "race",
@@ -211,18 +229,18 @@ export class SystemReveDeDragon {
],
makeDefault: true
})
RdDItemSheet.register(RdDBlessureItemSheet)
RdDItemSheet.register(RdDConteneurItemSheet)
RdDItemSheet.register(RdDFauneItemSheet)
RdDItemSheet.register(RdDGemmeItemSheet)
RdDItemSheet.register(RdDHerbeItemSheet)
RdDItemSheet.register(RdDIngredientItemSheet)
RdDItemSheet.register(RdDPlanteItemSheet)
RdDItemSheet.register(RdDPotionItemSheet)
RdDItemSheet.register(RdDRencontreItemSheet)
RdDItemSheet.register(RdDServiceItemSheet)
RdDItemSheet.register(RdDSigneDraconiqueItemSheet)
RdDItemSheetV1.register(RdDBlessureItemSheet)
RdDItemSheetV1.register(RdDConteneurItemSheet)
RdDItemSheetV1.register(RdDFauneItemSheet)
RdDItemSheetV1.register(RdDGemmeItemSheet)
RdDItemSheetV1.register(RdDHerbeItemSheet)
RdDItemSheetV1.register(RdDIngredientItemSheet)
RdDItemSheetV1.register(RdDPlanteItemSheet)
RdDItemSheetV1.register(RdDPotionItemSheet)
RdDItemSheetV1.register(RdDRencontreItemSheet)
RdDItemSheetV1.register(RdDServiceItemSheet)
RdDItemSheetV1.register(RdDSigneDraconiqueItemSheet)
RdDJournalSheet.register()
// préparation des différents modules

View File

@@ -104,8 +104,8 @@ export class RdDPossession {
rollData.selectedCarac = carac.reve
}
else {
rollData.selectedCarac = rollingActor.system.carac.reve
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: rollingActor.getReveActuel() } }
rollData.selectedCarac = rollData.forceCarac['reve-actuel']
rollData.competence.system.defaut_carac = 'reve-actuel'
}
}

View File

@@ -279,7 +279,7 @@ export class RdDRoll extends Dialog {
async setSelectedSort(sort) {
this.rollData.selectedSort = sort; // Update the selectedCarac
this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic);
this.rollData.competence = RdDItemSort.getBestDraconicSort(this.rollData.draconicList, sort)
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(sort);

View File

@@ -3,11 +3,11 @@ import { RdDItem } from "./item.js";
export class RdDSheetUtility {
static mergeDocumentRights(options, document, editable) {
static getOptions(document, editable) {
const userRightLevel = game.user.isGM
? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
: document.getUserLevel(game.user);
let newOptions = {
return {
isGM: game.user.isGM,
isOwned: document.parent ? true : false,
editable: editable,
@@ -16,10 +16,15 @@ export class RdDSheetUtility {
isObserver: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
isOwner: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
}
}
static mergeDocumentRights(options, document, editable) {
const newOptions = RdDSheetUtility.getOptions(document, editable);
foundry.utils.mergeObject(options, newOptions);
return options;
}
static getItem(event, actor) {
return actor.items.get(RdDSheetUtility.getItemId(event))
}

View File

@@ -15,7 +15,6 @@ import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
import { RdDDice } from "./rdd-dice.js";
import { STATUSES } from "./settings/status-effects.js";
import { RdDRencontre } from "./item/rencontre.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { ITEM_TYPES } from "./constants.js";
import { Misc } from "./misc.js";
@@ -83,7 +82,7 @@ export class RdDTMRDialog extends Dialog {
this.subdialog = undefined
this.displaySize = undefined
if (!this.viewOnly && !game.user.isGM) {
this._tellToGM(this.actor.name + " monte dans les terres médianes (" + tmrData.mode + ")");
this.$tellToGM(this.actor.name + " monte dans les terres médianes (" + tmrData.mode + ")");
}
this.callbacksOnAnimate = [];
const displaySize = TMR_DISPLAY_SIZE.clamp(game.settings.get(SYSTEM_RDD, TMR_DISPLAY_SIZE.code) ?? TMR_DISPLAY_SIZE.def);
@@ -139,7 +138,7 @@ export class RdDTMRDialog extends Dialog {
this.cumulFatigue += this.fatigueParCase;
// Le reste...
this.updateValuesDisplay();
this.$updateValuesDisplay();
}
lancerUnSort() {
@@ -190,7 +189,7 @@ export class RdDTMRDialog extends Dialog {
forceTMRContinueAction() {
ui.notifications.warn('Vous devez finir votre action avant de continuer dans les TMR');
this.bringSubDialogToTop();
return;
return false
}
setTMRPendingAction(dialog) {
@@ -297,7 +296,7 @@ export class RdDTMRDialog extends Dialog {
const coordOrig = this._getCoordActor();
const coordTarget = TMRUtility.deplacement(coordOrig, move);
await this._deplacerDemiReve(coordTarget, 'normal');
this.checkQuitterTMR();
await this.$checkQuitterTMR();
}
calculCoutMonteeTMR() {
@@ -305,7 +304,7 @@ export class RdDTMRDialog extends Dialog {
}
/* -------------------------------------------- */
async updateValuesDisplay() {
async $updateValuesDisplay() {
if (this.viewOnly || !this.rendered) {
return;
}
@@ -336,22 +335,31 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async close() {
await this.$forceClose(this.actor.name + " a quitté les terres médianes")
}
async $forceClose(message) {
if (this.subdialog) {
return this.forceTMRContinueAction()
this.forceTMRContinueAction()
return false
}
this.descenteTMR = true;
if (this.actor.tmrApp) {
this.actor.tmrApp = undefined; // Cleanup reference
this.actor.tmrApp = undefined // Cleanup reference
const appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue")
await this.actor.santeIncDec(
appliquerFatigue ? "fatigue" : "endurance",
(appliquerFatigue ? 1 : -1) * this.cumulFatigue)
if (!this.viewOnly) {
await this.actor.setEffect(STATUSES.StatusDemiReve, false)
this._tellToGM(this.actor.name + " a quitté les terres médianes");
this.$tellToUserAndGM(message)
}
await this.actor.santeIncDec((ReglesOptionnelles.isUsing("appliquer-fatigue") ? "fatigue" : "endurance"),
this.cumulFatigue)
}
await super.close();
this.pixiTMR.close()
this.pixiTMR.close();
this.pixiTMR = undefined
await super.close();
return true
}
/* -------------------------------------------- */
@@ -363,48 +371,53 @@ export class RdDTMRDialog extends Dialog {
}
switch (action) {
case 'derober':
await this.derober();
this.restoreTMRAfterAction();
return;
await this.$derober()
this.restoreTMRAfterAction()
return
case 'refouler':
await this.refouler();
break;
await this.$refouler()
break
case 'maitriser':
await this.maitriserRencontre();
break;
await this.$maitriserRencontre()
break
case 'ignorer':
await this.ignorerRencontre();
break;
await this.$ignorerRencontre()
break
}
await this.postRencontre(tmr);
this.restoreTMRAfterAction();
}
async derober() {
console.log("-> derober", this.currentRencontre);
await this.actor.addTMRRencontre(this.currentRencontre);
this._tellToGM(this.actor.name + " s'est dérobé et quitte les TMR.");
this.close();
async $derober() {
if (this.currentRencontre) {
console.log("-> derober", this.currentRencontre);
await this.actor.addTMRRencontre(this.currentRencontre);
this.$forceClose(`${this.actor.name} s'est dérobé face à la rencontre ${this.currentRencontre.name}, et quitte les TMR.`)
}
}
/* -------------------------------------------- */
async refouler() {
console.log("-> refouler", this.currentRencontre);
await this.actor.ajouterRefoulement(this.currentRencontre.system.refoulement, `${this.currentRencontre.system.genre == 'f' ? 'une' : 'un'} ${this.currentRencontre.name}`);
await this.actor.deleteRencontreTMRAtPosition()
this.updateTokens();
this.updateValuesDisplay();
this.nettoyerRencontre();
async $refouler() {
if (this.currentRencontre) {
console.log("-> refouler", this.currentRencontre);
await this.actor.ajouterRefoulement(this.currentRencontre.system.refoulement, `${this.currentRencontre.system.genre == 'f' ? 'une' : 'un'} ${this.currentRencontre.name}`);
await this.$deleteRencontreTMRAtPosition()
this.updateTokens();
this.$updateValuesDisplay();
this.$nettoyerRencontre();
}
}
/* -------------------------------------------- */
async ignorerRencontre() {
console.log("-> ignorer", this.currentRencontre);
this._tellToGM(this.actor.name + " a ignoré: " + this.currentRencontre.name);
await this.actor.deleteRencontreTMRAtPosition()
this.updateTokens();
this.updateValuesDisplay();
this.nettoyerRencontre();
async $ignorerRencontre() {
if (this.currentRencontre) {
console.log("-> ignorer", this.currentRencontre);
this.$tellToGM(this.actor.name + " a ignoré: " + this.currentRencontre.name);
await this.$deleteRencontreTMRAtPosition()
this.updateTokens();
this.$updateValuesDisplay();
this.$nettoyerRencontre();
}
}
/* -------------------------------------------- */
@@ -421,41 +434,29 @@ export class RdDTMRDialog extends Dialog {
}
/* -------------------------------------------- */
checkQuitterTMR() {
if (this.actor.isDead()) {
this._tellToGM("Vous êtes mort : vous quittez les Terres médianes !");
this.close();
return true;
async $checkQuitterTMR() {
const reason = this.actor.isDead()
? "est mort"
: this.actor.isCumulFatigueCauseSommeil(this.cumulFatigue)
? "s'écroule de fatigue"
: (this.actor.getReveActuel() == 0)
? "tombe à 0 Points de Rêve"
: undefined
if (reason) {
if (!this.actor.isDead()) {
await this.$refouler()
}
this.$forceClose(`${this.actor.name} ${reason} et quitte les Terres médianes !`)
return true
}
if (ReglesOptionnelles.isUsing("appliquer-fatigue")
? (this.actor.getFatigueRestante() <= this.cumulFatigue)
: (this.actor.getEnduranceActuelle() <= this.cumulFatigue)
) {
this._tellToGM("Vous vous écroulez de fatigue : vous quittez les Terres médianes !");
this.quitterLesTMRInconscient();
return true;
}
if (this.actor.getReveActuel() == 0) {
this._tellToGM("Vos Points de Rêve sont à 0 : vous quittez les Terres médianes !");
this.quitterLesTMRInconscient();
return true;
}
return false;
return false
}
/* -------------------------------------------- */
async quitterLesTMRInconscient() {
await this.refouler();
this.close();
}
/* -------------------------------------------- */
async maitriserRencontre() {
async $maitriserRencontre() {
console.log("-> maitriser", this.currentRencontre);
await this.actor.deleteRencontreTMRAtPosition()
await this.$deleteRencontreTMRAtPosition();
this.updateTokens();
let rencontreData = {
@@ -470,11 +471,21 @@ export class RdDTMRDialog extends Dialog {
tmr: TMRUtility.getTMR(this._getCoordActor())
}
await this._tentativeMaitrise(rencontreData);
await this.$tentativeMaitrise(rencontreData);
}
async $deleteRencontreTMRAtPosition() {
const position = this.actor.getDemiReve()
const rencontreIds = this.actor.itemTypes[ITEM_TYPES.rencontre]
.filter(it => it.system.coord == position)
.map(it => it.id)
if (rencontreIds.length > 0) {
await this.actor.deleteEmbeddedDocuments('Item', rencontreIds)
}
}
/* -------------------------------------------- */
async _tentativeMaitrise(rencData) {
async $tentativeMaitrise(rencData) {
this.rencontreState = 'normal';
rencData.reve = this.actor.getReveActuel();
@@ -483,7 +494,7 @@ export class RdDTMRDialog extends Dialog {
RollDataAjustements.calcul(rencData, this.actor);
rencData.rolled = rencData.presentCite
? this._rollPresentCite(rencData)
? this.$rollPresentCite(rencData)
: await RdDResolutionTable.roll(rencData.reve, RollDataAjustements.sum(rencData.ajustements));
const result = rencData.rolled.isSuccess
@@ -493,38 +504,41 @@ export class RdDTMRDialog extends Dialog {
await RdDRencontre.appliquer(result.effets, this, rencData);
rencData.poesie = { extrait: result.poesie, reference: result.reference };
rencData.message = this.formatMessageRencontre(rencData, result.message);
rencData.message = this.$formatMessageRencontre(rencData, result.message);
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-rencontre-tmr.hbs`, rencData)
});
this.updateValuesDisplay();
if (this.checkQuitterTMR()) {
this.$updateValuesDisplay();
if (await this.$checkQuitterTMR()) {
return;
}
if (this.rencontreState == 'persistant') {
this._nouvelleTentativeMaitrise(rencData);
this.$nouvelleTentativeMaitrise(rencData);
}
else if (!this.isRencontreDeplacement()) {
this.nettoyerRencontre();
this.$nettoyerRencontre();
}
}
_nouvelleTentativeMaitrise(rencData) {
$nouvelleTentativeMaitrise(rencData) {
setTimeout(() => {
// TODO: remplacer par une boucle while(this.currentRencontre) ?
/**
* TODO: remplacer par une boucle while(this.currentRencontre) ?
* ajouter un moyen d'attendre la saisie de l'utilisateur (jet obligatoire)?
*/
rencData.nbRounds++;
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
this.cumulFatigue += this.fatigueParCase;
}
this._tentativeMaitrise(rencData);
this._deleteTmrMessages(rencData.actor, rencData.nbRounds);
this.$tentativeMaitrise(rencData);
this.$deleteTmrMessages(rencData.actor, rencData.nbRounds);
}, 2000);
}
formatMessageRencontre(rencData, template) {
$formatMessageRencontre(rencData, template) {
let messageDuree = ''
if (rencData.nbRounds > 1) {
if (rencData.rolled.isSuccess) {
@@ -543,7 +557,7 @@ export class RdDTMRDialog extends Dialog {
}
/* -------------------------------------------- */
_rollPresentCite(rencData) {
$rollPresentCite(rencData) {
let rolled = RdDResolutionTable.computeChances(rencData.reve, 0);
foundry.utils.mergeObject(rolled, { caracValue: rencData.reve, finalLevel: 0, roll: rolled.score });
RdDResolutionTable.succesRequis(rolled);
@@ -551,7 +565,7 @@ export class RdDTMRDialog extends Dialog {
}
/* -------------------------------------------- */
_deleteTmrMessages(actor, nbRounds = -1) {
$deleteTmrMessages(actor, nbRounds = -1) {
setTimeout(() => {
if (nbRounds < 0) {
ChatUtility.removeChatMessageContaining(`<h4 data-categorie="tmr" data-actor-id="${actor._id}"`);
@@ -570,7 +584,7 @@ export class RdDTMRDialog extends Dialog {
}
/* -------------------------------------------- */
_tellToGM(message) {
$tellToGM(message) {
ChatMessage.create({
user: game.user.id,
content: message,
@@ -579,7 +593,7 @@ export class RdDTMRDialog extends Dialog {
}
/* -------------------------------------------- */
_tellToUserAndGM(message) {
$tellToUserAndGM(message) {
ChatMessage.create({
user: game.user.id,
content: message,
@@ -601,7 +615,7 @@ export class RdDTMRDialog extends Dialog {
if (this.currentRencontre) {
if (this.rencontresExistantes.find(it => it.id == this.currentRencontre.id)) {
// rencontre en attente suite à dérobade
await this.maitriserRencontre();
await this.$maitriserRencontre();
}
else {
const dialog = new RdDTMRRencontreDialog(this.actor, this.currentRencontre, tmr);
@@ -648,7 +662,7 @@ export class RdDTMRDialog extends Dialog {
tmr: tmr,
presentCite: presentCite
};
await this._tentativeMaitrise(rencontreData);
await this.$tentativeMaitrise(rencontreData);
this.postRencontre(tmr);
}
@@ -727,7 +741,7 @@ export class RdDTMRDialog extends Dialog {
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.hbs`, rollData)
});
if (rollData.rolled.isEchec) {
await this.close();
await this.$forceClose(`n'a pas maîtrisé la case ${rollData.tmr.label} et quitte les terres médianes`)
}
await this.souffleSiEchecTotal(rollData);
}
@@ -782,7 +796,7 @@ export class RdDTMRDialog extends Dialog {
onConqueteReussie: r => EffetsDraconiques.fermetureCites.onVisiteSupprimer(r.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr)),
onConqueteEchec: r => {
this.souffleSiEchecTotal(rollData);
this.close()
this.$forceClose(`${this.actor.name} n'a pas maîtrisé la ${tmr.label}, et quitte les TMR.`)
},
canClose: false
});
@@ -797,7 +811,7 @@ export class RdDTMRDialog extends Dialog {
onConqueteReussie: r => EffetsDraconiques.periple.onVisiteSupprimer(r.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr)),
onConqueteEchec: r => {
this.souffleSiEchecTotal(rollData);
this.close()
this.$forceClose(`${this.actor.name} n'a pas purifié la ${tmr.label}, et quitte les TMR.`)
},
canClose: false
});
@@ -811,7 +825,7 @@ export class RdDTMRDialog extends Dialog {
difficulte: -7,
action: 'Conquérir',
onConqueteReussie: r => EffetsDraconiques.conquete.onVisiteSupprimer(r.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr)),
onConqueteEchec: r => this.close(),
onConqueteEchec: r => this.$forceClose(`${this.actor.name} n'a pas conquis la case ${tmr.label}, et quitte les TMR.`),
canClose: false
});
}
@@ -922,19 +936,15 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async processSortReserve(sortReserve) {
await this.actor.deleteEmbeddedDocuments('Item', [sortReserve.id]);
console.log("declencheSortEnReserve", sortReserve);
const heureCible = RdDTimestamp.definition(sortReserve.system.heurecible).label;
this._tellToUserAndGM(`Vous avez déclenché
${sortReserve.system.echectotal ? "<strong>l'échec total!</strong>" : "le sort"}
en réserve <strong>${sortReserve.name}</strong>
avec ${sortReserve.system.ptreve} points de Rêve
en ${sortReserve.system.coord} (${TMRUtility.getTMRLabel(sortReserve.system.coord)}).
L'heure ciblée est ${heureCible}`);
this.close();
console.log("declencheSortEnReserve", sortReserve)
const sort = sortReserve.system.sortid ? this.actor.items.get(sortReserve.system.sortid) : undefined
const message = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-lancement-sortreserve.hbs`,
{ sortReserve, sort })
await this.$forceClose(message)
}
/* -------------------------------------------- */
nettoyerRencontre() {
$nettoyerRencontre() {
// Suppression des dessins des zones possibles
this.currentRencontre?.graphics?.forEach(graphic => this.pixiTMR.removeGraphic(graphic))
// Nettoyage de la structureet de l'état
@@ -1021,7 +1031,7 @@ export class RdDTMRDialog extends Dialog {
console.log("STATUS :", this.rencontreState, this.currentRencontre);
}
this.checkQuitterTMR();
await this.$checkQuitterTMR();
}
/* -------------------------------------------- */
@@ -1054,13 +1064,13 @@ export class RdDTMRDialog extends Dialog {
*/
this.notifierResonanceSigneDraconique(targetCoord);
await this.actor.rollUnSort(targetCoord);
this.nettoyerRencontre();
this.$nettoyerRencontre();
}
/* -------------------------------------------- */
externalRefresh() {
this.createPixiSprites();
this.updateValuesDisplay();
this.$updateValuesDisplay();
this.updateTokens();
console.log("TMR REFRESHED !!!");
}
@@ -1071,7 +1081,7 @@ export class RdDTMRDialog extends Dialog {
return this.forceTMRContinueAction()
}
if (this.currentRencontre != 'normal') {
this.nettoyerRencontre();
this.$nettoyerRencontre();
}
let tmr = TMRUtility.getTMR(targetCoord);
// Gestion cases spéciales type Trou noir, etc
@@ -1083,7 +1093,7 @@ export class RdDTMRDialog extends Dialog {
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
this.cumulFatigue += this.fatigueParCase;
}
this.updateValuesDisplay();
this.$updateValuesDisplay();
this.actor.notifyRefreshTMR();
if (deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/...

View File

@@ -318,6 +318,7 @@ export class RdDUtility {
// gestion des dates et heures
Handlebars.registerHelper('timestamp-imgSigneHeure', (heure) => { return new Handlebars.SafeString(RdDTimestamp.imgSigneHeure(heure)) });
Handlebars.registerHelper('timestamp-imgSigne', (heure) => { return new Handlebars.SafeString(RdDTimestamp.imgSigne(heure)) });
Handlebars.registerHelper('timestamp-definition', (heure) => RdDTimestamp.definition(heure))
Handlebars.registerHelper('timestamp-extract', timestamp => new RdDTimestamp(timestamp).toCalendrier());
Handlebars.registerHelper('timestamp-formulesDuree', () => RdDTimestamp.formulesDuree());
Handlebars.registerHelper('timestamp-formulesPeriode', () => RdDTimestamp.formulesPeriode());

View File

@@ -3,9 +3,9 @@ import { Draconique } from "./draconique.js";
import { PixiTMR } from "./pixi-tmr.js";
const IMAGE_CARTE_TMR = 'image-carte-tmr';
const TMR_V1 = "systems/foundryvtt-reve-de-dragon/styles/img/ui/tmr-v1.webp";
const TMR_V2 = "systems/foundryvtt-reve-de-dragon/styles/img/ui/tmr-v2.webp";
const TMR_V3_COULEUR = "systems/foundryvtt-reve-de-dragon/styles/img/ui/tmr-v3-couleur.webp";
const TMR_V1 = "systems/foundryvtt-reve-de-dragon/assets/ui/tmr-v1.webp";
const TMR_V2 = "systems/foundryvtt-reve-de-dragon/assets/ui/tmr-v2.webp";
const TMR_V3_COULEUR = "systems/foundryvtt-reve-de-dragon/assets/ui/tmr-v3-couleur.webp";
export class CarteTmr extends Draconique {

Some files were not shown because too many files have changed in this diff Show More