forked from public/foundryvtt-reve-de-dragon
Compare commits
24 Commits
foundryvtt
...
foundryvtt
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bd13a6021 | |||
| a29630f9a2 | |||
| c7fd9f7596 | |||
| 7b18fd25c3 | |||
| 5c256e2c49 | |||
| 1c475348d5 | |||
| de5d32f88f | |||
| 76a02d60ca | |||
| 724c556b9e | |||
| 7dfba94a11 | |||
| 928c7bbcfe | |||
| 222a06a978 | |||
| b4edaf8584 | |||
| 3c062afd56 | |||
| 6de4fff403 | |||
| 3543f081b2 | |||
| 56f14e12a2 | |||
| e226af5ac5 | |||
| d8be37a2ec | |||
| ba2d9de7b6 | |||
| 6b8fb3267a | |||
| 05d6f64a31 | |||
| c0570e58b4 | |||
| 8389d578bc |
17
changelog.md
17
changelog.md
@@ -1,4 +1,21 @@
|
|||||||
# v11.0
|
# v11.0
|
||||||
|
## v11.0.21
|
||||||
|
- Macro pour attaquer avec les compétences de créatures
|
||||||
|
|
||||||
|
## v11.0.20
|
||||||
|
- Macro pour attaquer avec les armes des personnages
|
||||||
|
|
||||||
|
## v11.0.17
|
||||||
|
- Fix: les actions de commerce ne s'appliquait pas bien aux personnages des tokens non liés
|
||||||
|
|
||||||
|
## v11.0.15 - L'apprentissage de Khrachtchoum
|
||||||
|
- Fix: l'expérience ne s'appliquait plus sur certaines réussites particulières (régression depuis la 11.0.7)
|
||||||
|
|
||||||
|
## v11.0.14 - Les pincettes de Khrachtchoum le Problémeux
|
||||||
|
- Correction du calcul de la place restante lors de l'ajout dans un conteneur
|
||||||
|
|
||||||
|
## v11.0.13 - La multiplication de l'eau de Khrachtchoum le Problémeux
|
||||||
|
- Correction de la vente depuis un commerce ayant des quantités illimitées
|
||||||
|
|
||||||
## v11.0.12 - Les poids de la mesure de Khrachtchoum le Problémeux
|
## v11.0.12 - Les poids de la mesure de Khrachtchoum le Problémeux
|
||||||
- Correction des malus de surencombrement
|
- Correction des malus de surencombrement
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getDraconicList() {
|
getDraconicList() {
|
||||||
return this.items.filter(it => it.isCompetencePersonnage() && it.system.categorie == 'draconic')
|
return this.itemTypes[TYPES.competence].filter(it => it.system.categorie == 'draconic')
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getBestDraconic() {
|
getBestDraconic() {
|
||||||
@@ -275,13 +275,13 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getDraconicOuPossession() {
|
getDraconicOuPossession() {
|
||||||
const possession = this.items.filter(it => it.type == TYPES.competencecreature && it.system.categorie == 'possession')
|
const possession = this.itemTypes[TYPES.competencecreature].filter(it => it.system.categorie == 'possession')
|
||||||
.sort(Misc.descending(it => it.system.niveau))
|
.sort(Misc.descending(it => it.system.niveau))
|
||||||
.find(it => true);
|
.find(it => true);
|
||||||
if (possession) {
|
if (possession) {
|
||||||
return possession.clone();
|
return possession;
|
||||||
}
|
}
|
||||||
const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0).map(it => it.clone()),
|
const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0),
|
||||||
POSSESSION_SANS_DRACONIC]
|
POSSESSION_SANS_DRACONIC]
|
||||||
.sort(Misc.descending(it => it.system.niveau));
|
.sort(Misc.descending(it => it.system.niveau));
|
||||||
return draconics[0];
|
return draconics[0];
|
||||||
@@ -1741,6 +1741,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
async consommerNourritureboisson(itemId, choix = { doses: 1, seForcer: false, supprimerSiZero: false }, userId = undefined) {
|
async consommerNourritureboisson(itemId, choix = { doses: 1, seForcer: false, supprimerSiZero: false }, userId = undefined) {
|
||||||
if (userId != undefined && userId != game.user.id) {
|
if (userId != undefined && userId != game.user.id) {
|
||||||
RdDBaseActor.remoteActorCall({
|
RdDBaseActor.remoteActorCall({
|
||||||
|
tokenId: this.token?.id,
|
||||||
actorId: this.id,
|
actorId: this.id,
|
||||||
method: 'consommerNourritureboisson',
|
method: 'consommerNourritureboisson',
|
||||||
args: [itemId, choix, userId]
|
args: [itemId, choix, userId]
|
||||||
@@ -3070,29 +3071,43 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
rollArme(arme) {
|
getArmeCompetence(arme, competenceName) {
|
||||||
|
let comp = arme.system[competenceName]
|
||||||
|
if (!comp || comp.name == "") {
|
||||||
|
comp = arme.system[competenceName]
|
||||||
|
}
|
||||||
|
if ( !comp || comp.name == "") {
|
||||||
|
comp = arme.system[competenceName]
|
||||||
|
}
|
||||||
|
return comp
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
rollArme(arme, competenceName = "competence") {
|
||||||
|
let compToUse = this.getArmeCompetence(arme, competenceName)
|
||||||
if (!Targets.hasTargets()) {
|
if (!Targets.hasTargets()) {
|
||||||
RdDConfirm.confirmer({
|
RdDConfirm.confirmer({
|
||||||
settingConfirmer: "confirmer-combat-sans-cible",
|
settingConfirmer: "confirmer-combat-sans-cible",
|
||||||
content: `<p>Voulez vous faire un jet de compétence ${arme.system.competence} sans choisir de cible valide?
|
content: `<p>Voulez vous faire un jet de compétence ${competenceName} sans choisir de cible valide?
|
||||||
<br>Tous les jets de combats devront être gérés à la main
|
<br>Tous les jets de combats devront être gérés à la main
|
||||||
</p>`,
|
</p>`,
|
||||||
title: 'Ne pas utiliser les automatisation de combat',
|
title: 'Ne pas utiliser les automatisation de combat',
|
||||||
buttonLabel: "Pas d'automatisation",
|
buttonLabel: "Pas d'automatisation",
|
||||||
onAction: async () => {
|
onAction: async () => {
|
||||||
this.rollCompetence(arme.system.competence, { tryTarget: false })
|
this.rollCompetence(compToUse, { tryTarget: false })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Targets.selectOneToken(target => {
|
Targets.selectOneToken(target => {
|
||||||
if (Targets.isTargetEntite(target)) {
|
if (Targets.isTargetEntite(target)) {
|
||||||
ui.notifications.warn(`Vous ne pouvez pas attaquer une entité non incarnée avec votre ${arme.name}!!!!`);
|
ui.notifications.warn(`Vous ne pouvez pas attaquer une entité non incarnée avec votre ${arme.name}!!!!`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const competence = this.getCompetence(compToUse)
|
||||||
const competence = this.getCompetence(arme.system.competence)
|
//console.log("RollArme", competence, arme)
|
||||||
if (competence.isCompetencePossession()) {
|
if (competence.isCompetencePossession()) {
|
||||||
return RdDPossession.onAttaquePossession(target, this, competence);
|
return RdDPossession.onAttaquePossession(target, this, competence);
|
||||||
}
|
}
|
||||||
@@ -3121,7 +3136,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
async onRollTachePremiersSoins(blessureId, rollData) {
|
async onRollTachePremiersSoins(blessureId, rollData) {
|
||||||
if (!this.isOwner) {
|
if (!this.isOwner) {
|
||||||
return RdDBaseActor.remoteActorCall({ actorId: this.id, method: 'onRollTachePremiersSoins', args: [blessureId, rollData] });
|
return RdDBaseActor.remoteActorCall({ tokenId: this.token?.id, actorId: this.id, method: 'onRollTachePremiersSoins', args: [blessureId, rollData] });
|
||||||
}
|
}
|
||||||
const blessure = this.getItem(blessureId, 'blessure')
|
const blessure = this.getItem(blessureId, 'blessure')
|
||||||
console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
|
console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
|
||||||
@@ -3151,7 +3166,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
async onRollSoinsComplets(blessureId, rollData) {
|
async onRollSoinsComplets(blessureId, rollData) {
|
||||||
if (!this.isOwner) {
|
if (!this.isOwner) {
|
||||||
return RdDBaseActor.remoteActorCall({ actorId: this.id, method: 'onRollSoinsComplets', args: [blessureId, rollData] });
|
return RdDBaseActor.remoteActorCall({ tokenId: this.token?.id, actorId: this.id, method: 'onRollSoinsComplets', args: [blessureId, rollData] });
|
||||||
}
|
}
|
||||||
const blessure = this.getItem(blessureId, 'blessure')
|
const blessure = this.getItem(blessureId, 'blessure')
|
||||||
if (blessure && blessure.system.premierssoins.done && !blessure.system.soinscomplets.done) {
|
if (blessure && blessure.system.premierssoins.done && !blessure.system.soinscomplets.done) {
|
||||||
@@ -3245,6 +3260,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
const attackerId = attacker?.id;
|
const attackerId = attacker?.id;
|
||||||
if (ReglesOptionnelles.isUsing('validation-encaissement-gr') && !game.user.isGM) {
|
if (ReglesOptionnelles.isUsing('validation-encaissement-gr') && !game.user.isGM) {
|
||||||
RdDBaseActor.remoteActorCall({
|
RdDBaseActor.remoteActorCall({
|
||||||
|
tokenId: this.token?.id,
|
||||||
actorId: this.id,
|
actorId: this.id,
|
||||||
method: 'appliquerEncaissement',
|
method: 'appliquerEncaissement',
|
||||||
args: [rollData, show, attackerId]
|
args: [rollData, show, attackerId]
|
||||||
|
|||||||
@@ -50,7 +50,13 @@ export class RdDBaseActor extends Actor {
|
|||||||
|
|
||||||
static onRemoteActorCall(callData, userId) {
|
static onRemoteActorCall(callData, userId) {
|
||||||
if (userId == game.user.id) {
|
if (userId == game.user.id) {
|
||||||
const actor = game.actors.get(callData?.actorId);
|
let actor = game.actors.get(callData?.actorId);
|
||||||
|
if ( callData.tokenId) {
|
||||||
|
let token = canvas.tokens.placeables.find(t => t.id == callData.tokenId)
|
||||||
|
if (token) {
|
||||||
|
actor = token.actor
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Misc.isOwnerPlayerOrUniqueConnectedGM(actor)) { // Seul le joueur choisi effectue l'appel: le joueur courant si propriétaire de l'actor, ou le MJ sinon
|
if (Misc.isOwnerPlayerOrUniqueConnectedGM(actor)) { // Seul le joueur choisi effectue l'appel: le joueur courant si propriétaire de l'actor, ou le MJ sinon
|
||||||
const args = callData.args;
|
const args = callData.args;
|
||||||
console.info(`RdDBaseActor.onRemoteActorCall: pour l'Actor ${callData.actorId}, appel de RdDBaseActor.${callData.method}(`, ...args, ')');
|
console.info(`RdDBaseActor.onRemoteActorCall: pour l'Actor ${callData.actorId}, appel de RdDBaseActor.${callData.method}(`, ...args, ')');
|
||||||
@@ -144,9 +150,10 @@ export class RdDBaseActor extends Actor {
|
|||||||
.forEach(async it => await it.onFinPeriodeTemporel(oldTimestamp, newTimestamp))
|
.forEach(async it => await it.onFinPeriodeTemporel(oldTimestamp, newTimestamp))
|
||||||
}
|
}
|
||||||
|
|
||||||
async creerObjetParMJ(object){
|
async creerObjetParMJ(object) {
|
||||||
if (!Misc.isUniqueConnectedGM()) {
|
if (!Misc.isUniqueConnectedGM()) {
|
||||||
RdDBaseActor.remoteActorCall({
|
RdDBaseActor.remoteActorCall({
|
||||||
|
tokenId: this.token?.id,
|
||||||
actorId: this.id,
|
actorId: this.id,
|
||||||
method: 'creerObjetParMJ',
|
method: 'creerObjetParMJ',
|
||||||
args: [object]
|
args: [object]
|
||||||
@@ -220,6 +227,7 @@ export class RdDBaseActor extends Actor {
|
|||||||
if (fromActorId && !game.user.isGM) {
|
if (fromActorId && !game.user.isGM) {
|
||||||
RdDBaseActor.remoteActorCall({
|
RdDBaseActor.remoteActorCall({
|
||||||
userId: Misc.connectedGMOrUser(),
|
userId: Misc.connectedGMOrUser(),
|
||||||
|
tokenId: this.token?.id,
|
||||||
actorId: this.id,
|
actorId: this.id,
|
||||||
method: 'ajouterSols', args: [sols, fromActorId]
|
method: 'ajouterSols', args: [sols, fromActorId]
|
||||||
});
|
});
|
||||||
@@ -262,10 +270,10 @@ export class RdDBaseActor extends Actor {
|
|||||||
const quantite = (achat.choix.nombreLots ?? 1) * (achat.vente.tailleLot);
|
const quantite = (achat.choix.nombreLots ?? 1) * (achat.vente.tailleLot);
|
||||||
const itemVendu = vendeur?.getItem(achat.vente.item._id) ?? game.items.get(achat.vente.item._id);
|
const itemVendu = vendeur?.getItem(achat.vente.item._id) ?? game.items.get(achat.vente.item._id);
|
||||||
if (!itemVendu) {
|
if (!itemVendu) {
|
||||||
ChatUtility.notifyUser(achat.userId, 'warn', vendeur ? `Le vendeur n'a pas plus de ${achat.vente.item.name} !`: `Impossible de retrouver: ${achat.vente.item.name} !`);
|
ChatUtility.notifyUser(achat.userId, 'warn', vendeur ? `Le vendeur n'a pas plus de ${achat.vente.item.name} !` : `Impossible de retrouver: ${achat.vente.item.name} !`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vendeur && !this.verifierQuantite(itemVendu, quantite)) {
|
if (vendeur && !vendeur.verifierQuantite(itemVendu, quantite)) {
|
||||||
ChatUtility.notifyUser(achat.userId, 'warn', `Le vendeur n'a pas assez de ${itemVendu.name} !`);
|
ChatUtility.notifyUser(achat.userId, 'warn', `Le vendeur n'a pas assez de ${itemVendu.name} !`);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -318,7 +326,7 @@ export class RdDBaseActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
verifierQuantite(item, quantiteDemande) {
|
verifierQuantite(item, quantiteDemande) {
|
||||||
const disponible = item?.getQuantite();
|
const disponible = this.getQuantiteDisponible(item);
|
||||||
return disponible == undefined || disponible >= quantiteDemande;
|
return disponible == undefined || disponible >= quantiteDemande;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,62 +455,33 @@ export class RdDBaseActor extends Actor {
|
|||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
conteneurPeutContenir(dest, item) {
|
conteneurPeutContenir(dest, moved) {
|
||||||
if (!dest) {
|
if (!dest) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!dest.isConteneur()) {
|
if (!dest.isConteneur()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const destData = dest
|
if (moved.isConteneurContenu(dest)) {
|
||||||
if (this._isConteneurContenu(item, dest)) {
|
ui.notifications.warn(`Impossible de déplacer un conteneur parent (${moved.name}) dans un de ses contenus ${dest.name} !`);
|
||||||
ui.notifications.warn(`Impossible de déplacer un conteneur parent (${item.name}) dans un de ses contenus ${destData.name} !`);
|
return false;
|
||||||
return false; // Loop detected !
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculer le total actuel des contenus
|
// Calculer le total actuel des contenus
|
||||||
let encContenu = this.getRecursiveEnc(dest) - Number(destData.system.encombrement);
|
const encContenu = dest.getEncContenu();
|
||||||
let newEnc = this.getRecursiveEnc(item); // Calculer le total actuel du nouvel objet
|
const newEnc = moved.getEncTotal(); // Calculer le total actuel du nouvel objet
|
||||||
|
const placeDisponible = Math.roundDecimals(dest.system.capacite - encContenu - newEnc, 4)
|
||||||
|
|
||||||
// Teste si le conteneur de destination a suffisament de capacité pour recevoir le nouvel objet
|
// Teste si le conteneur de destination a suffisament de capacité pour recevoir le nouvel objet
|
||||||
if (Number(destData.system.capacite) < encContenu + newEnc) {
|
if (placeDisponible < 0) {
|
||||||
ui.notifications.warn(
|
ui.notifications.warn(
|
||||||
`Le conteneur ${dest.name} a une capacité de ${destData.system.capacite}, et contient déjà ${encContenu}.
|
`Le conteneur ${dest.name} a une capacité de ${dest.system.capacite}, et contient déjà ${encContenu}.
|
||||||
Impossible d'y ranger: ${item.name} d'encombrement ${newEnc}!`);
|
Impossible d'y ranger: ${moved.name} d'encombrement ${newEnc}!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
_isConteneurContenu(item, conteneur) {
|
|
||||||
if (item?.isConteneur()) { // Si c'est un conteneur, il faut vérifier qu'on ne le déplace pas vers un sous-conteneur lui appartenant
|
|
||||||
for (let id of item.system.contenu) {
|
|
||||||
let subObjet = this.getItem(id);
|
|
||||||
if (subObjet?.id == conteneur.id) {
|
|
||||||
return true; // Loop detected !
|
|
||||||
}
|
|
||||||
if (subObjet?.isConteneur()) {
|
|
||||||
return this._isConteneurContenu(subObjet, conteneur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
getRecursiveEnc(objet) {
|
|
||||||
if (!objet) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const tplData = objet.system;
|
|
||||||
if (objet.type != 'conteneur') {
|
|
||||||
return Number(tplData.encombrement) * Number(tplData.quantite);
|
|
||||||
}
|
|
||||||
const encContenus = tplData.contenu.map(idContenu => this.getRecursiveEnc(this.getItem(idContenu)));
|
|
||||||
return encContenus.reduce(Misc.sum(), 0)
|
|
||||||
+ Number(tplData.encombrement) /* TODO? Number(tplData.quantite) -- on pourrait avoir plusieurs conteneurs...*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/** Ajoute un item dans un conteneur, sur la base
|
/** Ajoute un item dans un conteneur, sur la base
|
||||||
* de leurs ID */
|
* de leurs ID */
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export class RdDCommerce extends RdDBaseActor {
|
|||||||
verifierFortune(cout) {
|
verifierFortune(cout) {
|
||||||
return this.system.illimite || super.verifierFortune(cout);
|
return this.system.illimite || super.verifierFortune(cout);
|
||||||
}
|
}
|
||||||
|
|
||||||
async depenserSols(cout) {
|
async depenserSols(cout) {
|
||||||
if (this.system.illimite) {
|
if (this.system.illimite) {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export class DialogChronologie extends Dialog {
|
|||||||
heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()),
|
heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()),
|
||||||
minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(),
|
minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(),
|
||||||
},
|
},
|
||||||
dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val()
|
dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val().replace('T', ' ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,6 +395,16 @@ export class RdDItem extends Item {
|
|||||||
return Math.max(this.system.encombrement ?? 0, 0);
|
return Math.max(this.system.encombrement ?? 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getEncContenu() {
|
||||||
|
return this.getContenu()
|
||||||
|
.map(it => it.getRecursiveEnc())
|
||||||
|
.reduce(Misc.sum(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRecursiveEnc() {
|
||||||
|
return this.getEncTotal() + this.getEncContenu()
|
||||||
|
}
|
||||||
|
|
||||||
getEncHerbe() {
|
getEncHerbe() {
|
||||||
switch (this.system.categorie) {
|
switch (this.system.categorie) {
|
||||||
case 'Repos': case 'Soin': case 'Alchimie':
|
case 'Repos': case 'Soin': case 'Alchimie':
|
||||||
@@ -404,6 +414,18 @@ export class RdDItem extends Item {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getContenu() {
|
||||||
|
if (this.isConteneur()) {
|
||||||
|
return this.system.contenu.map(idContenu => this.actor.getItem(idContenu));
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
isConteneurContenu(conteneur) {
|
||||||
|
return this.getContenu()
|
||||||
|
.find(it => it.id == conteneur.id || it.isConteneurContenu(conteneur))
|
||||||
|
}
|
||||||
|
|
||||||
valeurTotale() {
|
valeurTotale() {
|
||||||
return (this.isService() ? 1 : this.getQuantite()) * this.valeur()
|
return (this.isService() ? 1 : this.getQuantite()) * this.valeur()
|
||||||
}
|
}
|
||||||
@@ -675,7 +697,7 @@ export class RdDItem extends Item {
|
|||||||
_armeChatData() {
|
_armeChatData() {
|
||||||
return [
|
return [
|
||||||
`<b>Compétence</b>: ${this.system.competence}`,
|
`<b>Compétence</b>: ${this.system.competence}`,
|
||||||
`<b>Dommages</b>: ${this.system.dommages} ${this.system.mortalite=='non-mortel'? '(Non mortel)':''}`,
|
`<b>Dommages</b>: ${this.system.dommages} ${this.system.mortalite == 'non-mortel' ? '(Non mortel)' : ''}`,
|
||||||
`<b>Force minimum</b>: ${this.system.force}`,
|
`<b>Force minimum</b>: ${this.system.force}`,
|
||||||
`<b>Resistance</b>: ${this.system.resistance}`,
|
`<b>Resistance</b>: ${this.system.resistance}`,
|
||||||
...this._inventaireTemplateChatData()
|
...this._inventaireTemplateChatData()
|
||||||
|
|||||||
@@ -789,7 +789,7 @@ export class RdDCombat {
|
|||||||
let rollData = {
|
let rollData = {
|
||||||
passeArme: randomID(16),
|
passeArme: randomID(16),
|
||||||
mortalite: arme?.system.mortalite,
|
mortalite: arme?.system.mortalite,
|
||||||
competence: competence.clone(),
|
competence: competence,
|
||||||
surprise: this.attacker.getSurprise(true),
|
surprise: this.attacker.getSurprise(true),
|
||||||
surpriseDefenseur: this.defender.getSurprise(true),
|
surpriseDefenseur: this.defender.getSurprise(true),
|
||||||
targetToken: Targets.extractTokenData(this.target),
|
targetToken: Targets.extractTokenData(this.target),
|
||||||
@@ -1044,7 +1044,7 @@ export class RdDCombat {
|
|||||||
passeArme: attackerRoll.passeArme,
|
passeArme: attackerRoll.passeArme,
|
||||||
diffLibre: attackerRoll.diffLibre,
|
diffLibre: attackerRoll.diffLibre,
|
||||||
attackerRoll: attackerRoll,
|
attackerRoll: attackerRoll,
|
||||||
competence: this.defender.getCompetence(competenceParade).clone(),
|
competence: this.defender.getCompetence(competenceParade),
|
||||||
arme: armeParade,
|
arme: armeParade,
|
||||||
surprise: this.defender.getSurprise(true),
|
surprise: this.defender.getSurprise(true),
|
||||||
needParadeSignificative: ReglesOptionnelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade),
|
needParadeSignificative: ReglesOptionnelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade),
|
||||||
@@ -1125,7 +1125,7 @@ export class RdDCombat {
|
|||||||
passeArme: attackerRoll.passeArme,
|
passeArme: attackerRoll.passeArme,
|
||||||
diffLibre: attackerRoll.diffLibre,
|
diffLibre: attackerRoll.diffLibre,
|
||||||
attackerRoll: attackerRoll,
|
attackerRoll: attackerRoll,
|
||||||
competence: competence.clone(),
|
competence: competence,
|
||||||
surprise: this.defender.getSurprise(true),
|
surprise: this.defender.getSurprise(true),
|
||||||
surpriseDefenseur: this.defender.getSurprise(true),
|
surpriseDefenseur: this.defender.getSurprise(true),
|
||||||
carac: this.defender.system.carac,
|
carac: this.defender.system.carac,
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ export class RdDEmpoignade {
|
|||||||
let rollData = {
|
let rollData = {
|
||||||
mode, empoignade, attacker, defender,
|
mode, empoignade, attacker, defender,
|
||||||
isEmpoignade: true,
|
isEmpoignade: true,
|
||||||
competence: attacker.getCompetence("Corps à corps").clone(),
|
competence: attacker.getCompetence("Corps à corps"),
|
||||||
selectedCarac: attacker.system.carac.melee,
|
selectedCarac: attacker.system.carac.melee,
|
||||||
malusTaille: RdDEmpoignade.getMalusTaille(empoignade, attacker, defender)
|
malusTaille: RdDEmpoignade.getMalusTaille(empoignade, attacker, defender)
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ export class RdDEmpoignade {
|
|||||||
mode: "immobilise",
|
mode: "immobilise",
|
||||||
empoignade, attacker, defender,
|
empoignade, attacker, defender,
|
||||||
isEmpoignade: true,
|
isEmpoignade: true,
|
||||||
competence: attacker.getCompetence("Corps à corps").clone()
|
competence: attacker.getCompetence("Corps à corps")
|
||||||
}
|
}
|
||||||
const msg = await ChatMessage.create({
|
const msg = await ChatMessage.create({
|
||||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(attacker.name),
|
whisper: ChatUtility.getWhisperRecipientsAndGMs(attacker.name),
|
||||||
@@ -272,7 +272,7 @@ export class RdDEmpoignade {
|
|||||||
mode, attacker, defender, empoignade, attackerRoll,
|
mode, attacker, defender, empoignade, attackerRoll,
|
||||||
diffLibre: attackerRoll.diffLibre,
|
diffLibre: attackerRoll.diffLibre,
|
||||||
attaqueParticuliere: attackerRoll.particuliere,
|
attaqueParticuliere: attackerRoll.particuliere,
|
||||||
competence: defender.getCompetence(competenceName).clone(),
|
competence: defender.getCompetence(competenceName),
|
||||||
surprise: defender.getSurprise(true),
|
surprise: defender.getSurprise(true),
|
||||||
carac: defender.system.carac,
|
carac: defender.system.carac,
|
||||||
selectedCarac: defender.system.carac[carac],
|
selectedCarac: defender.system.carac[carac],
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { TYPES } from "./item.js";
|
||||||
|
|
||||||
export class RdDHotbar {
|
export class RdDHotbar {
|
||||||
|
|
||||||
static async addToHotbar(item, slot) {
|
static async createItemMacro(item, slot, armeCompetence = undefined) {
|
||||||
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`;
|
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}"` + ((armeCompetence) ? `, "${armeCompetence}");` : `);`);
|
||||||
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
|
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
|
||||||
if (!macro) {
|
if (!macro) {
|
||||||
macro = await Macro.create({
|
macro = await Macro.create({
|
||||||
@@ -15,6 +16,33 @@ export class RdDHotbar {
|
|||||||
await game.user.assignHotbarMacro(macro, slot);
|
await game.user.assignHotbarMacro(macro, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async addToHotbar(item, slot) {
|
||||||
|
switch (item?.type ?? "") {
|
||||||
|
case TYPES.arme:
|
||||||
|
{
|
||||||
|
// Les armes peuvent avoir plusieurs usages
|
||||||
|
if (item.system.competence != "") {
|
||||||
|
await this.createItemMacro(item, slot, "competence")
|
||||||
|
slot++
|
||||||
|
}
|
||||||
|
if (item.system.lancer != "") {
|
||||||
|
await this.createItemMacro(item, slot, "lancer")
|
||||||
|
slot++
|
||||||
|
}
|
||||||
|
if (item.system.tir != "") {
|
||||||
|
await this.createItemMacro(item, slot, "lancer")
|
||||||
|
slot++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
case TYPES.competence:
|
||||||
|
case TYPES.competencecreature:
|
||||||
|
default:
|
||||||
|
await this.createItemMacro(item, slot)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a macro when dropping an entity on the hotbar
|
* Create a macro when dropping an entity on the hotbar
|
||||||
* Item - open roll dialog for item
|
* Item - open roll dialog for item
|
||||||
@@ -27,16 +55,16 @@ export class RdDHotbar {
|
|||||||
|
|
||||||
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
|
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
|
||||||
if (documentData.type == "Item") {
|
if (documentData.type == "Item") {
|
||||||
let item = fromUuidSync(documentData.uuid)
|
const item = fromUuidSync(documentData.uuid) ?? this.actor.items.get(documentData.uuid)
|
||||||
if (item == undefined) {
|
|
||||||
item = this.actor.items.get(documentData.uuid)
|
|
||||||
}
|
|
||||||
console.log("DROP", documentData, item)
|
console.log("DROP", documentData, item)
|
||||||
if (!item || (item.type != "arme" && item.type != "competence")) {
|
switch (item?.type ?? "")
|
||||||
return true
|
{
|
||||||
|
case TYPES.arme:
|
||||||
|
case TYPES.competence:
|
||||||
|
case TYPES.competencecreature:
|
||||||
|
this.addToHotbar(item, slot)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
this.addToHotbar(item, slot)
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -44,12 +72,14 @@ export class RdDHotbar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Roll macro */
|
/** Roll macro */
|
||||||
static rollMacro(itemName, itemType, bypassData) {
|
static rollMacro(itemName, itemType, competenceName) {
|
||||||
const speaker = ChatMessage.getSpeaker();
|
const speaker = ChatMessage.getSpeaker();
|
||||||
let actor;
|
let actor;
|
||||||
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
||||||
if (!actor) actor = game.actors.get(speaker.actor);
|
if (!actor) actor = game.actors.get(speaker.actor);
|
||||||
|
if (!actor) {
|
||||||
|
return ui.notifications.warn(`Impossible de trouver le personnage concerné`);
|
||||||
|
}
|
||||||
let item = actor?.items.find(it => it.name === itemName && it.type == itemType) ?? undefined;
|
let item = actor?.items.find(it => it.name === itemName && it.type == itemType) ?? undefined;
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
||||||
@@ -57,9 +87,10 @@ export class RdDHotbar {
|
|||||||
|
|
||||||
// Trigger the item roll
|
// Trigger the item roll
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case "arme":
|
case TYPES.arme:
|
||||||
return actor.rollArme(item);
|
return actor.rollArme(item, competenceName);
|
||||||
case "competence":
|
case TYPES.competence:
|
||||||
|
case TYPES.competencecreature:
|
||||||
return actor.rollCompetence(itemName);
|
return actor.rollCompetence(itemName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class RdDPossession {
|
|||||||
let rollData = {
|
let rollData = {
|
||||||
mode: "attaque",
|
mode: "attaque",
|
||||||
isECNIDefender: false,
|
isECNIDefender: false,
|
||||||
competence: competence.clone(),
|
competence: competence,
|
||||||
possession: possession,
|
possession: possession,
|
||||||
attacker: attacker,
|
attacker: attacker,
|
||||||
defender: defender,
|
defender: defender,
|
||||||
|
|||||||
@@ -106,11 +106,6 @@ export class RdDCalendrier extends Application {
|
|||||||
return buttons
|
return buttons
|
||||||
}
|
}
|
||||||
|
|
||||||
/*async maximize() {
|
|
||||||
await super.maximize()
|
|
||||||
this.render(true)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
async close() { }
|
async close() { }
|
||||||
|
|
||||||
async onUpdateSetting(setting, update, options, id) {
|
async onUpdateSetting(setting, update, options, id) {
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
{
|
{
|
||||||
"id": "foundryvtt-reve-de-dragon",
|
"id": "foundryvtt-reve-de-dragon",
|
||||||
"title": "Rêve de Dragon",
|
"title": "Rêve de Dragon",
|
||||||
"version": "11.0.12",
|
"version": "11.0.22",
|
||||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.12.zip",
|
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.22.zip",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json",
|
||||||
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "11",
|
"minimum": "11",
|
||||||
"verified": "11",
|
"verified": "11"
|
||||||
"maximum": "11"
|
|
||||||
},
|
},
|
||||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{{#if use.moral}}
|
{{#if use.moral}}
|
||||||
<span>
|
<span>
|
||||||
Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}}
|
Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du désespoir{{/if}}
|
||||||
{{#if (eq perteMoralEchec 'dissolution')}}et échoué, cous marquez un point de dissolution!.
|
{{#if (eq perteMoralEchec 'dissolution')}}et échoué, cous marquez un point de dissolution!.
|
||||||
{{else if (eq perteMoralEchec 'perte')}}et échoué, votre moral baisse à {{moral}}.
|
{{else if (eq perteMoralEchec 'perte')}}et échoué, votre moral baisse à {{moral}}.
|
||||||
{{else}}et réussi, votre moral reste de {{moral}}.
|
{{else}}et réussi, votre moral reste de {{moral}}.
|
||||||
|
|||||||
Reference in New Issue
Block a user