Préparation ajout empoignade
actor.rollArme prend maintenant une arme (ou structure) plutôt que des noms l'empoignade sera une pseudo arme, comme le corps à corps # Conflicts: # module/actor-sheet.js
This commit is contained in:
parent
ab9f6f0017
commit
9bc4b9a3ca
@ -327,7 +327,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
actor.sheet.render(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Boutons spéciaux MJs
|
||||
html.find('.forcer-tmr-aleatoire').click(async event => {
|
||||
this.actor.cacheTMRetMessage();
|
||||
@ -335,7 +335,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
html.find('.afficher-tmr').click(async event => {
|
||||
this.actor.afficheTMRetMessage();
|
||||
});
|
||||
|
||||
|
||||
// Points de reve actuel
|
||||
html.find('.ptreve-actuel a').click(async event => {
|
||||
this.actor.rollCarac('reve-actuel');
|
||||
@ -344,8 +344,16 @@ export class RdDActorSheet extends ActorSheet {
|
||||
// Roll Weapon1
|
||||
html.find('.arme-label a').click(async event => {
|
||||
let armeName = event.currentTarget.text;
|
||||
let competenceName = event.currentTarget.attributes['data-competence-name'].value;
|
||||
this.actor.rollArme(competenceName, armeName);
|
||||
let compName = event.currentTarget.attributes['data-competence-name'].value;
|
||||
let arme = this.actor.data.find(it =>
|
||||
it.name == armeName &&
|
||||
RdDItemArme.isArme(it) &&
|
||||
((compName ?? it.data.competence) == it.data.competence)
|
||||
);
|
||||
if (!arme) {
|
||||
arme = { name: armeName, data: { competence: compName } };
|
||||
}
|
||||
this.actor.rollArme(arme);
|
||||
});
|
||||
// Initiative pour l'arme
|
||||
html.find('.arme-initiative a').click(async event => {
|
||||
@ -441,6 +449,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
this.render(true);
|
||||
});
|
||||
html.find('.lock-unlock-controls').click(async event => {
|
||||
console.log("CONTROLS", this.options.hideControls)
|
||||
this.options.hideControls = !this.options.hideControls;
|
||||
this.render(true);
|
||||
});
|
||||
@ -560,7 +569,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
async _onSplitItem(item, split) {
|
||||
if (split >= 1 && split < Misc.data(item).data.quantite) {
|
||||
await item.diminuerQuantite(split);
|
||||
const itemData = duplicate( Misc.data(item));
|
||||
const itemData = duplicate(Misc.data(item));
|
||||
itemData.data.quantite = split;
|
||||
await this.actor.createEmbeddedDocuments('Item', [itemData])
|
||||
}
|
||||
|
@ -3117,11 +3117,9 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(compName, armeName = undefined) {
|
||||
let arme = armeName ? this.data.items.find(it => Misc.data(it).name == armeName && RdDItemArme.isArme(it)) : undefined;
|
||||
let competence = Misc.data(this.getCompetence(compName));
|
||||
|
||||
if (arme || armeName || (competence.type == 'competencecreature' && competence.data.iscombat)) {
|
||||
rollArme(arme) {
|
||||
let competence = Misc.data(this.getCompetence(arme.data.competence));
|
||||
if (arme || (competence.type == 'competencecreature' && competence.data.iscombat)) {
|
||||
RdDCombat.createUsingTarget(this)?.attaque(competence, arme);
|
||||
} else {
|
||||
this.rollCompetence(competence.name);
|
||||
|
@ -189,6 +189,6 @@ export class RdDItemArme extends Item {
|
||||
if (actorData) {
|
||||
mergeObject(mainsNues.data, actorData, { overwrite: false });
|
||||
}
|
||||
return mainsNues
|
||||
return mainsNues;
|
||||
}
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ export class RdDCombat {
|
||||
surpriseDefenseur: this.defender.getSurprise(true),
|
||||
essais: {}
|
||||
};
|
||||
|
||||
|
||||
if (this.attacker.isCreature()) {
|
||||
RdDItemCompetenceCreature.setRollDataCreature(rollData);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
export class RdDHotbar {
|
||||
|
||||
@ -67,15 +68,14 @@ export class RdDHotbar {
|
||||
let actor;
|
||||
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
||||
if (!actor) actor = game.actors.get(speaker.actor);
|
||||
let item = actor ? actor.items.find(i => i.name === itemName && i.type == itemType) : null;
|
||||
if (!item) return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
||||
|
||||
item = item.data;
|
||||
let item = Misc.data(actor?.items.find(it => it.name === itemName && it.type == itemType));
|
||||
if (!item) return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
||||
|
||||
// Trigger the item roll
|
||||
switch (item.type) {
|
||||
case "arme":
|
||||
return actor.rollArme(item.data.competence, itemName);
|
||||
return actor.rollArme(item);
|
||||
case "competence":
|
||||
return actor.rollCompetence( itemName );
|
||||
}
|
||||
|
@ -53,8 +53,7 @@ export class RdDTokenHud {
|
||||
await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html', hudData,
|
||||
(event) => {
|
||||
let armeIndex = event.currentTarget.attributes['data-arme-id'].value;
|
||||
let arme = armesList[armeIndex];
|
||||
actor.rollArme(arme.data.competence, arme.name);
|
||||
actor.rollArme(armesList[armeIndex]);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user