Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a04032e002 | |||
| 896fa512b5 | |||
| e7504d0ecb |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.history/
|
||||
node_modules/
|
||||
packs/_source/
|
||||
.github/
|
||||
|
||||
@@ -2682,3 +2682,19 @@ ul, li {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix: item-controls toujours visibles dans le tab combat (armures, boucliers) */
|
||||
.fvtt-yggdrasill .sheet-body[data-tab="combat"] .item.flexrow {
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
|
||||
.item-controls {
|
||||
display: flex !important;
|
||||
visibility: visible !important;
|
||||
opacity: 1 !important;
|
||||
position: static !important;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ export default class YggdrasillPersonnageSheet extends YggdrasillActorSheet {
|
||||
}
|
||||
|
||||
context.optionsBase = {}
|
||||
for (let i = 0; i <= 5; i++) {
|
||||
for (let i = 0; i <= 10; i++) {
|
||||
context.optionsBase[i] = i.toString()
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,18 @@ export class YggdrasillRollDialog {
|
||||
$("#srTotal").text(rollData.srTotal)
|
||||
})
|
||||
}
|
||||
|
||||
// Pour armes : mettre à jour l'effet affiché quand le type d'attaque change
|
||||
if (rollData.mode === "armecc" || rollData.mode === "armetir" || rollData.mode === "armedist") {
|
||||
$("#typeAttack").on("change", () => {
|
||||
rollData.attackDef = rollData.attackDef || {}
|
||||
rollData.attackDef.typeAttack = $("#typeAttack").val()
|
||||
this._updateAttackData(rollData, actor)
|
||||
$("#attackDescr").text(rollData.attackData.description || "")
|
||||
$("#caracName").text(`${rollData.attackData.categName || ""} / ${rollData.attackData.caracName || ""}`)
|
||||
$("#malus").text(rollData.attackData.malus ?? 0)
|
||||
})
|
||||
}
|
||||
|
||||
// Pour Sejdr: recalculer srTotal quand DM change
|
||||
if (rollData.mode === "sejdr") {
|
||||
@@ -223,19 +235,20 @@ export class YggdrasillRollDialog {
|
||||
* @private
|
||||
*/
|
||||
static _updateAttackData(rollData, actor) {
|
||||
const config = game.system.yggdrasill.config
|
||||
const attackType = rollData.attackDef.typeAttack
|
||||
const attackMode = config.attackMode?.[attackType]
|
||||
|
||||
if (attackMode) {
|
||||
rollData.attackData = rollData.attackData || {}
|
||||
rollData.attackData.categName = attackMode.categName
|
||||
rollData.attackData.caracName = attackMode.caracName
|
||||
rollData.attackData.malus = this._computeValue(attackMode.malus, actor)
|
||||
rollData.attackData.bonusdegats = this._computeValue(attackMode.bonusdegats, actor)
|
||||
rollData.attackData.protection = this._computeValue(attackMode.protection, actor)
|
||||
rollData.attackData.label = attackMode.label
|
||||
rollData.attackData.description = attackMode.description
|
||||
|
||||
let attackData
|
||||
if (rollData.mode === "armecc") {
|
||||
attackData = actor.getAttaqueData(attackType)
|
||||
} else {
|
||||
attackData = actor.getTirData(attackType)
|
||||
}
|
||||
|
||||
if (attackData) {
|
||||
rollData.attackDef = { ...rollData.attackDef, ...attackData }
|
||||
rollData.attackData = { ...rollData.attackDef }
|
||||
// Mettre à jour la caractéristique utilisée pour le jet (nbDice)
|
||||
rollData.selectedCarac = attackData.carac
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class ArmureDataModel extends foundry.abstract.TypeDataModel {
|
||||
return {
|
||||
categorie: new fields.StringField({ initial: "" }),
|
||||
equipe: new fields.BooleanField({ initial: false }),
|
||||
protection: new fields.StringField({ initial: "" }),
|
||||
protection: new fields.NumberField({ initial: 0, integer: true }),
|
||||
enc: new fields.NumberField({ initial: 0, integer: true }),
|
||||
valeur: new fields.NumberField({ initial: 0, integer: true }),
|
||||
description: new fields.HTMLField({ initial: "" })
|
||||
|
||||
@@ -597,18 +597,19 @@ export class YggdrasillActor extends Actor {
|
||||
let attackData = foundry.utils.duplicate(attackMode[mode]);
|
||||
if ( attackData){
|
||||
attackData.mode = mode;
|
||||
attackData.carac = foundry.utils.duplicate(this.system.carac[attackData.categName].carac[attackData.caracName]);
|
||||
const categ = this.system.carac[attackData.categName];
|
||||
attackData.carac = foundry.utils.duplicate(categ?.carac[attackData.caracName] ?? {});
|
||||
if ( attackData.malus != 0) {
|
||||
let malusTab = attackData.malus.split(';');
|
||||
attackData.malus = this.system.carac[attackData.categName].carac[malusTab[0]].value * Number(malusTab[1])
|
||||
attackData.malus = (categ?.carac[malusTab[0]]?.value ?? 0) * Number(malusTab[1]);
|
||||
}
|
||||
if ( attackData.protection != 0) {
|
||||
let malusTab = attackData.protection.split(';');
|
||||
attackData.protection = this.system.carac[attackData.categName].carac[malusTab[0]].value * Number(malusTab[1])
|
||||
attackData.protection = (categ?.carac[malusTab[0]]?.value ?? 0) * Number(malusTab[1]);
|
||||
}
|
||||
if ( attackData.bonusdegats != 0) {
|
||||
let malusTab = attackData.bonusdegats.split(';');
|
||||
attackData.bonusdegats = this.system.carac[attackData.categName].carac[malusTab[0]].value * Number(malusTab[1])
|
||||
attackData.bonusdegats = (categ?.carac[malusTab[0]]?.value ?? 0) * Number(malusTab[1]);
|
||||
}
|
||||
}
|
||||
return attackData;
|
||||
@@ -619,18 +620,19 @@ export class YggdrasillActor extends Actor {
|
||||
let attackData = foundry.utils.duplicate( tirMode[mode] );
|
||||
if ( attackData){
|
||||
attackData.mode = mode;
|
||||
attackData.carac = foundry.utils.duplicate(this.system.carac[attackData.categName].carac[attackData.caracName]);
|
||||
const categ = this.system.carac[attackData.categName];
|
||||
attackData.carac = foundry.utils.duplicate(categ?.carac[attackData.caracName] ?? {});
|
||||
if ( attackData.malus != 0) {
|
||||
let malusTab = attackData.malus.split(';');
|
||||
attackData.malus = this.system.carac[attackData.categName].carac[malusTab[0]].value * Number(malusTab[1])
|
||||
attackData.malus = (categ?.carac[malusTab[0]]?.value ?? 0) * Number(malusTab[1]);
|
||||
}
|
||||
if ( attackData.protection != 0) {
|
||||
let malusTab = attackData.protection.split(';');
|
||||
attackData.protection = this.system.carac[attackData.categName].carac[malusTab[0]].value * Number(malusTab[1])
|
||||
attackData.protection = (categ?.carac[malusTab[0]]?.value ?? 0) * Number(malusTab[1]);
|
||||
}
|
||||
if ( attackData.bonusdegats != 0) {
|
||||
let malusTab = attackData.bonusdegats.split(';');
|
||||
attackData.bonusdegats = this.system.carac[attackData.categName].carac[malusTab[0]].value * Number(malusTab[1])
|
||||
attackData.bonusdegats = (categ?.carac[malusTab[0]]?.value ?? 0) * Number(malusTab[1]);
|
||||
}
|
||||
}
|
||||
return attackData;
|
||||
@@ -730,13 +732,13 @@ export class YggdrasillActor extends Actor {
|
||||
for( let item of this.items) {
|
||||
if (item.type == "equipement" || item.type == "armecc"
|
||||
|| item.type == "armedist" || item.type == "armure" || item.type == "monnaie" || item.type == "bouclier") {
|
||||
encTotal += (item.system.enc * item.system.quantite);
|
||||
encTotal += (item.system.enc * (item.system.quantite || 1));
|
||||
}
|
||||
}
|
||||
for( let item of this.items) {
|
||||
if (item.type == "bouclier" && item.system.equipe) {
|
||||
encTotal -= (item.system.enc * item.system.quantite);
|
||||
encTotal += (item.system.enccomb * item.system.quantite);
|
||||
encTotal -= (item.system.enc * (item.system.quantite || 1));
|
||||
encTotal += (item.system.enccomb * (item.system.quantite || 1));
|
||||
}
|
||||
}
|
||||
return encTotal;
|
||||
|
||||
@@ -6,7 +6,7 @@ export class YggdrasillCombat extends Combat {
|
||||
/* -------------------------------------------- */
|
||||
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
|
||||
ids = typeof ids === "string" ? [ids] : ids;
|
||||
const currentId = this.combatant._id;
|
||||
const currentId = this.combatant?.id;
|
||||
for (let cId = 0; cId < ids.length; cId++) {
|
||||
const c = this.combatants.get(ids[cId]);
|
||||
let initBonus = c.actor ? c.actor.getInitiativeScore() : 0;
|
||||
@@ -17,7 +17,7 @@ export class YggdrasillCombat extends Combat {
|
||||
}
|
||||
if (roll.total <= 0) roll.total = 0;
|
||||
//console.log("Compute init for", roll.total);
|
||||
let id = c._id || c.id;
|
||||
let id = c.id;
|
||||
await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: roll.total }]);
|
||||
|
||||
// Send a chat message
|
||||
@@ -25,9 +25,9 @@ export class YggdrasillCombat extends Combat {
|
||||
let messageData = foundry.utils.mergeObject(
|
||||
{
|
||||
speaker: {
|
||||
scene: canvas.scene._id,
|
||||
actor: c.actor ? c.actor._id : null,
|
||||
token: c.token._id,
|
||||
scene: canvas.scene.id,
|
||||
actor: c.actor ? c.actor.id : null,
|
||||
token: c.token.id,
|
||||
alias: c.token.name,
|
||||
sound: CONFIG.sounds.dice,
|
||||
},
|
||||
|
||||
@@ -137,7 +137,7 @@ Hooks.once("ready", function () {
|
||||
ui.notifications.info("Attention ! Vous n'est connecté à aucun personnage");
|
||||
ChatMessage.create({
|
||||
content: "<b>WARNING</b> Le joueur " + game.user.name + " n'est pas connecté à un personnage !",
|
||||
user: game.user._id
|
||||
user: game.user.id
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ export class YggdrasillUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rollYggdrasill( rollData ) {
|
||||
let sumDice = ( rollData.isEpuise | rollData.isMeurtri) ? 1 : 2;
|
||||
let sumDice = ( rollData.isEpuise || rollData.isMeurtri) ? 1 : 2;
|
||||
|
||||
// Init stuff
|
||||
let isCritical = false;
|
||||
@@ -283,7 +283,7 @@ export class YggdrasillUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getUsers(filter) {
|
||||
return game.users.filter(filter).map(user => user.system._id);
|
||||
return game.users.filter(filter).map(user => user.id);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getWhisperRecipients(rollMode, name) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2857,5 +2857,19 @@ li {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
/* Fix: item-controls toujours visibles dans le tab combat (armures, boucliers) */
|
||||
.fvtt-yggdrasill .sheet-body[data-tab="combat"] .item.flexrow {
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
.fvtt-yggdrasill .sheet-body[data-tab="combat"] .item.flexrow .item-controls {
|
||||
display: flex !important;
|
||||
visibility: visible !important;
|
||||
opacity: 1 !important;
|
||||
position: static !important;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
/*# sourceMappingURL=yggdrasill.css.map */
|
||||
/*# sourceMappingURL=yggdrasill.css.map */
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -351,7 +351,7 @@
|
||||
</ul>
|
||||
|
||||
<div><h4>Armures (Protection Totale : {{protectionTotal}}) </h4></div>
|
||||
<ul class="item-list alternate-list">
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="stat flexrow" >
|
||||
<span class="stat-label flexrow">Nom</span>
|
||||
<span class="stat-label flexrow">Catégorie</span>
|
||||
@@ -375,7 +375,7 @@
|
||||
</ul>
|
||||
|
||||
<div><h4>Bouclier (Bonus de défense physique : {{dpBouclier}}) </h4></div>
|
||||
<ul class="item-list alternate-list">
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="stat flexrow" >
|
||||
<span class="stat-label flexrow">Nom</span>
|
||||
<span class="stat-label flexrow">Catégorie</span>
|
||||
|
||||
Reference in New Issue
Block a user