fix: initiative - auto-init deck, CSS stylisé, plus d'erreurs de formule
- Auto-initialisation du deck s'il est vide ou non initialisé - Fallback silencieux sur 1d6 si vraiment aucune carte dispo - _formula changé en '1d1' pour éviter les erreurs de parsing - Ajout du CSS complet pour le message d'initiative (chat.less) - Fond dégradé sombre, bordure rouge, badge arrondi - Avatar, nom, carte, valeur, score d'initiative - Pied de page stylisé
This commit is contained in:
@@ -2997,6 +2997,87 @@ i.fvtt-hamalron {
|
|||||||
box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
|
box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.initiative-roll {
|
||||||
|
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
||||||
|
border: 1px solid #e94560;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: var(--font-secondary, sans-serif);
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: rgba(233, 69, 96, 0.15);
|
||||||
|
border-bottom: 1px solid rgba(233, 69, 96, 0.3);
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-header .initiative-actor {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-header .initiative-actor .initiative-avatar {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid #e94560;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-header .initiative-actor .initiative-name {
|
||||||
|
color: #e0e0e0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-header .initiative-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: #e94560;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 4px 14px;
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-card .initiative-card-img {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-card .initiative-card-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-card .initiative-card-info .card-name {
|
||||||
|
color: #f0e6d3;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-card .initiative-card-info .card-value {
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.initiative-roll .initiative-footer {
|
||||||
|
text-align: center;
|
||||||
|
padding: 4px;
|
||||||
|
background: rgba(233, 69, 96, 0.08);
|
||||||
|
font-size: 11px;
|
||||||
|
color: #e94560;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
.application.dialog.fvtt-hamalron {
|
.application.dialog.fvtt-hamalron {
|
||||||
color: var(--color-dark-1);
|
color: var(--color-dark-1);
|
||||||
background-color: var(--color-light-1);
|
background-color: var(--color-light-1);
|
||||||
|
|||||||
+13
-3
@@ -47,15 +47,25 @@ Hooks.once("init", function () {
|
|||||||
const combatantName = this.name
|
const combatantName = this.name
|
||||||
const origEvaluate = roll.evaluate.bind(roll)
|
const origEvaluate = roll.evaluate.bind(roll)
|
||||||
roll.evaluate = async function (options = {}) {
|
roll.evaluate = async function (options = {}) {
|
||||||
const deckManager = globalThis.HamalronTarotDeckManager?._instance
|
let deckManager = globalThis.HamalronTarotDeckManager?._instance
|
||||||
if (deckManager?.deck?.length > 0) {
|
if (!deckManager) {
|
||||||
|
deckManager = new (globalThis.HamalronTarotDeckManager)()
|
||||||
|
globalThis.HamalronTarotDeckManager._instance = deckManager
|
||||||
|
}
|
||||||
|
if (deckManager.deck.length === 0) {
|
||||||
|
const tarotItems = game.items.filter(i => i.type === "tarot")
|
||||||
|
if (tarotItems.length > 0) deckManager.resetDeck()
|
||||||
|
}
|
||||||
|
if (deckManager.deck.length > 0) {
|
||||||
const drawn = deckManager.drawCards(1)
|
const drawn = deckManager.drawCards(1)
|
||||||
if (drawn.length > 0) {
|
if (drawn.length > 0) {
|
||||||
const card = drawn[0]
|
const card = drawn[0]
|
||||||
const val = SYSTEM.TAROT_VALEURS[card.valeur]?.value ?? 0
|
const val = SYSTEM.TAROT_VALEURS[card.valeur]?.value ?? 0
|
||||||
this._total = val
|
this._total = val
|
||||||
this._evaluated = true
|
this._evaluated = true
|
||||||
this._formula = `${card.name} (${val})`
|
this._formula = "1d1"
|
||||||
|
this._dice = []
|
||||||
|
this._terms = []
|
||||||
this.options.cardDraw = {
|
this.options.cardDraw = {
|
||||||
name: card.name,
|
name: card.name,
|
||||||
img: card.img,
|
img: card.img,
|
||||||
|
|||||||
@@ -787,3 +787,96 @@
|
|||||||
box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
|
box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.initiative-roll {
|
||||||
|
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
||||||
|
border: 1px solid #e94560;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: var(--font-secondary, sans-serif);
|
||||||
|
|
||||||
|
.initiative-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: rgba(233, 69, 96, 0.15);
|
||||||
|
border-bottom: 1px solid rgba(233, 69, 96, 0.3);
|
||||||
|
|
||||||
|
.initiative-actor {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.initiative-avatar {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid #e94560;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.initiative-name {
|
||||||
|
color: #e0e0e0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.initiative-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: #e94560;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 4px 14px;
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.initiative-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px;
|
||||||
|
|
||||||
|
.initiative-card-img {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.initiative-card-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
|
||||||
|
.card-name {
|
||||||
|
color: #f0e6d3;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-value {
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.initiative-footer {
|
||||||
|
text-align: center;
|
||||||
|
padding: 4px;
|
||||||
|
background: rgba(233, 69, 96, 0.08);
|
||||||
|
font-size: 11px;
|
||||||
|
color: #e94560;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user