8 Commits

27 changed files with 90 additions and 68 deletions

View File

@ -14,8 +14,8 @@ export class YggdrasillActorSheet extends ActorSheet {
return mergeObject(super.defaultOptions, {
classes: ["yggdrasill", "sheet", "actor"],
template: "systems/fvtt-yggdrasill/templates/actor-sheet.html",
width: 640,
height: 720,
width: 680,
height: 740,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
editScore: false
@ -23,7 +23,7 @@ export class YggdrasillActorSheet extends ActorSheet {
}
/* -------------------------------------------- */
getData() {
async getData() {
const objectData = duplicate(this.object)
let formData = {
@ -63,7 +63,11 @@ export class YggdrasillActorSheet extends ActorSheet {
optionsCarac: YggdrasillUtility.createDirectOptionList(0, 20),
optionsDMDP: YggdrasillUtility.createDirectSortedOptionList(-10, +10),
optionsBase: YggdrasillUtility.createDirectOptionList(0, 20),
optionsFuror: YggdrasillUtility.createDirectOptionList(0, 15),
optionsFuror: YggdrasillUtility.createDirectOptionList(0, 15),
tiragerunes: await TextEditor.enrichHTML(this.object.system.tiragesrunes, {async: true}),
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
notes: await TextEditor.enrichHTML(this.object.system.notes, {async: true}),
gmnotes: await TextEditor.enrichHTML(this.object.system.biodata.gmnotes, {async: true}),
options: this.options,
owner: this.document.isOwner,
editScore: this.options.editScore,

View File

@ -193,18 +193,18 @@ export class YggdrasillActor extends Actor {
/* -------------------------------------------- */
_preUpdate(changed, options, user) {
if ( changed.data?.caracsecondaire?.pv?.value ) {
if ( changed.data.caracsecondaire.pv.value < 0 )
changed.data.caracsecondaire.pv.value = 0;
if ( changed.data.caracsecondaire.pv.value > this.system.caracsecondaire.pv.max )
changed.data.caracsecondaire.pv.value = this.system.caracsecondaire.pv.max;
if ( changed.system?.caracsecondaire?.pv?.value ) {
if ( changed.system.caracsecondaire.pv.value < 0 )
changed.system.caracsecondaire.pv.value = 0;
if ( changed.system.caracsecondaire.pv.value > this.system.caracsecondaire.pv.max )
changed.system.caracsecondaire.pv.value = this.system.caracsecondaire.pv.max;
}
if ( changed.data?.furor?.value ) {
if ( changed.data.furor.value < 0 )
changed.data.furor.value = 0;
if ( changed.data.furor.value > this.system.furor.max )
changed.data.furor.value = this.system.furor.max;
if ( changed.system?.furor?.value ) {
if ( changed.system.furor.value < 0 )
changed.system.furor.value = 0;
if ( changed.system.furor.value > this.system.furor.max )
changed.system.furor.value = this.system.furor.max;
}
super._preUpdate(changed, options, user);
}
@ -407,7 +407,6 @@ export class YggdrasillActor extends Actor {
/* -------------------------------------------- */
getActiveEffects(matching = it => true) {
let array = Array.from(this.getEmbeddedCollection("ActiveEffect").values());
return Array.from(this.getEmbeddedCollection("ActiveEffect").values()).filter(it => matching(it));
}
/* -------------------------------------------- */
@ -448,19 +447,41 @@ export class YggdrasillActor extends Actor {
}
this.system.caracsecondaire.reaction.value = baseesprit.intellect.value + baseesprit.perception.value + baseame.instinct.value;
this.system.caracsecondaire.reaction.max = baseesprit.intellect.value + baseesprit.perception.value + baseame.instinct.value;
let newReac = baseesprit.intellect.value + baseesprit.perception.value + baseame.instinct.value;
if ( newReac != this.system.caracsecondaire.reaction.max) {
this.system.caracsecondaire.reaction.max = newReac
this.update( { 'system.caracsecondaire.reaction.max': newReac });
}
this.system.caracsecondaire.defensephy.value = basecorps.agilite.value + basecorps.vigueur.value + baseame.instinct.value;
this.system.caracsecondaire.defensephy.max = basecorps.agilite.value + basecorps.vigueur.value + baseame.instinct.value;
let newDef = basecorps.agilite.value + basecorps.vigueur.value + baseame.instinct.value;
if ( newDef != this.system.caracsecondaire.defensephy.max) {
this.system.caracsecondaire.defensephy.max = newDef
this.update( { 'system.caracsecondaire.defensephy.max': newDef });
}
this.system.caracsecondaire.defensemen.value = baseesprit.tenacite.value + baseame.instinct.value + baseesprit.intellect.value;
this.system.caracsecondaire.defensemen.max = baseesprit.tenacite.value + baseame.instinct.value + baseesprit.intellect.value;
newDef = baseesprit.tenacite.value + baseame.instinct.value + baseesprit.intellect.value;
if ( newDef != this.system.caracsecondaire.defensemen.max) {
this.system.caracsecondaire.defensemen.max = newDef
this.update( { 'system.caracsecondaire.defensemen.max': newDef });
}
this.system.caracsecondaire.deplacement.value = basecorps.agilite.value + basecorps.vigueur.value;
this.system.caracsecondaire.deplacement.max = basecorps.agilite.value + basecorps.vigueur.value;
let depl = basecorps.agilite.value + basecorps.vigueur.value;
if ( depl != this.system.caracsecondaire.deplacement.max) {
this.system.caracsecondaire.deplacement.max = depl
this.update( { 'system.caracsecondaire.deplacement.max': depl });
}
this.system.caracsecondaire.capaenc.value = (basecorps.puissance.value * 2) + basecorps.vigueur.value;
this.system.caracsecondaire.capaenc.max = (basecorps.puissance.value * 2) + basecorps.vigueur.value;
let enc = (basecorps.puissance.value * 2) + basecorps.vigueur.value;
if ( enc != this.system.caracsecondaire.capaenc.max ) {
this.system.caracsecondaire.capaenc.max = enc
this.update( { 'system.caracsecondaire.capaenc.max': enc });
}
//console.log("CARAC SEC", this.system.caracsecondaire)
}
}

View File

@ -23,7 +23,7 @@ export class YggdrasillFigurantSheet extends ActorSheet {
}
/* -------------------------------------------- */
getData() {
async getData() {
const objectData = duplicate(this.object)
let formData = {
@ -42,6 +42,8 @@ export class YggdrasillFigurantSheet extends ActorSheet {
monnaies: this.actor.getMonnaies(),
optionsAttr: new Array(41).fill('option'),
optionsBase: YggdrasillUtility.createDirectOptionList(0, 20),
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
notes: await TextEditor.enrichHTML(this.object.system.notes, {async: true}),
options: this.options,
owner: this.document.isOwner,
editScore: this.options.editScore,

View File

@ -56,6 +56,7 @@ export class YggdrasillItemSheet extends ItemSheet {
data: foundry.utils.deepClone(this.object.system),
optionsBase: YggdrasillUtility.createDirectOptionList(0, 20),
optionsNiveaux4: YggdrasillUtility.buildListOptions(1, 5),
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
limited: this.object.limited,
options: this.options,
owner: this.document.isOwner,

View File

@ -1,5 +1,4 @@
/* -------------------------------------------- */
//import { YggdrasillCombat } from "./yggdrasill-combat.js";
/* -------------------------------------------- */
const dureeGaldrText = { "1d5a": "Actions", "1d10t": "Tours", "1d10m": "Minutes", "1d10h": "Heures", "1d5j": "Jours"};
@ -86,13 +85,11 @@ export class YggdrasillUtility {
}
/* -------------------------------------------- */
static async specificYggRoll( nbDice ) {
static async specificYggRoll( nbDice, isFurorUsage = false) {
let rawDices = []
let rolls = []
let maxTab = []
maxTab[0] = {idx: 0, value: 0}
maxTab[1] = {idx: 0, value: 0}
let maxTabMaxIndex = isFurorUsage ? nbDice : 2;
for (let i=0; i<nbDice; i++) {
rolls[i] = new Roll("1d10x10").roll( {async: false}) //+sumDice+"+"+rollData.furorUsage+"d10+"+niveauCompetence+"+"+rollData.finalBM).roll( { async: false} );
@ -102,19 +99,17 @@ export class YggdrasillUtility {
this.showDiceSoNice(rolls[i], game.settings.get("core", "rollMode") );
}
rawDices.push({ 'result': rolls[i].total});
if ( rolls[i].total > maxTab[0].value) {
if ( nbDice > 1 && maxTab[0].value > maxTab[1].value) {
maxTab[1].value = maxTab[0].value
}
maxTab[0].value = rolls[i].total
} else {
if ( nbDice > 1 && rolls[i].total > maxTab[1].value) {
maxTab[1].value = rolls[i].total
}
}
}
return { rawDices: rawDices, maxTab: maxTab, rolls: rolls}
rolls.sort((a,b) => a.total-b.total);
rolls.reverse();
for (let i=0; i<maxTabMaxIndex; i++) {
maxTab[i] = {idx: 0, value: 0};
if (rolls[i].total != undefined) maxTab[i].value = rolls[i].total;
}
return { rawDices: rawDices, maxTab: maxTab, rolls: rolls }
}
/* -------------------------------------------- */
@ -175,7 +170,6 @@ export class YggdrasillUtility {
this.createChatWithRollMode( rollData.alias, {
content: await renderTemplate(`systems/fvtt-yggdrasill/templates/chat-generic-result.html`, rollData)
});
//myRoll.toMessage();
}
/* -------------------------------------------- */
@ -218,7 +212,7 @@ export class YggdrasillUtility {
console.log("RES", results, nbDice, sumDice)
if ( rollData.furorUsage > 0 ) {
results = await this.specificYggRoll( rollData.furorUsage )
results = await this.specificYggRoll( rollData.furorUsage, true )
rollData.furorRawDices = results.rawDices
rollData.furorMaxTab = results.maxTab
rollData.furorRolls = results.rolls
@ -292,7 +286,6 @@ export class YggdrasillUtility {
this.createChatWithRollMode( rollData.alias, {
content: await renderTemplate(`systems/fvtt-yggdrasill/templates/chat-generic-result.html`, rollData)
});
//myRoll.toMessage();
}
/* -------------------------------------------- */

View File

@ -1,7 +1,7 @@
{
"title": "Yggdrasill",
"description": "Système non-officiel Yggdrasill (7ième Cercle) pour FoundryVTT",
"version": "10.0.0",
"version": "11.0.0",
"esmodules": [
"modules/yggdrasill-main.js"
],
@ -196,7 +196,7 @@
"socket": true,
"url": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/raw/branch/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/archive/fvtt-yggdrasill-10.0.0.zip",
"download": "https://www.uberwald.me/gitea/public/fvtt-yggdrasill/archive/fvtt-yggdrasill-11.0.0.zip",
"license": "LICENSE.txt",
"id": "fvtt-yggdrasill",
"authors": [
@ -221,6 +221,7 @@
},
"compatibility": {
"minimum": "10",
"verified": "10.286"
"verified": "11",
"maximum": "11"
}
}

View File

@ -540,17 +540,17 @@
<hr>
<h3>Biographie : </h3>
<div class="form-group editor">
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
<hr>
<h3>Notes : </h3>
<div class="form-group editor">
{{editor data.notes target="system.notes" button=true owner=owner editable=editable}}
{{editor notes target="system.notes" button=true owner=owner editable=editable}}
</div>
<hr>
<h3>Tirage des Runes: </h3>
<div class="form-group editor">
{{editor data.tiragerunes target="system.tiragerunes" button=true owner=owner editable=editable}}
{{editor tiragerunes target="system.tiragerunes" button=true owner=owner editable=editable}}
</div>
<hr>
{{>"systems/fvtt-yggdrasill/templates/editor-notes-gm.html"}}

View File

@ -1,6 +1,6 @@
{{#if data.isGM}}
<h3>GM Notes : </h3>
<div class="form-group editor">
{{editor data.biodata.gmnotes target="system.biodata.gmnotes" button=true owner=owner editable=editable}}
{{editor gmnotes target="system.biodata.gmnotes" button=true owner=owner editable=editable}}
</div>
{{/if}}

View File

@ -151,12 +151,12 @@
<article class="flexcol">
<h3>Biographie : </h3>
<div class="form-group editor">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
{{editor description target="data.description" button=true owner=owner editable=editable}}
</div>
<hr>
<h3>Notes : </h3>
<div class="form-group editor">
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}}
{{editor notes target="data.notes" button=true owner=owner editable=editable}}
</div>
</article>
</div>

View File

@ -32,7 +32,7 @@
<li class="flexrow"><label class="generic-label">Valeur</label><input type="text" name="system.valeur" value="{{data.valeur}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -29,7 +29,7 @@
<li class="flexrow"><label class="generic-label">Portée</label><input type="text" name="system.portee" value="{{data.portee}}" data-dtype="String"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -27,7 +27,7 @@
<li class="flexrow"><label class="generic-label">Valeur</label><input type="text" name="system.valeur" value="{{data.valeur}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -11,7 +11,7 @@
<div class="tab" data-group="primary">
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -28,7 +28,7 @@
<li class="flexrow"><label class="generic-label">Valeur</label><input type="text" name="system.valeur" value="{{data.valeur}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -34,7 +34,7 @@
</li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -11,7 +11,7 @@
<div class="tab" data-group="primary">
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -11,7 +11,7 @@
<div class="tab" data-group="primary">
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -17,7 +17,7 @@
</li>
</ul>
<label class="generic-label">Effet</label>
{{editor data.effet target="system.effet" button=true owner=owner editable=editable}}
{{editor effet target="system.effet" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -18,7 +18,7 @@
<li class="flexrow"><label class="generic-label">Valeur</label><input type="text" name="system.valeur" value="{{data.valeur}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -11,7 +11,7 @@
<div class="tab" data-group="primary">
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -24,7 +24,7 @@
</li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -15,7 +15,7 @@
<li class="flexrow"><label class="generic-label">Encombrement</label><input type="text" name="system.enc" value="{{data.enc}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -23,7 +23,7 @@
<li class="flexrow"><label class="generic-label">Type</label><input type="text" name="system.type" value="{{data.type}}" data-dtype="String"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -33,7 +33,7 @@
<li class="flexrow"><label class="generic-label">Modificateur</label><input type="text" name="system.modificateur" value="{{data.modificateur}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -24,7 +24,7 @@
<li class="flexrow"><label class="generic-label">Zone/Cible</label><input type="text" name="system.zonecible" value="{{data.zonecible}}" data-dtype="String"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -24,7 +24,7 @@
<li class="flexrow"><label class="generic-label">SD</label><input type="text" name="system.sd" value="{{data.sd}}" data-dtype="Number"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>

View File

@ -26,7 +26,7 @@
<li class="flexrow"><label class="generic-label">Zone</label><input type="text" name="system.zone" value="{{data.zone}}" data-dtype="String"/></li>
</ul>
<label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</section>