Compare commits

..

12 Commits

Author SHA1 Message Date
1c475348d5 Gestion des armes dans hotbar 2023-10-04 21:24:51 +02:00
de5d32f88f Gestion des armes dans hotbar 2023-10-04 09:33:24 +02:00
76a02d60ca Gestion des armes dans hotbar 2023-10-04 09:07:49 +02:00
724c556b9e Merge pull request 'v11' (#667) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: public/foundryvtt-reve-de-dragon#667
2023-10-04 09:07:10 +02:00
7dfba94a11 Nettoyage de date
Pas de "T" entre date et heure
2023-10-03 21:03:19 +02:00
928c7bbcfe Désespoir 2023-08-28 01:46:43 +02:00
222a06a978 Fix remoteCall 2023-08-15 17:24:01 +02:00
b4edaf8584 Fix remoteActorCall 2023-08-13 20:43:32 +02:00
3c062afd56 Fix remoteActorCall 2023-08-13 20:42:54 +02:00
6de4fff403 Merge pull request 'v11.0.15 - L'apprentissage de Khrachtchoum' (#666) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: public/foundryvtt-reve-de-dragon#666
2023-08-03 09:10:32 +02:00
3543f081b2 Version 11.0.15 2023-08-03 00:41:16 +02:00
56f14e12a2 Fix: regression sur les particulières
L'utilisation de la méthode clone() pôur cloner la compétence
supprime l'id de la compétence, du coup l'update pour y
ajouter de l'expérience ne marchait plus et bloquait la suite de la
résolution (pas de messages dans le tchat, ...)
2023-08-03 00:41:16 +02:00
11 changed files with 74 additions and 34 deletions

View File

@@ -1,5 +1,8 @@
# v11.0 # v11.0
## 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 ## v11.0.14 - Les pincettes de Khrachtchoum le Problémeux
- Correction du calcul de la place restante lors de l'ajout dans un conteneur - Correction du calcul de la place restante lors de l'ajout dans un conteneur

View File

@@ -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]

View File

@@ -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, ')');
@@ -147,6 +153,7 @@ export class RdDBaseActor extends Actor {
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]
}); });

View File

@@ -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', ' ')
} }
} }

View File

@@ -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,

View File

@@ -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],

View File

@@ -1,8 +1,8 @@
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 +15,25 @@ export class RdDHotbar {
await game.user.assignHotbarMacro(macro, slot); await game.user.assignHotbarMacro(macro, slot);
} }
static async addToHotbar(item, slot) {
if (item?.type == "arme") { // Used to manage weapons with multiple skills
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++
}
} else {
await this.createItemMacro(item, slot)
}
}
/** /**
* 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
@@ -44,7 +63,7 @@ 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];
@@ -58,7 +77,7 @@ export class RdDHotbar {
// Trigger the item roll // Trigger the item roll
switch (item.type) { switch (item.type) {
case "arme": case "arme":
return actor.rollArme(item); return actor.rollArme(item, competenceName);
case "competence": case "competence":
return actor.rollCompetence(itemName); return actor.rollCompetence(itemName);
} }

View File

@@ -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,

View File

@@ -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) {

View File

@@ -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.14", "version": "11.0.19",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.14.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.19.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": [

View File

@@ -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}}.