v11.0.21 - les automatismes de Khrachtchoum le Problémeux #668

Merged
uberwald merged 2 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2023-10-18 21:17:04 +02:00
3 changed files with 48 additions and 28 deletions

View File

@ -1,4 +1,12 @@
# 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 ## 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) - Fix: l'expérience ne s'appliquait plus sur certaines réussites particulières (régression depuis la 11.0.7)

View File

@ -1,3 +1,4 @@
import { TYPES } from "./item.js";
export class RdDHotbar { export class RdDHotbar {
@ -16,21 +17,29 @@ export class RdDHotbar {
} }
static async addToHotbar(item, slot) { static async addToHotbar(item, slot) {
if (item?.type == "arme") { // Used to manage weapons with multiple skills switch (item?.type ?? "") {
if (item.system.competence != "") { case TYPES.arme:
await this.createItemMacro(item, slot, "competence") {
slot++ // Les armes peuvent avoir plusieurs usages
} if (item.system.competence != "") {
if (item.system.lancer != "") { await this.createItemMacro(item, slot, "competence")
await this.createItemMacro(item, slot, "lancer") slot++
slot++ }
} if (item.system.lancer != "") {
if (item.system.tir != "") { await this.createItemMacro(item, slot, "lancer")
await this.createItemMacro(item, slot, "lancer") slot++
slot++ }
} if (item.system.tir != "") {
} else { await this.createItemMacro(item, slot, "lancer")
await this.createItemMacro(item, slot) slot++
}
}
return
case TYPES.competence:
case TYPES.competencecreature:
default:
await this.createItemMacro(item, slot)
return
} }
} }
@ -46,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
@ -68,7 +77,9 @@ export class RdDHotbar {
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`);
@ -76,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, competenceName); return actor.rollArme(item, competenceName);
case "competence": case TYPES.competence:
case TYPES.competencecreature:
return actor.rollCompetence(itemName); return actor.rollCompetence(itemName);
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "11.0.20", "version": "11.0.21",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.20.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.21.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": {