Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a04032e002 | |||
| 896fa512b5 | |||
| e7504d0ecb |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
.history/
|
.history/
|
||||||
node_modules/
|
node_modules/
|
||||||
packs/_source/
|
packs/_source/
|
||||||
|
.github/
|
||||||
|
|||||||
@@ -2682,3 +2682,19 @@ ul, li {
|
|||||||
opacity: 0.9;
|
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 = {}
|
context.optionsBase = {}
|
||||||
for (let i = 0; i <= 5; i++) {
|
for (let i = 0; i <= 10; i++) {
|
||||||
context.optionsBase[i] = i.toString()
|
context.optionsBase[i] = i.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,18 @@ export class YggdrasillRollDialog {
|
|||||||
$("#srTotal").text(rollData.srTotal)
|
$("#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
|
// Pour Sejdr: recalculer srTotal quand DM change
|
||||||
if (rollData.mode === "sejdr") {
|
if (rollData.mode === "sejdr") {
|
||||||
@@ -223,19 +235,20 @@ export class YggdrasillRollDialog {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
static _updateAttackData(rollData, actor) {
|
static _updateAttackData(rollData, actor) {
|
||||||
const config = game.system.yggdrasill.config
|
|
||||||
const attackType = rollData.attackDef.typeAttack
|
const attackType = rollData.attackDef.typeAttack
|
||||||
const attackMode = config.attackMode?.[attackType]
|
|
||||||
|
let attackData
|
||||||
if (attackMode) {
|
if (rollData.mode === "armecc") {
|
||||||
rollData.attackData = rollData.attackData || {}
|
attackData = actor.getAttaqueData(attackType)
|
||||||
rollData.attackData.categName = attackMode.categName
|
} else {
|
||||||
rollData.attackData.caracName = attackMode.caracName
|
attackData = actor.getTirData(attackType)
|
||||||
rollData.attackData.malus = this._computeValue(attackMode.malus, actor)
|
}
|
||||||
rollData.attackData.bonusdegats = this._computeValue(attackMode.bonusdegats, actor)
|
|
||||||
rollData.attackData.protection = this._computeValue(attackMode.protection, actor)
|
if (attackData) {
|
||||||
rollData.attackData.label = attackMode.label
|
rollData.attackDef = { ...rollData.attackDef, ...attackData }
|
||||||
rollData.attackData.description = attackMode.description
|
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 {
|
return {
|
||||||
categorie: new fields.StringField({ initial: "" }),
|
categorie: new fields.StringField({ initial: "" }),
|
||||||
equipe: new fields.BooleanField({ initial: false }),
|
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 }),
|
enc: new fields.NumberField({ initial: 0, integer: true }),
|
||||||
valeur: new fields.NumberField({ initial: 0, integer: true }),
|
valeur: new fields.NumberField({ initial: 0, integer: true }),
|
||||||
description: new fields.HTMLField({ initial: "" })
|
description: new fields.HTMLField({ initial: "" })
|
||||||
|
|||||||
@@ -597,18 +597,19 @@ export class YggdrasillActor extends Actor {
|
|||||||
let attackData = foundry.utils.duplicate(attackMode[mode]);
|
let attackData = foundry.utils.duplicate(attackMode[mode]);
|
||||||
if ( attackData){
|
if ( attackData){
|
||||||
attackData.mode = mode;
|
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) {
|
if ( attackData.malus != 0) {
|
||||||
let malusTab = attackData.malus.split(';');
|
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) {
|
if ( attackData.protection != 0) {
|
||||||
let malusTab = attackData.protection.split(';');
|
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) {
|
if ( attackData.bonusdegats != 0) {
|
||||||
let malusTab = attackData.bonusdegats.split(';');
|
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;
|
return attackData;
|
||||||
@@ -619,18 +620,19 @@ export class YggdrasillActor extends Actor {
|
|||||||
let attackData = foundry.utils.duplicate( tirMode[mode] );
|
let attackData = foundry.utils.duplicate( tirMode[mode] );
|
||||||
if ( attackData){
|
if ( attackData){
|
||||||
attackData.mode = mode;
|
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) {
|
if ( attackData.malus != 0) {
|
||||||
let malusTab = attackData.malus.split(';');
|
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) {
|
if ( attackData.protection != 0) {
|
||||||
let malusTab = attackData.protection.split(';');
|
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) {
|
if ( attackData.bonusdegats != 0) {
|
||||||
let malusTab = attackData.bonusdegats.split(';');
|
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;
|
return attackData;
|
||||||
@@ -730,13 +732,13 @@ export class YggdrasillActor extends Actor {
|
|||||||
for( let item of this.items) {
|
for( let item of this.items) {
|
||||||
if (item.type == "equipement" || item.type == "armecc"
|
if (item.type == "equipement" || item.type == "armecc"
|
||||||
|| item.type == "armedist" || item.type == "armure" || item.type == "monnaie" || item.type == "bouclier") {
|
|| 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) {
|
for( let item of this.items) {
|
||||||
if (item.type == "bouclier" && item.system.equipe) {
|
if (item.type == "bouclier" && item.system.equipe) {
|
||||||
encTotal -= (item.system.enc * item.system.quantite);
|
encTotal -= (item.system.enc * (item.system.quantite || 1));
|
||||||
encTotal += (item.system.enccomb * item.system.quantite);
|
encTotal += (item.system.enccomb * (item.system.quantite || 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return encTotal;
|
return encTotal;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export class YggdrasillCombat extends Combat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
|
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
|
||||||
ids = typeof ids === "string" ? [ids] : ids;
|
ids = typeof ids === "string" ? [ids] : ids;
|
||||||
const currentId = this.combatant._id;
|
const currentId = this.combatant?.id;
|
||||||
for (let cId = 0; cId < ids.length; cId++) {
|
for (let cId = 0; cId < ids.length; cId++) {
|
||||||
const c = this.combatants.get(ids[cId]);
|
const c = this.combatants.get(ids[cId]);
|
||||||
let initBonus = c.actor ? c.actor.getInitiativeScore() : 0;
|
let initBonus = c.actor ? c.actor.getInitiativeScore() : 0;
|
||||||
@@ -17,7 +17,7 @@ export class YggdrasillCombat extends Combat {
|
|||||||
}
|
}
|
||||||
if (roll.total <= 0) roll.total = 0;
|
if (roll.total <= 0) roll.total = 0;
|
||||||
//console.log("Compute init for", roll.total);
|
//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 }]);
|
await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: roll.total }]);
|
||||||
|
|
||||||
// Send a chat message
|
// Send a chat message
|
||||||
@@ -25,9 +25,9 @@ export class YggdrasillCombat extends Combat {
|
|||||||
let messageData = foundry.utils.mergeObject(
|
let messageData = foundry.utils.mergeObject(
|
||||||
{
|
{
|
||||||
speaker: {
|
speaker: {
|
||||||
scene: canvas.scene._id,
|
scene: canvas.scene.id,
|
||||||
actor: c.actor ? c.actor._id : null,
|
actor: c.actor ? c.actor.id : null,
|
||||||
token: c.token._id,
|
token: c.token.id,
|
||||||
alias: c.token.name,
|
alias: c.token.name,
|
||||||
sound: CONFIG.sounds.dice,
|
sound: CONFIG.sounds.dice,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ Hooks.once("ready", function () {
|
|||||||
ui.notifications.info("Attention ! Vous n'est connecté à aucun personnage");
|
ui.notifications.info("Attention ! Vous n'est connecté à aucun personnage");
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "<b>WARNING</b> Le joueur " + game.user.name + " n'est pas connecté à un personnage !",
|
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 ) {
|
static async rollYggdrasill( rollData ) {
|
||||||
let sumDice = ( rollData.isEpuise | rollData.isMeurtri) ? 1 : 2;
|
let sumDice = ( rollData.isEpuise || rollData.isMeurtri) ? 1 : 2;
|
||||||
|
|
||||||
// Init stuff
|
// Init stuff
|
||||||
let isCritical = false;
|
let isCritical = false;
|
||||||
@@ -283,7 +283,7 @@ export class YggdrasillUtility {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getUsers(filter) {
|
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) {
|
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;
|
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 */
|
||||||
/*# sourceMappingURL=yggdrasill.css.map */
|
/*# sourceMappingURL=yggdrasill.css.map */
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -351,7 +351,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div><h4>Armures (Protection Totale : {{protectionTotal}}) </h4></div>
|
<div><h4>Armures (Protection Totale : {{protectionTotal}}) </h4></div>
|
||||||
<ul class="item-list alternate-list">
|
<ul class="stat-list alternate-list">
|
||||||
<li class="stat flexrow" >
|
<li class="stat flexrow" >
|
||||||
<span class="stat-label flexrow">Nom</span>
|
<span class="stat-label flexrow">Nom</span>
|
||||||
<span class="stat-label flexrow">Catégorie</span>
|
<span class="stat-label flexrow">Catégorie</span>
|
||||||
@@ -375,7 +375,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div><h4>Bouclier (Bonus de défense physique : {{dpBouclier}}) </h4></div>
|
<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" >
|
<li class="stat flexrow" >
|
||||||
<span class="stat-label flexrow">Nom</span>
|
<span class="stat-label flexrow">Nom</span>
|
||||||
<span class="stat-label flexrow">Catégorie</span>
|
<span class="stat-label flexrow">Catégorie</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user