Merge branch 'master-des' into 'master'

Un dé pour les heures draconiques

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!219
This commit is contained in:
Leratier Bretonnien 2021-04-30 06:13:46 +00:00
commit 03b88a269a
14 changed files with 59 additions and 14 deletions

BIN
icons/heures/hd01.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
icons/heures/hd02.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
icons/heures/hd03.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
icons/heures/hd04.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
icons/heures/hd05.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
icons/heures/hd06.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
icons/heures/hd07.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
icons/heures/hd08.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
icons/heures/hd09.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
icons/heures/hd10.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
icons/heures/hd11.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
icons/heures/hd12.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -2,18 +2,30 @@ import { ChatUtility } from "./chat-utility.js";
import { SYSTEM_RDD } from "./constants.js"; import { SYSTEM_RDD } from "./constants.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
function img(src) {
return `<img src="${src}" class="dice-img" />`
}
function iconHeure(heure){
if (heure<10) {
heure = '0'+heure;
}
return `systems/foundryvtt-reve-de-dragon/icons/heures/hd${heure}.webp`
}
const signeDragon = 'systems/foundryvtt-reve-de-dragon/icons/heures/hdragon.webp'; const signeDragon = 'systems/foundryvtt-reve-de-dragon/icons/heures/hdragon.webp';
const imgSigneDragon = `<img src="${signeDragon}" />`; const imgSigneDragon = img(signeDragon);
const labelsDeDragon = ['1', '2', '3', '4', '5', '6', signeDragon, '0']; const labelsDeDragon = ['1', '2', '3', '4', '5', '6', signeDragon, '0'];
const bumpsDeDragon = [, , , , , , signeDragon,]; const bumpsDeDragon = [, , , , , , signeDragon,];
const signeHeure = 'systems/foundryvtt-reve-de-dragon/icons/heures/hd';
/** De7 pour les jets de rencontre */ /** De7 pour les jets de rencontre */
export class De7 extends Die { export class De7 extends Die {
/** @override */ /** @override */
static DENOMINATION = "7"; static DENOMINATION = "7";
static diceSoNiceData() { static diceSoNiceData(system) {
return { type: "d7", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: SYSTEM_RDD } return { type: "d7", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: system }
} }
constructor(termData) { constructor(termData) {
@ -33,7 +45,7 @@ export class De7 extends Die {
static getResultLabel(result) { static getResultLabel(result) {
switch (result) { switch (result) {
case '7': return imgSigneDragon case 7: return imgSigneDragon
} }
return result; return result;
} }
@ -43,8 +55,8 @@ export class De7 extends Die {
export class DeDraconique extends Die { export class DeDraconique extends Die {
static DENOMINATION = "r"; static DENOMINATION = "r";
static diceSoNiceData() { static diceSoNiceData(system) {
return { type: "dr", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: SYSTEM_RDD } return { type: "dr", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: system }
} }
constructor(termData) { constructor(termData) {
@ -64,22 +76,52 @@ export class DeDraconique extends Die {
static getResultLabel(result) { static getResultLabel(result) {
switch (result) { switch (result) {
case '7': return imgSigneDragon case 7: return imgSigneDragon
} }
return result; return result;
} }
} }
const imagesHeures = [1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 11, 12].map(it => iconHeure(it));
/** De 12 avec les heures */
export class DeHeure extends Die {
/** @override */
static DENOMINATION = "h";
static diceSoNiceData(system) {
return {
type: "dh",
labels: imagesHeures,
bumpMaps: imagesHeures,
system: system
}
}
constructor(termData) {
termData.faces = 12;
super(termData);
}
static getResultLabel(result) {
return img(imagesHeures[result]);
}
}
export class RdDDice { export class RdDDice {
static init() { static init() {
CONFIG.Dice.terms[De7.DENOMINATION] = De7; CONFIG.Dice.terms[De7.DENOMINATION] = De7;
CONFIG.Dice.terms[DeDraconique.DENOMINATION] = DeDraconique; CONFIG.Dice.terms[DeDraconique.DENOMINATION] = DeDraconique;
CONFIG.Dice.terms[DeHeure.DENOMINATION] = DeHeure;
} }
static diceSoNiceReady(dice3d) { static diceSoNiceReady(dice3d) {
dice3d.addSystem({ id: SYSTEM_RDD, name: "Rêve de Dragon" }); for (const system of Object.keys(dice3d.DiceFactory.systems)) {
dice3d.addDicePreset(De7.diceSoNiceData()); dice3d.addDicePreset(De7.diceSoNiceData(system));
dice3d.addDicePreset(DeDraconique.diceSoNiceData()); dice3d.addDicePreset(DeDraconique.diceSoNiceData(system));
dice3d.addDicePreset(DeHeure.diceSoNiceData(system));
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -240,6 +240,9 @@ table {border: 1px solid #7a7971;}
object-position: 50% 0; object-position: 50% 0;
} }
.dice-img {
border-width: 0;
}
.button-img { .button-img {
vertical-align: baseline; vertical-align: baseline;
width: 8%; width: 8%;