Compare commits

...

66 Commits
13.0.26 ... v13

Author SHA1 Message Date
6b0a6a268e Merge pull request '13.0.36 - Les rêveries d'Illisys' (#801) from feature/v13-corrections into v13
Some checks failed
Release Creation / build (release) Failing after 1h28m41s
Reviewed-on: https, #801
2026-04-30 18:25:47 +02:00
c7da930556 Boutons dans les listes d'équipement
Affichage amélioré en évitant les retours à la ligne
Meilleur affichage des -/+
2026-04-30 00:05:31 +02:00
e9e2eba9b5 Support v14: commandes dans chatMessage en html 2026-04-29 22:53:23 +02:00
423dcaf53e Cuisiner depuis l'équipement 2026-04-29 22:53:23 +02:00
a01086ff28 Amélioration champs input
- ajout de min et max quand utile
- ordre et regroupement des attributs:
   - préférence pour name en premier
   - regroupement de class/type/data-dtype
   - regroupement value/min/max
2026-04-29 22:53:22 +02:00
76e651cf19 Corrections mineures 2026-04-28 19:21:00 +02:00
eaee50511a Fix v14: attaque à distance 2026-04-28 19:10:38 +02:00
d1832917bc Message de dommage sur entité
Plutôt que de dire "ne subit aucun dommage", une gravité de blessure
indicative est donnée
2026-04-28 19:09:08 +02:00
277799088f Affichage des jeux 2026-04-28 19:07:24 +02:00
0398fbdbd1 Fix: Pas d'affichage de feuille sur encaissement 2026-04-28 19:07:00 +02:00
4faa9b6b54 Merge pull request 'Quelques corrections mineures' (#800) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 1m40s
Reviewed-on: https, #800
2026-04-26 22:38:40 +02:00
43a09f3a99 Compatibilité v14 2026-04-26 22:37:49 +02:00
ec8fc795f4 Affichage état & blessures
Les icônes d'effets sont affichées en premier.

Affichage des contusions. Les blessures sont affichées en
dernier, par gravité décroissante
2026-04-26 22:37:49 +02:00
8b46ea3681 Ajout de tokens de créatures 2026-04-26 22:37:49 +02:00
3ce33eeea3 simplification pre-update checkCompetence 2026-04-26 22:37:48 +02:00
5c4292882f Correction des updates multiples
Utilisation d'un render sur timer pour forcer le réaffichage
2026-04-26 22:37:48 +02:00
fb150753e0 Suppression image de fond "players"
Adaptation theme Foundry v13
2026-04-26 22:37:48 +02:00
fa54865369 Amélioration des tirages
- option pour ne pas afficher la table source
- les tirages de rencontres sont entre joueur et MJ
2026-04-26 22:37:48 +02:00
200e35b7b7 Filtrage des actions des items des commerces 2026-04-26 22:37:48 +02:00
76fb385c69 Visibilité des tirages dans le compendium
Les tirages de queues, têtes, ... ne concernent plus tout le monde,
mais le joueur et le MJ
2026-04-26 22:37:48 +02:00
ef30e76449 Fix: recul contre entité de cauchemar 2026-04-26 22:37:47 +02:00
10aba8bd58 Fix: sortie d'objet de conteneur 2026-04-26 22:37:47 +02:00
0aedff9d4b Merge pull request 'v13.0.34 - La saumuche d'Illysis' (#799) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 2m2s
Reviewed-on: https, #799
2026-04-07 19:23:26 +02:00
6062d0428c Fix: difficulté d'annulation de magie 2026-04-03 22:16:50 +02:00
eebca509bd Fix: affichage appel moral sur sorts 2026-04-03 22:16:50 +02:00
9934fe9191 Le pluriel de jeu est jeux 2026-04-03 22:16:50 +02:00
e6c4f7990a Correction: qualité des improvisations de cuisine 2026-04-03 22:16:50 +02:00
956fecdd82 Demi-rêve masqué, masquer les rencontres
Pour éviter de trahir l'emplacement du demi-rêve...
2026-04-03 22:16:50 +02:00
afcd200913 Merge pull request 'v13.0.33 - L'ébriété d'Illysis' (#798) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 1m31s
Reviewed-on: https, #798
2026-03-26 23:11:26 +01:00
f3e7cc38a7 Message de Vaisseau 2026-03-24 20:45:54 +01:00
bcc1ec6a37 Pas de perte d'endurance quand éméché 2026-03-24 20:45:54 +01:00
4141eeaa4a Cleanup: gererExperience=>ajoutExperience 2026-03-24 20:45:54 +01:00
d80efba092 Corrections relecture IA 2026-03-24 20:45:54 +01:00
a768419029 Merge pull request '## 13.0.32 - Le surpoids d'Illysis' (#797) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 2m42s
Reviewed-on: https, #797
2026-03-09 09:47:19 +01:00
dfc73fb96d Fix: affichage blessures et pertes
Les pertes et la récupération sont correctement gérées (en ne
faisant qu'un seul render pour le personnage)
2026-03-07 20:38:28 +01:00
9bb9a3b0eb Icône "sonné" inline dans le tchat 2026-03-07 20:38:28 +01:00
3f014faf02 Pas de perte endurance blessures graves soignées 2026-03-07 20:38:12 +01:00
6f30913a8f Visibilité ajustement conditions 2026-03-07 20:38:11 +01:00
b326484797 Fix: malus encombrement 2026-03-07 20:38:11 +01:00
fd96be439e Merge pull request '13.0.31 - Les choix multiples d'Illysis' (#796) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 1m57s
Reviewed-on: https, #796
2026-03-04 09:01:53 +01:00
238d99fa9b Fix: dommages armes 1/2 mains à deux mains 2026-03-03 18:14:58 +01:00
490de5882b Fix: valeurs par défaut après la sélection 2026-03-03 17:58:52 +01:00
4fc06a449c Merge pull request '13.0.30 - Le pansement d'Illysis' (#795) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 1m27s
Reviewed-on: https, #795
2026-02-18 00:43:46 +01:00
929d6af173 Saisie de valeurs négatives 2026-02-17 00:36:08 +01:00
e15ed9d05d Jet de compétence avec défauts
Utilisation de carac par défaut et difficulté par défaut à l'ouverture
de la fenêtre de jet depuis une compétence
2026-02-16 23:58:45 +01:00
3699bc19b8 Fix: soins d'un joueur à l'autre
Les données dans rollData ne pouvaient pas être serialisées
2026-02-06 13:42:27 +01:00
15510b99d8 Merge pull request 'feature/v13-corrections' (#794) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 2m45s
Reviewed-on: https, #794
2026-01-19 21:44:59 +01:00
fa30705989 Affichage de l'XP des sorts et caractéristiques 2026-01-17 03:45:42 +01:00
04f550dd21 Fix jet de résistance V2
sans cométence s'il n'y a pas de sélection
2026-01-16 08:47:51 +01:00
850cae3979 Attaques V2 depuis onglet combat 2026-01-16 08:47:50 +01:00
7b514d5159 Background arme inutilisable 2026-01-14 23:55:03 +01:00
d78ede4f59 Fix missing import 2026-01-14 23:47:01 +01:00
3de00fd001 Merge pull request 'Correction chat appel moral' (#793) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 2m28s
Reviewed-on: https, #793
2026-01-13 22:08:14 +01:00
1b340e526c Simplifications en cherchant bug rêve actuel
Parfois, le rêve actuel est ajouté dans les caractéristiques des
feuilles de personnage.

Simplifications pour essayer d'isoler le souci.
2026-01-10 23:07:25 +01:00
3f3bf293b1 Correction Fenêtre astrologie v13 2026-01-10 22:28:39 +01:00
80b4cde130 Status effect v13 2026-01-10 22:28:09 +01:00
74fecac47e Correction chat appel moral 2026-01-09 02:06:16 +01:00
f1ee8fb45b Merge pull request 'Fix: attaques à distance' (#792) from feature/v13-corrections into v13
Reviewed-on: https, #792
2026-01-07 14:44:21 +01:00
52a5084419 Fix: attaques à distance 2026-01-05 19:12:55 +01:00
8fdf49bfce Message d'information affiché une seule fois toutes les 24 heures
All checks were successful
Release Creation / build (release) Successful in 10m20s
2025-12-30 10:30:14 +01:00
f897a94e60 Merge pull request '## 13.0.27 - Les lunettes d'Illysis' (#791) from feature/v13-corrections into v13
Reviewed-on: https, #791
2025-12-30 10:19:45 +01:00
e6aed2d554 Amélioration des choix d'attaque 2025-12-30 01:30:19 +01:00
0dd671d8a5 Mise à jour d'images
- ajout d'un coffre
- ajout de tissu soie
- correction d'image pour utiliser le style classique
2025-12-30 01:30:15 +01:00
a5c4303012 Les conteneurs ouverts sont mis à jour 2025-12-30 01:29:31 +01:00
ad84e36d43 Suppression timestamp doublon 2025-12-30 01:25:29 +01:00
af9ecda30f fix changelog 2025-12-30 01:25:29 +01:00
236 changed files with 2223 additions and 1856 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 256px; width: 256px;"><defs><radialGradient id="skoll-open-chest-gradient-2"><stop offset="0%" stop-color="#b8e986" stop-opacity="1"></stop><stop offset="100%" stop-color="#ffe0af" stop-opacity="1"></stop></radialGradient><linearGradient x1="0" x2="0" y1="0" y2="1" id="skoll-open-chest-gradient-5"><stop offset="0%" stop-color="#417505" stop-opacity="1"></stop><stop offset="100%" stop-color="#8b572a" stop-opacity="1"></stop></linearGradient></defs><g class="" transform="translate(1,0)" style=""><path d="M457.03 213.037 416.514 100.24C425 77.232 433.27 68.075 437.527 64.633c3.162-2.563 5.922-3.534 8.185-2.904 4.134 1.168 8.775 7.7 12.278 17.456 11.266 31.347 10.377 87.094-.96 133.85zm-324.287-17.9 312.804 34.84-43.82-122.1L145.558 79.34c2.593 36.102-1.913 79.913-12.817 115.796zM128.98 77.5l-45.06-5.02 37.03 103.123c7.773-32.06 10.625-68.357 8.03-98.102zm-27.52-50.31c-3.793 3.1-10.77 10.666-18.25 28.566L402.23 91.3c5.333-13.695 11.37-24.702 17.88-32.495L108.796 24.13c-2.573-.29-5.415 1.51-7.338 3.06zm280.63 283.338.61 169.352 66.352-53.63-.61-169.35zM366.163 487.9 46.62 452.306 46 278.396l319.553 35.594zM216.726 337.648a9.777 9.777 0 0 0 5.168-9.405c-.248-6.367-5.364-12.092-11.43-12.857h-.125c-6.14-.693-10.904 3.927-10.646 10.335a13.973 13.973 0 0 0 5.767 10.543l-2.17 25.073 17.57 2.005zm219.28-91.983-307.46-34.25v59.54l242.712 27.037zM58.31 263.13l54.34 6.058v-49.98z" fill="#fff" fill-opacity="1" transform="translate(25.6, 25.6) scale(0.9, 0.9) rotate(0, 256, 256) skewX(0) skewY(0)"></path></g></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,6 +1,81 @@
# 13.0
## 13.0.25 - La ménagerie d'Illysis
## 13.0.36 - Les rêveries d'Illisys
- Corrections v14
- les attaques à distance n'empèchent plus la fenêtre d'attaque de s'ouvrir
- les commandes (/help, ...) fonctionnent en v14
- Les feuilles d'acteurs ne s'ouvrent plus lors d'un changement (par exemple en cas d'encaissement)
- Les jeux sont correctement affichés
- Ajout d'une gravité de blessure sur les encaissement d'entités
- Amélioration de champs numériques: ajout de min et max quand c'est utile
- correction pour cuisiner depuis l'équipement
- les boutons dans les listes d'équipement sont mieux affichés sans retour à la ligne
## 13.0.35 - Les travaux d'Illisys
- Correction du recul contre une entité de cauchemar (qui utilise le rêve comme force)
- Correction erreur lors de la suppression d'un objet d'un conteneur
- Meilleure gestion des messages publics/GM, en particulier pour les tirage dans les compendiums
- Filtrage des boutons pour les acteurs non personnages (pour éviter de faire manger l'auberge...)
## 13.0.34 - La saumuche d'Illysis
- la qualité des "improvisations du moment" se base sur le niveau du cuisinier
- l'appel au moral n'est pas affiché à l'ouverture d'une fenêtre de jets de sorts (ou de tâche intellectuelle)
- la difficulté variable de l'annulation de magie est bien prise en compte
- correction erreur lors de la suppression d'un objet d'un conteneur
## 13.0.33 - L'ébriété d'Illysis
- le stade éméché ne cause plus de perte d'endurance
## 13.0.32 - Le surpoids d'Illysis
- Le malus d'encombrement sur jet d'Agilité avec Natation ou Acrobatie peuvent être changés, et sont correctement arrondis
- L'ajustement de condition est plus visible sur les résultats de jets de dés
- Les blessures graves soignées ne font pas perdre d'endurance par round
- Les blessures et pertes correspondantes (vie, endurance, effets sonné, ...) s'affichent correctement
- la remise à neuf ne provoque pas d'erreur pour certains effets déjà supprimés
## 13.0.31 - Les choix multiples d'Illysis
- les défauts de caractéristique/difficulté des compétences ne sont pris que si aucun autre choix n'est fait
- lors d'une attaque à deux mains avec une arme à une ou deux mains, les dommages à deux mains sont bien utilisés
## 13.0.30 - Le pansement d'Illysis
- les soins d'un joueur à l'autre fonctionne de nouveau
- la fenêtre de jet de compétence s'ouvre avec la caractéristique et la difficulté par défaut
- on peut saisir des valeurs négatives au clavier en sélectionnant les conditions/difficultés
## 13.0.29 - Le tricorne d'Illysis
- gestion des attaques avec jets V2 depuis l'onglet de combat
- les jets de résistance en mode V2 fonctionnent sans sélection de compétence
- affichage de l'expérience correspondant aux sorts pour aider à la création
- affichage de l'équivallent d'expérience des caractéristiques
## 13.0.28 - La quadrature d'Illysis
- Les ajustements de portée sont calculés pour les attaques à distance
- L'appel au moral dans le tchat ne déplace plus les boutons d'appel à la chance
- Correction d'apparence V13
- la fenêtre de choix des status utilisés est affichée correctement
- la fenêtre d'astrologie MJ est affichée correctement
## 13.0.27 - Les lunettes d'Illysis
- Les heures ne sont plus affichées en doublon sur les messages
- Les conteneurs ouverts sont mis à jour si leur contenu change
- Le style des icones d'objets est homogénéisé
- Ajout d'icônes: coffre, tissu de soie, parchemin
- Amélioration des choix d'actions de combat
- le choix d'initiative limite les attaques disponibles
- les compétences sont triées dans l'ordre décroissant
## 13.0.26 - La ménagerie d'Illysis
- Correction: on peut de nouveau modifier les caractéristiques des créatures

View File

@@ -893,7 +893,7 @@ body {
max-width: 1.4rem;
max-height: 1.4rem;
border: 1px;
background: center / contain no-repeat url("../../icons/templates/icone_parchement_vierge.webp");
background: center / contain no-repeat url("../icons/templates/icone_parchement_vierge.webp");
}
.system-foundryvtt-reve-de-dragon .sheet-header .header-compteurs {
width: calc(60% - 110px - 1rem);
@@ -1120,49 +1120,27 @@ body {
text-align: left;
}
.system-foundryvtt-reve-de-dragon .equipement-nom {
flex-grow: 3;
flex-grow: 4;
flex-shrink: 2;
margin: 0;
justify-content: center;
text-align: left;
display: ruby;
}
.system-foundryvtt-reve-de-dragon .equipement-valeur {
margin: 0;
flex-grow: 1.5;
flex-grow: 1;
flex-shrink: 1;
text-align: center;
}
.system-foundryvtt-reve-de-dragon .equipement-detail {
margin: 0;
flex-grow: 1;
align-items: center;
justify-content: center;
text-align: center;
}
.system-foundryvtt-reve-de-dragon span.equipement-detail-buttons {
margin: 0;
flex-grow: 1.5;
flex-shrink: 1;
align-items: center;
justify-content: center;
text-align: center;
display: flex;
flex-direction: row;
}
.system-foundryvtt-reve-de-dragon .equipement-button {
margin: 0;
flex-grow: 0.5;
align-items: center;
justify-content: center;
text-align: center;
}
.system-foundryvtt-reve-de-dragon :is(.item-actions-controls, .equipement-actions) {
margin: 0;
flex-grow: 1.2;
align-items: end;
justify-content: flex-end;
text-align: right;
}
.system-foundryvtt-reve-de-dragon .liste-equipement :is(.equipement-actions, .item-actions-controls) {
flex-grow: 2;
min-width: max-content;
}
.system-foundryvtt-reve-de-dragon .blessure-control {
flex-grow: 1;
@@ -1210,6 +1188,10 @@ body {
color: rgba(173, 36, 26, 0.9);
text-shadow: 1px 1px 4px #3c3c3c;
}
.system-foundryvtt-reve-de-dragon .rdd-dialog.status-effects li {
display: flex;
flex-direction: row;
}
.system-foundryvtt-reve-de-dragon .rdd-dialog-select img.select-img {
-webkit-box-flex: 0;
-ms-flex: 0 0 48px;
@@ -1522,9 +1504,20 @@ body {
.system-foundryvtt-reve-de-dragon .competence-list .item-controls.hidden-controls {
display: none !important;
}
.system-foundryvtt-reve-de-dragon .competence-header .item-actions-controls {
flex-shrink: 2;
flex-grow: 2;
}
.system-foundryvtt-reve-de-dragon .item-actions-controls,
.system-foundryvtt-reve-de-dragon .item-controls {
vertical-align: super;
margin: 0;
flex-grow: 1;
flex-shrink: 1;
align-items: end;
text-align: right;
min-width: max-content;
flex-basis: fit-content;
vertical-align: baseline;
}
.system-foundryvtt-reve-de-dragon .item-actions-controls img,
.system-foundryvtt-reve-de-dragon .item-controls img {
@@ -1734,25 +1727,121 @@ body {
.system-foundryvtt-reve-de-dragon form.app-personnage-aleatoire h2 {
min-width: 30rem;
}
.system-foundryvtt-reve-de-dragon .app-calendar-astrologie div.theme-astral {
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.theme-astral {
width: 14rem;
margin: 0.4rem;
}
.system-foundryvtt-reve-de-dragon .app-calendar-astrologie div.horloge-roue {
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-roue {
position: relative;
left: calc(50% - 6.5rem);
width: 13rem;
height: 13rem;
}
.system-foundryvtt-reve-de-dragon .app-calendar-astrologie div.horloge-roue div.horloge-heure {
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-roue div.horloge-heure {
position: absolute;
width: 1.8rem;
height: 1.8rem;
}
.system-foundryvtt-reve-de-dragon .app-calendar-astrologie div.horloge-roue div.horloge-heure img.horloge-heure-img {
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-roue div.horloge-heure img.horloge-heure-img {
width: 2rem;
height: 2rem;
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-01 {
top: calc(50% - 1rem + 0 * 41%);
left: calc(50% - 1rem + -1 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-02 {
top: calc(50% - 1rem + -0.5 * 41%);
left: calc(50% - 1rem + -0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-03 {
top: calc(50% - 1rem + -0.8660254 * 41%);
left: calc(50% - 1rem + -0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-04 {
top: calc(50% - 1rem + -1 * 41%);
left: calc(50% - 1rem + 0 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-05 {
top: calc(50% - 1rem + -0.8660254 * 41%);
left: calc(50% - 1rem + 0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-06 {
top: calc(50% - 1rem + -0.5 * 41%);
left: calc(50% - 1rem + 0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-07 {
top: calc(50% - 1rem + 0 * 41%);
left: calc(50% - 1rem + 1 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-08 {
top: calc(50% - 1rem + 0.5 * 41%);
left: calc(50% - 1rem + 0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-09 {
top: calc(50% - 1rem + 0.8660254 * 41%);
left: calc(50% - 1rem + 0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-10 {
top: calc(50% - 1rem + 1 * 41%);
left: calc(50% - 1rem + 0 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-11 {
top: calc(50% - 1rem + 0.8660254 * 41%);
left: calc(50% - 1rem + -0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-heure.heure-12 {
top: calc(50% - 1rem + 0.5 * 41%);
left: calc(50% - 1rem + -0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-01 {
top: calc(50% - 0.4rem + 0 * 28%);
left: calc(50% - 0.4rem + -1 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-02 {
top: calc(50% - 0.4rem + -0.5 * 28%);
left: calc(50% - 0.4rem + -0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-03 {
top: calc(50% - 0.4rem + -0.8660254 * 28%);
left: calc(50% - 0.4rem + -0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-04 {
top: calc(50% - 0.4rem + -1 * 28%);
left: calc(50% - 0.4rem + 0 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-05 {
top: calc(50% - 0.4rem + -0.8660254 * 28%);
left: calc(50% - 0.4rem + 0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-06 {
top: calc(50% - 0.4rem + -0.5 * 28%);
left: calc(50% - 0.4rem + 0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-07 {
top: calc(50% - 0.4rem + 0 * 28%);
left: calc(50% - 0.4rem + 1 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-08 {
top: calc(50% - 0.4rem + 0.5 * 28%);
left: calc(50% - 0.4rem + 0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-09 {
top: calc(50% - 0.4rem + 0.8660254 * 28%);
left: calc(50% - 0.4rem + 0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-10 {
top: calc(50% - 0.4rem + 1 * 28%);
left: calc(50% - 0.4rem + 0 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-11 {
top: calc(50% - 0.4rem + 0.8660254 * 28%);
left: calc(50% - 0.4rem + -0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie div.horloge-ajustement.heure-12 {
top: calc(50% - 0.4rem + 0.5 * 28%);
left: calc(50% - 0.4rem + -0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .window-app .window-content,
.system-foundryvtt-reve-de-dragon .window-app.sheet .window-content .sheet-body,
.system-foundryvtt-reve-de-dragon .application .window-content {
@@ -2279,8 +2368,9 @@ body {
}
.system-foundryvtt-reve-de-dragon .chat-inline-icon {
border: 0;
padding: 1px;
padding: 0 0.2rem;
vertical-align: text-top;
display: inline;
}
.system-foundryvtt-reve-de-dragon .actor-img-small {
max-width: 1.5rem;
@@ -2398,12 +2488,6 @@ body {
background: #1e1914;
border: 1px solid #482e1c;
}
.system-foundryvtt-reve-de-dragon #players {
border-image: url(../assets/ui/footer-button.webp) 10 repeat;
border-image-width: 4px;
border-image-outset: 0px;
background: #1e1914;
}
.system-foundryvtt-reve-de-dragon #navigation #scene-list .scene.nav-item.active {
background: #482e1c;
}
@@ -2597,102 +2681,6 @@ body {
top: calc(50% - 0.7rem + 0.5 * 38%);
left: calc(50% - 0.7rem + -0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-01 {
top: calc(50% - 1rem + 0 * 41%);
left: calc(50% - 1rem + -1 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-02 {
top: calc(50% - 1rem + -0.5 * 41%);
left: calc(50% - 1rem + -0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-03 {
top: calc(50% - 1rem + -0.8660254 * 41%);
left: calc(50% - 1rem + -0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-04 {
top: calc(50% - 1rem + -1 * 41%);
left: calc(50% - 1rem + 0 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-05 {
top: calc(50% - 1rem + -0.8660254 * 41%);
left: calc(50% - 1rem + 0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-06 {
top: calc(50% - 1rem + -0.5 * 41%);
left: calc(50% - 1rem + 0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-07 {
top: calc(50% - 1rem + 0 * 41%);
left: calc(50% - 1rem + 1 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-08 {
top: calc(50% - 1rem + 0.5 * 41%);
left: calc(50% - 1rem + 0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-09 {
top: calc(50% - 1rem + 0.8660254 * 41%);
left: calc(50% - 1rem + 0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-10 {
top: calc(50% - 1rem + 1 * 41%);
left: calc(50% - 1rem + 0 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-11 {
top: calc(50% - 1rem + 0.8660254 * 41%);
left: calc(50% - 1rem + -0.5 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-heure.heure-12 {
top: calc(50% - 1rem + 0.5 * 41%);
left: calc(50% - 1rem + -0.8660254 * 41%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-01 {
top: calc(50% - 0.4rem + 0 * 28%);
left: calc(50% - 0.4rem + -1 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-02 {
top: calc(50% - 0.4rem + -0.5 * 28%);
left: calc(50% - 0.4rem + -0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-03 {
top: calc(50% - 0.4rem + -0.8660254 * 28%);
left: calc(50% - 0.4rem + -0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-04 {
top: calc(50% - 0.4rem + -1 * 28%);
left: calc(50% - 0.4rem + 0 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-05 {
top: calc(50% - 0.4rem + -0.8660254 * 28%);
left: calc(50% - 0.4rem + 0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-06 {
top: calc(50% - 0.4rem + -0.5 * 28%);
left: calc(50% - 0.4rem + 0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-07 {
top: calc(50% - 0.4rem + 0 * 28%);
left: calc(50% - 0.4rem + 1 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-08 {
top: calc(50% - 0.4rem + 0.5 * 28%);
left: calc(50% - 0.4rem + 0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-09 {
top: calc(50% - 0.4rem + 0.8660254 * 28%);
left: calc(50% - 0.4rem + 0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-10 {
top: calc(50% - 0.4rem + 1 * 28%);
left: calc(50% - 0.4rem + 0 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-11 {
top: calc(50% - 0.4rem + 0.8660254 * 28%);
left: calc(50% - 0.4rem + -0.5 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-astrologie div.horloge-ajustement.heure-12 {
top: calc(50% - 0.4rem + 0.5 * 28%);
left: calc(50% - 0.4rem + -0.8660254 * 28%);
}
.system-foundryvtt-reve-de-dragon .calendar-boutons-heure .calendar-btn:is(.calendar-lyre, .calendar-vaisseau) img {
color: hsla(0, 0%, 100%, 0.5);
border: none;

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 136 KiB

BIN
icons/creatures/glou_t.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
icons/objets/coffre.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
icons/objets/parchemin.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1,5 +1,6 @@
<h3>Joyeuses fêtes</h3>
<h3>L'oeuf de Dragon</h3>
<p>
VincentVK, LeRatierBretonnien et toute l'équipe de Scriptrarium vous
souhaitent de joyeuses et oniriques fêtes !
On raconte que si le premier Vaisseau, on trouve un oeuf couvé par
un lapin, il faut bien s'occuper dudit lapin, car quatre mois plus tard
pourrait bien éclore un dragon!
</p>

View File

@@ -136,7 +136,7 @@
max-height: 1.4rem;
border: 1px;
background: center / contain no-repeat
url("../../icons/templates/icone_parchement_vierge.webp");
url("../icons/templates/icone_parchement_vierge.webp");
}
.sheet-header .header-compteurs {
@@ -393,49 +393,27 @@
text-align: left;
}
.equipement-nom {
flex-grow: 3;
flex-grow: 4;
flex-shrink: 2;
margin: 0;
justify-content: center;
text-align: left;
display: ruby;
}
.equipement-valeur {
margin: 0;
flex-grow: 1.5;
flex-grow: 1;
flex-shrink: 1;
text-align: center;
}
.equipement-detail {
margin: 0;
flex-grow: 1;
align-items: center;
justify-content: center;
text-align: center;
}
span.equipement-detail-buttons {
margin: 0;
flex-grow: 1.5;
flex-shrink: 1;
align-items: center;
justify-content: center;
text-align: center;
display: flex;
flex-direction: row;
}
.equipement-button {
margin: 0;
flex-grow: 0.5;
align-items: center;
justify-content: center;
text-align: center;
}
:is(.item-actions-controls, .equipement-actions) {
margin: 0;
flex-grow: 1.2;
align-items: end;
justify-content: flex-end;
text-align: right;
}
.liste-equipement :is(.equipement-actions, .item-actions-controls) {
flex-grow: 2;
min-width: max-content;
}
.blessure-control {
@@ -484,7 +462,10 @@
color: rgba(173, 36, 26, 0.9);
text-shadow: 1px 1px 4px rgba(60, 60, 60, 1);
}
.rdd-dialog.status-effects li {
display: flex;
flex-direction: row;
}
.rdd-dialog-select img.select-img {
-webkit-box-flex: 0;
-ms-flex: 0 0 48px;
@@ -845,12 +826,20 @@
.competence-list .item-controls.hidden-controls {
display: none !important;
}
.competence-header .item-actions-controls{
flex-shrink: 2;
flex-grow: 2;
}
.item-actions-controls,
.item-controls {
vertical-align: super;
// a {
// }
margin: 0;
flex-grow: 1;
flex-shrink: 1;
align-items: end;
text-align: right;
min-width: max-content;
flex-basis: fit-content;
vertical-align: baseline;
img {
vertical-align: text-bottom;
display: inline;
@@ -1065,7 +1054,7 @@
min-width: 30rem;
}
}
.app-calendar-astrologie {
.rdd-calendar-astrologie {
div.theme-astral {
width: 14rem;
margin: 0.4rem;
@@ -1085,6 +1074,105 @@
}
}
}
div.horloge-heure.heure-01 {
top: calc(50% - 1rem + sin(-180deg) * 41%);
left: calc(50% - 1rem + cos(-180deg) * 41%);
}
div.horloge-heure.heure-02 {
top: calc(50% - 1rem + sin(-150deg) * 41%);
left: calc(50% - 1rem + cos(-150deg) * 41%);
}
div.horloge-heure.heure-03 {
top: calc(50% - 1rem + sin(-120deg) * 41%);
left: calc(50% - 1rem + cos(-120deg) * 41%);
}
div.horloge-heure.heure-04 {
top: calc(50% - 1rem + sin(-90deg) * 41%);
left: calc(50% - 1rem + cos(-90deg) * 41%);
}
div.horloge-heure.heure-05 {
top: calc(50% - 1rem + sin(-60deg) * 41%);
left: calc(50% - 1rem + cos(-60deg) * 41%);
}
div.horloge-heure.heure-06 {
top: calc(50% - 1rem + sin(-30deg) * 41%);
left: calc(50% - 1rem + cos(-30deg) * 41%);
}
div.horloge-heure.heure-07 {
top: calc(50% - 1rem + sin(-0deg) * 41%);
left: calc(50% - 1rem + cos(-0deg) * 41%);
}
div.horloge-heure.heure-08 {
top: calc(50% - 1rem + sin(30deg) * 41%);
left: calc(50% - 1rem + cos(30deg) * 41%);
}
div.horloge-heure.heure-09 {
top: calc(50% - 1rem + sin(60deg) * 41%);
left: calc(50% - 1rem + cos(60deg) * 41%);
}
div.horloge-heure.heure-10 {
top: calc(50% - 1rem + sin(90deg) * 41%);
left: calc(50% - 1rem + cos(90deg) * 41%);
}
div.horloge-heure.heure-11 {
top: calc(50% - 1rem + sin(120deg) * 41%);
left: calc(50% - 1rem + cos(120deg) * 41%);
}
div.horloge-heure.heure-12 {
top: calc(50% - 1rem + sin(150deg) * 41%);
left: calc(50% - 1rem + cos(150deg) * 41%);
}
div.horloge-ajustement.heure-01 {
top: calc(50% - 0.4rem + sin(180deg) * 28%);
left: calc(50% - 0.4rem + cos(180deg) * 28%);
}
div.horloge-ajustement.heure-02 {
top: calc(50% - 0.4rem + sin(-150deg) * 28%);
left: calc(50% - 0.4rem + cos(-150deg) * 28%);
}
div.horloge-ajustement.heure-03 {
top: calc(50% - 0.4rem + sin(-120deg) * 28%);
left: calc(50% - 0.4rem + cos(-120deg) * 28%);
}
div.horloge-ajustement.heure-04 {
top: calc(50% - 0.4rem + sin(-90deg) * 28%);
left: calc(50% - 0.4rem + cos(-90deg) * 28%);
}
div.horloge-ajustement.heure-05 {
top: calc(50% - 0.4rem + sin(-60deg) * 28%);
left: calc(50% - 0.4rem + cos(-60deg) * 28%);
}
div.horloge-ajustement.heure-06 {
top: calc(50% - 0.4rem + sin(-30deg) * 28%);
left: calc(50% - 0.4rem + cos(-30deg) * 28%);
}
div.horloge-ajustement.heure-07 {
top: calc(50% - 0.4rem + sin(0deg) * 28%);
left: calc(50% - 0.4rem + cos(0deg) * 28%);
}
div.horloge-ajustement.heure-08 {
top: calc(50% - 0.4rem + sin(30deg) * 28%);
left: calc(50% - 0.4rem + cos(30deg) * 28%);
}
div.horloge-ajustement.heure-09 {
top: calc(50% - 0.4rem + sin(60deg) * 28%);
left: calc(50% - 0.4rem + cos(60deg) * 28%);
}
div.horloge-ajustement.heure-10 {
top: calc(50% - 0.4rem + sin(90deg) * 28%);
left: calc(50% - 0.4rem + cos(90deg) * 28%);
}
div.horloge-ajustement.heure-11 {
top: calc(50% - 0.4rem + sin(120deg) * 28%);
left: calc(50% - 0.4rem + cos(120deg) * 28%);
}
div.horloge-ajustement.heure-12 {
top: calc(50% - 0.4rem + sin(150deg) * 28%);
left: calc(50% - 0.4rem + cos(150deg) * 28%);
}
}
.window-app .window-content,
@@ -1674,8 +1762,9 @@
}
.chat-inline-icon {
border: 0;
padding: 1px;
padding: 0 0.2rem;
vertical-align: text-top;
display: inline;
}
.actor-img-small {
@@ -1809,13 +1898,6 @@
border: 1px solid rgba(72, 46, 28, 1);
}
#players {
border-image: url(../assets/ui/footer-button.webp) 10 repeat;
border-image-width: 4px;
border-image-outset: 0px;
background: rgba(30, 25, 20, 1);
}
#navigation #scene-list .scene.nav-item.active {
background: rgba(72, 46, 28, 1);
}
@@ -2022,106 +2104,6 @@
}
}
.calendar-astrologie {
div.horloge-heure.heure-01 {
top: calc(50% - 1rem + sin(-180deg) * 41%);
left: calc(50% - 1rem + cos(-180deg) * 41%);
}
div.horloge-heure.heure-02 {
top: calc(50% - 1rem + sin(-150deg) * 41%);
left: calc(50% - 1rem + cos(-150deg) * 41%);
}
div.horloge-heure.heure-03 {
top: calc(50% - 1rem + sin(-120deg) * 41%);
left: calc(50% - 1rem + cos(-120deg) * 41%);
}
div.horloge-heure.heure-04 {
top: calc(50% - 1rem + sin(-90deg) * 41%);
left: calc(50% - 1rem + cos(-90deg) * 41%);
}
div.horloge-heure.heure-05 {
top: calc(50% - 1rem + sin(-60deg) * 41%);
left: calc(50% - 1rem + cos(-60deg) * 41%);
}
div.horloge-heure.heure-06 {
top: calc(50% - 1rem + sin(-30deg) * 41%);
left: calc(50% - 1rem + cos(-30deg) * 41%);
}
div.horloge-heure.heure-07 {
top: calc(50% - 1rem + sin(-0deg) * 41%);
left: calc(50% - 1rem + cos(-0deg) * 41%);
}
div.horloge-heure.heure-08 {
top: calc(50% - 1rem + sin(30deg) * 41%);
left: calc(50% - 1rem + cos(30deg) * 41%);
}
div.horloge-heure.heure-09 {
top: calc(50% - 1rem + sin(60deg) * 41%);
left: calc(50% - 1rem + cos(60deg) * 41%);
}
div.horloge-heure.heure-10 {
top: calc(50% - 1rem + sin(90deg) * 41%);
left: calc(50% - 1rem + cos(90deg) * 41%);
}
div.horloge-heure.heure-11 {
top: calc(50% - 1rem + sin(120deg) * 41%);
left: calc(50% - 1rem + cos(120deg) * 41%);
}
div.horloge-heure.heure-12 {
top: calc(50% - 1rem + sin(150deg) * 41%);
left: calc(50% - 1rem + cos(150deg) * 41%);
}
div.horloge-ajustement.heure-01 {
top: calc(50% - 0.4rem + sin(180deg) * 28%);
left: calc(50% - 0.4rem + cos(180deg) * 28%);
}
div.horloge-ajustement.heure-02 {
top: calc(50% - 0.4rem + sin(-150deg) * 28%);
left: calc(50% - 0.4rem + cos(-150deg) * 28%);
}
div.horloge-ajustement.heure-03 {
top: calc(50% - 0.4rem + sin(-120deg) * 28%);
left: calc(50% - 0.4rem + cos(-120deg) * 28%);
}
div.horloge-ajustement.heure-04 {
top: calc(50% - 0.4rem + sin(-90deg) * 28%);
left: calc(50% - 0.4rem + cos(-90deg) * 28%);
}
div.horloge-ajustement.heure-05 {
top: calc(50% - 0.4rem + sin(-60deg) * 28%);
left: calc(50% - 0.4rem + cos(-60deg) * 28%);
}
div.horloge-ajustement.heure-06 {
top: calc(50% - 0.4rem + sin(-30deg) * 28%);
left: calc(50% - 0.4rem + cos(-30deg) * 28%);
}
div.horloge-ajustement.heure-07 {
top: calc(50% - 0.4rem + sin(0deg) * 28%);
left: calc(50% - 0.4rem + cos(0deg) * 28%);
}
div.horloge-ajustement.heure-08 {
top: calc(50% - 0.4rem + sin(30deg) * 28%);
left: calc(50% - 0.4rem + cos(30deg) * 28%);
}
div.horloge-ajustement.heure-09 {
top: calc(50% - 0.4rem + sin(60deg) * 28%);
left: calc(50% - 0.4rem + cos(60deg) * 28%);
}
div.horloge-ajustement.heure-10 {
top: calc(50% - 0.4rem + sin(90deg) * 28%);
left: calc(50% - 0.4rem + cos(90deg) * 28%);
}
div.horloge-ajustement.heure-11 {
top: calc(50% - 0.4rem + sin(120deg) * 28%);
left: calc(50% - 0.4rem + cos(120deg) * 28%);
}
div.horloge-ajustement.heure-12 {
top: calc(50% - 0.4rem + sin(150deg) * 28%);
left: calc(50% - 0.4rem + cos(150deg) * 28%);
}
}
.calendar-boutons-heure {
.calendar-btn:is(.calendar-lyre, .calendar-vaisseau) img {
color: hsla(0, 0%, 100%, 0.5);

View File

@@ -19,6 +19,7 @@ import { RdDCoeur } from "./coeur/rdd-coeur.js";
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
import { MORAL } from "./moral/apprecier.mjs";
import { RdDItemSort } from "./item-sort.js";
/* -------------------------------------------- */
/**
@@ -50,8 +51,9 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
foundry.utils.mergeObject(formData.calc, {
surenc: this.actor.computeMalusSurEncombrement(),
surprise: RdDBonus.find(this.actor.getSurprise(false)).label,
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
blessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
caracTotal: RdDCarac.computeTotal(this.actor.system.carac, this.actor.system.beaute),
caracTotalXp: RdDCarac.computeTotalXp(this.actor.system.carac, this.actor.system.beaute),
surEncombrementMessage: this.actor.isSurenc() ? "Sur-Encombrement!" : "",
malusArmure: this.actor.getMalusArmure()
})
@@ -61,9 +63,13 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
if (formData.type == ACTOR_TYPES.personnage) {
formData.options.mainsDirectrices = MAINS_DIRECTRICES;
formData.byCateg = Misc.classify(formData.competences, it => it.system.categorie)
formData.calc.comptageArchetype = RdDItemCompetence.computeResumeArchetype(formData.competences);
formData.calc.competenceXPTotal = RdDItemCompetence.computeTotalXP(formData.competences);
formData.calc.fatigue = RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max);
foundry.utils.mergeObject(formData.calc, {
comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.competences),
competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.competences),
sortsXPTotal: RdDItemSort.computeTotalXP(this.actor.itemTypes[ITEM_TYPES.sort]),
fatigue: RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max)
})
formData.competences.forEach(item => {
item.system.isHidden = this.options.recherche
@@ -273,7 +279,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
// On pts de reve change
this.html.find('.pointsreve-value').change(async event => await this.actor.update({ "system.reve.reve.value": event.currentTarget.value }))
this.html.find('.seuil-reve-value').change(async event => await this.actor.setPointsDeSeuil(event.currentTarget.value))
this.html.find('.seuil-reve-value').change(async event => await this.actor.update({ "system.reve.seuil.value": event.currentTarget.value }))
this.html.find('.stress-test').click(async event => await this.actor.transformerStress())
this.html.find('.moral-malheureux').click(async event => await this.actor.jetDeMoral(MORAL.MALHEUREUX))

View File

@@ -175,7 +175,7 @@ export class RdDActor extends RdDBaseActorSang {
}
isForceInsuffisante(forceRequise) {
const force = parseInt(this.system.carac.force.value)
const force = parseInt(this.getForce())
return forceRequise > force
}
@@ -418,7 +418,7 @@ export class RdDActor extends RdDBaseActorSang {
}
async _recupereMoralChateauDormant(message) {
await this.update({ 'system.compteurs.bonmoments': [] }, { render: false })
await this.update({ 'system.compteurs.bonmoments': [] })
if (!ReglesOptionnelles.isUsing("recuperation-moral")) { return }
@@ -454,7 +454,7 @@ export class RdDActor extends RdDBaseActorSang {
blessures
})));
await this.supprimerBlessures(it => it.system.gravite <= 0);
await this.supprimerBlessures(it => it.system.gravite <= 0)
}
/* -------------------------------------------- */
@@ -498,18 +498,18 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async remiseANeuf() {
await this.removeEffects(e => !e.statuses?.has(STATUSES.StatusDemiReve))
await this.supprimerBlessures(it => true)
await this.update({
'system.sante.endurance.value': this.system.sante.endurance.max,
'system.sante.vie.value': this.system.sante.vie.max,
'system.sante.fatigue.value': 0,
'system.compteurs.ethylisme': { value: 1, nb_doses: 0, jet_moral: false }
})
await this.removeEffects(e => !e.statuses?.has(STATUSES.StatusDemiReve));
await this.supprimerBlessures(it => true);
await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: 'Remise à neuf de ' + this.name
});
})
}
/* -------------------------------------------- */
@@ -689,8 +689,9 @@ export class RdDActor extends RdDBaseActorSang {
message.content += `<br>Vous n'avez bu que ${eauConsomme} doses de liquide pour une soif de ${sustNeeded}, vous avez soif!
La soif devrait vous faire ${perte} points d'endurance non récupérables, notez le cumul de côté et ajustez l'endurance`;
}
await this.updateCompteurValue('sust', 0);
await this.updateCompteurValue('eau', 0);
await this.update({ 'system.compteurs.sust.value': 0 });
await this.update({ 'system.compteurs.eau.value': 0 });
}
/* -------------------------------------------- */
@@ -703,9 +704,9 @@ export class RdDActor extends RdDBaseActorSang {
rencontre: rencontre,
tmr: true,
use: { libre: false, conditions: false },
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.getReveActuel() } }
forceCarac: this.getCaracReveActuel()
}
rollData.competence.system.defaut_carac = 'reve-actuel';
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
const dialog = await RdDRoll.create(this, rollData,
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-reve-de-dragon.hbs' },
@@ -753,25 +754,25 @@ export class RdDActor extends RdDBaseActorSang {
updates[`system.compteurs.chance.value`] = to
}
}
let selectedCarac = this.findCaracByName(caracName);
let selectedCarac = this.findCaracByName(caracName)
const from = selectedCarac.value
updates[`system.carac.${caracName}.value`] = to;
await this.update(updates, { noHook: true });
await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName);
updates[`system.carac.${caracName}.value`] = to
await this.update(updates, { noHook: true })
await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName)
}
/* -------------------------------------------- */
async updateCaracXP(caracName, to) {
if (caracName == 'Taille') {
return;
return
}
let selectedCarac = this.findCaracByName(caracName);
if (!selectedCarac.derivee) {
const from = Number(selectedCarac.xp);
await this.update({ [`system.carac.${caracName}.xp`]: to });
await ExperienceLog.add(this, XP_TOPIC.XPCARAC, from, to, caracName);
const from = Number(selectedCarac.xp)
await this.update({ [`system.carac.${caracName}.xp`]: to })
await ExperienceLog.add(this, XP_TOPIC.XPCARAC, from, to, caracName)
}
this.checkCaracXP(caracName);
this.checkCaracXP(caracName)
}
/* -------------------------------------------- */
@@ -792,9 +793,9 @@ export class RdDActor extends RdDBaseActorSang {
}
carac.xp = toXp;
carac.value = toValue;
await this.update({ [`system.carac.${caracName}`]: carac });
await ExperienceLog.add(this, XP_TOPIC.XPCARAC, fromXp, toXp, caracName);
await ExperienceLog.add(this, XP_TOPIC.CARAC, fromValue, toValue, caracName);
await this.update({ [`system.carac.${caracName}`]: carac })
await ExperienceLog.add(this, XP_TOPIC.XPCARAC, fromXp, toXp, caracName)
await ExperienceLog.add(this, XP_TOPIC.CARAC, fromValue, toValue, caracName)
}
}
@@ -813,7 +814,7 @@ export class RdDActor extends RdDBaseActorSang {
await competence.update({
"system.xp": toXp,
"system.niveau": toNiveau,
}, { render: false })
})
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name);
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name);
}
@@ -822,35 +823,35 @@ export class RdDActor extends RdDBaseActorSang {
async updateCompetenceStress(idOrName) {
const competence = this.getCompetence(idOrName);
if (!competence) {
return;
return
}
const fromXp = competence.system.xp;
const fromXpStress = this.system.compteurs.experience.value;
const fromNiveau = Number(competence.system.niveau);
const xpSuivant = RdDItemCompetence.getCompetenceNextXp(fromNiveau);
const xpRequis = xpSuivant - fromXp;
const fromXp = competence.system.xp
const fromXpStress = this.system.compteurs.experience.value
const fromNiveau = Number(competence.system.niveau)
const xpSuivant = RdDItemCompetence.getCompetenceNextXp(fromNiveau)
const xpRequis = xpSuivant - fromXp
if (fromXpStress <= 0 || fromNiveau >= competence.system.niveau_archetype) {
ui.notifications.info(`La compétence ne peut pas augmenter!
stress disponible: ${fromXpStress}
expérience requise: ${xpRequis}
niveau : ${fromNiveau}
archétype : ${competence.system.niveau_archetype}`);
archétype : ${competence.system.niveau_archetype}`)
return
}
const xpUtilise = Math.max(0, Math.min(fromXpStress, xpRequis));
const gainNiveau = (xpUtilise >= xpRequis || xpRequis <= 0) ? 1 : 0;
const toNiveau = fromNiveau + gainNiveau;
const newXp = gainNiveau > 0 ? Math.max(fromXp - xpSuivant, 0) : (fromXp + xpUtilise);
const xpUtilise = Math.max(0, Math.min(fromXpStress, xpRequis))
const gainNiveau = (xpUtilise >= xpRequis || xpRequis <= 0) ? 1 : 0
const toNiveau = fromNiveau + gainNiveau
const newXp = gainNiveau > 0 ? Math.max(fromXp - xpSuivant, 0) : (fromXp + xpUtilise)
await competence.update({
"system.xp": newXp,
"system.niveau": toNiveau,
}, { render: false })
const toXpStress = Math.max(0, fromXpStress - xpUtilise);
await this.update({ "system.compteurs.experience.value": toXpStress });
})
const toXpStress = Math.max(0, fromXpStress - xpUtilise)
await this.update({ "system.compteurs.experience.value": toXpStress })
await ExperienceLog.add(this, XP_TOPIC.TRANSFORM, fromXpStress, toXpStress, `Dépense stress`);
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, newXp, competence.name);
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name);
await ExperienceLog.add(this, XP_TOPIC.TRANSFORM, fromXpStress, toXpStress, `Dépense stress`)
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, newXp, competence.name)
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name)
}
/* -------------------------------------------- */
@@ -860,8 +861,8 @@ 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: true })
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
await competence.update({ 'system.niveau': toNiveau })
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true)
}
}
@@ -882,11 +883,13 @@ export class RdDActor extends RdDBaseActorSang {
async updateCompetenceXP(idOrName, toXp) {
let competence = this.getCompetence(idOrName);
if (competence) {
if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0;
const fromXp = competence.system.xp;
this.checkCompetenceXP(idOrName, toXp);
await competence.update({ 'system.xp': toXp }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true);
if (isNaN(toXp) || typeof (toXp) != 'number') {
toXp = 0
}
const fromXp = competence.system.xp
this.checkCompetenceXP(idOrName, toXp)
await competence.update({ 'system.xp': toXp })
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true)
if (toXp > fromXp) {
RdDUtility.checkThanatosXP(competence)
}
@@ -897,10 +900,12 @@ export class RdDActor extends RdDBaseActorSang {
async updateCompetenceXPSort(idOrName, toXpSort) {
let competence = this.getCompetence(idOrName);
if (competence) {
if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0;
const fromXpSort = competence.system.xp_sort;
await competence.update({ 'system.xp_sort': toXpSort }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true);
if (isNaN(toXpSort) || typeof (toXpSort) != 'number') {
toXpSort = 0
}
const fromXpSort = competence.system.xp_sort
await competence.update({ 'system.xp_sort': toXpSort })
await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true)
if (toXpSort > fromXpSort) {
RdDUtility.checkThanatosXP(competence)
}
@@ -917,25 +922,25 @@ export class RdDActor extends RdDBaseActorSang {
async deleteExperienceLog(from, count) {
if (from >= 0 && count > 0) {
let expLog = foundry.utils.duplicate(this.system.experiencelog);
expLog.splice(from, count);
await this.update({ [`system.experiencelog`]: expLog });
let expLog = foundry.utils.duplicate(this.system.experiencelog)
expLog.splice(from, count)
await this.update({ [`system.experiencelog`]: expLog })
}
}
/* -------------------------------------------- */
async updateCompteurValue(fieldName, to) {
const from = this.system.compteurs[fieldName].value
await this.update({ [`system.compteurs.${fieldName}.value`]: to });
await this.addStressExperienceLog(fieldName, from, to, fieldName, true);
await this.update({ [`system.compteurs.${fieldName}.value`]: to })
await this.addStressExperienceLog(fieldName, from, to, fieldName, true)
}
/* -------------------------------------------- */
async addCompteurValue(fieldName, add, raison) {
let from = this.system.compteurs[fieldName].value;
const to = Number(from) + Number(add);
await this.update({ [`system.compteurs.${fieldName}.value`]: to });
await this.addStressExperienceLog(fieldName, from, to, raison);
let from = this.system.compteurs[fieldName].value
const to = Number(from) + Number(add)
await this.update({ [`system.compteurs.${fieldName}.value`]: to })
await this.addStressExperienceLog(fieldName, from, to, raison)
}
async addStressExperienceLog(topic, from, to, raison, manuel) {
@@ -948,35 +953,22 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async distribuerStress(compteur, stress, motif) {
async distribuerStress(compteur, valeur, motif) {
if (game.user.isGM && this.hasPlayerOwner) {
switch (compteur) {
case 'stress': case 'experience':
await this.addCompteurValue(compteur, stress, motif);
const message = `${this.name} a reçu ${stress} points ${compteur == 'stress' ? "de stress" : "d'expérience"} (raison : ${motif})`;
ui.notifications.info(message);
game.users.players.filter(player => player.active && player.character?.id == this.id)
await this.addCompteurValue(compteur, valeur, motif);
const message = `${this.name} a reçu ${valeur} points ${compteur == 'stress' ? "de stress" : "d'expérience"} (raison : ${motif})`;
game.users.players.filter(player => this.testUserPermission(player, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER))
.forEach(player => ChatUtility.notifyUser(player.id, 'info', message));
}
}
}
/* -------------------------------------------- */
async updateAttributeValue(fieldName, fieldValue) {
await this.update({ [`system.attributs.${fieldName}.value`]: fieldValue });
}
/* -------------------------------------------- */
ethylisme() {
return this.system.compteurs.ethylisme?.value ?? 1;
}
malusEthylisme() {
return Math.min(0, this.ethylisme())
}
isAlcoolise() {
return this.ethylisme() < 1
}
ethylisme() { return this.system.compteurs.ethylisme?.value ?? 1 }
malusEthylisme() { return Math.min(0, this.ethylisme()) }
isAlcoolise() { return this.ethylisme() < 1 }
/* -------------------------------------------- */
async actionRefoulement(item) {
@@ -997,15 +989,15 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async ajouterRefoulement(value = 1, refouler) {
let refoulement = this.system.reve.refoulement.value + value;
const roll = new Roll("1d20");
await roll.evaluate();
await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` });
let refoulement = this.system.reve.refoulement.value + value
const roll = new Roll("1d20")
await roll.evaluate()
await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` })
if (roll.total <= refoulement) {
refoulement = 0;
await this.ajouterSouffle({ chat: true });
refoulement = 0
await this.ajouterSouffle({ chat: true })
}
await this.update({ "system.reve.refoulement.value": refoulement });
await this.update({ "system.reve.refoulement.value": refoulement })
return roll;
}
@@ -1013,14 +1005,14 @@ export class RdDActor extends RdDBaseActorSang {
async ajouterSouffle(options = { chat: false }) {
let souffle = await RdDRollTables.getSouffle()
//souffle.id = undefined; //TBC
await this.createEmbeddedDocuments('Item', [souffle]);
await this.createEmbeddedDocuments('Item', [souffle])
if (options.chat) {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: this.name + " subit un Souffle de Dragon : " + souffle.name
});
})
}
return souffle;
return souffle
}
/* -------------------------------------------- */
@@ -1028,7 +1020,7 @@ export class RdDActor extends RdDBaseActorSang {
let queue;
if (this.system.reve.reve.thanatosused) {
queue = await RdDRollTables.getOmbre();
await this.update({ "system.reve.reve.thanatosused": false });
await this.update({ "system.reve.reve.thanatosused": false })
}
else {
queue = await RdDRollTables.getQueue();
@@ -1038,7 +1030,7 @@ export class RdDActor extends RdDBaseActorSang {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: this.name + " subit une Queue de Dragon : " + queue.name
});
})
}
return queue;
}
@@ -1074,13 +1066,13 @@ export class RdDActor extends RdDBaseActorSang {
}
const donHR = await RdDItemTete.teteDonDeHautReve()
if (donHR) {
this.createEmbeddedDocuments('Item', [donHR.toObject()])
await this.createEmbeddedDocuments('Item', [donHR.toObject()])
}
}
async addSortReserve(item) {
if (item?.type == ITEM_TYPES.sort && !item.system.isrituel) {
this.$createSortReserve(item)
await this.$createSortReserve(item)
return
}
const selectSortReserve = {
@@ -1091,9 +1083,9 @@ export class RdDActor extends RdDBaseActorSang {
DialogSelect.select(selectSortReserve, sort => this.$createSortReserve(sort))
}
$createSortReserve(sort) {
async $createSortReserve(sort) {
const ptReve = Number.isInteger(sort.system.ptreve) ? Number(sort.system.ptreve) : Number(sort.system.ptreve.match(/\d+/))
this.createEmbeddedDocuments("Item",
await this.createEmbeddedDocuments("Item",
[{
type: ITEM_TYPES.sortreserve,
name: sort.name,
@@ -1141,7 +1133,7 @@ export class RdDActor extends RdDBaseActorSang {
async addTMRRencontre(currentRencontre) {
const toCreate = currentRencontre.toObject();
console.log('actor.addTMRRencontre(', toCreate, ')');
this.createEmbeddedDocuments('Item', [toCreate]);
await this.createEmbeddedDocuments('Item', [toCreate]);
}
/* -------------------------------------------- */
@@ -1161,26 +1153,17 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async regainPointDeSeuil() {
const seuil = Misc.toInt(this.system.reve.seuil.value);
const seuilMax = Misc.toInt(this.system.carac.reve.value)
async recuperationSeuilReve() {
const value = Misc.toInt(this.system.reve.seuil.value);
const max = Misc.toInt(this.system.carac.reve.value)
+ 2 * EffetsDraconiques.countAugmentationSeuil(this);
if (seuil < seuilMax) {
await this.setPointsDeSeuil(Math.min(seuil + 1, seuilMax));
if (value < max) {
const nouveauSeuil = Math.min(value + 1, max);
await this.update({ "system.reve.seuil.value": nouveauSeuil });
}
}
/* -------------------------------------------- */
async setPointsDeSeuil(seuil) {
await this.update({ "system.reve.seuil.value": seuil });
}
/* -------------------------------------------- */
async setPointsDeChance(chance) {
await this.updateCompteurValue("chance", chance);
}
async jetEndurance(resteEndurance = undefined) {
const result = super.jetEndurance(resteEndurance);
if (result.jetEndurance == 1) {
@@ -1191,13 +1174,9 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
getSConst() { return RdDCarac.calculSConst(this.getConstitution()) }
async ajoutXpConstitution(xp) {
await this.update({ "system.carac.constitution.xp": Misc.toInt(this.system.carac.constitution.xp) + xp });
}
async _gainXpConstitutionJetEndurance() {
await this.ajoutXpConstitution(1); // +1 XP !
await this.updateCaracXP('constitution', Misc.toInt(this.system.carac.constitution.xp) + 1)
return `${this.name} a obtenu 1 sur son Jet d'Endurance et a gagné 1 point d'Expérience en Constitution. Ce point d'XP a été ajouté automatiquement.`;
}
@@ -1234,27 +1213,25 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async moralIncDec(ajustementMoral, bonmoment = "") {
if (ajustementMoral != 0) {
if (ajustementMoral > 0 && bonmoment != "" && bonmoment != undefined) {
const bonmoments = [...this.system.compteurs.bonmoments, bonmoment]
await this.update({ 'system.compteurs.bonmoments': bonmoments }, { render: false })
async moralIncDec(ajustement, bonmoment = "") {
let moral = parseInt(this.system.compteurs.moral.value)
if (ajustement != 0) {
if (ajustement > 0 && bonmoment != "" && bonmoment != undefined) {
await this.update({ 'system.compteurs.bonmoments': [...this.system.compteurs.bonmoments, bonmoment] })
}
const startMoral = parseInt(this.system.compteurs.moral.value)
const moralTheorique = startMoral + ajustementMoral
const moralTheorique = moral + ajustement
if (moralTheorique > 3) { // exaltation
const ajoutExaltation = moralTheorique - 3
const exaltation = parseInt(this.system.compteurs.exaltation.value) + ajoutExaltation
await this.updateCompteurValue('exaltation', exaltation)
const exaltation = parseInt(this.system.compteurs.exaltation.value) + moralTheorique - 3
await this.update({ 'system.compteurs.exaltation.value': exaltation })
}
if (moralTheorique < -3) { // dissolution
const ajoutDissolution = -3 - moralTheorique
const dissolution = parseInt(this.system.compteurs.dissolution.value) + ajoutDissolution
await this.updateCompteurValue('dissolution', dissolution)
const dissolution = parseInt(this.system.compteurs.dissolution.value) - 3 - moralTheorique
await this.update({ 'system.compteurs.dissolution.value': dissolution })
}
await this.updateCompteurValue('moral', Math.max(-3, Math.min(moralTheorique, 3)));
moral = Math.max(-3, Math.min(moralTheorique, 3));
await this.update({ 'system.compteurs.moral.value': moral })
}
return this.system.compteurs.moral.value;
return moral
}
/* -------------------------------------------- */
@@ -1386,7 +1363,7 @@ export class RdDActor extends RdDBaseActorSang {
async manger(item, doses, options = { diminuerQuantite: true }) {
const sust = item.system.sust
if (sust > 0) {
await this.updateCompteurValue('sust', RdDActor.$calculNewSust(this.system.compteurs.sust.value, sust, doses));
await this.update({ 'system.compteurs.sust.value': RdDActor.$calculNewSust(this.system.compteurs.sust.value, sust, doses) })
}
await item.diminuerQuantite(doses, options);
}
@@ -1394,9 +1371,9 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async boire(item, doses, options = { diminuerQuantite: true }) {
const desaltere = item.system.desaltere;
if (desaltere > 0) {
await this.updateCompteurValue('eau', RdDActor.$calculNewSust(this.system.compteurs.eau.value, desaltere, doses));
const eau = item.system.desaltere
if (eau > 0) {
await this.update({ 'system.compteurs.eau.value': RdDActor.$calculNewSust(this.system.compteurs.eau.value, eau, doses) })
}
if (item.isAlcool()) {
for (let i = 0; i < doses; i++) {
@@ -1421,6 +1398,7 @@ export class RdDActor extends RdDBaseActorSang {
actor: this,
vie: this.system.sante.vie.max,
alcool: alcool,
perteEndurance: 0,
jetVie: {
forceAlcool: forceAlcool,
nbDoses: nbDoses,
@@ -1433,7 +1411,7 @@ export class RdDActor extends RdDBaseActorSang {
}
await RdDResolutionTable.rollData(ethylismeData.jetVie);
this.gererExperience(ethylismeData.jetVie);
this.ajoutExperience(ethylismeData.jetVie);
RollDataAjustements.calcul(ethylismeData.jetVie, this);
if (ethylismeData.jetVie.rolled.isSuccess) {
ethylisme.nb_doses++;
@@ -1441,8 +1419,9 @@ export class RdDActor extends RdDBaseActorSang {
ethylisme.value = Math.max(ethylisme.value - 1, -7);
ethylisme.nb_doses = 0;
let perte = await RdDDice.rollTotal("1d6");
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte);
if (ethylisme.value > 0) {
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -(await RdDDice.rollTotal("1d6")))
}
if (!ethylisme.jet_moral) {
ethylismeData.jetMoral = await this._jetDeMoral(MORAL.HEUREUX, "Ethylisme");
@@ -1465,7 +1444,7 @@ export class RdDActor extends RdDBaseActorSang {
finalLevel: Number(ethylisme.value) + Number(this.system.compteurs.moral.value)
}
await RdDResolutionTable.rollData(ethylismeData.jetVolonte);
this.gererExperience(ethylismeData.jetVolonte);
this.ajoutExperience(ethylismeData.jetVolonte);
RollDataAjustements.calcul(ethylismeData.jetVolonte, this);
}
}
@@ -1521,13 +1500,12 @@ export class RdDActor extends RdDBaseActorSang {
const toStress = Math.max(fromStress - stressRollData.perte - 1, 0);
const fromXpSress = Number(this.system.compteurs.experience.value);
const toXpStress = fromXpSress + Number(stressRollData.xp);
const updates = {
await this.update({
"system.compteurs.stress.value": toStress,
"system.compteurs.experience.value": toXpStress,
"system.compteurs.dissolution.value": dissolution - perteDissolution,
"system.compteurs.exaltation.value": 0
}
await this.update(updates);
})
await ExperienceLog.add(this, XP_TOPIC.STRESS, fromStress, toStress, 'Transformation')
await ExperienceLog.add(this, XP_TOPIC.TRANSFORM, fromXpSress, toXpStress, 'Transformation')
}
@@ -1560,21 +1538,6 @@ export class RdDActor extends RdDBaseActorSang {
return 0;
}
/* -------------------------------------------- */
createCallbackExperience() {
return {
action: r => this.appliquerAjoutExperience(r)
};
}
/* -------------------------------------------- */
createCallbackAppelAuMoral() { /* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */
return {
action: r => this.appliquerAppelMoral(r)
};
}
/* -------------------------------------------- */
isCaracMax(code) {
return RdDItemRace.isRacialMax(this, code)
@@ -1608,38 +1571,11 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async checkCompetenceXP(compName, newXP, display = true) {
let compData = this.getCompetence(compName);
if (compData && newXP && newXP == compData.system.xp) { // Si édition, mais sans changement XP
return;
}
newXP = (newXP) ? newXP : compData.system.xp;
if (compData && newXP > 0) {
let xpNeeded = RdDItemCompetence.getCompetenceNextXp(compData.system.niveau + 1);
if (newXP >= xpNeeded) {
let newCompData = foundry.utils.duplicate(compData);
newCompData.system.niveau += 1;
newCompData.system.xp = newXP;
let checkXp = {
alias: this.getAlias(),
competence: newCompData.name,
niveau: newCompData.system.niveau,
xp: newCompData.system.xp,
archetype: newCompData.system.niveau_archetype,
archetypeWarning: newCompData.system.niveau > compData.system.niveau_archetype
}
if (display) {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.hbs`, checkXp)
});
}
return checkXp;
}
}
return this.getCompetence(compName)?.checkCompetenceXP( newXP, display)
}
/* -------------------------------------------- */
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
async ajoutExperience(rollData, hideChatMessage = 'show') {
if (!rollData.rolled.isPart ||
rollData.finalLevel >= 0 ||
game.settings.get("core", "rollMode") == 'selfroll' ||
@@ -1805,30 +1741,30 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async _rollUnSortResult(rollData) {
let rolled = rollData.rolled;
let selectedSort = rollData.selectedSort;
let rolled = rollData.rolled
let selectedSort = rollData.selectedSort
rollData.isSortReserve = rollData.mettreEnReserve && !selectedSort.system.isrituel;
rollData.isSortReserve = rollData.mettreEnReserve && !selectedSort.system.isrituel
rollData.show = {}
rollData.depenseReve = Number(selectedSort.system.ptreve_reel);
rollData.depenseReve = Number(selectedSort.system.ptreve_reel)
if (rollData.competence.name.includes('Thanatos')) { // Si Thanatos
await this.update({ "system.reve.reve.thanatosused": true });
await this.update({ "system.reve.reve.thanatosused": true })
}
let reveActuel = parseInt(this.system.reve.reve.value)
if (rolled.isSuccess) { // Réussite du sort !
if (rolled.isPart) {
rollData.depenseReve = Math.max(Math.floor(rollData.depenseReve / 2), 1);
rollData.depenseReve = Math.max(Math.floor(rollData.depenseReve / 2), 1)
}
if (rollData.isSortReserve) {
rollData.depenseReve++;
rollData.depenseReve++
}
if (reveActuel > rollData.depenseReve) {
// Incrémenter/gére le bonus de case
RdDItemSort.incrementBonusCase(this, selectedSort, rollData.tmr.coord);
RdDItemSort.incrementBonusCase(this, selectedSort, rollData.tmr.coord)
if (rollData.isSortReserve) {
await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel));
await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel))
}
else {
console.log('lancement de sort', rollData.selectedSort)
@@ -1853,16 +1789,15 @@ export class RdDActor extends RdDBaseActorSang {
}
}
reveActuel = Math.max(reveActuel - rollData.depenseReve, 0);
await this.update({ "system.reve.reve.value": reveActuel });
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-sort.hbs');
reveActuel = Math.max(reveActuel - rollData.depenseReve, 0)
await this.update({ "system.reve.reve.value": reveActuel })
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-sort.hbs')
if (reveActuel == 0) { // 0 points de reve
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" })
}
if (!rollData.isSortReserve || !rolled.isSuccess) {
this.tmrApp?.close();
this.tmrApp?.close()
}
}
@@ -1891,16 +1826,11 @@ export class RdDActor extends RdDBaseActorSang {
};
RollDataAjustements.calcul(rollData, this);
await RdDResolutionTable.rollData(rollData);
this.gererExperience(rollData);
this.ajoutExperience(rollData);
await RdDRollResult.displayRollData(rollData, this)
return rollData.rolled;
}
/* -------------------------------------------- */
gererExperience(rollData) {
this.createCallbackExperience().action(rollData);
}
/* -------------------------------------------- */
async creerTacheDepuisLivre(item, options = { renderSheet: true }) {
const nomTache = "Lire " + item.name;
@@ -2228,12 +2158,11 @@ export class RdDActor extends RdDBaseActorSang {
let destinee = this.system.compteurs.destinee?.value ?? 0;
if (destinee > 0) {
ChatMessage.create({ content: `<span class="rdd-roll-part">${this.name} a fait appel à la Destinée !</span>` });
destinee--;
await this.updateCompteurValue("destinee", destinee);
onSuccess();
await this.update({ 'system.compteurs.destinee.value ': destinee - 1 })
onSuccess()
}
else {
onEchec();
onEchec()
}
}
@@ -2294,7 +2223,7 @@ export class RdDActor extends RdDBaseActorSang {
const from = Number(xpData.competence.system.xp);
const to = from + xpData.xpCompetence;
await this.updateEmbeddedDocuments('Item', [{ _id: xpData.competence._id, 'system.xp': to }]);
xpData.checkComp = await this.checkCompetenceXP(xpData.competence.name, undefined, false);
xpData.checkComp = await this.checkCompetenceXP(xpData.competence.name, undefined, false)
await ExperienceLog.add(this, XP_TOPIC.XP, from, to, xpData.competence.name);
return [xpData]
}
@@ -2479,10 +2408,13 @@ export class RdDActor extends RdDBaseActorSang {
async quitterTMR(message, viewOnly, cumulFatigue) {
if (this.tmrApp) {
this.tmrApp = undefined
const appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue");
await this.santeIncDec(
appliquerFatigue ? "fatigue" : "endurance",
(appliquerFatigue ? 1 : -1) * cumulFatigue)
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
await this.santeIncDec("fatigue", cumulFatigue)
}
else {
await this.santeIncDec("endurance", - cumulFatigue)
}
if (!viewOnly) {
await this.supprimerSignesDraconiques(it => it.system.ephemere && it.system.duree == '1 round', { render: false })
await this.setEffect(STATUSES.StatusDemiReve, false)
@@ -2504,9 +2436,9 @@ export class RdDActor extends RdDBaseActorSang {
const blessure = blesse.blessuresASoigner().find(it => it.id == blessureId);
if (blessure) {
if (!blessure.system.premierssoins.done) {
const tache = await this.getTacheBlessure(blesse, blessure);
return await this.rollTache(tache.id, {
callbacks: [async r => await blesse.onRollTachePremiersSoins(blessureId, r, this.id)],
const tacheId = (await this.getTacheBlessure(blesse, blessure))?.id
return await this.rollTache(tacheId, {
callbacks: [async r => await blesse.callbackPremiersSoins(blessureId, r, this.id)],
title: 'Premiers soins', forced: true
});
}
@@ -2545,10 +2477,10 @@ export class RdDActor extends RdDBaseActorSang {
async equiperObjet(item) {
if (item?.isEquipable()) {
const isEquipe = !item.system.equipe;
await item.update({ "system.equipe": isEquipe });
await item.update({ "system.equipe": isEquipe })
this.computeEncTotal()
if (isEquipe)
this.verifierForceMin(item);
this.verifierForceMin(item)
}
}
@@ -2691,10 +2623,10 @@ export class RdDActor extends RdDBaseActorSang {
async setPointsCoeur(subActorId, coeurs, options = { immediat: false }) {
const newSuivants = foundry.utils.duplicate(this.system.subacteurs.suivants)
const amoureux = newSuivants.find(it => it.id == subActorId);
const amoureux = newSuivants.find(it => it.id == subActorId)
if (amoureux) {
amoureux[options.immediat ? 'coeur' : 'prochainCoeur'] = coeurs
await this.update({ 'system.subacteurs.suivants': newSuivants });
await this.update({ 'system.subacteurs.suivants': newSuivants })
}
}
@@ -2748,9 +2680,9 @@ export class RdDActor extends RdDBaseActorSang {
let alreadyPresent = dataArray.find(attached => attached.id == subActor.id);
if (!alreadyPresent) {
let newArray = [...dataArray, subActor]
await this.update({ [dataPath]: newArray });
await this.update({ [dataPath]: newArray })
} else {
ui.notifications.warn(dataName + " est déja attaché à " + this.name);
ui.notifications.warn(dataName + " est déja attaché à " + this.name)
}
}
@@ -2772,36 +2704,37 @@ export class RdDActor extends RdDBaseActorSang {
async deleteSubActeur(actorId) {
['vehicules', 'suivants', 'montures'].forEach(async type => {
const subList = this.system.subacteurs[type];
const subList = this.system.subacteurs[type]
if (subList.find(it => it.id == actorId)) {
let newList = subList.filter(it => it.id != actorId)
await this.update({ [`system.subacteurs.${type}`]: newList }, { renderSheet: false });
await this.update({ [`system.subacteurs.${type}`]: newList }, { render: false })
}
})
}
/* -------------------------------------------- */
async buildPotionGuerisonList(pointsGuerison) {
const pointsGuerisonInitial = pointsGuerison;
const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure').sort(Misc.descending(it => it.system.gravite))
const pointsGuerisonInitial = pointsGuerison
const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure')
.sort(Misc.descending(it => it.system.gravite))
const ids = []
const guerisonData = { list: [], pointsConsommes: 0 }
for (let blessure of blessures) {
if (pointsGuerison >= blessure.system.gravite) {
pointsGuerison -= blessure.system.gravite;
guerisonData.list.push(`1 Blessure ${blessure.system.label} (${blessure.system.gravite} points)`);
pointsGuerison -= blessure.system.gravite
guerisonData.list.push(`1 Blessure ${blessure.system.label} (${blessure.system.gravite} points)`)
ids.push(blessure.id)
}
}
if (ids.length > 0) {
await this.supprimerBlessures(it => ids.includes(it.id));
await this.supprimerBlessures(it => ids.includes(it.id))
}
if (blessures.length == ids.length) {
let pvManquants = this.system.sante.vie.max - this.system.sante.vie.value;
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2));
pointsGuerison -= pvSoignees * 2;
guerisonData.list.push(pvSoignees + " Points de Vie soignés");
await this.santeIncDec('vie', +pvSoignees, false);
await this.santeIncDec('vie', +pvSoignees)
}
guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison;
return guerisonData;
@@ -2931,12 +2864,6 @@ export class RdDActor extends RdDBaseActorSang {
await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potion.supprimer });
}
/* -------------------------------------------- */
async onPreUpdateItem(item, change, options, id) {
if (item.isCompetencePersonnage() && item.system.defaut_carac && item.system.xp) {
await this.checkCompetenceXP(item.name, item.system.xp);
}
}
/* -------------------------------------------- */
async onCreateItem(item, options, id) {
switch (item.type) {

View File

@@ -26,7 +26,7 @@ import { BASE_CORPS_A_CORPS, BASE_ESQUIVE, CATEGORIES_COMPETENCES_CREATURES } fr
import { RollDataAjustements } from "../rolldata-ajustements-v1.js";
import { MappingCreatureArme } from "../item/mapping-creature-arme.mjs";
import RollDialog from "../roll/roll-dialog.mjs";
import { ATTAQUE_ROLL_TYPES, DEFAULT_ROLL_TYPES, DIFF, ROLL_TYPE_ATTAQUE } from "../roll/roll-constants.mjs";
import { DEFAULT_ROLL_TYPES, DIFF, ROLL_TYPE_ATTAQUE } from "../roll/roll-constants.mjs";
import { OptionsAvancees, ROLL_DIALOG_V2 } from "../settings/options-avancees.js";
import { PART_COMP } from "../roll/roll-part-comp.mjs";
import { RdDInitiative } from "../initiative.mjs";
@@ -48,39 +48,24 @@ export class RdDBaseActorReve extends RdDBaseActor {
}
getCarac() {
return foundry.utils.mergeObject(this.system.carac,
{
'reve-actuel': this.getCaracReveActuel(),
'chance-actuelle': this.getCaracChanceActuelle()
},
{ inplace: false })
}
getCaracChanceActuelle() {
return {
label: 'Chance actuelle',
value: this.getChanceActuel(),
type: "number"
};
}
getCaracReveActuel() {
return {
label: 'Rêve actuel',
value: this.getReveActuel(),
type: "number"
};
const carac = super.getCarac()
foundry.utils.mergeObject(carac, this.getCaracReveActuel())
foundry.utils.mergeObject(carac, this.getCaracCompetenceCreature(), { overwrite: false })
return carac
}
getTaille() { return Misc.toInt(this.system.carac.taille?.value) }
getConstitution() { return this.getReve() }
getForce() { return this.getReve() }
getAgilite() { return this.getForce() }
getReve() { return Misc.toInt(this.system.carac.reve?.value) }
getChance() { return this.getReve() }
getChanceActuel() { return this.getChance() }
getCaracChanceActuelle() { return { [CARACS.CHANCE_ACTUELLE]: { label: 'Chance actuelle', value: this.getChanceActuel(), type: "number" } } }
getReveActuel() { return this.getReve() }
getChanceActuel() { return this.getChance() }
getCaracReveActuel() { return { [CARACS.REVE_ACTUEL]: { label: "Rêve Actuel", value: this.getReveActuel(), type: "number" } } }
getEnduranceMax() { return Math.max(1, this.getTaille() + this.getConstitution()) }
getEncombrementMax() { return (this.getForce() + this.getTaille()) / 2 }
@@ -169,11 +154,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
async computeArmure(dmg) { return this.getProtectionNaturelle() }
async remiseANeuf() { }
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { }
async ajoutExperience(rollData, hideChatMessage = 'show') { }
computeResumeBlessure() { }
computeResumeBlessure() { return []}
countBlessures(filter = it => !it.isContusion()) { return 0 }
async santeIncDec(name, inc, isCritique = false) { }
async santeIncDec(name, inc, isCritique) { }
async finDeRound(options = { terminer: false }) {
await this.finDeRoundSuppressionEffetsTermines(options)
@@ -270,15 +255,15 @@ export class RdDBaseActorReve extends RdDBaseActor {
if (competence) {
function getFieldPath(fieldName) {
switch (fieldName) {
case "niveau": return 'system.niveau';
case "dommages": return 'system.dommages';
case "carac_value": return 'system.carac_value';
case "niveau": return 'system.niveau'
case "dommages": return 'system.dommages'
case "carac_value": return 'system.carac_value'
}
return undefined
}
const path = getFieldPath(fieldName);
const path = getFieldPath(fieldName)
if (path) {
await competence.update({ [path]: value });
await competence.update({ [path]: value })
}
}
}
@@ -310,7 +295,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
/* -------------------------------------------- */
createCallbackExperience() {
return { action: r => this.appliquerAjoutExperience(r) }
return { action: r => this.ajoutExperience(r) }
}
/* -------------------------------------------- */
@@ -319,7 +304,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
return { action: r => this.appliquerAppelMoral(r) }
}
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { }
async ajoutExperience(rollData, hideChatMessage = 'show') { }
async appliquerAppelMoral(rollData) { }
async _onCloseRollDialog(html) { }
@@ -386,13 +371,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
}
RollDataAjustements.calcul(rollData, this);
await RdDResolutionTable.rollData(rollData);
this.gererExperience(rollData);
this.ajoutExperience(rollData);
await RdDResolutionTable.displayRollData(rollData, this)
return rollData.rolled;
}
gererExperience(rollData) { }
/* -------------------------------------------- */
async roll() {
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
@@ -497,17 +480,15 @@ export class RdDBaseActorReve extends RdDBaseActor {
async rollCompetence(idOrName, options = { tryTarget: true, arme: undefined }) {
RdDEmpoignade.checkEmpoignadeEnCours(this)
const competence = this.getCompetence(idOrName);
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
const rollData = {
ids: { actorId: this.id },
type: { allowed: options.arme ? ATTAQUE_ROLL_TYPES : DEFAULT_ROLL_TYPES },
type: { allowed: DEFAULT_ROLL_TYPES },
selected: {
carac: competence.type == ITEM_TYPES.competencecreature ? { key: competence.name } : undefined,
comp: { key: competence.name },
diff: { type: options.arme ? DIFF.ATTAQUE : DIFF.LIBRE, value: competence.system.default_diffLibre ?? 0 },
attaque: options.arme ? { arme: { key: options.arme.id } } : undefined
diff: { type: DIFF.LIBRE, value: competence.system.default_diffLibre ?? 0 },
}
}
return await RollDialog.create(rollData)
@@ -579,7 +560,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
type: {
allowed: [ROLL_TYPE_ATTAQUE], current: ROLL_TYPE_ATTAQUE
}
};
}
return await RollDialog.create(rollData, { onRollDone: RollDialog.onRollDoneClose })
}
})
@@ -588,16 +569,18 @@ export class RdDBaseActorReve extends RdDBaseActor {
/** --------------------------------------------
* @param {*} arme item d'arme/compétence de créature
* @param {*} categorieArme catégorie d'attaque à utiliser: competence (== melee), lancer, tir; naturelle, possession
* @param {*} maniement catégorie d'attaque à utiliser: competence (== melee), lancer, tir; naturelle, possession
* @returns
*/
rollArme(arme, categorieArme = 'competence', token = undefined) {
async rollArme(arme, maniement = 'competence', token = undefined) {
token = token ?? RdDUtility.getSelectedToken(this)
const compToUse = RdDItemArme.getCompetenceArme(arme, categorieArme)
const compToUse = RdDItemArme.getCompetenceArme(arme, maniement)
if (!RdDItemArme.isUtilisable(arme)) {
ui.notifications.warn(`Arme inutilisable: ${arme.name} non équipée ou avec une résistance de 0 ou moins`)
return
}
if (!Targets.hasTargets()) {
RdDConfirm.confirmer({
settingConfirmer: "confirmer-combat-sans-cible",
@@ -609,7 +592,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
onAction: async () => {
this.rollCompetence(compToUse, { tryTarget: false, arme: arme })
}
});
})
return
}
@@ -619,11 +602,12 @@ export class RdDBaseActorReve extends RdDBaseActor {
return
}
const competence = this.getCompetence(compToUse)
if (competence.isCompetencePossession()) {
return RdDPossession.onAttaquePossession(target, this, competence);
const comp = this.getCompetence(compToUse)
if (comp.isCompetencePossession()) {
// TODO: vérifier si c'est possible, sinon simplifier
return RdDPossession.onAttaquePossession(target, this, comp);
}
RdDCombat.rddCombatTarget(target, this, token).attaque(competence, arme);
RdDCombat.rddCombatTarget(target, this, token).attaque(comp, arme, maniement)
})
}
@@ -670,28 +654,23 @@ export class RdDBaseActorReve extends RdDBaseActor {
jet => this.$onEncaissement(jet, show, attackerToken, defenderToken));
}
}
async $onEncaissement(jet, show, attackerToken, defenderToken) {
await this.onAppliquerJetEncaissement(jet, attackerToken);
await this.$afficherEncaissement(jet, show, defenderToken);
}
async onAppliquerJetEncaissement(encaissement, attackerToken) { }
async $afficherEncaissement(encaissement, show, defenderToken) {
async $onEncaissement(encaissement, show, attackerToken, defenderToken) {
await this.onAppliquerJetEncaissement(encaissement, attackerToken);
foundry.utils.mergeObject(encaissement, {
alias: defenderToken?.name ?? this.getAlias(),
hasPlayerOwner: this.hasPlayerOwner,
show: show ?? {}
}, { overwrite: false });
await ChatUtility.createChatWithRollMode(
await ChatMessage.create(ChatUtility.adaptVisibility(
{
roll: encaissement.roll,
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
},
this
)
{ actor: this }))
if (!encaissement.hasPlayerOwner && encaissement.endurance != 0) {
encaissement = foundry.utils.duplicate(encaissement)
@@ -746,7 +725,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
}
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.hbs')
await this.appliquerAjoutExperience(rollData, true)
await this.ajoutExperience(rollData, true)
return rolled.isSuccess;
}

View File

@@ -8,6 +8,7 @@ import { RdDItemBlessure } from "../item/blessure.js";
import { ChatUtility } from "../chat-utility.js";
import { Misc } from "../misc.js";
import { RdDBaseActor } from "./base-actor.js";
import { CARACS } from "../rdd-carac.js";
/**
* Classe de base pour les acteurs qui peuvent subir des blessures
@@ -16,6 +17,14 @@ import { RdDBaseActor } from "./base-actor.js";
*/
export class RdDBaseActorSang extends RdDBaseActorReve {
async _preUpdate(changed, options, user) {
const updatedEndurance = changed?.system?.sante?.endurance
if (updatedEndurance && options.diff) {
await this.setEffect(STATUSES.StatusUnconscious, updatedEndurance.value == 0)
}
}
prepareActorData() {
this.system.sante.vie.max = Math.ceil((this.getTaille() + this.getConstitution()) / 2)
this.system.sante.vie.value = Math.min(this.system.sante.vie.value, this.system.sante.vie.max)
@@ -23,10 +32,18 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
this.system.attributs.encombrement.value = this.getEncombrementMax()
}
getCarac() {
const carac = super.getCarac()
foundry.utils.mergeObject(carac, this.getCaracChanceActuelle())
foundry.utils.mergeObject(carac, this.getCaracVie())
return carac
}
getForce() { return Misc.toInt(this.system.carac.force?.value) }
getConstitution() { return Misc.toInt(this.system.carac.constitution?.value) }
getVolonte() { return Misc.toInt(this.system.carac.volonte?.value) }
getCaracVie() { return { [CARACS.VIE]: { label: "Vie", value: this.getVieMax(), type: "number" } } }
getVieMax() { return Misc.toInt(this.system.sante.vie?.max) }
getEnduranceMax() { return Math.max(1, this.getTaille() + this.getConstitution()) }
getFatigueMax() { return this.getEnduranceMax() * 2 }
@@ -62,51 +79,64 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
return Math.min(0, Math.floor(this.getEncombrementMax() - this.encTotal));
}
countBlessures(filter) { return this.itemTypes[ITEM_TYPES.blessure].filter(filter).length }
isDead() { return this.system.sante.vie.value < -this.getSConst() }
nbBlessuresLegeres() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isLegere()).length }
nbBlessuresGraves() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isGrave()).length }
nbBlessuresCritiques() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isCritique()).length }
/* -------------------------------------------- */
computeResumeBlessure() {
const nbLegeres = this.nbBlessuresLegeres()
const nbGraves = this.nbBlessuresGraves()
const nbCritiques = this.nbBlessuresCritiques()
function descBlessure(count, name) {
return count > 0 ? [`${count} ${name}${count > 1 ? "s" : ""}`] : []
}
if (nbLegeres + nbGraves + nbCritiques == 0) {
return "Aucune blessure";
}
let resume = "Blessures:";
if (nbLegeres > 0) {
resume += " " + nbLegeres + " légère" + (nbLegeres > 1 ? "s" : "");
}
if (nbGraves > 0) {
if (nbLegeres > 0)
resume += ",";
resume += " " + nbGraves + " grave" + (nbGraves > 1 ? "s" : "");
}
if (nbCritiques > 0) {
if (nbGraves > 0 || nbLegeres > 0)
resume += ",";
resume += " une CRITIQUE !";
}
return resume;
const nbContusions = this.countBlessures(it => it.isContusion())
const nbLegeres = this.countBlessures(it => it.isLegere())
const nbGraves = this.countBlessures(it => it.isGrave())
const nbCritiques = this.countBlessures(it => it.isCritique())
return [
... (nbCritiques > 0 ? ['une CRITIQUE !'] : []),
...descBlessure(nbGraves, 'grave'),
...descBlessure(nbLegeres, 'légère'),
...descBlessure(nbContusions, 'contusion'),
]
}
blessuresASoigner() { return [] }
async computeArmure(attackerRoll) { return this.getProtectionNaturelle() }
async remiseANeuf() { }
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { }
async ajoutExperience(rollData, hideChatMessage = 'show') { }
/* -------------------------------------------- */
async onAppliquerJetEncaissement(encaissement, attackerToken) {
const santeOrig = foundry.utils.duplicate(this.system.sante);
const blessure = await this.ajouterBlessure(encaissement, attackerToken); // Will update the result table
const perteVie = await this.santeIncDec("vie", -encaissement.vie);
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, blessure?.isCritique());
const blessure = this.nouvelleBlessure(encaissement.gravite, {
localisation: encaissement.dmg?.loc.label ?? '',
origine: attackerToken?.name ?? ''
})
if (blessure.system.gravite == encaissement.gravite) {
blessure.system.vie = encaissement.vie
blessure.system.endurance = encaissement.endurance
}
else { // aggravation du fait du nombre de blessures
blessure.system.vie = blessure.system.vie
const rollPerteEndurance = new Roll(blessure.system.endurance)
await rollPerteEndurance.evaluate()
blessure.system.endurance = rollPerteEndurance.total
}
const isCritique = blessure.system.gravite >= 6;
if (isCritique) {
blessure.system.endurance = this.getEnduranceActuelle()
}
// Will update the result table
if (blessure.system.gravite > 6) {
this.setEffect(STATUSES.StatusComma, true)
encaissement.mort = "à seconde blessure critique"
}
const perteVie = await this.santeIncDec("vie", -encaissement.vie)
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, isCritique)
await this.createEmbeddedDocuments('Item', [blessure])
foundry.utils.mergeObject(encaissement, {
resteEndurance: perteEndurance.newValue,
@@ -115,7 +145,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
endurance: perteEndurance.perte,
vie: santeOrig.vie.value - perteVie.newValue,
blessure: blessure
});
})
}
/* -------------------------------------------- */
@@ -133,12 +163,13 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
let minValue = name == "vie" ? -this.getSConst() - 1 : 0;
result.newValue = Math.max(minValue, Math.min(compteur.value + inc, compteur.max));
//console.log("New value ", inc, minValue, result.newValue);
let fatigue = 0;
if (name == "endurance") {
if (result.newValue == 0 && inc < 0 && !isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie
sante.vie.value--;
result.perteVie = true;
if (result.newValue == 0 && inc < 0 && !isCritique) {
// perte endurance et endurance devient 0 (sauf critique) -> -1 vie
sante.vie.value--
result.perteVie = true
}
result.newValue = Math.max(0, result.newValue);
if (inc > 0) { // le max d'endurance s'applique seulement à la récupération
@@ -155,34 +186,39 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
if (ReglesOptionnelles.isUsing("appliquer-fatigue") && sante.fatigue && fatigue > 0) {
sante.fatigue.value = Math.max(sante.fatigue.value + fatigue, this.getFatigueMin());
}
await this.update({ "system.sante": sante }, { render: true })
await this.update({ "system.sante": sante })
if (perteEndurance > 1) {
// Peut-être sonné si 2 points d'endurance perdus d'un coup
foundry.utils.mergeObject(result, await this.jetEndurance(result.newValue));
} else if (name == "endurance" && inc > 0) {
await this.setSonne(false);
await this.setSonne(false)
}
if (this.isDead()) {
await this.setEffect(STATUSES.StatusComma, true);
await this.setEffect(STATUSES.StatusComma, true)
}
return result
}
async onRollTachePremiersSoins(blessureId, rollData, soigneurId) {
async callbackPremiersSoins(blessureId, rollData, soigneurId) {
await this.onRollTachePremiersSoins(blessureId,
rollData.v2 ? rollData.current.tache.tache : rollData.tache,
rollData.rolled.isETotal,
soigneurId)
}
async onRollTachePremiersSoins(blessureId, tache, isETotal, soigneurId) {
if (!this.isOwner) {
return RdDBaseActor.remoteActorCall({
tokenId: this.token?.id,
actorId: this.id,
method: 'onRollTachePremiersSoins', args: [blessureId, rollData, soigneurId]
method: 'onRollTachePremiersSoins', args: [blessureId, tache, isETotal, soigneurId]
})
}
const blessure = this.getItem(blessureId, 'blessure')
if (blessure && !blessure.system.premierssoins.done) {
const tache = rollData.v2 ? rollData.current.tache.tache : rollData.tache
if (rollData.rolled.isETotal) {
if (isETotal) {
await blessure.update({
'system.difficulte': blessure.system.difficulte - 1,
'system.premierssoins.tache': Math.max(0, tache.system.points_de_tache_courant)
@@ -242,22 +278,14 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
return Math.max(0, Math.min(maxEndVie, maxEndGraves, maxEndCritiques));
}
async onUpdateActor(update, options, actorId) {
const updatedEndurance = update?.system?.sante?.endurance
if (updatedEndurance && options.diff) {
await this.setEffect(STATUSES.StatusUnconscious, updatedEndurance.value == 0)
}
await super.onUpdateActor(update, options, actorId)
}
async onCreateItem(item, options, id) {
await this.changeItemEffects(item)
await super.onCreateItem(item, options, id)
}
async onUpdateItem(item, options, id) {
async onUpdateItem(item, updates, options, id) {
await this.changeItemEffects(item);
await super.onUpdateItem(item, options, id)
await super.onUpdateItem(item, updates, options, id)
}
async onDeleteItem(item, options, id) {
@@ -268,12 +296,12 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
async changeItemEffects(item) {
switch (item.type) {
case ITEM_TYPES.blessure:
await this.changeStateBleeding();
await this.changeStateBleeding()
break;
case ITEM_TYPES.maladie:
case ITEM_TYPES.poison:
await this.changeStateMalade();
break;
await this.changeStateMalade()
break
}
}
@@ -292,32 +320,15 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
}
/* -------------------------------------------- */
async ajouterBlessure(encaissement, attackerToken = undefined) {
if (encaissement.gravite < 0) return;
if (encaissement.gravite > 0) {
while (this.countBlessures(it => it.system.gravite == encaissement.gravite) >= RdDItemBlessure.maxBlessures(encaissement.gravite) && encaissement.gravite <= 6) {
nouvelleBlessure(gravite, options = { origine: undefined, localisation: '' }) {
if (gravite < 0) return
if (gravite > 0) {
while (this.countBlessures(it => it.system.gravite == gravite) >= RdDItemBlessure.maxBlessures(gravite) && gravite <= 6) {
// Aggravation
encaissement.gravite += 2
if (encaissement.gravite > 2) {
encaissement.vie += 2;
}
gravite += 2
}
}
const endActuelle = this.getEnduranceActuelle();
const blessure = await RdDItemBlessure.createBlessure(this, encaissement.gravite, encaissement.dmg?.loc.label ?? '', attackerToken);
if (blessure.isCritique()) {
encaissement.endurance = endActuelle
}
if (blessure.isMort()) {
this.setEffect(STATUSES.StatusComma, true);
encaissement.mort = true;
ChatMessage.create({
content: `<img class="chat-icon" src="icons/svg/skull.svg" data-tooltip="charge" />
<strong>${this.getAlias()} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !</strong>`
});
}
return blessure;
return RdDItemBlessure.prepareBlessure(gravite, options);
}
async supprimerBlessure({ gravite }) {
@@ -329,8 +340,8 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
async supprimerBlessures(filterToDelete) {
const toDelete = this.filterItems(filterToDelete, ITEM_TYPES.blessure)
.map(it => it.id);
await this.deleteEmbeddedDocuments('Item', toDelete);
.map(it => it.id)
await this.deleteEmbeddedDocuments('Item', toDelete)
}
countBlessures(filter = it => !it.isContusion()) {
@@ -347,12 +358,11 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
return
}
const jetDeVie = await RdDDice.roll("1d20");
const sConst = this.getSConst();
const vie = this.system.sante.vie.value;
const isCritique = this.nbBlessuresCritiques() > 0;
const isGrave = this.nbBlessuresGraves();
const isEchecTotal = jetDeVie.total == 20;
const isCritique = this.countBlessures(it => it.isCritique()) > 0
const isGrave = this.countBlessures(it => it.isGrave())
const isEchecTotal = jetDeVie.total == 20
const isSuccess = jetDeVie.total == 1 || jetDeVie.total <= vie;
const perte = isSuccess ? 0 : 1 + (isEchecTotal ? vie + sConst : 0)
const prochainJet = (jetDeVie.total == 1 && vie > 0 ? 20 : 1) * (isCritique ? 1 : isGrave > 0 ? sConst : 0)
@@ -373,7 +383,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
ChatMessage.create({
content: msgText,
whisper: ChatUtility.getOwners(this)
});
})
}
/* -------------------------------------------- */
@@ -381,13 +391,14 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
const jetEndurance = (await RdDDice.roll("1d20")).total;
const sonne = jetEndurance == 20 || jetEndurance > (resteEndurance ?? this.system.sante.endurance.value)
if (sonne) {
await this.setSonne();
await this.setSonne(true)
}
return { jetEndurance, sonne }
}
async finDeRoundBlessures() {
const nbGraves = this.filterItems(it => it.isGrave(), 'blessure').length;
const nbGraves = this.itemTypes[ITEM_TYPES.blessure]
.filter(it => it.isGrave() && !it.system.premierssoins.done).length;
if (nbGraves > 0) {
// Gestion blessure graves : -1 pt endurance par blessure grave
await this.santeIncDec("endurance", -nbGraves);
@@ -396,8 +407,9 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
async setSonne(sonne = true) {
if (!game.combat && sonne) {
// TODO: vérifier si comportement toujours valable
ui.notifications.info(`${this.getAlias()} est hors combat, il ne reste donc pas sonné`);
return;
return
}
await this.setEffect(STATUSES.StatusStunned, sonne)
}

View File

@@ -12,6 +12,7 @@ import { SystemCompendiums } from "../settings/system-compendiums.js";
import { RdDItem } from "../item.js";
import { StatusEffects, STATUSES } from "../settings/status-effects.js";
import { Apprecier } from "../moral/apprecier.mjs";
import { CARACS } from "../rdd-carac.js";
export class RdDBaseActor extends Actor {
@@ -48,11 +49,9 @@ export class RdDBaseActor extends Actor {
static init() {
Handlebars.registerHelper('actor-isFeminin', actor => actor.isFeminin())
Hooks.on("preUpdateItem", (item, change, options, id) => Misc.documentIfResponsible(item.parent)?.onPreUpdateItem(item, change, options, id))
Hooks.on("createItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onCreateItem(item, options, id))
Hooks.on("updateItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onUpdateItem(item, options, id))
Hooks.on("updateItem", (item, updates, options, id) => Misc.documentIfResponsible(item.parent)?.onUpdateItem(item, updates, options, id))
Hooks.on("deleteItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onDeleteItem(item, options, id))
Hooks.on("updateActor", (actor, change, options, actorId) => Misc.documentIfResponsible(actor)?.onUpdateActor(change, options, actorId))
}
static onSocketMessage(sockmsg) {
@@ -92,25 +91,11 @@ export class RdDBaseActor extends Actor {
}
static getRealActor(actorId, tokenId) {
if (tokenId) {
let token = canvas.tokens.get(tokenId)
if (token) {
return token.actor
}
}
return game.actors.get(actorId)
const actor = tokenId ? canvas.tokens.get(tokenId)?.actor : undefined
return actor ?? game.actors.get(actorId)
}
getAlias() {
if (this.token?.name != null && this.token != this.prototypeToken) {
return this.token.name
}
return this.name
}
isPersonnageJoueur() { return false }
static extractActorMin = (actor) => { return { id: actor?.id, type: actor?.type, name: actor?.name, img: actor?.img }; };
static extractActorMin(actor) { return { id: actor?.id, type: actor?.type, name: actor?.name, img: actor?.img } }
/**
* Cette methode surcharge Actor.create() pour ajouter si besoin des Items par défaut:
@@ -155,20 +140,30 @@ export class RdDBaseActor extends Actor {
super(docData, context);
}
getAlias() {
if (this.token?.name != null && this.token != this.prototypeToken) {
return this.token.name
}
return this.name
}
isPersonnageJoueur() { return false }
getCarac() {
return foundry.utils.duplicate(this.system.carac)
}
findCaracByName(name) {
name = Grammar.toLowerCaseNoAccent(name)
switch (name) {
case 'reve-actuel': case 'reve actuel':
return this.system.carac.reve
case 'chance-actuelle': case 'chance actuelle':
return this.system.carac.chance
case 'vie':
return this.system.sante.vie
case 'reve actuel':
name = CARACS.REVE_ACTUEL
break
case 'chance actuelle':
name = CARACS.CHANCE_ACTUELLE
break
}
const carac = {}
foundry.utils.mergeObject(carac, this.system.carac, { overwrite: false })
foundry.utils.mergeObject(carac, this.getCaracCompetenceCreature(), { overwrite: false })
const carac = this.getCarac()
return RdDBaseActor.$findCaracByName(carac, name);
}
@@ -183,10 +178,18 @@ export class RdDBaseActor extends Actor {
getCaracByName(name) {
name = this.mapCarac(Grammar.toLowerCaseNoAccent(name)) ?? name
switch (name) {
case 'reve-actuel': case 'reve actuel':
return this.getCaracReveActuel();
case 'chance-actuelle': case 'chance-actuelle':
return this.getCaracChanceActuelle();
case 'reve actuel':
name = CARACS.REVE_ACTUEL
break
case 'chanceactuelle':
name = CARACS.CHANCE_ACTUELLE
break
}
switch (name) {
case CARACS.REVE_ACTUEL:
return this.getCaracReveActuel()[CARACS.REVE_ACTUEL]
case CARACS.CHANCE_ACTUELLE:
return this.getCaracChanceActuelle()[CARACS.CHANCE_ACTUELLE]
}
return this.findCaracByName(name);
}
@@ -211,6 +214,41 @@ export class RdDBaseActor extends Actor {
}
}
async _preUpdate(changed, options, user) {
const updatedCarac = changed?.system?.carac
if (updatedCarac && (updatedCarac.force || updatedCarac.reve || updatedCarac.taille)) {
await this.setEffect(STATUSES.StatusSurEnc, this.isSurenc())
}
await this.delayedRenderSheet('_preUpdate', changed, options)
return super._preUpdate(changed, options, user)
}
_onUpdate(changed, options, userId) {
super._onUpdate(changed, options, userId)
if (userId == game.user.id){
this.delayedRenderSheet('_onUpdate', changed, options)
}
}
async delayedRenderSheet(caller, data, options) {
this.refreshDelayCounter = (this.refreshDelayCounter ?? 0)+1
if (this.refreshDelayCounter == 1) {
this.renderAfterDelay(this.refreshDelayCounter)
}
}
renderAfterDelay(currentCounter) {
setTimeout(async () => {
if (currentCounter == this.refreshDelayCounter) {
this.sheet?.render()
this.refreshDelayCounter = 0
}
else {
this.renderAfterDelay(this.refreshDelayCounter)
}
}, 30)
}
/* -------------------------------------------- */
prepareData() {
super.prepareData()
@@ -223,6 +261,7 @@ export class RdDBaseActor extends Actor {
prepareActorData() { }
async computeEtatGeneral() { }
/* -------------------------------------------- */
findPlayer() {
return game.users.players.find(player => player.active && player.character?.id == this.id);
@@ -275,14 +314,14 @@ export class RdDBaseActor extends Actor {
return this.getEffects().filter(it => it.statuses.has(effectId))
}
async setEffect(effectId, status) {
async setEffect(effectId, status, options = { render: true }) {
if (this.isEffectAllowed(effectId)) {
const effects = this.getEffectsByStatus(effectId)
if (!status && effects.length > 0) {
await this.deleteEmbeddedDocuments('ActiveEffect', effects.map(it => it.id), { render: true })
await this.deleteEmbeddedDocuments('ActiveEffect', effects.map(it => it.id), options)
}
if (status && effects.length == 0) {
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.prepareActiveEffect(effectId)], { render: true })
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.prepareActiveEffect(effectId)], options)
}
}
}
@@ -291,13 +330,13 @@ export class RdDBaseActor extends Actor {
this.removeEffects(it => it.id == id)
}
async removeEffects(filter = e => true) {
async removeEffects(filter = e => true, options = { render: true }) {
if (game.user.isGM) {
const ids = this.getEffects(filter)
.filter(it => this.canRemoveEffects(it))
.map(it => it.id)
if (ids.length > 0) {
await this.deleteEmbeddedDocuments('ActiveEffect', ids)
await this.deleteEmbeddedDocuments('ActiveEffect', ids, options)
}
}
@@ -316,21 +355,15 @@ export class RdDBaseActor extends Actor {
async updateCarac(caracName, to) {
}
async onUpdateActor(change, options, actorId) {
const updatedCarac = change?.system?.carac
if (updatedCarac && (updatedCarac.force || updatedCarac.reve || updatedCarac.taille)) {
console.log(' onUpdateActor', change, options, actorId)
await this.setEffect(STATUSES.StatusSurEnc, this.isSurenc())
}
}
/* -------------------------------------------- */
async onPreUpdateItem(item, change, options, id) { }
async onCreateItem(item, options, id) {
}
async onUpdateItem(item, options, id) {
async onUpdateItem(item, updates, options, id) {
const conteneur = item.findConteneur()
conteneur?.render(options.render)
}
async onDeleteItem(item, options, id) {
@@ -339,15 +372,14 @@ export class RdDBaseActor extends Actor {
}
}
async _removeItemFromConteneur(item) {
const updates = this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
.map(conteneur => {
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
return { _id: conteneur.id, 'system.contenu': nouveauContenu }
})
if (updates.length > 0) {
await this.updateEmbeddedDocuments('Item', updates)
const conteneur = this.findConteneur(item);
if (conteneur) {
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
const updates = { _id: conteneur.id, 'system.contenu': nouveauContenu }
if (updates.length > 0) {
await this.updateEmbeddedDocuments('Item', updates)
}
}
}
@@ -371,7 +403,7 @@ export class RdDBaseActor extends Actor {
/* -------------------------------------------- */
async cleanupConteneurs() {
if (Misc.isOwnerPlayer(this)) {
let updates = this.itemTypes['conteneur']
let updates = this.itemTypes[ITEM_TYPES.conteneur]
.filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0)
.map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } });
if (updates.length > 0) {
@@ -382,7 +414,7 @@ export class RdDBaseActor extends Actor {
/* -------------------------------------------- */
getFortune() {
return Monnaie.getFortune(this.itemTypes['monnaie']);
return Monnaie.getFortune(this.itemTypes[ITEM_TYPES.monnaie]);
}
/* -------------------------------------------- */
@@ -663,7 +695,7 @@ export class RdDBaseActor extends Actor {
if (srcId != destId && itemId != destId) { // déplacement de l'objet
const src = this.getItem(srcId);
const dest = this.getItem(destId);
const cible = this.getContenantOrParent(dest);
const cible = this.findConteneurOrParent(dest);
const [empilable, message] = item.isInventaireEmpilable(dest);
if (empilable) {
await dest.empiler(item)
@@ -685,15 +717,15 @@ export class RdDBaseActor extends Actor {
return result;
}
getContenantOrParent(dest) {
findConteneurOrParent(dest) {
if (!dest || dest.isConteneur()) {
return dest;
}
return this.getContenant(dest);
return this.findConteneur(dest)
}
getContenant(item) {
return this.itemTypes['conteneur'].find(it => it.system.contenu.includes(item.id));
findConteneur(item) {
return this.itemTypes[ITEM_TYPES.conteneur].find(it => it.system.contenu.includes(item.id));
}
@@ -868,6 +900,7 @@ export class RdDBaseActor extends Actor {
ui.notifications.info(`${this.getAlias()} ne peut pas faire cette action: ${action}`)
}
ajoutExperience(rollData) { }
isAlcoolise() { return false }
async jetEthylisme() { this.actionImpossible("jet d'éthylisme") }
async rollAppelChance() { this.actionImpossible("appel à la chance") }

View File

@@ -15,8 +15,8 @@ export class RdDCreature extends RdDBaseActorSang {
}
async remiseANeuf() {
await this.removeEffects(e => true);
await this.supprimerBlessures(it => true);
await this.removeEffects(e => true)
await this.supprimerBlessures(it => true)
await this.update({
'system.sante.endurance.value': this.system.sante.endurance.max,
'system.sante.vie.value': this.system.sante.vie.max,

View File

@@ -18,6 +18,7 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
formData.niveau = this.actor.getNiveau()
delete formData.system.carac.niveau
formData.resonances = this.actor.system.sante.resonnance.actors.map(actorId => game.actors.get(actorId))
.filter(actor => actor != undefined)
.map(actor => { return { id: actor.id, name: actor.name, img: actor.img } })
return formData
}
@@ -75,6 +76,6 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
async resonanceDelete(actorId) {
console.log('Delete : ', actorId);
let newResonances = this.actor.system.sante.resonnance.actors.filter(id => id != actorId);
await this.actor.update({ 'system.sante.resonnance.actors': newResonances }, { renderSheet: false });
await this.actor.update({ 'system.sante.resonnance.actors': newResonances }, { render: false });
}
}

View File

@@ -43,9 +43,7 @@ export class RdDEntite extends RdDBaseActorReve {
async remiseANeuf() {
if (!this.isEntiteNonIncarnee()) {
await this.update({
'system.sante.endurance.value': this.system.sante.endurance.max
});
await this.update({ 'system.sante.endurance.value': this.system.sante.endurance.max })
}
await this.removeEffects(e => true)
}
@@ -85,12 +83,9 @@ export class RdDEntite extends RdDBaseActorReve {
if (this.isEntiteNonIncarnee()) {
return
}
encaissement.isEntiteIncarnee = true
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance);
foundry.utils.mergeObject(encaissement, {
resteEndurance: perteEndurance.newValue,
endurance: perteEndurance.perte,
blessure: RdDItemBlessure.prepareBlessure(encaissement.gravite, encaissement.dmg?.loc.label ?? '', attackerToken)
})
foundry.utils.mergeObject(encaissement, { resteEndurance: perteEndurance.newValue, endurance: perteEndurance.perte })
}
isEntiteAccordee(attacker) {

View File

@@ -46,9 +46,9 @@ export class RdDActorExportSheet extends RdDActorSheet {
formData.export = this.getMappingValues(formData.context, this.actor)
formData.competences = this.getCompetences(CATEGORIES_COMPETENCES_BASE)
formData.draconic = this.getCompetences(CATEGORIES_DRACONIC)
const legeres = this.actor.nbBlessuresLegeres()
const graves = this.actor.nbBlessuresGraves()
const critiques = this.actor.nbBlessuresCritiques()
const legeres = this.actor.countBlessures(it => it.isLegere())
const graves = this.actor.countBlessures(it => it.isGrave())
const critiques = this.actor.countBlessures(it => it.isCritique())
formData.etat = {
surenc: this.actor.computeMalusSurEncombrement(),
fatigue: {
@@ -103,11 +103,10 @@ export class RdDActorExportSheet extends RdDActorSheet {
gravite: this.html.find(event.currentTarget).data('gravite')
})
)
this.html.find('.click-blessure-add').click(async event =>
await this.actor.ajouterBlessure({
gravite: this.html.find(event.currentTarget).data('gravite')
})
)
this.html.find('.click-blessure-add').click(async event => {
const blessure = this.actor.nouvelleBlessure(this.html.find(event.currentTarget).data('gravite'))
await actor.createEmbeddedDocuments('Item', [blessure])
})
this.html.find('.button-export').click(async event => await
ExportScriptarium.INSTANCE.exportActors([this.actor],
`${this.actor.uuid}-${this.actor.name}`

View File

@@ -92,27 +92,28 @@ export class ChatUtility {
}
/* -------------------------------------------- */
static async createChatWithRollMode(messageData, actor = undefined, rollMode = game.settings.get("core", "rollMode")) {
switch (rollMode) {
static adaptVisibility( messageData, options = { actor: undefined, rollMode: undefined }) {
foundry.utils.mergeObject(options, { rollMode: game.settings.get("core", "rollMode") }, { overwrite: false });
switch (options.rollMode) {
case "blindroll": // GM only
if (!game.user.isGM) {
ChatUtility.blindMessageToGM(messageData)
messageData.whisper = [game.user];
messageData.content = "Message envoyé en aveugle au Gardien"
messageData.whisper = [game.user]
messageData.content = "Message envoyé en aveugle au Gardien";
}
else {
messageData.whisper = ChatUtility.getGMs()
}
break
break;
case "gmroll":
messageData.whisper = actor ? ChatUtility.getOwners(actor) : ChatUtility.getUserAndGMs()
break
messageData.whisper = options.actor ? ChatUtility.getOwners(options.actor) : ChatUtility.getUserAndGMs()
break;
case "selfroll":
messageData.whisper = [game.user]
break
}
messageData.alias = messageData.alias ?? actor?.name ?? game.user.name
return await ChatMessage.create(messageData)
messageData.alias = messageData.alias ?? options.actor?.name ?? game.user.name
return messageData
}
static tellToUser(message) {
@@ -134,6 +135,7 @@ export class ChatUtility {
whisper: ChatUtility.getUserAndGMs()
})
}
static getOwners(document) {
return document ? game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) : [game.user]
}
@@ -215,11 +217,13 @@ export class ChatUtility {
static async onRenderChatMessage(chatMessage, html, data) {
const rddTimestamp = chatMessage.getFlag(SYSTEM_RDD, 'rdd-timestamp')
if (rddTimestamp) {
const heureRdD = $(html).find('header.message-header .heure-rdd')
if (rddTimestamp && heureRdD.length == 0) {
const messageTimestamp = $(html).find('header.message-header .message-timestamp');
const timestamp = new RdDTimestamp(rddTimestamp);
const timestampData = timestamp.toCalendrier();
const dateHeure = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData);
$(html).find('header.message-header .message-timestamp').after(dateHeure)
messageTimestamp.after(dateHeure)
}
}
@@ -238,25 +242,4 @@ export class ChatUtility {
const date = new Date(chatMessage.timestamp);
return date?.toISOString().substring(0, 10)
}
// async flush() {
// const question = game.i18n.localize("AreYouSure");
// const warning = game.i18n.localize("CHAT.FlushWarning");
// return foundry.applications.api.DialogV2.confirm({
// window: {title: "CHAT.FlushTitle"},
// content: `<p><strong>${question}</strong> ${warning}</p>`,
// position: {
// top: window.innerHeight - 150,
// left: window.innerWidth - 720
// },
// yes: {
// callback: async () => {
// await this.documentClass.deleteDocuments([], {deleteAll: true});
// const jumpToBottomElement = document.querySelector(".jump-to-bottom");
// jumpToBottomElement.hidden = true;
// }
// }
// });
// }
}

View File

@@ -7,8 +7,6 @@ const fields = foundry.applications.fields
export class DialogFlushByDate {
static async init() {
Hooks.on("renderChatMessageHTML", async (app, html, msg) => await ChatUtility.onRenderChatMessage(app, html, msg))
Hooks.on("createChatMessage", async (chatMessage, options, id) => await ChatUtility.onCreateChatMessage(chatMessage, options, id))
Hooks.once("renderChatLog", async () => await DialogFlushByDate.onFirstRenderChatLog())
}

View File

@@ -13,7 +13,7 @@ export class Distance {
}
return undefined
}
switch (attaque.comp.type) {
switch (attaque.comp?.type) {
case ITEM_TYPES.competence: return mapTypeAttaque(attaque.main)
case ITEM_TYPES.competencecreature: return mapTypeAttaque(attaque.arme.system.categorie)
}
@@ -36,20 +36,19 @@ export class Distance {
}
static distance(token, defenderToken) {
if (token instanceof Token && defenderToken instanceof Token) {
const ray = new foundry.canvas.geometry.Ray(
token.getCenterPoint(),
defenderToken.getCenterPoint()
)
return Number(canvas.grid.measureDistances([{ ray }], { gridSpaces: false }))
if (Distance.$isToken(token) && Distance.$isToken(defenderToken)) {
const source = token.getCenterPoint()
const target = defenderToken.getCenterPoint()
const measure = canvas.grid.measurePath([ source, target])
return measure.distance
}
return -1 /* distance indéterminée */
}
static isVisible(token, defenderToken) {
// TODO: regarder les StatusEffect aveuglé?
if (token instanceof Token && defenderToken instanceof Token) {
return canvas.effects.visibility.testVisibility(defenderToken.getCenterPoint(), { object: token })
if (Distance.$isToken(token) && Distance.$isToken(defenderToken)) {
return canvas.visibility.testVisibility(defenderToken.getCenterPoint(), { object: token })
}
return true
}
@@ -79,11 +78,11 @@ export class Distance {
}
static ajustementMouvement(defenderToken) {
if (defenderToken instanceof Token) {
if (Distance.$isToken(defenderToken)) {
if (defenderToken.actor?.getSurprise(true) != '') return { msg: "immobile (surprise)", diff: 0 };
if (defenderToken.inCombat) return { msg: "en mouvement (combat)", diff: -4 };
if (defenderToken.inCombat) return { msg: "en combat", diff: -4 };
}
return { msg: "à déterminer (0 immobile, -3 actif, -4 en mouvement, -5 en zig-zag)", diff: -3 };
return { msg: "à déterminer", diff: -3 };
}
static diff(...ajustements) {
@@ -116,4 +115,8 @@ export class Distance {
return undefined
}
static $isToken(token) {
return token instanceof Token || token instanceof TokenDocument
}
}

View File

@@ -0,0 +1,19 @@
export class RdDActiveEffect extends ActiveEffect {
async _preCreate(data, options, user) {
await this.parent?.delayedRenderSheet('_preCreateEffect', data, options)
return super._preCreate(data, options, user)
}
async _preUpdate(changed, options, user) {
await this.parent?.delayedRenderSheet('_preUpdateEffect', changed, options)
return super._preUpdate(changed, options, user)
}
async _preDelete(options, user) {
await this.parent?.delayedRenderSheet('_preDeleteEffect', { id: this.id }, options)
return super._preDelete(options, user)
}
}

View File

@@ -1,4 +1,4 @@
import { ChatUtility } from "./chat-utility.js";
import { Grammar } from "./grammar.js";
import { RdDInitiative } from "./initiative.mjs";
import { RdDItem } from "./item.js";
@@ -71,6 +71,36 @@ export class RdDItemCompetence extends RdDItem {
}
return undefined
}
async _preUpdate(changed, options, user) {
await this.checkCompetenceXP(changed.system?.xp)
return super._preUpdate(changed, options, user)
}
async checkCompetenceXP(newXP, display = true) {
if (this.actor?.isPersonnage() && newXP && newXP != this.system.xp && newXP > 0) {
const newNiv = this.system.niveau + 1
let needed = RdDItemCompetence.getCompetenceNextXp(newNiv)
if (newXP >= needed) {
const xpData = {
alias: this.actor.getAlias(),
competence: this.name,
niveau: newNiv,
xp: newXP,
archetype: this.system.niveau_archetype,
archetypeWarning: newNiv > this.system.niveau_archetype
}
if (display) {
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.hbs`, xpData)
})
}
return xpData
}
}
}
/* -------------------------------------------- */
static getLabelCategorie(category) {
return CATEGORIES_COMPETENCES[category].label;
@@ -136,7 +166,7 @@ export class RdDItemCompetence extends RdDItem {
return troncList;
}
}
return [];
return []
}
/* -------------------------------------------- */

View File

@@ -16,6 +16,7 @@ import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
import { ItemAction } from "./item/item-actions.js";
import { SANS_COMPETENCE } from "./item/base-items.js";
import { Apprecier } from "./moral/apprecier.mjs";
import { CARACS } from "./rdd-carac.js";
/**
* Extend the basic ItemSheet for RdD specific items
@@ -118,7 +119,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
this.item.type == ITEM_TYPES.meditation ||
this.item.type == ITEM_TYPES.oeuvre) {
formData.caracList = foundry.utils.duplicate(game.model.Actor.personnage.carac)
formData.caracList["reve-actuel"] = foundry.utils.duplicate(game.model.Actor.personnage.reve.reve)
formData.caracList[CARACS.REVE_ACTUEL] = foundry.utils.duplicate(game.model.Actor.personnage.reve.reve)
}
if (this.item.type == ITEM_TYPES.arme) {
formData.competences = formData.competences.filter(it => it.isCompetenceArme())

View File

@@ -41,6 +41,11 @@ export class RdDItemSort extends RdDItem {
return value ? value.replace('variable', 'var') : ''
}
static computeTotalXP(sorts) {
return sorts.map(sort => RdDItemSort.isDifficulteVariable(sort) ? 70 : -10 * Misc.toInt(sort.system.difficulte))
.reduce(Misc.sum(), 0)
}
static isSortOnCoord(sort, coord) {
let tmr = TMRUtility.getTMR(coord)
const caseTMR = sort.system.caseTMR.toLowerCase();

View File

@@ -81,13 +81,17 @@ export const defaultItemImg = {
souffle: "systems/foundryvtt-reve-de-dragon/icons/souffle_dragon.webp",
tarot: "systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp",
tete: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp",
monnaie:"systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp",
monnaie: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp",
munition: "systems/foundryvtt-reve-de-dragon/icons/objets/fleche.webp"
}
const ITEM_TYPES_PLURIEL = {
[ITEM_TYPES.jeu]: 'jeux'
}
/* -------------------------------------------- */
export class RdDItem extends Item {
static get defaultIcon() {
return undefined;
}
@@ -112,6 +116,13 @@ export class RdDItem extends Item {
return true;
}
static itemTypePluriel(type) {
if (ITEM_TYPES[type]) {
return ITEM_TYPES_PLURIEL[type] ?? (type + 's')
}
console.error(`Item type ${type} is undefined`)
return type
}
static async getCorrespondingItem(itemRef) {
if (itemRef.pack) {
return await SystemCompendiums.loadDocument(itemRef)
@@ -163,6 +174,21 @@ export class RdDItem extends Item {
super(docData, context);
}
async _preCreate(data, options, user) {
await this.parent?.delayedRenderSheet('_preCreateItem', data, options)
return super._preCreate(data, options, user)
}
async _preUpdate(changed, options, user) {
await this.parent?.delayedRenderSheet('_preUpdateItem', changed, options)
return super._preUpdate(changed, options, user)
}
async _preDelete(options, user) {
await this.parent?.delayedRenderSheet('_preDeleteItem', { id: this.id }, options)
return super._preDelete(options, user)
}
getUniteQuantite() {
switch (this.type) {
case ITEM_TYPES.monnaie: return "(Pièces)"
@@ -185,6 +211,13 @@ export class RdDItem extends Item {
isCompetencePersonnage() { return this.type == ITEM_TYPES.competence }
isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature }
isConteneur() { return this.type == ITEM_TYPES.conteneur }
findConteneur() {
if (this.isInventaire('all') && this.parent) {
return this.parent.findConteneur(this)
}
return undefined
}
isMonnaie() { return this.type == ITEM_TYPES.monnaie }
isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; }
isService() { return this.type == ITEM_TYPES.service }

View File

@@ -19,7 +19,7 @@ const definitionsBlessures = [
{ type: "legere", gravite: 2, endurance: "1d6", vie: 0, label: 'Légère', max: 5, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "grave", gravite: 4, endurance: "2d6", vie: -2, label: 'Grave', max: 2, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "critique", gravite: 6, endurance: "-100", vie: -4, label: 'Critique', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "mort", gravite: 8, label: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" }
{ type: "mort", gravite: 8, endurance: "-100", vie: 0, label: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" }
]
export class RdDItemBlessure extends RdDItem {
@@ -71,13 +71,13 @@ export class RdDItemBlessure extends RdDItem {
return 0
}
static async createBlessure(actor, gravite, localisation = '', attackerToken = undefined) {
const blessure = RdDItemBlessure.prepareBlessure(gravite, localisation, attackerToken);
const blessures = await actor.createEmbeddedDocuments('Item', [blessure])
static async createBlessure(actor, gravite, options = { localisation: '', origine: '', render: true }) {
const blessure = RdDItemBlessure.prepareBlessure(gravite, options);
const blessures = await actor.createEmbeddedDocuments('Item', [blessure], options)
return blessures[0]
}
static prepareBlessure(gravite, localisation, attackerToken) {
static prepareBlessure(gravite, options = { localisation: '', origine: '' }) {
const definition = RdDItemBlessure.getDefinition(gravite);
return {
name: definition.label,
@@ -85,9 +85,11 @@ export class RdDItemBlessure extends RdDItem {
img: definition.icon,
system: {
gravite: gravite,
vie: definition.vie,
endurance: definition.endurance,
difficulte: -gravite,
localisation: localisation,
origine: attackerToken?.name ?? ""
localisation: options.localisation,
origine: options.origine
}
}
}
@@ -104,11 +106,9 @@ export class RdDItemBlessure extends RdDItem {
async updateTacheSoinBlessure(tache) {
if (tache) {
await tache.update({
system: {
itemId: this.id,
difficulte: Math.min(this.system.difficulte, tache.system.difficulte),
points_de_tache_courant: Math.max(0, this.system.premierssoins.tache)
}
'system.itemId': this.id,
'system.difficulte': Math.min(this.system.difficulte, tache.system.difficulte),
'system.points_de_tache_courant': Math.max(0, this.system.premierssoins.tache)
});
}
}
@@ -160,7 +160,7 @@ export class RdDItemBlessure extends RdDItem {
message.content += ` -- une blessure ${label} reste stable`;
}
}
await this.update(update);
await this.update(update)
}
}

View File

@@ -1,4 +1,4 @@
import { ACTOR_TYPES } from "../constants.js"
import { ACTOR_TYPES, ITEM_TYPES } from "../constants.js"
import { Misc } from "../misc.js"
import { RdDSheetUtility } from "../rdd-sheet-utility.js"
import { RdDUtility } from "../rdd-utility.js"
@@ -11,86 +11,98 @@ import { RdDUtility } from "../rdd-utility.js"
const _SPACEHOLDER = { placeholder: true }
const _VENDRE = {
code: 'item-vendre', label: 'Vendre ou donner', icon: it => 'fa-solid fa-comments-dollar',
code: 'item-vendre', label: 'Vendre ou donner', icon: 'fa-solid fa-comments-dollar',
filter: it => Misc.toInt(it.system.quantite) > 0 || it.parent?.type == ACTOR_TYPES.commerce,
action: (item, actor) => item.proposerVente()
}
const _ACHETER = {
code: 'item-acheter', label: 'Acheter', icon: it => 'fa-regular fa-coins',
code: 'item-acheter', label: 'Acheter', icon: 'fa-regular fa-coins',
filter: it => it.parent?.type == ACTOR_TYPES.commerce,
allowLimited: true,
action: (item, actor) => actor.vente(item)
}
const _MONTRER = {
code: 'item-montrer', label: 'Montrer', icon: it => 'fa-solid fa-comment',
code: 'item-montrer', label: 'Montrer', icon: 'fa-solid fa-comment',
allowLimited: true,
action: (item, actor) => item.postItemToChat()
}
const _SPLIT = {
code: 'item-split', label: 'Séparer le goupe', icon: it => 'fa-solid fa-unlink',
code: 'item-split', label: 'Séparer le goupe', icon: 'fa-solid fa-unlink',
actorFilter: actor => actor.isOwner,
filter: it => Misc.toInt(it.system.quantite) > 1 && it.parent?.type != ACTOR_TYPES.commerce,
action: (item, actor) => RdDSheetUtility.splitItem(item, actor)
}
const _EDIT = {
code: 'item-edit', label: 'Editer', icon: it => 'fa-solid fa-edit',
code: 'item-edit', label: it => it.type == ITEM_TYPES.conteneur ? 'Ouvrir' : 'Editer',
icon: 'fa-solid fa-edit',
action: (item, actor) => item.sheet.render(true)
}
const _DELETE = {
code: 'item-delete', label: 'Supprimer', icon: it => 'fa-solid fa-trash',
code: 'item-delete', label: 'Supprimer', icon: 'fa-solid fa-trash',
optionsFilter: options => options.isOwner,
action: (item, actor) => RdDUtility.confirmActorItemDelete(item, actor)
}
const _EQUIPER = {
code: 'item-equip', label: 'Equiper', icon: it => it.system.equipe ? 'fa-solid fa-hand-rock' : 'fa-regular fa-hand-paper',
actorFilter: actor => actor.isPersonnage(),
filter: it => !it.estContenu && it.isEquipable(),
action: (item, actor) => actor.equiperObjet(item)
}
const _CUISINER = {
code: 'item-cuisiner', label: 'Cuisiner',
img: it => 'systems/foundryvtt-reve-de-dragon/assets/actions/cuisine.svg',
// icon: it => 'fa-solid fa-spoon',
img: 'systems/foundryvtt-reve-de-dragon/assets/actions/cuisine.svg',
actorFilter: actor => actor.isPersonnage(),
filter: it => it.getUtilisation() == 'cuisine' && it.system.sust > 0,
action: (item, actor) => actor.preparerNourriture(item)
}
const _MANGER_CRU = {
code: 'item-manger-cru', label: 'Manger cru', icon: it => 'fa-solid fa-drumstick-bite',
code: 'item-manger-cru', label: 'Manger cru', icon: 'fa-solid fa-drumstick-bite',
actorFilter: actor => actor.isPersonnage(),
filter: it => it.getUtilisation() == 'cuisine' && it.system.sust > 0,
action: (item, actor) => actor.mangerNourriture(item)
}
const _MANGER = {
code: 'item-manger', label: 'Manger', icon: it => 'fa-solid fa-utensils',
code: 'item-manger', label: 'Manger', icon: 'fa-solid fa-utensils',
actorFilter: actor => actor.isPersonnage(),
filter: it => !(it.system.boisson),
action: (item, actor) => actor.mangerNourriture(item)
}
const _BOIRE = {
code: 'item-boire', label: 'Boire', icon: it => 'fa-solid fa-glass-water',
code: 'item-boire', label: 'Boire', icon: 'fa-solid fa-glass-water',
actorFilter: actor => actor.isPersonnage(),
filter: it => it.system.boisson,
action: (item, actor) => actor.mangerNourriture(item)
}
const _DECOCTION = {
code: 'item-decoction', label: 'Décoction', icon: it => 'fa-solid fa-flask-vial',
code: 'item-decoction', label: 'Décoction', icon: 'fa-solid fa-flask-vial',
actorFilter: actor => actor.isPersonnage(),
action: (item, actor) => actor.fabriquerDecoctionHerbe(item)
}
const _OUVRIR = {
code: 'item-edit', label: 'Ouvrir', icon: it => 'fa-solid fa-eye',
code: 'item-edit', label: 'Ouvrir',
img: 'systems/foundryvtt-reve-de-dragon/assets/actions/ouvrir.svg',
action: (item, actor) => item.sheet.render(true)
}
const _LIRE = {
code: 'item-lire', label: 'Lire', icon: it => 'fa-solid fa-book-open',
code: 'item-lire', label: 'Lire', icon: 'fa-solid fa-book-open',
actorFilter: actor => actor.isPersonnage(),
action: (item, actor) => actor.actionLire(item)
}
const _REFOULER = {
code: 'item-refouler', label: 'Refouler', icon: it => 'fa-solid fa-burst',
code: 'item-refouler', label: 'Refouler', icon: 'fa-solid fa-burst',
actorFilter: actor => actor.isPersonnage(),
filter: it => it.system.refoulement > 0,
action: (item, actor) => actor.actionRefoulement(item)
}
const _SORT_RESERVE = {
code: 'item-sortreserve-add', label: 'Ajouter en réserve', icon: it => 'fa-solid fa-sparkles',
code: 'item-sortreserve-add', label: 'Ajouter en réserve', icon: 'fa-solid fa-sparkles',
actorFilter: actor => actor.isPersonnage(),
filter: it => game.user.isGM && !it.system.isrituel,
action: (item, actor) => actor.addSortReserve(item)
}
@@ -116,25 +128,39 @@ export class ItemAction {
static applies(action, item, options) {
return action && item
&& item.isActionAllowed(action.code)
&& (!action.actorFilter || (item.actor && action.actorFilter(item.actor)))
&& (!action.filter || action.filter(item))
&& (action.allowLimited || options.editable)
&& (!action.optionsFilter || action.optionsFilter(options))
}
static img(action, item) {
if (action.placeholder){
static label(action, item) {
if (action.placeholder) {
return ""
}
if (action?.img) {
return `<img src="${action.img(item)}" />`
return ItemAction.getParam(action.label, item)
}
static img(action, item) {
if (action.placeholder) {
return ""
}
if (action?.icon) {
return `<i class="${action.icon(item)}"></i>`
const img = ItemAction.getParam(action.img, item)
if (img) {
return `<img src="${img}" />`
}
const icon = ItemAction.getParam(action.icon, item)
if (icon) {
return `<i class="${icon}"></i>`
}
return action.label
}
static getParam(p, item) {
return typeof (p) == 'function' ? p(item) : p
}
static async onActionItem(event, actor, options) {
const code = $(event.currentTarget).data('code')
const item = RdDSheetUtility.getItem(event, actor)

View File

@@ -77,41 +77,41 @@ export class RdDInventaireItemSheet extends RdDItemSheetV1 {
}
async onAddMilieu(event) {
const milieu = this.html.find('input.input-selection-milieu').val();
const milieu = this.html.find('input.input-selection-milieu').val()
if (!milieu) {
ui.notifications.warn(`Choisissez le milieu dans lequel se trouve le/la ${this.item.name}`);
ui.notifications.warn(`Choisissez le milieu dans lequel se trouve le/la ${this.item.name}`)
return
}
const list = this.item.getEnvironnements();
const exists = list.find(it => it.milieu == milieu);
const list = this.item.getEnvironnements()
const exists = list.find(it => it.milieu == milieu)
if (exists) {
ui.notifications.warn(`${this.item.name} a déjà une rareté ${exists.rarete} en ${milieu} (fréquence: ${exists.frequence})`);
return
}
const rarete = RdDRaretes.rareteFrequente();
const added = { milieu, rarete: rarete.code, frequence: rarete.frequence };
const rarete = RdDRaretes.rareteFrequente()
const added = { milieu, rarete: rarete.code, frequence: rarete.frequence }
const newList = [added, ...list].sort(Misc.ascending(it => it.milieu))
await this.item.update({ 'system.environnement': newList })
}
async onDeleteMilieu(event) {
const milieu = this.$getEventMilieu(event);
const milieu = this.$getEventMilieu(event)
if (milieu != undefined) {
const newList = this.item.getEnvironnements().filter(it => it.milieu != milieu)
.sort(Misc.ascending(it => it.milieu));
await this.item.update({ 'system.environnement': newList });
.sort(Misc.ascending(it => it.milieu))
await this.item.update({ 'system.environnement': newList })
}
}
async onChange(event, doMutation) {
const list = this.item.system.environnement;
const milieu = this.$getEventMilieu(event);
const updated = list.find(it => it.milieu == milieu);
const list = this.item.system.environnement
const milieu = this.$getEventMilieu(event)
const updated = list.find(it => it.milieu == milieu)
if (updated) {
doMutation(updated);
doMutation(updated)
const newList = [...list.filter(it => it.milieu != milieu), updated]
.sort(Misc.ascending(it => it.milieu));
await this.item.update({ 'system.environnement': newList });
.sort(Misc.ascending(it => it.milieu))
await this.item.update({ 'system.environnement': newList })
}
}

View File

@@ -20,7 +20,7 @@ export class RdDFauneItemSheet extends RdDInventaireItemSheet {
'system.actor.pack': linkedActor.pack,
'system.actor.id': linkedActor._id,
'system.actor.name': linkedActor.name
});
})
}
else {
ui.notifications.warn(`${linkedActor.name} ne provient pas d'un compendium.
@@ -32,7 +32,7 @@ export class RdDFauneItemSheet extends RdDInventaireItemSheet {
'system.actor.pack': '',
'system.actor.id': '',
'system.actor.name': ''
});
})
}
}

View File

@@ -16,22 +16,18 @@ class Migration {
async migrate() { }
async applyItemsUpdates(computeUpdates) {
await game.actors.forEach(async (actor) => {
await Promise.all(game.actors.map(actor => {
const actorItemUpdates = computeUpdates(actor.items).filter(it => it != undefined);
if (actorItemUpdates.length > 0) {
console.log(
this.code,
`Applying updates on actor ${actor.name} items`,
actorItemUpdates
);
await actor.updateEmbeddedDocuments("Item", actorItemUpdates);
console.log(this.code, `Applying updates on actor ${actor.name} items`, actorItemUpdates);
return actor.updateEmbeddedDocuments("Item", actorItemUpdates);
}
});
}))
const itemUpdates = computeUpdates(game.items).filter(it => it != undefined);
const itemUpdates = computeUpdates(game.items).filter(it => it != undefined)
if (itemUpdates.length > 0) {
console.log(this.code, "Applying updates on items", itemUpdates);
await Item.updateDocuments(itemUpdates);
console.log(this.code, "Applying updates on items", itemUpdates)
await Item.updateDocuments(itemUpdates)
}
}
}
@@ -58,13 +54,13 @@ class _1_5_34_migrationPngWebp {
//Migrate system png to webp
await Item.updateDocuments(itemsUpdates);
await Actor.updateDocuments(actorsUpdates);
game.actors.forEach(actor => {
if (actor.token?.img && actor.token.img.match(regexOldPngJpg)) {
actor.update({ "token.img": convertImgToWebp(actor.token.img) });
}
const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items);
actor.updateEmbeddedDocuments('Item', actorItemsToUpdate);
});
await Promise.all(game.actors
.filter(actor => actor.token?.img && actor.token.img.match(regexOldPngJpg))
.map(actor => actor.update({ "token.img": convertImgToWebp(actor.token.img) }))
)
await Promise.all(game.actors.map(actor =>
actor.updateEmbeddedDocuments('Item', prepareDocumentsImgUpdate(actor.items))
))
}
}
@@ -125,16 +121,15 @@ class _10_0_21_VehiculeStructureResistanceMax extends Migration {
get version() { return "10.0.21"; }
async migrate() {
await game.actors
.filter((actor) => actor.type == "vehicule")
.forEach(async (actor) => {
await actor.update({
await Promise.all(
game.actors.filter(actor => actor.type == "vehicule")
.map(actor => actor.update({
'system.etat.resistance.value': actor.system.resistance,
'system.etat.resistance.max': actor.system.resistance,
'system.etat.structure.value': actor.system.structure,
'system.etat.structure.max': actor.system.structure
})
});
}))
)
}
}
@@ -192,9 +187,9 @@ class _10_2_5_ArmesTirLancer extends Migration {
get version() { return "10.2.5"; }
migrateArmeTirLancer(it) {
let updates = foundry.utils.mergeObject({ _id: it.id }, this.getMapping(it).updates);
console.log(it.name, updates);
return updates;
const updates = foundry.utils.mergeObject({ _id: it.id }, this.getMapping(it).updates)
console.log(it.name, updates)
return updates
}
async migrate() {

View File

@@ -24,6 +24,13 @@ export class Misc {
return text.charAt(0).toLowerCase() + text.slice(1);
}
static stripHtml(html)
{
const tmp = document.createElement("DIV")
tmp.innerHTML = html
return tmp.textContent || tmp.innerText || ""
}
static toSignedString(number) {
const value = parseInt(number)
const isPositiveNumber = value != NaN && value > 0;

View File

@@ -70,7 +70,7 @@ export class RdDBonus {
dmgParticuliere: RdDBonus._dmgParticuliere(rollData),
dmgSurprise: rollData.opponent?.surprise?.dmg ?? 0,
mortalite: RdDBonus.mortalite(attaque.dmg?.mortalite, arme?.system.mortalite),
dmgActor: RdDBonus.bonusDmg(actor, attaque.carac.key, dmgArme, attaque.forceRequise),
dmgActor: RdDBonus.bonusDmg(actor, attaque.carac?.key, dmgArme, attaque.forceRequise),
dmgForceInsuffisante: Math.min(0, actor.getForce() - (attaque.forceRequise ?? 0)),
dmgDiffLibre: ReglesOptionnelles.isUsing('degat-ajout-malus-libre') ? Math.abs(attaque.diff ?? 0) : 0
}

View File

@@ -61,7 +61,9 @@ export const CARACS = {
DEROBEE: 'derobee',
CHANCE_ACTUELLE: 'chance-actuelle',
REVE_ACTUEL: 'reve-actuel',
VIE: 'vie'
}
export const LIST_CARAC_PERSONNAGE = {
[CARACS.TAILLE]: { code: CARACS.TAILLE, label: 'Taille', isCarac: true, path: 'system.carac.taille.value' },
[CARACS.APPARENCE]: { code: CARACS.APPARENCE, label: 'Apparence', isCarac: true, path: 'system.carac.apparence.value' },
@@ -166,10 +168,18 @@ export class RdDCarac {
const total = Object.values(carac ?? {}).filter(c => !c.derivee)
.map(it => parseInt(it.value))
.reduce(Misc.sum(), 0);
const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0);
const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0)
return total + beauteSuperieur10;
}
static computeTotalXp(carac, beaute = undefined) {
const totalXp = Object.values(carac ?? {}).filter(c => !c.derivee)
.map(it => RdDCarac.getCaracXp(0, Misc.toInt(it.value)) + Misc.toInt(it.xp))
.reduce(Misc.sum(), 0);
const beauteXp = beaute > 10 ? RdDCarac.getCaracXp(10, beaute) : 0
return totalXp + beauteXp;
}
static levelUp(it) {
it.xpNext = RdDCarac.getCaracNextXp(it.value);
it.isLevelUp = (it.xp >= it.xpNext);
@@ -182,12 +192,16 @@ export class RdDCarac {
/* -------------------------------------------- */
static getCaracNextXp(value) {
const nextValue = Number(value) + 1;
value = Number(value);
const nextValue = value + 1;
// xp est le coût pour atteindre cette valeur, on regarde donc le coût de la valeur+1
return RdDCarac.getCaracXp(nextValue);
return RdDCarac.getCaracXp(value, nextValue)
}
static getCaracXp(targetValue) {
return RdDCarac.getCaracDerivee(targetValue)?.xp ?? 200;
static getCaracXp(from, to) {
return Array.from({ length: to - from },
(_, i) => from + i + 1)
.map(it => RdDCarac.getCaracDerivee(it)?.xp ?? 200)
.reduce(Misc.sum(), 0)
}
}

View File

@@ -63,6 +63,11 @@ export class RdDCombatManager extends Combat {
it.token.id == tokenId
)
}
static getRangInitiativeCombatant(actorId, tokenId) {
const combatant = RdDCombatManager.getCombatant(actorId, tokenId)
return combatant?.system.init?.rang
}
/* -------------------------------------------- */
async nextRound() {
await this.finDeRound();
@@ -383,7 +388,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static onMsgEncaisser(msg) {
let defender = canvas.tokens.get(msg.defenderToken.id).actor;
let defender = canvas.tokens.get(msg.defenderToken.id)?.actor;
if (Misc.isOwnerPlayer(defender)) {
let attackerRoll = msg.attackerRoll;
let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : undefined;
@@ -462,24 +467,10 @@ export class RdDCombat {
this.defenderId = this.defender.id
this.attackerTokenId = attackerTokenId
this.defenderTokenId = defenderTokenId
this.attackerToken = RdDCombat.$extractAttackerTokenData(attacker, attackerTokenId)
this.defenderToken = RdDCombat.$extractDefenderTokenData(defender, defenderTokenId, target)
this.attackerToken = Targets.getTokenData(attacker, attackerTokenId)
this.defenderToken = Targets.getTokenData(defender, defenderTokenId, target)
}
static $extractAttackerTokenData(attacker, attackerTokenId) {
const token = canvas.tokens.get(attackerTokenId);
return token ? Targets.extractTokenData(token) : Targets.buildActorTokenData(attackerTokenId, attacker)
}
static $extractDefenderTokenData(defender, defenderTokenId, target) {
if (target) {
return Targets.extractTokenData(target)
}
const token = canvas.tokens.get(defenderTokenId);
return token ? Targets.extractTokenData(token) : Targets.buildActorTokenData(defenderTokenId, defender)
}
/* -------------------------------------------- */
async onEvent(button, event) {
const chatMessage = ChatUtility.getChatMessage(event);
@@ -514,8 +505,8 @@ export class RdDCombat {
/* -------------------------------------------- */
attaqueChanceuse(attackerRoll) {
ui.notifications.info("L'attaque est rejouée grâce à la chance")
attackerRoll.essais.attaqueChance = true;
this.attaque(attackerRoll, attackerRoll.arme);
attackerRoll.essais.attaqueChance = true
this.attaque(attackerRoll, attackerRoll.arme)
}
/* -------------------------------------------- */
@@ -642,11 +633,11 @@ export class RdDCombat {
}
}
async attaqueV2() {
async attaqueV2(options = undefined) {
if (!await this.attacker.accorder(this.defender, 'avant-attaque')) {
return
}
await this.doRollAttaque({
const rollData = {
ids: {
actorId: this.attackerId,
actorTokenId: this.attackerTokenId,
@@ -654,8 +645,19 @@ export class RdDCombat {
opponentTokenId: this.defenderTokenId,
},
type: { allowed: ['attaque'], current: 'attaque' },
selected: {},
passeArme: foundry.utils.randomID(16),
})
}
if (options) {
rollData.selected = {
attaque: {
comp: { id: options.comp.id },
arme: { id: options.arme.id },
main: options.main
}
}
}
await this.doRollAttaque(rollData)
}
async doRollAttaque(rollData, callbacks = []) {
@@ -721,7 +723,7 @@ export class RdDCombat {
const choixDefense = await ChatMessage.create({
// message privé: du défenseur à lui même (et aux GMs)
speaker: ChatMessage.getSpeaker(this.defender, canvas.tokens.get(this.defenderTokenId)),
speaker: ChatMessage.getSpeaker({ actor: this.defender, token: canvas.tokens.get(this.defenderTokenId) }),
alias: this.attacker?.getAlias(),
whisper: ChatUtility.getOwners(this.defender),
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-defense.hbs', defenseData)
@@ -736,12 +738,14 @@ export class RdDCombat {
}
/* -------------------------------------------- */
async attaque(competence, arme) {
async attaque(competence, arme, main) {
if (!await this.attacker.accorder(this.defender, 'avant-attaque')) {
return
}
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
return this.attacker.rollCompetence(competence.name, { arme: arme })
return this.attaqueV2(
{ comp: competence, arme: arme, main: main }
)
}
if (arme.system.cac == EMPOIGNADE) {
RdDEmpoignade.onAttaqueEmpoignade(this.attacker, this.defender)
@@ -750,7 +754,7 @@ export class RdDCombat {
RdDEmpoignade.checkEmpoignadeEnCours(this.attacker)
let rollData = this._prepareAttaque(competence, arme)
console.log("RdDCombat.attaque >>>", rollData);
console.log("RdDCombat.attaque >>>", rollData)
if (arme) {
this.attacker.verifierForceMin(arme);
}
@@ -925,7 +929,7 @@ export class RdDCombat {
async _chatMessageDefense(paramDemandeDefense, defenderRoll) {
const choixDefense = await ChatMessage.create({
// message privé: du défenseur à lui même (et aux GMs)
speaker: ChatMessage.getSpeaker(this.defender, canvas.tokens.get(this.defenderTokenId)),
speaker: ChatMessage.getSpeaker({ actor: this.defender, token: canvas.tokens.get(this.defenderTokenId) }),
alias: this.attacker?.getAlias(),
whisper: ChatUtility.getOwners(this.defender),
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-defense-v1.hbs', paramDemandeDefense),
@@ -992,9 +996,9 @@ export class RdDCombat {
const arme = rollData.arme;
const avecArme = !['', 'sans-armes', 'armes-naturelles'].includes(arme?.system.categorie_parade ?? '');
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
ChatUtility.createChatWithRollMode(
await ChatMessage.create(ChatUtility.adaptVisibility(
{ content: `<strong>Maladresse à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme }) },
this.defender)
{ actor: this.defender }))
}
/* -------------------------------------------- */
@@ -1118,9 +1122,9 @@ export class RdDCombat {
async infoAttaquantDesarme(rollData) {
if (/*TODO: parade?*/!rollData.attackerRoll?.particuliere) {
// TODO: attaquant doit jouer résistance et peut être désarmé p132
ChatUtility.createChatWithRollMode(
await ChatMessage.create(ChatUtility.adaptVisibility(
{ content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)` },
this.defender)
{ actor: this.defender }))
}
}
@@ -1152,9 +1156,9 @@ export class RdDCombat {
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
if (!defenderRoll.attackerRoll.isPart) {
// TODO: attaquant doit jouer résistance et peut être désarmé p132
ChatUtility.createChatWithRollMode(
await ChatMessage.create(ChatUtility.adaptVisibility(
{ content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)` },
this.defender)
{ actor: this.defender }))
}
}
/* -------------------------------------------- */
@@ -1239,9 +1243,9 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onEsquiveParticuliere(defenderRoll) {
console.log("RdDCombat._onEsquiveParticuliere >>>", defenderRoll);
ChatUtility.createChatWithRollMode(
await ChatMessage.create(ChatUtility.adaptVisibility(
{ content: "<strong>Vous pouvez esquiver une deuxième fois!</strong>" },
this.defender);
{ actor: this.defender }))
}
/* -------------------------------------------- */

View File

@@ -27,20 +27,8 @@ const rddRollNumeric = /^(\d+)\s*([\+\-]?\d+)?\s*(s)?/;
export class RdDCommands {
static init() {
const rddCommands = new RdDCommands();
game.system.rdd.commands = rddCommands;
Hooks.on("chatMessage", (html, content, msg) => {
if (content[0] == '/') {
let regExp = /(\S+)/g;
let commands = content.match(regExp);
if (rddCommands.processChatCommand(commands, content, msg)) {
return false;
}
}
return true;
});
game.system.rdd.commands = new RdDCommands()
Hooks.on("chatMessage", (chatLog, message, msg) => game.system.rdd.commands.onChatMessage(message, msg))
}
constructor() {
@@ -116,6 +104,7 @@ export class RdDCommands {
this.registerCommand({
path: ["/xp", "carac"], func: (content, msg, params) => this.getCoutXpCarac(msg, params),
descr: `Détermine le coût d'expérience pour augmenter une caractéristique. Exemples:
<br>/xp carac 12 15: coût pour passer de 12 15
<br>/xp carac 15: coût pour atteindre 15 (depuis 14)`
});
@@ -215,6 +204,17 @@ export class RdDCommands {
}
onChatMessage(message, msg = {}) {
const content = Misc.stripHtml(message)
if (content[0] == '/') {
const commands = content.match(/(\S+)/g)
if (this.processChatCommand(commands, content, msg)) {
return false
}
}
return true
}
/* -------------------------------------------- */
/* Manage chat commands */
processChatCommand(commandLine, content = '', msg = {}) {
@@ -440,13 +440,18 @@ export class RdDCommands {
/* -------------------------------------------- */
getCoutXpCarac(msg, params) {
if (params && params.length == 1) {
let to = Number(params[0]);
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to)}`);
}
else {
return false;
if (params) {
if (params.length == 1) {
const to = Number(params[0])
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to - 1, to)}`);
}
if (params.length == 2) {
const from = Number(params[0]);
const to = Number(params[1]);
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${from} à ${to}: ${RdDCarac.getCaracXp(from, to)}`);
}
}
return false
}
async creerSignesDraconiques() {

View File

@@ -15,21 +15,28 @@ export class RdDEmpoignade {
}
/* -------------------------------------------- */
static getActorEmpoignade(actorId) {
const actor = game.actors.get(actorId)
if (actor == undefined) {
ui.notifications.warn(`Impossible de retrouver l'acteur ${actorId}, l'empoignade ne peut pas être continuée.`)
}
return actor
}
static isCombatantEmpoignade(actorId, tokenId) {
const combatant = RdDCombatManager.getCombatant(actorId, tokenId)
return MAP_PHASE.empoignade.rang == combatant?.system.init?.rang
return combatant && MAP_PHASE.empoignade.rang == combatant?.system.init?.rang
}
static async ajustementEmpoignade(attacker, defender, adjust = 1) {
let empoignade = RdDEmpoignade.getEmpoignade(attacker, defender)
if (empoignade?.system.empoigneurid == defender.id) {
let empoignade = RdDEmpoignade.getEmpoignade(defender, attacker)
empoignade = RdDEmpoignade.getEmpoignade(defender, attacker)
return await RdDEmpoignade.$ajustementEmpoignade(empoignade, defender, attacker, - adjust);
}
return await RdDEmpoignade.$ajustementEmpoignade(empoignade, attacker, defender, adjust);
}
static async $ajustementEmpoignade(empoignade, attacker, defender, adjust) {
const empId = empoignade?.system.empoignadeid ?? foundry.utils.randomID(16);
const empFin = (empoignade?.system.pointsemp ?? 0) + adjust
@@ -73,30 +80,32 @@ export class RdDEmpoignade {
const rollData = RdDEmpoignade.$readRollEmpoignade(chatMessage);
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
RdDEmpoignade.onDefenseEmpoignade(rollData, defenseMode, "Corps à corps", "melee")
});
})
$(html).on("click", '.defense-empoignade-esquive', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.$readRollEmpoignade(chatMessage);
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
RdDEmpoignade.onDefenseEmpoignade(rollData, defenseMode, "Esquive", "derobee")
});
})
$(html).on("click", '.empoignade-poursuivre', event => {
let attackerId = event.currentTarget.attributes['data-attackerId'].value
let defenderId = event.currentTarget.attributes['data-defenderId'].value
RdDEmpoignade.onAttaqueEmpoignadeValidee(game.actors.get(attackerId), game.actors.get(defenderId))
});
const attacker = RdDEmpoignade.getActorFromEventTag(event, 'data-attackerId')
const defender = RdDEmpoignade.getActorFromEventTag(event, 'data-defenderId')
if (attacker && defender) {
RdDEmpoignade.onAttaqueEmpoignadeValidee(attacker, defender)
}
})
$(html).on("click", '.empoignade-entrainer-sol', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.$readRollEmpoignade(chatMessage);
RdDEmpoignade.entrainerAuSol(rollData)
ChatUtility.remover(chatMessage)()
});
})
$(html).on("click", '.empoignade-projeter-sol', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.$readRollEmpoignade(chatMessage);
RdDEmpoignade.projeterAuSol(rollData)
ChatUtility.remover(chatMessage)()
});
})
$(html).on("change", '.empoignade-perte-endurance', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.$readRollEmpoignade(chatMessage);
@@ -104,7 +113,11 @@ export class RdDEmpoignade {
RdDEmpoignade.perteEndurance(rollData, event.currentTarget.value)
ChatUtility.remover(chatMessage)()
}
});
})
}
static getActorFromEventTag(event, tag) {
return RdDEmpoignade.getActorEmpoignade(event.currentTarget.attributes[tag]?.value ?? '<inconnu>')
}
/* -------------------------------------------- */
@@ -112,32 +125,31 @@ export class RdDEmpoignade {
// TODO: autoriser la perception? la comédie/séduction?
if (RdDEmpoignade.isEmpoignadeEnCours(actor)) {
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
return true;
return true
}
return false;
return false
}
/* -------------------------------------------- */
static $storeRollEmpoignade(msg, rollData) {
RdDEmpoignade.$reduceActorToIds(rollData);
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData);
ChatUtility.setMessageData(msg, "empoignade-roll-data", RdDEmpoignade.$reduceActorToIds(rollData))
}
static $reduceActorToIds(rollData) {
rollData.attacker = { id: rollData.attacker.id };
rollData.defender = { id: rollData.defender.id };
rollData.attacker = { id: rollData.attacker.id }
rollData.defender = { id: rollData.defender.id }
return rollData
}
/* -------------------------------------------- */
static $readRollEmpoignade(msg) {
const rollData = ChatUtility.getMessageData(msg, 'empoignade-roll-data');
RdDEmpoignade.$replaceIdsWithActors(rollData);
return rollData
return RdDEmpoignade.$replaceIdsWithActors(ChatUtility.getMessageData(msg, 'empoignade-roll-data'))
}
static $replaceIdsWithActors(rollData) {
rollData.attacker = game.actors.get(rollData.attacker.id);
rollData.defender = game.actors.get(rollData.defender.id);
rollData.attacker = RdDEmpoignade.getActorEmpoignade(rollData.attacker.id)
rollData.defender = RdDEmpoignade.getActorEmpoignade(rollData.defender.id)
return rollData
}
/* -------------------------------------------- */
@@ -147,19 +159,21 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static getEmpoignadeById(actor, id) {
return actor.itemTypes[ITEM_TYPES.empoignade].find(it => it.system.empoignadeid == id)
return actor?.itemTypes[ITEM_TYPES.empoignade].find(it => it.system.empoignadeid == id)
}
/* -------------------------------------------- */
static getEmpoignade(attacker, defender) {
let emp = attacker.itemTypes[ITEM_TYPES.empoignade].find(it =>
(it.system.empoigneurid == attacker.id && it.system.empoigneid == defender.id) ||
(it.system.empoigneurid == defender.id && it.system.empoigneid == attacker.id)
)
if (emp) {
return foundry.utils.duplicate(emp);
if (attacker && defender) {
const empoignade = attacker.itemTypes[ITEM_TYPES.empoignade].find(it =>
(it.system.empoigneurid == attacker.id && it.system.empoigneid == defender.id) ||
(it.system.empoigneurid == defender.id && it.system.empoigneid == attacker.id)
)
if (empoignade) {
return foundry.utils.duplicate(empoignade)
}
}
return undefined;
return undefined
}
/* -------------------------------------------- */
@@ -180,10 +194,14 @@ export class RdDEmpoignade {
}
static isActionAutorisee(mode, attacker, defender) {
const acting = RdDEmpoignade.isActionDefenseur(mode) ? defender : attacker;
if (!defender || !attacker) {
return false
}
const acting = RdDEmpoignade.isActionDefenseur(mode) ? defender : attacker
if (acting.getUserLevel(game.user) < CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) {
ui.notifications.warn(`Vous n'êtes pas autorisé à choisir l'action de ${acting.name}`)
return false;
return false
}
return true
}
@@ -205,14 +223,11 @@ export class RdDEmpoignade {
let empoignade = RdDEmpoignade.getEmpoignade(attacker, defender)
const isNouvelle = empoignade == undefined;
empoignade = empoignade ?? (await RdDEmpoignade.createEmpoignade(attacker, defender))
//console.log("W.", empoignade, defender.hasArmeeMeleeEquipee())
if ((isNouvelle || empoignade.system.pointsemp == 0) && defender.hasArmeeMeleeEquipee()) {
ChatUtility.createChatWithRollMode(
{
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-valider.hbs`, { attacker: attacker, defender: defender })
},
attacker
)
await ChatMessage.create(ChatUtility.adaptVisibility(
{ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-valider.hbs`, { attacker: attacker, defender: defender }) },
{ actor: attacker }
))
} else {
await this.onAttaqueEmpoignadeValidee(attacker, defender)
}
@@ -264,30 +279,34 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static async onAttaqueEmpoignadeFromItem(empoignade) {
let attacker = game.actors.get(empoignade.system.empoigneurid)
let defender = game.actors.get(empoignade.system.empoigneid)
await this.onAttaqueEmpoignadeValidee(attacker, defender)
const attacker = RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneurid)
const defender = RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneid)
if (attacker && defender) {
await this.onAttaqueEmpoignadeValidee(attacker, defender)
}
}
static async onImmobilisation(attacker, empoignade) {
const defender = game.actors.get(empoignade.system.empoigneid)
const empDefenseur = defender.itemTypes[ITEM_TYPES.empoignade]
.find(it => it.system.empoignadeid == empoignade.system.empoignadeid);
await defender.updateEmbeddedDocuments('Item', [{
_id: empDefenseur.id,
'system.immobilise': true
}])
const rollData = {
mode: "immobilise",
empoignade, attacker, defender,
isEmpoignade: true,
competence: attacker.getCompetenceCorpsACorps()
const defender = RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneid)
if (defender) {
const empDefenseur = defender.itemTypes[ITEM_TYPES.empoignade]
.find(it => it.system.empoignadeid == empoignade.system.empoignadeid);
await defender.updateEmbeddedDocuments('Item', [{
_id: empDefenseur.id,
'system.immobilise': true
}])
const rollData = {
mode: "immobilise",
empoignade, attacker, defender,
isEmpoignade: true,
competence: attacker.getCompetenceCorpsACorps()
}
const msg = await ChatMessage.create({
whisper: ChatUtility.getOwners(attacker),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-immobilise.hbs`, rollData)
})
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
const msg = await ChatMessage.create({
whisper: ChatUtility.getOwners(attacker),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-immobilise.hbs`, rollData)
})
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
/* -------------------------------------------- */
@@ -304,30 +323,30 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static async $onRollEmpoignade(rollData, isNouvelle = false) {
let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defender.id)
const attacker = RdDEmpoignade.getActorEmpoignade(rollData.attacker.id)
const defender = RdDEmpoignade.getActorEmpoignade(rollData.defender.id)
if (attacker && defender) {
if (rollData.rolled.isSuccess && isNouvelle) {
RdDEmpoignade.$createEtatEmpoignade(rollData.empoignade)
}
if (rollData.rolled.isSuccess && isNouvelle) {
RdDEmpoignade.$createEtatEmpoignade(rollData.empoignade)
rollData.empoignade.isSuccess = rollData.rolled.isSuccess;
if (rollData.rolled.isPart) {
rollData.particuliere = "finesse";
}
let msg = await RdDRollResult.displayRollData(rollData, defender, 'chat-empoignade-resultat.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
rollData.empoignade.isSuccess = rollData.rolled.isSuccess;
if (rollData.rolled.isPart) {
rollData.particuliere = "finesse";
}
let msg = await RdDRollResult.displayRollData(rollData, defender, 'chat-empoignade-resultat.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
/* -------------------------------------------- */
static async onDefenseEmpoignade(attackerRoll, mode, competenceName = "Corps à corps", carac = "melee") {
let attacker = game.actors.get(attackerRoll.attacker.id)
let defender = game.actors.get(attackerRoll.defender.id)
const attacker = RdDEmpoignade.getActorEmpoignade(rollData.attacker.id)
const defender = RdDEmpoignade.getActorEmpoignade(rollData.defender.id)
if (!RdDEmpoignade.isActionAutorisee(mode, attacker, defender)) {
return
}
let empoignade = RdDEmpoignade.getEmpoignade(attacker, defender)
if (!empoignade) {
@@ -367,7 +386,7 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static async $onRollContrerLiberer(rollData) {
let empoignade = rollData.empoignade
const empoignade = rollData.empoignade
if (rollData.mode == "contrer-empoigner" && !rollData.rolled.isSuccess) {
empoignade.system.pointsemp++
@@ -389,35 +408,40 @@ export class RdDEmpoignade {
static async $createEtatEmpoignade(empoignade) {
console.log("CREATE Empoignade", empoignade)
let defender = game.actors.get(empoignade.system.empoigneid)
let attacker = game.actors.get(empoignade.system.empoigneurid)
const attacker = RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneurid)
const defender = RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneid)
// Creer l'empoignade sur attaquant/defenseur
await attacker.creerObjetParMJ(empoignade)
await defender.creerObjetParMJ(empoignade)
if (attacker && defender) {
// Creer l'empoignade sur attaquant et defenseur
await attacker.creerObjetParMJ(empoignade)
await defender.creerObjetParMJ(empoignade)
}
}
/* -------------------------------------------- */
static async $updateEtatEmpoignade(empoignade, attacker, defender) {
const belligerants = [
attacker ?? game.actors.get(empoignade.system.empoigneurid),
defender ?? game.actors.get(empoignade.system.empoigneid)]
const removeEmp = empoignade.system.pointsemp == 0
attacker = attacker ?? RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneurid)
defender = defender ?? RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneid)
if (removeEmp) {
const emp = RdDEmpoignade.getEmpoignadeById(attacker, empoignade.system.empoignadeid)
return await attacker.deleteEmbeddedDocuments('Item', [emp.id])
}
else {
await Promise.all(
belligerants.map(async belligerant => {
const emp = RdDEmpoignade.getEmpoignadeById(belligerant, empoignade.system.empoignadeid)
return await belligerant.updateEmbeddedDocuments('Item', [{
_id: emp.id,
"system.pointsemp": empoignade.system.pointsemp,
"system.ausol": empoignade.system.ausol
}])
}))
if (attacker && defender) {
const belligerants = [attacker, defender]
const removeEmp = empoignade.system.pointsemp == 0
if (removeEmp) {
const emp = RdDEmpoignade.getEmpoignadeById(attacker, empoignade.system.empoignadeid)
return await attacker.deleteEmbeddedDocuments('Item', [emp.id])
}
else {
await Promise.all(
belligerants.map(async belligerant => {
const emp = RdDEmpoignade.getEmpoignadeById(belligerant, empoignade.system.empoignadeid)
return await belligerant.updateEmbeddedDocuments('Item', [{
_id: emp.id,
"system.pointsemp": empoignade.system.pointsemp,
"system.ausol": empoignade.system.ausol
}])
}))
}
}
}
@@ -425,19 +449,21 @@ export class RdDEmpoignade {
static async $deleteEmpoignade(empoignade) {
console.log("DELETE Empoignade", empoignade)
const defender = game.actors.get(empoignade.system.empoigneid)
const emp = RdDEmpoignade.getEmpoignadeById(defender, empoignade.system.empoignadeid)
await defender.deleteEmbeddedDocuments('Item', [emp.id])
const defender = RdDEmpoignade.getActorEmpoignade(empoignade.system.empoigneid)
if (defender) {
const emp = RdDEmpoignade.getEmpoignadeById(defender, empoignade.system.empoignadeid)
await defender.deleteEmbeddedDocuments('Item', [emp.id])
}
}
/* -------------------------------------------- */
static async entrainerAuSol(rollData) {
let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defender.id)
const attacker = RdDEmpoignade.getActorEmpoignade(rollData.attacker.id)
const defender = RdDEmpoignade.getActorEmpoignade(rollData.defender.id)
if (!RdDEmpoignade.isActionAutorisee("immobilise", attacker, defender)) {
return
}
let empoignade = RdDEmpoignade.getEmpoignade(attacker, defender)
const empoignade = RdDEmpoignade.getEmpoignade(attacker, defender)
empoignade.system.ausol = true
await this.$updateEtatEmpoignade(empoignade)
@@ -445,14 +471,14 @@ export class RdDEmpoignade {
await attacker.setEffect(STATUSES.StatusProne, true);
await defender.setEffect(STATUSES.StatusProne, true);
let msg = await RdDRollResult.displayRollData(rollData, attacker, 'chat-empoignade-entrainer-sol.hbs');
const msg = await RdDRollResult.displayRollData(rollData, attacker, 'chat-empoignade-entrainer-sol.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
/* -------------------------------------------- */
static async projeterAuSol(rollData) {
let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defender.id)
const attacker = RdDEmpoignade.getActorEmpoignade(rollData.attacker.id)
const defender = RdDEmpoignade.getActorEmpoignade(rollData.defender.id)
if (!RdDEmpoignade.isActionAutorisee("immobilise", attacker, defender)) {
return
}
@@ -467,8 +493,8 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static async perteEndurance(rollData, perteMode) {
let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defender.id)
const attacker = RdDEmpoignade.getActorEmpoignade(rollData.attacker.id)
const defender = RdDEmpoignade.getActorEmpoignade(rollData.defender.id)
if (perteMode == "none" || !RdDEmpoignade.isActionAutorisee("immobilise", attacker, defender)) {
return
}
@@ -501,11 +527,11 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static async deleteLinkedEmpoignade(actorId, empoignade) {
let actorDeleteId = (actorId == empoignade.system.empoigneurid) ? empoignade.system.empoigneid : empoignade.system.empoigneurid
let actor = game.actors.get(actorDeleteId)
let emp = this.getEmpoignadeById(actor, empoignade.system.empoignadeid)
if (emp) {
await actor.deleteEmbeddedDocuments('Item', [emp.id])
const actorDeleteId = (actorId == empoignade.system.empoigneurid) ? empoignade.system.empoigneid : empoignade.system.empoigneurid
const actor = RdDEmpoignade.getActorEmpoignade(actorDeleteId)
const empoignadeOpposant = this.getEmpoignadeById(actor, empoignade.system.empoignadeid)
if (actor && empoignadeOpposant) {
await actor.deleteEmbeddedDocuments('Item', [empoignadeOpposant.id])
}
}

View File

@@ -101,7 +101,7 @@ export class RdDHotbar {
}
/** Roll macro */
static rollMacro(itemName, itemType, categorieArme = 'competence') {
static rollMacro(itemName, itemType, maniement = 'competence') {
const speaker = ChatMessage.getSpeaker();
let actor;
if (speaker.token) actor = game.actors.tokens[speaker.token];
@@ -117,10 +117,10 @@ export class RdDHotbar {
// Trigger the item roll
switch (item.type) {
case ITEM_TYPES.arme:
return actor.rollArme(item, categorieArme);
return actor.rollArme(item, maniement);
case ITEM_TYPES.competence:
if (item.isCorpsACorps()) {
switch (categorieArme) {
switch (maniement) {
case PUGILAT:
return actor.rollArme(RdDItemArme.pugilat(actor));
case EMPOIGNADE:
@@ -130,7 +130,7 @@ export class RdDHotbar {
return actor.rollCompetence(item);
case ITEM_TYPES.competencecreature:
return item.system.iscombat
? actor.rollArme(item, categorieArme)
? actor.rollArme(item, maniement)
: actor.rollCompetence(item);
}

View File

@@ -94,6 +94,7 @@ import ChatRollResult from "./roll/chat-roll-result.mjs"
import ExportPdf from "./actor/export-pdf/export-pdf.mjs"
import { DialogFlushByDate } from "./chat/dialog-flush-by-date.mjs"
import { Remote } from "./remote.mjs"
import { RdDActiveEffect } from "./effect/base-active-effect.js"
/**
* RdD system
@@ -199,6 +200,7 @@ export class SystemReveDeDragon {
// Define custom Entity classes
console.log(`Initializing Reve de Dragon Documents`)
CONFIG.Actor.documentClass = RdDBaseActor
CONFIG.ActiveEffect.documentClass = RdDActiveEffect
CONFIG.Item.documentClass = RdDItem
CONFIG.Item.dataModels = {
monnaie: models.RdDModelMonnaie,
@@ -358,6 +360,15 @@ export class SystemReveDeDragon {
},
default: "aucun"
})
/* -------------------------------------------- */
game.settings.register(SYSTEM_RDD, "info-msg-timeout", {
name: "Gestion du timeout d'affichage du message d'information",
scope: "world",
config: false,
type: Number,
default: 0
})
}
async onReady() {
@@ -416,7 +427,16 @@ export class SystemReveDeDragon {
<br>Vous trouverez quelques informations pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}
<br>La commande <code>/aide</code> dans le chat permet de voir les commandes spécifiques à Rêve de Dragon.</div>
` })
// Try to fetch the welcome message from the github repo "welcome-message-ecryme.html"
// Get last message display time
const lastDisplay = game.settings.get(SYSTEM_RDD, "info-msg-timeout") || 0
const now = Date.now()
const oneDayMs = 24 * 60 * 60 * 1000
if (now - lastDisplay < oneDayMs) {
return // Already displayed in the last 24 hours
}
// Update last display time
game.settings.set(SYSTEM_RDD, "info-msg-timeout", now)
// Try to fetch the welcome message from the github repo RDD_INFO_MESSAGE_URL
fetch(RDD_INFO_MESSAGE_URL)
.then(response => response.text())
.then(html => {

View File

@@ -2,6 +2,7 @@ import { RdDRoll } from "./rdd-roll.js";
import { Targets } from "./targets.js";
import { ITEM_TYPES } from "./constants.js";
import { RdDRollResult } from "./rdd-roll-result.js";
import { CARACS } from "./rdd-carac.js";
/* -------------------------------------------- */
/* On part du principe qu'une entité démarre tjs
@@ -96,15 +97,14 @@ export class RdDPossession {
static selectCompetenceDraconicOuPossession(rollData, rollingActor) {
rollData.competence = rollingActor.getDraconicOuPossession().find(it => true);
if (rollingActor.isCreatureOuEntite()) {
const carac = rollingActor.system.carac
rollData.carac = carac
rollData.competence.system.defaut_carac = 'reve'
rollData.selectedCarac = carac.reve
rollData.carac = rollingActor.system.carac
rollData.competence.system.defaut_carac = CARACS.REVE
rollData.selectedCarac = rollingActor.system.carac.reve
}
else {
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: rollingActor.getReveActuel() } }
rollData.selectedCarac = rollData.forceCarac['reve-actuel']
rollData.competence.system.defaut_carac = 'reve-actuel'
rollData.forceCarac = rollingActor.getCaracReveActuel()
rollData.selectedCarac = rollData.forceCarac[CARACS.REVE_ACTUEL]
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
}
}

View File

@@ -4,12 +4,10 @@ import { renderTemplate } from "./constants.js";
export class RdDRollResult {
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.hbs') {
const chatMessage = await ChatUtility.createChatWithRollMode(
return await ChatMessage.create(ChatUtility.adaptVisibility(
{ content: await RdDRollResult.buildRollDataHtml(rollData, template) },
actor,
rollData.current?.rollmode?.key
)
return chatMessage
{ actor: actor, rollMode: rollData.current?.rollmode?.key }
))
}
static async buildRollDataHtml(rollData, template = 'chat-resultat-general.hbs') {

View File

@@ -4,7 +4,7 @@ import { RdDItemCompetence } from "./item-competence.js";
import { RdDItemSort } from "./item-sort.js";
import { Misc } from "./misc.js";
import { RdDBonus } from "./rdd-bonus.js";
import { RdDCarac } from "./rdd-carac.js";
import { CARACS, RdDCarac } from "./rdd-carac.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
import { Grammar } from "./grammar.js";
@@ -65,7 +65,7 @@ export class RdDRoll extends Dialog {
}
// Mini patch :Ajout du rêve actuel
if (actor.type == ACTOR_TYPES.personnage) {
defaultRollData.carac["reve-actuel"] = actor.system.reve.reve
defaultRollData.carac[CARACS.REVE_ACTUEL] = actor.system.reve.reve
}
foundry.utils.mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });

View File

@@ -34,9 +34,9 @@ export class RdDRollTables {
}
/* -------------------------------------------- */
static async getCompetence(toChat = false) {
static async getCompetence(toChat = false, rollMode = "gmroll") {
if (toChat == 'liste') {
return await RdDRollTables.listOrRoll('competences', 'Item', ['competence'], toChat, it => 1);
return await RdDRollTables.listOrRoll('competences', 'Item', ['competence'], toChat, rollMode, it => 1);
}
else {
return await RdDRollTables.drawItemFromRollTable("Détermination aléatoire de compétence", toChat);
@@ -44,56 +44,58 @@ export class RdDRollTables {
}
/* -------------------------------------------- */
static async getSouffle(toChat = false) {
return await RdDRollTables.listOrRoll('souffles-de-dragon', 'Item', ['souffle'], toChat);
static async getSouffle(toChat = false, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('souffles-de-dragon', 'Item', ['souffle'], toChat, rollMode);
}
/* -------------------------------------------- */
static async getQueue(toChat = false) {
return await RdDRollTables.listOrRoll('queues-de-dragon', 'Item', ['queue'], toChat);
static async getQueue(toChat = false, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('queues-de-dragon', 'Item', ['queue'], toChat, rollMode);
}
static async getDesirLancinant(toChat = false) {
return await RdDRollTables.listOrRoll('queues-de-dragon', 'Item', ['queue'], toChat,
static async getDesirLancinant(toChat = false, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('queues-de-dragon', 'Item', ['queue'], toChat, rollMode,
it => it.system.frequence,
it => it.system.categorie == 'lancinant');
}
static async getIdeeFixe(toChat = false) {
return await RdDRollTables.listOrRoll('queues-de-dragon', 'Item', ['queue'], toChat,
static async getIdeeFixe(toChat = false, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('queues-de-dragon', 'Item', ['queue'], toChat, rollMode,
it => it.system.frequence,
it => it.system.categorie == 'ideefixe');
}
/* -------------------------------------------- */
static async getTeteHR(toChat = false) {
return await RdDRollTables.listOrRoll('tetes-de-dragon-pour-haut-revants', 'Item', ['tete'], toChat);
static async getTeteHR(toChat = false, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('tetes-de-dragon-pour-haut-revants', 'Item', ['tete'], toChat, rollMode);
}
/* -------------------------------------------- */
static async getTete(toChat = false) {
return await RdDRollTables.listOrRoll('tetes-de-dragon-pour-tous-personnages', 'Item', ['tete'], toChat);
static async getTete(toChat = false, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('tetes-de-dragon-pour-tous-personnages', 'Item', ['tete'], toChat, rollMode);
}
/* -------------------------------------------- */
static async getOmbre(toChat = false) {
return await RdDRollTables.listOrRoll('ombres-de-thanatos', 'Item', ['ombre'], toChat);
static async getOmbre(toChat = false, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('ombres-de-thanatos', 'Item', ['ombre'], toChat, rollMode);
}
/* -------------------------------------------- */
static async getTarot(toChat = true) {
return await RdDRollTables.listOrRoll('tarot-draconique', 'Item', ['tarot'], toChat);
static async getTarot(toChat = true, rollMode = "gmroll") {
return await RdDRollTables.listOrRoll('tarot-draconique', 'Item', ['tarot'], toChat, rollMode);
}
/* -------------------------------------------- */
static async listOrRoll(compendium, type, subTypes, toChat, itemFrequence = it => it.system.frequence, filter = it => true) {
static async listOrRoll(compendium, type, subTypes, toChat, rollMode,
itemFrequence = it => it.system.frequence,
filter = it => true) {
const table = new CompendiumTable(compendium, type, subTypes);
if (toChat == 'liste') {
return await table.toChatMessage(itemFrequence, filter);
}
const row = await table.getRandom(itemFrequence, filter);
if (row) {
await CompendiumTableHelpers.tableRowToChatMessage(row, type);
await CompendiumTableHelpers.tableRowToChatMessage(row, type, { rollMode: rollMode });
return row.document;
}
return undefined;

View File

@@ -93,7 +93,7 @@ export class RdDSheetUtility {
static async renderItemBranch(actor, item) {
while (item) {
await item.sheet?.render()
item = actor.getContenant(item)
item = actor.findConteneur(item)
}
}
}

View File

@@ -16,6 +16,7 @@ import { RdDDice } from "./rdd-dice.js";
import { RdDRencontre } from "./item/rencontre.js";
import { ITEM_TYPES } from "./constants.js";
import { Misc } from "./misc.js";
import { CARACS } from "./rdd-carac.js";
const TMR_DISPLAY_SIZE = {
code: 'tmr-display-size',
@@ -125,7 +126,7 @@ export class RdDTMRDialog extends Dialog {
HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(this._getCoordActor()));
this.html.find('form.tmr-dialog *').click(event => {
if (this.subdialog?.rendered){
if (this.subdialog?.rendered) {
this.subdialog?.bringToFront()
}
})
@@ -685,12 +686,12 @@ export class RdDTMRDialog extends Dialog {
tmr: tmr,
canClose: false,
diffLibre: -7,
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.actor.getReveActuel() } },
forceCarac: this.actor.getCaracReveActuel(),
maitrise: { verbe: 'maîtriser', action: 'Maîtriser le fleuve' }
}
rollData.double = EffetsDraconiques.isDoubleResistanceFleuve(this.actor) ? true : undefined,
rollData.competence.system.defaut_carac = 'reve-actuel';
await this._rollMaitriseCaseHumide(rollData);
rollData.double = EffetsDraconiques.isDoubleResistanceFleuve(this.actor) ? true : undefined
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
await this._rollMaitriseCaseHumide(rollData)
}
}
@@ -810,30 +811,30 @@ export class RdDTMRDialog extends Dialog {
tmr: tmr,
canClose: options.canClose ?? false,
diffLibre: options.difficulte ?? -7,
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.actor.getReveActuel() } },
forceCarac: this.actor.getCaracReveActuel(),
maitrise: { verbe: 'conquérir', action: options.action }
};
rollData.competence.system.defaut_carac = 'reve-actuel';
}
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
await this._maitriserTMR(rollData, r => this._onResultatConquerir(r, options));
await this._maitriserTMR(rollData, r => this._onResultatConquerir(r, options))
}
/* -------------------------------------------- */
async _onResultatConquerir(rollData, options) {
if (rollData.rolled.isETotal) {
rollData.souffle = await this.actor.ajouterSouffle({ chat: false });
rollData.souffle = await this.actor.ajouterSouffle({ chat: false })
}
rollData.poesie = await Poetique.getExtrait();
rollData.poesie = await Poetique.getExtrait()
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.hbs`, rollData)
});
})
if (rollData.rolled.isEchec) {
options.onConqueteEchec(rollData, options.effetDraconique);
options.onConqueteEchec(rollData, options.effetDraconique)
}
else {
await options.onConqueteReussie(rollData, options.effetDraconique);
this.updateTokens();
await options.onConqueteReussie(rollData, options.effetDraconique)
this.updateTokens()
}
}
@@ -967,7 +968,7 @@ export class RdDTMRDialog extends Dialog {
const targetOddq = this.pixiTMR.computeEventOddq(event)
const targetCoord = TMRUtility.oddqToCoordTMR(targetOddq)
if (targetCoord == COORD_TMR_INCONNU){
if (targetCoord == COORD_TMR_INCONNU) {
ui.notifications.error("Vous ne pouvez pas vous déplacer ici");
return
}
@@ -1136,12 +1137,12 @@ export class RdDTMRDialog extends Dialog {
if (!token) {
return
}
if (this.demiReve === token && this.isDemiReveCache()) {
if (this.isDemiReveCache() && [EffetsDraconiques.rencontre.code(), EffetsDraconiques.demiReve.code()].includes(token.code)) {
return
}
this.pixiTMR.positionToken(token);
this.pixiTMR.positionToken(token)
if (!this.allTokens.includes(token)) {
this.allTokens.push(token);
this.allTokens.push(token)
}
}
}

View File

@@ -147,7 +147,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor/taches.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.hbs',
@@ -348,6 +348,7 @@ export class RdDUtility {
// Items
Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field));
Handlebars.registerHelper('item-action-applies', (action, item, options) => ItemAction.applies(action, item, options))
Handlebars.registerHelper('item-action-label', (action, item) => new Handlebars.SafeString(ItemAction.label(action, item)))
Handlebars.registerHelper('item-action-img', (action, item) => new Handlebars.SafeString(ItemAction.img(action, item)))
Handlebars.registerHelper('item-name', (item) => item.nameDisplay)
@@ -482,7 +483,7 @@ export class RdDUtility {
static filterItemsPerTypeForSheet(formData, itemTypes) {
Object.values(ITEM_TYPES).forEach(t => {
formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t])
formData[RdDItem.itemTypePluriel(t)] = Misc.arrayOrEmpty(itemTypes[t])
itemTypes[t].forEach(item => item.actions = item.itemActions())
})
@@ -679,7 +680,7 @@ export class RdDUtility {
encaissement.dmg = dmg
if (ReglesOptionnelles.isUsing('localisation-aleatoire')) {
encaissement.dmg.loc = dmg.loc ?? await RdDUtility.getLocalisation(targetActor.type)
encaissement.dmg.loc.label = encaissement.dmg.loc.label ?? 'Corps;'
encaissement.dmg.loc.label = encaissement.dmg.loc.label ?? 'Corps'
}
else {
encaissement.dmg.loc = { label: '' }
@@ -688,9 +689,9 @@ export class RdDUtility {
encaissement.armure = armure
encaissement.penetration = dmg.penetration
encaissement.total = jetTotal
encaissement.vie = await RdDUtility._evaluatePerte(encaissement.vie, over20);
encaissement.endurance = await RdDUtility._evaluatePerte(encaissement.endurance, over20);
return encaissement;
encaissement.vie = await RdDUtility._evaluatePerte(encaissement.vie, over20)
encaissement.endurance = await RdDUtility._evaluatePerte(encaissement.endurance, over20)
return encaissement
}
/* -------------------------------------------- */

View File

@@ -43,13 +43,13 @@ export default class ChatRollResult {
async display(roll, impacts) {
this.prepareDisplay(roll)
const chatMessage = await ChatUtility.createChatWithRollMode(
const chatMessage = await ChatMessage.create(ChatUtility.adaptVisibility(
{
content: await this.buildRollHtml(roll)
},
roll.active.actor,
roll.current?.rollmode?.key
)
))
await this.saveChatMessageRoll(chatMessage, roll, impacts)
return chatMessage
@@ -105,8 +105,8 @@ export default class ChatRollResult {
if (attaque &&
(roll.rolled.isEchec || !roll.current.defense.isEsquive) &&
(attaque.particuliere == 'force' || 'charge' == attaque.tactique?.key)) {
const taille = defender.system.carac.taille.value
const impact = attacker.system.carac.force.value + roll.attackerRoll?.dmg.dmgArme
const taille = defender.getTaille()
const impact = attacker.getForce() + roll.attackerRoll?.dmg.dmgArme
return {
raison: 'charge' == attaque.tactique?.key ? 'charge' : 'particulière en force',
taille: taille,

View File

@@ -218,7 +218,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
foundry.applications.handlebars.loadTemplates(ALL_ROLL_TYPES.map(m => m.chatResultTemplate))
foundry.applications.handlebars.loadTemplates(ROLL_PARTS.map(p => p.template))
ROLL_PARTS.forEach(p => p.onReady())
ROLL_PARTS.forEach(p => p.onReady(ROLL_PARTS))
Handlebars.registerHelper('roll-centered-array', (base, show) => {
show = Math.abs(show)
@@ -380,7 +380,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
this.rollData = rollData
this.rollOptions = {
callbacks: [
async r => await r.active.actor.appliquerAjoutExperience(r),
async r => await r.active.actor.ajoutExperience(r),
async r => await r.active.actor.appliquerAppelMoral(r),
...(rollOptions.callbacks ?? [])
],
@@ -479,16 +479,13 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
RollBasicParts.loadSurprises(rollData, this.getSelectedType().code)
rollData.type.label = this.getSelectedType()?.title(rollData)
const visibleRollParts = this.getActiveParts()
visibleRollParts.forEach(p => p.applyExternalImpacts(visibleRollParts, rollData))
this.setSpecialComp(visibleRollParts);
visibleRollParts.forEach(p => p.prepareContext(rollData))
this.getActiveParts().forEach(p => p.applyExternalImpacts(this.getActiveParts(), rollData))
this.setSpecialComp(this.getActiveParts());
this.getActiveParts().forEach(p => p.prepareContext(rollData))
RollDialog.calculAjustement(rollData)
const templates = visibleRollParts.map(p => p.toTemplateData())
const templates = this.getActiveParts().map(p => p.toTemplateData())
const context = await super._prepareContext()
return foundry.utils.mergeObject(
{
@@ -569,7 +566,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
}
async defaultCallback(roll, rolled) {
await roll.active.actor.appliquerAjoutExperience(roll)
await roll.active.actor.ajoutExperience(roll)
await roll.active.actor.appliquerAppelMoral(roll)
}

View File

@@ -1,4 +1,5 @@
import { Grammar } from "../grammar.js"
import { CARACS } from "../rdd-carac.js"
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js"
import { ROLL_TYPE_SORT } from "./roll-constants.mjs"
import { RollPartCheckbox } from "./roll-part-checkbox.mjs"
@@ -20,7 +21,7 @@ export class RollPartAstrologique extends RollPartCheckbox {
}
isJetChance(rollData) {
return Grammar.includesLowerCaseNoAccent(rollData.current.carac.key, 'chance')
return Grammar.includesLowerCaseNoAccent(rollData.current.carac.key, CARACS.CHANCE)
}
$isUsingAstrologie() {

View File

@@ -1,8 +1,11 @@
import { Distance } from "../combat/distance.mjs"
import { RDD_CONFIG } from "../constants.js"
import { MAP_PHASE, RdDInitiative } from "../initiative.mjs"
import { ATTAQUE_TYPE_MELEE } from "../item/arme.js"
import { Misc } from "../misc.js"
import { RdDBonus } from "../rdd-bonus.js"
import { CARACS } from "../rdd-carac.js"
import { RdDCombatManager } from "../rdd-combat.js"
import { RdDEmpoignade } from "../rdd-empoignade.js"
import { DIFF, ROLL_TYPE_ATTAQUE, ROLL_TYPE_COMP } from "./roll-constants.mjs"
import RollDialog from "./roll-dialog.mjs"
@@ -17,9 +20,9 @@ export const PART_ATTAQUE = 'attaque'
const TACTIQUES = RdDBonus.tactiques.filter(it => it.isTactique)
const FILTER_ATTAQUE_EMPOIGNADE = attaque => attaque.arme.isEmpoignade()
const FILTER_ATTAQUE_NON_EMPOIGNADE = attaque => !attaque.arme.isEmpoignade()
const FILTER_ATTAQUE_EMPOIGNE = attaque => attaque.arme.isUtilisableEmpoigne() && ATTAQUE_TYPE_MELEE.includes(attaque.main)
const FILTER_ATTAQUE_EMPOIGNADE = attaque => attaque.arme?.isEmpoignade()
const FILTER_ATTAQUE_RANG = rang => attaque => !attaque.arme?.isEmpoignade() && (attaque.rang == rang || rang == undefined)
const FILTER_ATTAQUE_EMPOIGNE = attaque => attaque.arme?.isUtilisableEmpoigne() && ATTAQUE_TYPE_MELEE.includes(attaque.main)
export class RollPartAttaque extends RollPartSelect {
@@ -33,8 +36,9 @@ export class RollPartAttaque extends RollPartSelect {
loadRefs(rollData) {
const refs = this.getRefs(rollData)
const attaques = rollData.active.actor.listAttaques()
.sort(Misc.descending(it => it.comp?.system.niveau ?? -8))
refs.all = attaques.map(it => RollPartAttaque.$extractAttaque(it, rollData))
this.filterAttaquesEmpoignade(rollData)
this.filterAttaquesInitiative(rollData)
refs.tactiques = TACTIQUES
if (refs.attaques.length > 0) {
const attaque = this.findAttaque(refs.attaques, this.getSaved(rollData))
@@ -48,11 +52,13 @@ export class RollPartAttaque extends RollPartSelect {
restore(rollData) {
const saved = this.getSaved(rollData) ?? {}
this.setCurrent(rollData, {
key: saved.key,
tactique: saved.tactique,
dmg: saved.dmg
})
if (saved.key) {
this.setCurrent(rollData, {
key: saved.key,
tactique: saved.tactique,
dmg: saved.dmg
})
}
}
store(rollData, targetData) {
@@ -66,9 +72,11 @@ export class RollPartAttaque extends RollPartSelect {
findAttaque(attaques, saved) {
return attaques.find(at => at.arme.id == saved?.arme?.id &&
at.comp.id == saved?.comp?.id
)
return attaques.find(it => it.key == saved.key) ??
attaques.find(it => it.arme.id == (saved?.arme?.id ?? it.arme.id)
&& it.comp.id == (saved?.comp?.id ?? it.comp.id)
&& it.main == (saved?.main ?? it.main)
)
}
choices(refs) { return refs.attaques }
@@ -78,24 +86,27 @@ export class RollPartAttaque extends RollPartSelect {
attaque.tactique = TACTIQUES[0]
attaque.initialDiff = attaque.comp?.system.default_diffLibre ?? 0
attaque.distance = Distance.ajustements(rollData.active?.token, rollData.opponent?.token, attaque)
attaque.rang = RdDInitiative.phaseArme(attaque.comp?.system.categorie, attaque.arme)?.rang
return attaque
}
prepareContext(rollData) {
this.filterAttaquesEmpoignade(rollData)
this.filterAttaquesInitiative(rollData)
const current = this.getCurrent(rollData)
current.dmg = RdDBonus.dmgRollV2(rollData, current)
}
filterAttaquesEmpoignade(rollData) {
filterAttaquesInitiative(rollData) {
const refs = this.getRefs(rollData)
const isEmpoignade = RdDEmpoignade.isCombatantEmpoignade(rollData.ids.actorId, rollData.ids.actorTokenId)
const rang = RdDCombatManager.getRangInitiativeCombatant(rollData.ids.actorId, rollData.ids.actorTokenId)
const isEmpoignade = MAP_PHASE.empoignade.rang == rang
//const isEmpoignade = RdDEmpoignade.isCombatantEmpoignade(rollData.ids.actorId, rollData.ids.actorTokenId)
refs.isEmpoignadeEnCours = RdDEmpoignade.isEmpoignadeEnCours(rollData.active.actor)
const filterAttaques = isEmpoignade ?
FILTER_ATTAQUE_EMPOIGNADE
: refs.isEmpoignadeEnCours
? FILTER_ATTAQUE_EMPOIGNE
: FILTER_ATTAQUE_NON_EMPOIGNADE
: FILTER_ATTAQUE_RANG(rang)
refs.attaques = refs.all.filter(filterAttaques)
}
@@ -168,8 +179,8 @@ export class RollPartAttaque extends RollPartSelect {
if (this.visible(rollData)) {
const current = this.getCurrent(rollData)
switch (part.code) {
case PART_CARAC: return part.filterCaracs(rollData, [current.carac.key])
case PART_COMP: return part.filterComps(rollData, [current.comp.name])
case PART_CARAC: return part.filterCaracs(rollData, [current.carac?.key])
case PART_COMP: return part.filterComps(rollData, [current.comp?.name])
case PART_DIFF: {
if (Distance.typeAttaqueDistance(current)) {
part.setDiff(rollData, { type: DIFF.DEFAUT })

View File

@@ -41,7 +41,7 @@ export class RollPartCheckbox extends RollPart {
}
getCheckboxLabelAjustement(rollData) {
return `${this.getCheckboxIcon(rollData)} ${this.getRefs(rollData).label}`
return `${this.getCheckboxIcon(rollData)} ${this.getCheckboxLabel(rollData)}`
}
async _onRender(rollDialog, context, options) {

View File

@@ -1,7 +1,9 @@
import { Grammar } from "../grammar.js"
import { Misc } from "../misc.js"
import { PART_CARAC } from "./roll-part-carac.mjs"
import { PART_DIFF } from "./roll-part-diff.mjs"
import { RollPartSelect } from "./roll-part-select.mjs"
import { ROLLDIALOG_SECTION } from "./roll-part.mjs"
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
export const PART_COMP = "comp"
@@ -15,15 +17,21 @@ export class RollPartComp extends RollPartSelect {
get name() { return 'Compétences' }
get section() { return ROLLDIALOG_SECTION.COMP }
onReady(rollParts) {
this.rollPartCarac = rollParts.find(it => it.code == PART_CARAC)
this.rollPartDiff = rollParts.find(it => it.code == PART_DIFF)
}
loadRefs(rollData) {
const refs = this.getRefs(rollData)
const selected = this.getSelected(rollData)
const all = this.$getActorComps(rollData)
if (selected.forced) {
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selected.key))
const selectedComp = selected.key
if (selected.forced && selectedComp) {
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selectedComp))
if (refs.all.length == 0) {
if (selected.key.length > 0) {
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selected.key))
if (selected.key && selected.key.length > 0) {
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selectedComp))
}
else {
refs.all = all.filter(comp => comp == SANS_COMPETENCE)
@@ -35,6 +43,13 @@ export class RollPartComp extends RollPartSelect {
}
refs.comps = refs.all
this.$selectComp(rollData)
if (rollData.type.current == PART_COMP && selectedComp) {
const current = this.getCurrent(rollData)
const selectedCarac = RollPart.getSelectedPart(rollData, PART_CARAC)
const selectedDiff = RollPart.getSelectedPart(rollData, PART_DIFF)
this.rollPartCarac.selectByKey(rollData, selectedCarac?.key ?? current.comp.system.defaut_carac)
this.rollPartDiff.setDiff(rollData, selectedDiff?.value ?? current.comp.system.default_diffLibre)
}
}
choices(refs) { return refs.comps }
@@ -71,6 +86,7 @@ export class RollPartComp extends RollPartSelect {
refs.comps.sort(sorting)
}
this.$selectComp(rollData)
}
prepareContext(rollData) {

View File

@@ -10,7 +10,7 @@ export class RollPartConditions extends RollPart {
settingMin() { return RollPart.settingKey(this, 'min') }
settingMax() { return RollPart.settingKey(this, 'max') }
onReady() {
onReady(rollParts) {
game.settings.register(SYSTEM_RDD, this.settingMin(),
{
name: "Malus maximal de conditions",
@@ -65,12 +65,7 @@ export class RollPartConditions extends RollPart {
async _onRender(rollDialog, context, options) {
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
}
onInputChange(event, rollDialog) {
this.getCurrent(rollDialog.rollData).value = parseInt(event.currentTarget.value)
rollDialog.render()
input?.addEventListener("input", e => this.onNumericInputChange(e, rollDialog))
}
}

View File

@@ -9,7 +9,7 @@ import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
export const PART_CUISINE = "cuisine"
export class RollPartCuisine extends RollPartSelect {
onReady() {
onReady(rollParts) {
foundry.applications.handlebars.loadTemplates({ 'roll-oeuvre-recettecuisine': `systems/foundryvtt-reve-de-dragon/templates/roll/roll-oeuvre-recettecuisine.hbs` })
}
@@ -43,14 +43,13 @@ export class RollPartCuisine extends RollPartSelect {
const recettes = actor.items
.filter(it => it.type == ITEM_TYPES.recettecuisine)
.map(RollPartCuisine.$extractPreparationRecette)
.map(it => RollPartCuisine.$extractPreparationRecette(refs.cuisine, it))
const ingredientsBruts = actor.items
.filter(it => it.getUtilisationCuisine() == 'brut')
.map(RollPartCuisine.$extractPreparationBrut)
.map(it => RollPartCuisine.$extractPreparationBrut(refs.cuisine, it))
refs.preparations = [RollPartCuisine.$preparationBasique(), ...recettes, ...ingredientsBruts]
refs.preparations.forEach(p => p.comp = refs.cuisine)
refs.preparations = [RollPartCuisine.$preparationBasique(refs.cuisine), ...recettes, ...ingredientsBruts]
if (refs.preparations.length > 0) {
this.$selectPreparation(rollData)
this.$restoreSavedOptions(rollData)
@@ -73,7 +72,7 @@ export class RollPartCuisine extends RollPartSelect {
choices(refs) { return refs.preparations }
static $preparationBasique() {
static $preparationBasique(cuisine) {
return {
key: '',
label: "Improvisation du moment",
@@ -85,10 +84,12 @@ export class RollPartCuisine extends RollPartSelect {
proportionsMax: 50,
value: 0,
fabriquer: false,
qualite: cuisine.system.niveau,
comp: cuisine,
}
}
static $extractPreparationRecette(recette) {
static $extractPreparationRecette(cuisine, recette) {
const proportions = recette.system.sust ?? 1
return {
key: recette.id,
@@ -102,10 +103,12 @@ export class RollPartCuisine extends RollPartSelect {
value: -recette.system.niveau,
recette: recette,
fabriquer: true,
qualite: recette.system.niveau,
comp: cuisine,
}
}
static $extractPreparationBrut(ingredient) {
static $extractPreparationBrut(cuisine, ingredient) {
return {
key: ingredient.id,
label: ingredient.name + ' cuisiné',
@@ -118,6 +121,8 @@ export class RollPartCuisine extends RollPartSelect {
value: 0,
ingredient: ingredient,
fabriquer: true,
qualite: cuisine.system.niveau,
comp: cuisine,
}
}
@@ -150,7 +155,7 @@ export class RollPartCuisine extends RollPartSelect {
this.$selectPreparation(rollDialog.rollData, selectOptions[index]?.value)
rollDialog.render()
})
checkboxFabriquer?.addEventListener("change", e => {
current.fabriquer = e.currentTarget.checked
})

View File

@@ -73,12 +73,7 @@ export class RollPartDiff extends RollPart {
async _onRender(rollDialog, context, options) {
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
}
onInputChange(event, rollDialog) {
this.getCurrent(rollDialog.rollData).value = parseInt(event.currentTarget.value)
rollDialog.render()
input?.addEventListener("input", e => this.onNumericInputChange(e, rollDialog))
}
}

View File

@@ -15,18 +15,32 @@ export class RollPartEncTotal extends RollPartCheckbox {
&& RdDItemCompetence.isMalusEncombrementTotal(rollData.current.comp?.key)
}
loadRefs(rollData) {
const refs = this.getRefs(rollData)
refs.malusEnc = - Math.floor(rollData.active.actor.getEncTotal())
const current = this.getCurrent(rollData)
current.value = refs.malusEnc
}
async _onRender(rollDialog, context, options) {
super._onRender(rollDialog, context, options)
const inputMalusEnc = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="malusenc"]`)
inputMalusEnc?.addEventListener("change", e => {
this.getCurrent(rollDialog.rollData).value = parseInt(e.currentTarget.value)
const malusEnc = Math.floor(e.currentTarget.value)
const rollData = rollDialog.rollData
const refs = this.getRefs(rollData)
const current = this.getCurrent(rollData)
if (refs.malusEnc == current.value) {
current.value = malusEnc
}
refs.malusEnc = malusEnc
rollDialog.render()
})
}
getCheckboxIcon(rollData) { return `<img src="${RDD_CONFIG.icons.surenc}">` }
getCheckboxLabel(rollData) { return "Enc. total" }
getCheckboxValue(rollData) { return - rollData.active.actor.getEncTotal() }
getCheckboxValue(rollData) { return this.getCurrent(rollData).value }
}

View File

@@ -24,7 +24,7 @@ const ARTS = [
]
export class RollPartOeuvre extends RollPartSelect {
onReady() {
onReady(rollParts) {
ARTS.forEach(art => art.label = Misc.typeName('Item', art.type))
ARTS.map(it => `roll-oeuvre-${it.type}`)
.forEach(art =>

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