Merge pull request 'v10: pinaillages mineurs' (#642) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: public/foundryvtt-reve-de-dragon#642
This commit is contained in:
commit
fb8189606b
@ -84,7 +84,7 @@ export class RdDActorSheet extends RdDBaseActorSheet {
|
|||||||
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.system.carac);
|
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.system.carac);
|
||||||
formData.esquives = this.actor.getCompetences("Esquive");
|
formData.esquives = this.actor.getCompetences("Esquive");
|
||||||
formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac);
|
formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac);
|
||||||
formData.empoignades = this.actor.getEmpoignades("Esquive");
|
formData.empoignades = this.actor.getEmpoignades();
|
||||||
|
|
||||||
this.armesList = formData.combat;
|
this.armesList = formData.combat;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async cleanupConteneurs() {
|
async cleanupConteneurs() {
|
||||||
let updates = this.listItems('conteneur')
|
let updates = this.itemTypes['conteneur']
|
||||||
.filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0)
|
.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) } });
|
.map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } });
|
||||||
if (updates.length > 0) {
|
if (updates.length > 0) {
|
||||||
@ -333,18 +333,12 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
hasArmeeMeleeEquipee() { // Return true si l'acteur possède au moins 1 arme de mêlée équipée
|
hasArmeeMeleeEquipee() { // Return true si l'acteur possède au moins 1 arme de mêlée équipée
|
||||||
let melee = this.items.filter(it => it.type == "arme" && it.system.equipe && it.system.competence != "")
|
return this.itemTypes['arme'].find(it => it.system.equipe && it.system.competence != "")
|
||||||
return (melee.length > 0)
|
|
||||||
}
|
|
||||||
isEmpoignadeEnCours() {
|
|
||||||
return this.items.find(it => it.type == "empoignade" && it.system.pointsemp > 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async roll() {
|
async roll() {
|
||||||
if (this.isEmpoignadeEnCours()) {
|
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||||
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
|
|
||||||
}
|
|
||||||
|
|
||||||
const carac = mergeObject(duplicate(this.system.carac),
|
const carac = mergeObject(duplicate(this.system.carac),
|
||||||
{
|
{
|
||||||
@ -1101,16 +1095,12 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeIsHautRevant() {
|
computeIsHautRevant() {
|
||||||
if (this.isPersonnage()) {
|
if (this.isPersonnage()) {
|
||||||
this.system.attributs.hautrevant.value = this.hasItemNamed('tete', 'don de haut-reve')
|
this.system.attributs.hautrevant.value = this.itemTypes['tete'].find(it => Grammar.equalsInsensitive(it.name, 'don de haut-reve'))
|
||||||
? "Haut rêvant"
|
? "Haut rêvant"
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasItemNamed(type, name) {
|
|
||||||
name = Grammar.toLowerCaseNoAccent(name);
|
|
||||||
return this.listItems(type).find(it => Grammar.toLowerCaseNoAccent(it.name) == name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async computeMalusArmure() {
|
async computeMalusArmure() {
|
||||||
@ -1672,7 +1662,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
await this.rollTache(tache.id);
|
await this.rollTache(tache.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async actionHerbe(item, onActionItem = async () => {}) {
|
async actionHerbe(item, onActionItem = async () => { }) {
|
||||||
if (item.isHerbeAPotion()) {
|
if (item.isHerbeAPotion()) {
|
||||||
return DialogFabriquerPotion.create(this, item, onActionItem);
|
return DialogFabriquerPotion.create(this, item, onActionItem);
|
||||||
}
|
}
|
||||||
@ -2076,16 +2066,13 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollUnSort(coord) {
|
async rollUnSort(coord) {
|
||||||
if (this.isEmpoignadeEnCours()) {
|
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||||
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EffetsDraconiques.isSortImpossible(this)) {
|
if (EffetsDraconiques.isSortImpossible(this)) {
|
||||||
ui.notifications.error("Une queue ou un souffle vous empèche de lancer de sort!");
|
ui.notifications.error("Une queue ou un souffle vous empèche de lancer de sort!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Duplication car les pts de reve sont modifiés dans le sort
|
// Duplication car les pts de reve sont modifiés dans le sort
|
||||||
let sorts = duplicate(this.$filterSortList(this.getSortList(), coord));
|
let sorts = duplicate(this.$filterSortList(this.itemTypes['sort'], coord));
|
||||||
if (sorts.length == 0) {
|
if (sorts.length == 0) {
|
||||||
ui.notifications.info(`Aucun sort disponible en ${TMRUtility.getTMR(coord).label} !`);
|
ui.notifications.info(`Aucun sort disponible en ${TMRUtility.getTMR(coord).label} !`);
|
||||||
return;
|
return;
|
||||||
@ -2219,10 +2206,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollCarac(caracName, jetResistance = undefined) {
|
async rollCarac(caracName, jetResistance = undefined) {
|
||||||
if (this.isEmpoignadeEnCours()) {
|
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||||
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
|
|
||||||
}
|
|
||||||
|
|
||||||
let selectedCarac = this.getCaracByName(caracName)
|
let selectedCarac = this.getCaracByName(caracName)
|
||||||
await this._openRollDialog({
|
await this._openRollDialog({
|
||||||
name: 'jet-' + caracName,
|
name: 'jet-' + caracName,
|
||||||
@ -2290,10 +2274,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollCompetence(idOrName, options = { tryTarget: true }) {
|
async rollCompetence(idOrName, options = { tryTarget: true }) {
|
||||||
if (this.isEmpoignadeEnCours()) {
|
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||||
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
|
|
||||||
}
|
|
||||||
|
|
||||||
let rollData = {
|
let rollData = {
|
||||||
carac: this.system.carac,
|
carac: this.system.carac,
|
||||||
competence: this.getCompetence(idOrName)
|
competence: this.getCompetence(idOrName)
|
||||||
@ -2365,7 +2346,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
async getTacheBlessure(blesse, blessure) {
|
async getTacheBlessure(blesse, blessure) {
|
||||||
const gravite = blessure?.system.gravite ?? 0;
|
const gravite = blessure?.system.gravite ?? 0;
|
||||||
if (gravite > 0) {
|
if (gravite > 0) {
|
||||||
const tache = this.listItems('tache').find(it => it.system.itemId == blessure.id)
|
const tache = this.itemTypes['tache'].find(it => it.system.itemId == blessure.id)
|
||||||
?? await RdDItemBlessure.createTacheSoinBlessure(this, gravite);
|
?? await RdDItemBlessure.createTacheSoinBlessure(this, gravite);
|
||||||
await blessure?.updateTacheSoinBlessure(tache);
|
await blessure?.updateTacheSoinBlessure(tache);
|
||||||
return tache
|
return tache
|
||||||
@ -2374,10 +2355,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
|
async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
|
||||||
if (this.isEmpoignadeEnCours()) {
|
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||||
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
|
|
||||||
}
|
|
||||||
|
|
||||||
const competence = this.getCompetence(compName);
|
const competence = this.getCompetence(compName);
|
||||||
await this._openRollDialog({
|
await this._openRollDialog({
|
||||||
name: 'jet-competence',
|
name: 'jet-competence',
|
||||||
@ -2398,10 +2376,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollTache(id, options = {}) {
|
async rollTache(id, options = {}) {
|
||||||
if (this.isEmpoignadeEnCours()) {
|
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||||
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
|
|
||||||
}
|
|
||||||
|
|
||||||
const tacheData = this.getTache(id)
|
const tacheData = this.getTache(id)
|
||||||
const compData = this.getCompetence(tacheData.system.competence)
|
const compData = this.getCompetence(tacheData.system.competence)
|
||||||
compData.system.defaut_carac = tacheData.system.carac; // Patch !
|
compData.system.defaut_carac = tacheData.system.carac; // Patch !
|
||||||
@ -2668,7 +2643,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_getSignesDraconiques(coord) {
|
_getSignesDraconiques(coord) {
|
||||||
const type = TMRUtility.getTMRType(coord);
|
const type = TMRUtility.getTMRType(coord);
|
||||||
return this.listItems("signedraconique").filter(it => it.system.typesTMR.includes(type));
|
return this.itemTypes["signedraconique"].filter(it => it.system.typesTMR.includes(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -2875,8 +2850,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async resetNombresAstraux() {
|
async resetNombresAstraux() {
|
||||||
let toDelete = this.listItems('nombreastral');
|
const deletions = this.itemTypes['nombreastral'].map(it => it._id);
|
||||||
const deletions = toDelete.map(it => it._id);
|
|
||||||
await this.deleteEmbeddedDocuments("Item", deletions);
|
await this.deleteEmbeddedDocuments("Item", deletions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2900,7 +2874,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
async supprimerAnciensNombresAstraux() {
|
async supprimerAnciensNombresAstraux() {
|
||||||
const calendrier = game.system.rdd.calendrier;
|
const calendrier = game.system.rdd.calendrier;
|
||||||
if (calendrier) {
|
if (calendrier) {
|
||||||
const toDelete = this.listItems('nombreastral')
|
const toDelete = this.itemTypes['nombreastral']
|
||||||
.filter(it => calendrier.isAfterIndexDate(it.system.jourindex))
|
.filter(it => calendrier.isAfterIndexDate(it.system.jourindex))
|
||||||
.map(it => it._id);
|
.map(it => it._id);
|
||||||
await this.deleteEmbeddedDocuments("Item", toDelete);
|
await this.deleteEmbeddedDocuments("Item", toDelete);
|
||||||
@ -2958,11 +2932,6 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
return entry && entry.length > 0 ? carac[entry[0]] : undefined;
|
return entry && entry.length > 0 ? carac[entry[0]] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
getSortList() {
|
|
||||||
return this.listItems("sort");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
countMonteeLaborieuse() { // Return +1 par queue/ombre/souffle Montée Laborieuse présente
|
countMonteeLaborieuse() { // Return +1 par queue/ombre/souffle Montée Laborieuse présente
|
||||||
let countMonteeLaborieuse = EffetsDraconiques.countMonteeLaborieuse(this);
|
let countMonteeLaborieuse = EffetsDraconiques.countMonteeLaborieuse(this);
|
||||||
@ -3022,8 +2991,8 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
mode: mode,
|
mode: mode,
|
||||||
fatigue: RdDUtility.calculFatigueHtml(fatigue, endurance),
|
fatigue: RdDUtility.calculFatigueHtml(fatigue, endurance),
|
||||||
draconic: this.getDraconicList(),
|
draconic: this.getDraconicList(),
|
||||||
sort: this.getSortList(),
|
sort: this.itemTypes['sort'],
|
||||||
signes: this.listItems("signedraconique"),
|
signes: this.itemTypes['signedraconique'],
|
||||||
caracReve: this.system.carac.reve.value,
|
caracReve: this.system.carac.reve.value,
|
||||||
pointsReve: this.getReveActuel(),
|
pointsReve: this.getReveActuel(),
|
||||||
isRapide: isRapide,
|
isRapide: isRapide,
|
||||||
@ -3163,7 +3132,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async equiperObjet(itemID) {
|
async equiperObjet(itemID) {
|
||||||
let item = this.getEmbeddedDocument('Item', itemID);
|
let item = this.getEmbeddedDocument('Item', itemID);
|
||||||
if (item && ['arme', 'armure'].includes(item.type)) {
|
if (item?.isEquipable()) {
|
||||||
const isEquipe = !item.system.equipe;
|
const isEquipe = !item.system.equipe;
|
||||||
await this.updateEmbeddedDocuments('Item', [{ _id: item.id, "system.equipe": isEquipe }]);
|
await this.updateEmbeddedDocuments('Item', [{ _id: item.id, "system.equipe": isEquipe }]);
|
||||||
this.computeEncTotal(); // Mise à jour encombrement
|
this.computeEncTotal(); // Mise à jour encombrement
|
||||||
|
@ -109,7 +109,6 @@ export class RdDBaseActor extends Actor {
|
|||||||
isEntite() { return this.type == 'entite'; }
|
isEntite() { return this.type == 'entite'; }
|
||||||
isPersonnage() { return this.type == 'personnage'; }
|
isPersonnage() { return this.type == 'personnage'; }
|
||||||
isVehicule() { return this.type == 'vehicule'; }
|
isVehicule() { return this.type == 'vehicule'; }
|
||||||
|
|
||||||
getItem(id, type = undefined) {
|
getItem(id, type = undefined) {
|
||||||
const item = this.items.get(id);
|
const item = this.items.get(id);
|
||||||
if (type == undefined || (item?.type == type)) {
|
if (type == undefined || (item?.type == type)) {
|
||||||
@ -119,7 +118,7 @@ export class RdDBaseActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
listItems(type = undefined) { return (type ? this.itemTypes[type] : this.items); }
|
listItems(type = undefined) { return (type ? this.itemTypes[type] : this.items); }
|
||||||
filterItems(filter, type = undefined) { return this.listItems(type)?.filter(filter) ?? []; }
|
filterItems(filter, type = undefined) { return type ? this.itemTypes[type]?.filter(filter) ?? [] : []; }
|
||||||
findItemLike(idOrName, type) {
|
findItemLike(idOrName, type) {
|
||||||
return this.getItem(idOrName, type)
|
return this.getItem(idOrName, type)
|
||||||
?? Misc.findFirstLike(idOrName, this.listItems(type), { description: Misc.typeName('Item', type) });
|
?? Misc.findFirstLike(idOrName, this.listItems(type), { description: Misc.typeName('Item', type) });
|
||||||
@ -244,12 +243,16 @@ export class RdDBaseActor extends Actor {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('achatVente', achat);
|
|
||||||
const cout = Number(achat.prixTotal ?? 0);
|
const cout = Number(achat.prixTotal ?? 0);
|
||||||
const vendeur = achat.vendeurId ? game.actors.get(achat.vendeurId) : undefined;
|
const vendeur = achat.vendeurId ? game.actors.get(achat.vendeurId) : undefined;
|
||||||
const acheteur = achat.acheteurId ? game.actors.get(achat.acheteurId) : undefined;
|
const acheteur = achat.acheteurId ? game.actors.get(achat.acheteurId) : undefined;
|
||||||
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);
|
const itemVendu = vendeur?.getItem(achat.vente.item._id) ?? game.items.get(achat.vente.item._id) ?? achat.vente.item;
|
||||||
|
if (!itemVendu) {
|
||||||
|
ui.notifications.warn("Erreur sur achat: rien à acheter<br>Si possible, transmettez les logs de la console aux développeurs");
|
||||||
|
console.log('Erreur sur achat: rien à acheter', achat);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!this.verifierQuantite(vendeur, itemVendu, quantite)) {
|
if (!this.verifierQuantite(vendeur, 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
|
||||||
|
@ -18,7 +18,7 @@ export class DialogItemAchat extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
item: (json ? JSON.parse(json) : undefined),
|
item: JSON.parse(json),
|
||||||
vendeur,
|
vendeur,
|
||||||
acheteur,
|
acheteur,
|
||||||
nbLots: parseInt(chatButton.attributes['data-quantiteNbLots']?.value),
|
nbLots: parseInt(chatButton.attributes['data-quantiteNbLots']?.value),
|
||||||
@ -34,7 +34,6 @@ export class DialogItemAchat extends Dialog {
|
|||||||
const venteData = {
|
const venteData = {
|
||||||
item,
|
item,
|
||||||
actingUserId: game.user.id,
|
actingUserId: game.user.id,
|
||||||
vendeurId: vendeur?.id,
|
|
||||||
vendeur,
|
vendeur,
|
||||||
acheteur,
|
acheteur,
|
||||||
tailleLot,
|
tailleLot,
|
||||||
|
@ -34,6 +34,7 @@ const typesObjetsConnaissance = ["meditation", "recettealchimique", "sort"]
|
|||||||
const typesObjetsEffet = ["possession", "poison", "maladie", "blessure"]
|
const typesObjetsEffet = ["possession", "poison", "maladie", "blessure"]
|
||||||
const typesObjetsCompetence = ["competence", "competencecreature"]
|
const typesObjetsCompetence = ["competence", "competencecreature"]
|
||||||
const typesObjetsTemporels = ["blessure", "poison", "maladie", "queue", "ombre", "souffle", "signedraconique", "rencontre"]
|
const typesObjetsTemporels = ["blessure", "poison", "maladie", "queue", "ombre", "souffle", "signedraconique", "rencontre"]
|
||||||
|
const typesObjetsEquipable = ['arme', 'armure', 'objet'];
|
||||||
const typesEnvironnement = typesInventaireMateriel;
|
const typesEnvironnement = typesInventaireMateriel;
|
||||||
const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
|
const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
|
||||||
const encPepin = 0.0007; /* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc
|
const encPepin = 0.0007; /* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc
|
||||||
@ -81,6 +82,10 @@ export const defaultItemImg = {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
export class RdDItem extends Item {
|
export class RdDItem extends Item {
|
||||||
|
|
||||||
|
static get defaultIcon() {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
static getDefaultImg(itemType) {
|
static getDefaultImg(itemType) {
|
||||||
return game.system.rdd.itemClasses[itemType]?.defaultIcon ?? defaultItemImg[itemType];
|
return game.system.rdd.itemClasses[itemType]?.defaultIcon ?? defaultItemImg[itemType];
|
||||||
}
|
}
|
||||||
@ -139,10 +144,6 @@ export class RdDItem extends Item {
|
|||||||
super(docData, context);
|
super(docData, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static get defaultIcon() {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
getUniteQuantite() {
|
getUniteQuantite() {
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
case "monnaie": return "(Pièces)"
|
case "monnaie": return "(Pièces)"
|
||||||
@ -158,6 +159,10 @@ export class RdDItem extends Item {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isEquipable() {
|
||||||
|
return typesObjetsEquipable.includes(this.type)
|
||||||
|
}
|
||||||
|
|
||||||
isCompetencePersonnage() { return this.type == 'competence' }
|
isCompetencePersonnage() { return this.type == 'competence' }
|
||||||
isCompetenceCreature() { return this.type == 'competencecreature' }
|
isCompetenceCreature() { return this.type == 'competencecreature' }
|
||||||
isConteneur() { return this.type == 'conteneur'; }
|
isConteneur() { return this.type == 'conteneur'; }
|
||||||
@ -367,6 +372,7 @@ export class RdDItem extends Item {
|
|||||||
}
|
}
|
||||||
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
|
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
|
||||||
}
|
}
|
||||||
|
this.equipable = this.isEquipable();
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareDataPotion() {
|
prepareDataPotion() {
|
||||||
|
@ -756,9 +756,7 @@ export class RdDCombat {
|
|||||||
RdDEmpoignade.onAttaqueEmpoignade(this.attacker, this.defender)
|
RdDEmpoignade.onAttaqueEmpoignade(this.attacker, this.defender)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( this.attacker.isEmpoignadeEnCours() ) {
|
RdDEmpoignade.checkEmpoignadeEnCours(this.attacker)
|
||||||
ui.notifications.warn("Une empoignade est en cours ! Normalement, vous ne pouvez rien faire d'autre que continuer l'empoignade ou la rompre.")
|
|
||||||
}
|
|
||||||
|
|
||||||
let rollData = this._prepareAttaque(competence, arme);
|
let rollData = this._prepareAttaque(competence, arme);
|
||||||
console.log("RdDCombat.attaque >>>", rollData);
|
console.log("RdDCombat.attaque >>>", rollData);
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
import { RdDCombat } from "./rdd-combat.js";
|
|
||||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||||
import { RdDRoll } from "./rdd-roll.js";
|
import { RdDRoll } from "./rdd-roll.js";
|
||||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||||
import { ChatUtility } from "./chat-utility.js";
|
import { ChatUtility } from "./chat-utility.js";
|
||||||
import { STATUSES, StatusEffects } from "./settings/status-effects.js";
|
import { STATUSES } from "./settings/status-effects.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
@ -15,22 +14,38 @@ export class RdDEmpoignade {
|
|||||||
static init() {
|
static init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static checkEmpoignadeEnCours(actor) {
|
||||||
|
// 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 false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static isEmpoignadeEnCours(actor) {
|
||||||
|
return actor.itemTypes['empoignade'].find(it => it.system.pointsemp > 0)
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getEmpoignadeById(actor, id) {
|
static getEmpoignadeById(actor, id) {
|
||||||
let emp = actor.items.find(emp => emp.type == 'empoignade' && emp.system.empoignadeid == id)
|
let emp = actor.itemTypes['empoignade'].find(it => it.system.empoignadeid == id)
|
||||||
return emp && duplicate(emp) || undefined;
|
return emp && duplicate(emp) || undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getEmpoignade(attacker, defender) {
|
static getEmpoignade(attacker, defender) {
|
||||||
let emp = attacker.items.find(emp => emp.type == 'empoignade' && emp.system.empoigneurid == attacker.id && emp.system.empoigneid == defender.id)
|
let emp = attacker.itemTypes['empoignade'].find(it => it.system.empoigneurid == attacker.id && it.system.empoigneid == defender.id)
|
||||||
if (!emp) {
|
if (!emp) {
|
||||||
emp = attacker.items.find(emp => emp.type == 'empoignade' && emp.system.empoigneurid == defender.id && emp.system.empoigneid == attacker.id)
|
emp = attacker.itemTypes['empoignade'].find(it => it.system.empoigneurid == defender.id && it.system.empoigneid == attacker.id)
|
||||||
}
|
}
|
||||||
if (emp) {
|
if (emp) {
|
||||||
// TODO ? central storage ?
|
// TODO ? central storage ?
|
||||||
|
return duplicate(emp);
|
||||||
}
|
}
|
||||||
return emp && duplicate(emp) || undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getMalusTaille(emp, attacker, defender) {
|
static getMalusTaille(emp, attacker, defender) {
|
||||||
@ -252,16 +267,16 @@ export class RdDEmpoignade {
|
|||||||
console.log("Perte d'endurance :!!!", perteMode)
|
console.log("Perte d'endurance :!!!", perteMode)
|
||||||
let endValue = defender.system.sante.endurance.value
|
let endValue = defender.system.sante.endurance.value
|
||||||
if (perteMode == "end0") {
|
if (perteMode == "end0") {
|
||||||
await defender.santeIncDec("endurance", -defender.system.sante.endurance.value);
|
await defender.santeIncDec("endurance", -endValue);
|
||||||
}
|
}
|
||||||
if (perteMode == "end1") {
|
if (perteMode == "end1") {
|
||||||
await defender.santeIncDec("endurance", -(defender.system.sante.endurance.value - 1));
|
await defender.santeIncDec("endurance", -(endValue - 1));
|
||||||
}
|
}
|
||||||
if (perteMode == "endmoitie") {
|
if (perteMode == "endmoitie") {
|
||||||
await defender.santeIncDec("endurance", -Math.floor(defender.system.sante.endurance.value / 2));
|
await defender.santeIncDec("endurance", -Math.floor(endValue / 2));
|
||||||
}
|
}
|
||||||
if (perteMode == "endquart") {
|
if (perteMode == "endquart") {
|
||||||
await defender.santeIncDec("endurance", -(3 * Math.floor(defender.system.sante.endurance.value / 4)));
|
await defender.santeIncDec("endurance", -(3 * Math.floor(endValue / 4)));
|
||||||
}
|
}
|
||||||
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-perte-endurance.html');
|
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-perte-endurance.html');
|
||||||
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData)
|
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData)
|
||||||
@ -270,10 +285,8 @@ export class RdDEmpoignade {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async deleteAllEmpoignades() {
|
static async deleteAllEmpoignades() {
|
||||||
for (let actor of game.actors) {
|
for (let actor of game.actors) {
|
||||||
let empList = actor.items.filter(it => it.type == "empoignade")
|
let empIds = actor.itemTypes["empoignade"].map(it => it.id)
|
||||||
for (let emp of empList) {
|
await actor.deleteEmbeddedDocuments('Item', empIds)
|
||||||
await actor.deleteEmbeddedDocuments('Item', [emp.id])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +303,8 @@ export class RdDEmpoignade {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async createEmpoignade(attacker, defender) {
|
static async createEmpoignade(attacker, defender) {
|
||||||
return await Item.create({
|
return await Item.create({
|
||||||
name: "Empoignade en cours de " + attacker.name + ' sur ' + defender.name, type: 'empoignade',
|
name: "Empoignade en cours de " + attacker.name + ' sur ' + defender.name,
|
||||||
|
type: 'empoignade',
|
||||||
img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp",
|
img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp",
|
||||||
system: { description: "", empoignadeid: randomID(16), compteempoigne: 0, empoigneurid: attacker.id, empoigneid: defender.id, ptsemp: 0, empoigneurname: attacker.name, empoignename: defender.name }
|
system: { description: "", empoignadeid: randomID(16), compteempoigne: 0, empoigneurid: attacker.id, empoigneid: defender.id, ptsemp: 0, empoigneurname: attacker.name, empoignename: defender.name }
|
||||||
},
|
},
|
||||||
|
@ -57,7 +57,7 @@ export class AppAstrologie extends Application {
|
|||||||
if (this.actor) {
|
if (this.actor) {
|
||||||
return {
|
return {
|
||||||
actor: this.actor,
|
actor: this.actor,
|
||||||
nombres: this._organizeNombresAstraux(this.actor.listItems('nombreastral')),
|
nombres: this._organizeNombresAstraux(this.actor.itemTypes['nombreastral']),
|
||||||
ajustements: CONFIG.RDD.difficultesLibres,
|
ajustements: CONFIG.RDD.difficultesLibres,
|
||||||
etat: this.actor.getEtatGeneral(),
|
etat: this.actor.getEtatGeneral(),
|
||||||
astrologie: this.actor.getCompetence('Astrologie')
|
astrologie: this.actor.getCompetence('Astrologie')
|
||||||
|
@ -692,7 +692,7 @@
|
|||||||
"capacite": 0
|
"capacite": 0
|
||||||
},
|
},
|
||||||
"objet": {
|
"objet": {
|
||||||
"templates": ["description", "inventaire"]
|
"templates": ["description", "equipement", "inventaire"]
|
||||||
},
|
},
|
||||||
"monnaie": {
|
"monnaie": {
|
||||||
"templates": ["description", "inventaire"]
|
"templates": ["description", "inventaire"]
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<span class="equipement-actions item-controls">
|
<span class="equipement-actions item-controls">
|
||||||
{{#if options.isOwner}}
|
{{#if options.isOwner}}
|
||||||
{{#unless item.estContenu}}
|
{{#unless item.estContenu}}
|
||||||
{{#if (or (eq item.type 'arme') (eq item.type 'armure') )}}
|
{{#if item.equipable}}
|
||||||
<a class="item-equip" title="Equiper">{{#if item.system.equipe}}<i class="fas fa-hand-rock"></i>{{else}}<i class="far fa-hand-paper"></i>{{/if}}</a>
|
<a class="item-equip" title="Equiper">{{#if item.system.equipe}}<i class="fas fa-hand-rock"></i>{{else}}<i class="far fa-hand-paper"></i>{{/if}}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
Loading…
Reference in New Issue
Block a user