Compare commits

..

18 Commits

Author SHA1 Message Date
uberwald f6fb0b68b8 Fix spell rolls again
Release Creation / build (release) Successful in 47s
2026-05-25 20:41:00 +02:00
uberwald e45edd60c4 FIx spell order and dual rollll for spell damages
Release Creation / build (release) Successful in 1m6s
2026-05-25 12:29:39 +02:00
uberwald d389a85a9f Fix ranged attacks again
Release Creation / build (release) Successful in 43s
2026-05-24 09:42:07 +02:00
uberwald c217490a5b Fix ranged attacks again
Release Creation / build (release) Has been cancelled
2026-05-24 09:41:06 +02:00
uberwald 38eb1a8d3d Add ranged actions for monsters
Release Creation / build (release) Successful in 54s
2026-05-23 19:10:10 +02:00
uberwald 4724cdf2bb VArious fixes for rolls and ranged attacks
Release Creation / build (release) Successful in 44s
2026-05-23 09:08:16 +02:00
uberwald 6d06c8ddad Various fixes for spell and ranged attacks 2026-05-23 00:21:05 +02:00
uberwald 2770774aa3 Various fixes for spell and ranged attacks 2026-05-23 00:11:58 +02:00
uberwald e417b61625 Spells fixe
Release Creation / build (release) Successful in 46s
2026-05-20 23:17:07 +02:00
uberwald 9a8d580ef6 Other fixes for damage buttons from chat
Release Creation / build (release) Successful in 53s
2026-05-20 10:53:46 +02:00
uberwald 9ccb0f90f0 Other fixes for damage buttons from chat 2026-05-20 10:53:22 +02:00
uberwald 6cf0880ad3 Enhance spell damage and messages content
Release Creation / build (release) Successful in 44s
2026-05-19 10:52:03 +02:00
uberwald 96306623e5 UPdate and fixes for roll in combats
Release Creation / build (release) Successful in 43s
2026-05-18 20:26:39 +02:00
uberwald 7279cd752d Fix initiative again
Release Creation / build (release) Successful in 43s
2026-05-18 07:58:28 +02:00
uberwald db3e8b5d35 Improve init for monsters and some fixwes around shields
Release Creation / build (release) Successful in 48s
2026-05-17 13:22:29 +02:00
uberwald 54421e4a83 MAnage spell/miracle spending points and favor/disfavor for shield rolls
Release Creation / build (release) Successful in 43s
2026-05-10 17:49:53 +02:00
uberwald ac44419b7a Corredction sur attack ranged 2026-05-03 15:12:25 +02:00
uberwald a3fc0a42b9 Corredction sur attack ranged
Release Creation / build (release) Successful in 1m19s
2026-05-03 10:06:44 +02:00
60 changed files with 1789 additions and 807 deletions
+2 -2
View File
@@ -59,5 +59,5 @@ jobs:
version: ${{github.event.release.tag_name}} version: ${{github.event.release.tag_name}}
manifest: "https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/system.json" manifest: "https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/system.json"
notes: "https://www.uberwald.me/gitea/public/fvtt-lethal-fantasy/raw/branch/main/changelog.md" notes: "https://www.uberwald.me/gitea/public/fvtt-lethal-fantasy/raw/branch/main/changelog.md"
compatibility-minimum: "13" compatibility-minimum: "14"
compatibility-verified: "13" compatibility-verified: "14"
+62
View File
@@ -0,0 +1,62 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with this repository.
## Overview
FoundryVTT v13+ game system for the **Lethal Fantasy RPG**. Entry point: `lethal-fantasy.mjs`.
## Commands
```bash
# Compile LESS styles (styles/ -> css/)
npx gulp css # one-shot
npx gulp # compile + watch
# Lint
npx eslint .
# Compendium pack management (LevelDB <-> YAML source)
npm run pushLDBtoYML # export packs-system/ LevelDB -> source YAML
npm run pullYMLtoLDB # import source YAML -> packs-system/ LevelDB
```
No test suite exists.
## Architecture
Four layers in `module/`, all wired in `lethal-fantasy.mjs` via the `init` hook:
| Layer | Path | Purpose |
|---|---|---|
| Config | `module/config/` | Game constants. `SYSTEM` is `globalThis.SYSTEM` — always use `SYSTEM.*` for enumerations. |
| Models | `module/models/` | `TypeDataModel` subclasses — data schemas per document type. |
| Documents | `module/documents/` | Actor/Item/Roll/ChatMessage subclasses — game logic, roll processing, hooks. |
| Applications | `module/applications/` | `ApplicationV2` sheets + custom combat tracker. |
**Actor types**: `character`, `monster`
**Item types**: `skill`, `gift`, `vulnerability`, `weapon`, `armor`, `shield`, `spell`, `miracle`, `equipment`
Each layer has an `_module.mjs` barrel file that re-exports all classes from that layer.
Templates (`.hbs`) live in `templates/`. Styles are authored in LESS under `styles/` and compiled to `css/`.
### Key Patterns
- **Sheets**: Extend `HandlebarsApplicationMixin(foundry.applications.sheets.ActorSheetV2)` — imported from `foundry.applications.api`. **Not** the legacy `ActorSheet`. Child sheets (e.g. `character-sheet.mjs`) extend `base-actor-sheet.mjs` and override `static PARTS` and `DEFAULT_OPTIONS.actions`. Template paths are prefixed `systems/fvtt-lethal-fantasy/templates/`. Actor sheets have a play/edit toggle via `_sheetMode` and `SHEET_MODES`.
- **Models**: `static defineSchema()` using `foundry.data.fields.*`. Field definitions derived from SYSTEM config objects.
- **Rolls**: `LethalFantasyRoll` extends `Roll` with rich metadata via `this.options`. `D30Roll` is a separate class for D30 result tables (initialized in the `ready` hook).
- **Socket**: Events use `game.socket.on(\`system.${SYSTEM.id}\`, ...)`. Multi-player attack-defense uses a global `pendingDefenses` Map.
- **i18n**: All user-visible strings are keys in `lang/en.json` as `LETHALFANTASY.Category.Key`. Always use `game.i18n.localize(key)`.
### Compendium Packs
Five LevelDB packs in `packs-system/`: skills, equipment, gifts, vulnerabilities, spells-miracles. Use the `tools/` scripts to export/import editable YAML.
## Code Style
- No semicolons, double quotes, 2-space indent
- JSDoc `/** */` required on all functions/classes
- Max line length 180 (strings/templates exempt)
- Arrow functions: omit parens for single param
- ESLint + Prettier config in `eslint.config.mjs`
+131 -25
View File
@@ -529,16 +529,16 @@ i.lethalfantasy {
} }
.lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .armor-hp { .lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .armor-hp {
margin-right: 4px; margin-right: 4px;
min-width: 10rem; min-width: 11rem;
max-width: 10rem; max-width: 11rem;
} }
.lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .armor-hp .name { .lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .armor-hp .name {
min-width: 6rem; min-width: 6rem;
max-width: 6rem; max-width: 6rem;
} }
.lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .armor-hp .input { .lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .armor-hp .input {
min-width: 2.5rem; min-width: 3.5rem;
max-width: 2.5rem; max-width: 3.5rem;
} }
.lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .granted { .lethalfantasy .tab.character-combat .main-div .combat-details .combat-detail .granted {
min-width: 8rem; min-width: 8rem;
@@ -2027,9 +2027,12 @@ i.lethalfantasy {
background: #4a4940 !important; background: #4a4940 !important;
color: #ffffff !important; color: #ffffff !important;
} }
.lethalfantasy .grit-luck-dialog {
color: var(--color-text-dark-primary, #191813);
}
.lethalfantasy .grit-luck-dialog .combat-status { .lethalfantasy .grit-luck-dialog .combat-status {
padding: 12px; padding: 12px;
background: linear-gradient(to bottom, rgba(42, 41, 32, 0.8) 0%, rgba(26, 25, 16, 0.9) 100%); background: linear-gradient(to bottom, rgba(42, 41, 32, 0.88) 0%, rgba(26, 25, 16, 0.95) 100%);
border: 1px solid rgba(212, 175, 55, 0.5); border: 1px solid rgba(212, 175, 55, 0.5);
border-radius: 6px; border-radius: 6px;
margin-bottom: 16px; margin-bottom: 16px;
@@ -2049,11 +2052,25 @@ i.lethalfantasy {
margin-top: 8px; margin-top: 8px;
} }
.lethalfantasy .grit-luck-dialog .offer-text { .lethalfantasy .grit-luck-dialog .offer-text {
color: #f0e6d2; color: var(--color-text-dark-primary, #191813);
font-size: calc(var(--font-size-standard) * 1); font-size: calc(var(--font-size-standard) * 1);
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
margin: 0 0 8px 0;
}
.lethalfantasy .grit-luck-dialog .shield-warning {
color: #7a4000;
background: rgba(255, 160, 0, 0.12);
border: 1px solid rgba(255, 160, 0, 0.4);
border-radius: 5px;
font-size: calc(var(--font-size-standard) * 0.88);
padding: 6px 10px;
margin: 0; margin: 0;
text-align: center;
}
.lethalfantasy .grit-luck-dialog .shield-warning i {
color: #c07000;
margin-right: 5px;
} }
.lethalfantasy .attack-result { .lethalfantasy .attack-result {
padding: 16px; padding: 16px;
@@ -2144,31 +2161,66 @@ i.lethalfantasy {
color: #d4af37; color: #d4af37;
} }
.lethalfantasy .attack-result .attack-result-damage { .lethalfantasy .attack-result .attack-result-damage {
display: flex; display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px; gap: 8px;
justify-content: center; }
.lethalfantasy .attack-result .attack-result-damage.single-btn {
grid-template-columns: 1fr;
max-width: 280px;
margin: 0 auto;
}
.lethalfantasy .attack-result .attack-result-damage.spell-damage {
grid-template-columns: 1fr;
width: 100%;
} }
.lethalfantasy .attack-result .attack-result-damage .roll-damage-btn { .lethalfantasy .attack-result .attack-result-damage .roll-damage-btn {
padding: 10px 16px; padding: 10px 14px;
background: linear-gradient(to bottom, #8b0000 0%, #660000 100%); background: linear-gradient(to bottom, #8b0000 0%, #660000 100%);
border: 1px solid #ff0000; border: 1px solid #4b0000;
border-radius: 6px; border-radius: 6px;
color: #f0e6d2; color: #f0e6d2;
font-weight: 600; font-weight: 600;
font-size: calc(var(--font-size-standard) * 0.9);
text-align: center;
white-space: nowrap;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
position: relative;
overflow: hidden;
}
.lethalfantasy .attack-result .attack-result-damage .roll-damage-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
transition: left 0.5s;
}
.lethalfantasy .attack-result .attack-result-damage .roll-damage-btn:hover::before {
left: 100%;
}
.lethalfantasy .attack-result .attack-result-damage .roll-damage-btn i {
font-size: calc(var(--font-size-standard) * 1.1);
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
flex-shrink: 0;
} }
.lethalfantasy .attack-result .attack-result-damage .roll-damage-btn:hover { .lethalfantasy .attack-result .attack-result-damage .roll-damage-btn:hover {
background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%); background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
transform: translateY(-2px); transform: translateY(-2px);
border-color: #5b0000;
} }
.lethalfantasy .attack-result .attack-result-damage .roll-damage-btn:active { .lethalfantasy .attack-result .attack-result-damage .roll-damage-btn:active {
transform: translateY(0); transform: translateY(0);
} box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 3px rgba(0, 0, 0, 0.3);
.lethalfantasy .attack-result .attack-result-damage .roll-damage-btn i {
margin-right: 6px;
} }
.lethalfantasy .equipment-content { .lethalfantasy .equipment-content {
font-family: var(--font-primary); font-family: var(--font-primary);
@@ -2634,6 +2686,21 @@ i.lethalfantasy {
max-width: 8rem; max-width: 8rem;
margin-left: 1rem; margin-left: 1rem;
} }
.dialog-warning {
margin: 0.4rem 0.2rem 0.2rem;
padding: 0.35rem 0.5rem;
border-left: 3px solid #c8941a;
background: rgba(200, 148, 26, 0.12);
border-radius: 3px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 0.9);
color: #7a5400;
line-height: 1.4;
}
.dialog-warning i {
color: #c8941a;
margin-right: 0.4rem;
}
.lethalfantasy.dice-roll, .lethalfantasy.dice-roll,
.fvtt-lethal-fantasy.dice-roll, .fvtt-lethal-fantasy.dice-roll,
.message.lethalfantasy.dice-roll, .message.lethalfantasy.dice-roll,
@@ -3928,35 +3995,74 @@ i.lethalfantasy {
} }
.message .attack-result .attack-result-damage, .message .attack-result .attack-result-damage,
.attack-result .attack-result-damage { .attack-result .attack-result-damage {
display: flex; display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px; gap: 8px;
justify-content: center; }
.message .attack-result .attack-result-damage.single-btn,
.attack-result .attack-result-damage.single-btn {
grid-template-columns: 1fr;
max-width: 280px;
margin: 0 auto;
}
.message .attack-result .attack-result-damage.spell-damage,
.attack-result .attack-result-damage.spell-damage {
grid-template-columns: 1fr;
width: 100%;
} }
.message .attack-result .attack-result-damage .roll-damage-btn, .message .attack-result .attack-result-damage .roll-damage-btn,
.attack-result .attack-result-damage .roll-damage-btn { .attack-result .attack-result-damage .roll-damage-btn {
padding: 10px 16px; padding: 10px 14px;
background: linear-gradient(to bottom, #8b0000 0%, #660000 100%); background: linear-gradient(to bottom, #8b0000 0%, #660000 100%);
border: 1px solid #ff0000; border: 1px solid #4b0000;
border-radius: 6px; border-radius: 6px;
color: #f0e6d2; color: #f0e6d2;
font-weight: 600; font-weight: 600;
font-size: calc(var(--font-size-standard) * 0.9);
text-align: center;
white-space: nowrap;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
position: relative;
overflow: hidden;
}
.message .attack-result .attack-result-damage .roll-damage-btn::before,
.attack-result .attack-result-damage .roll-damage-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
transition: left 0.5s;
}
.message .attack-result .attack-result-damage .roll-damage-btn:hover::before,
.attack-result .attack-result-damage .roll-damage-btn:hover::before {
left: 100%;
}
.message .attack-result .attack-result-damage .roll-damage-btn i,
.attack-result .attack-result-damage .roll-damage-btn i {
font-size: calc(var(--font-size-standard) * 1.1);
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
flex-shrink: 0;
} }
.message .attack-result .attack-result-damage .roll-damage-btn:hover, .message .attack-result .attack-result-damage .roll-damage-btn:hover,
.attack-result .attack-result-damage .roll-damage-btn:hover { .attack-result .attack-result-damage .roll-damage-btn:hover {
background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%); background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
transform: translateY(-2px); transform: translateY(-2px);
border-color: #5b0000;
} }
.message .attack-result .attack-result-damage .roll-damage-btn:active, .message .attack-result .attack-result-damage .roll-damage-btn:active,
.attack-result .attack-result-damage .roll-damage-btn:active { .attack-result .attack-result-damage .roll-damage-btn:active {
transform: translateY(0); transform: translateY(0);
} box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 3px rgba(0, 0, 0, 0.3);
.message .attack-result .attack-result-damage .roll-damage-btn i,
.attack-result .attack-result-damage .roll-damage-btn i {
margin-right: 6px;
} }
#token-hud .hp-loss-wrap { #token-hud .hp-loss-wrap {
position: absolute; position: absolute;
+69 -4
View File
@@ -382,7 +382,7 @@
"rollProgressionCount": "Roll progression count", "rollProgressionCount": "Roll progression count",
"rollProgressionDice": "Roll progression/Lethargy dice", "rollProgressionDice": "Roll progression/Lethargy dice",
"earned": "Earned", "earned": "Earned",
"divinityPoints": "Divinity points", "divinityPoints": "Grace",
"aetherPoints": "Aether points", "aetherPoints": "Aether points",
"attacks": "Attacks", "attacks": "Attacks",
"attackMode": "Attack Mode", "attackMode": "Attack Mode",
@@ -471,6 +471,8 @@
"range": "Range", "range": "Range",
"rangeDefenseDialog": "Ranged defense dialog", "rangeDefenseDialog": "Ranged defense dialog",
"rangeDefenseRoll": "Ranged defense roll", "rangeDefenseRoll": "Ranged defense roll",
"rangeAttackDialog": "Ranged attack dialog",
"rangeAttackRoll": "Ranged attack roll",
"rangedAttackDefense": "Ranged attack defense", "rangedAttackDefense": "Ranged attack defense",
"resource": "Resource", "resource": "Resource",
"resources": "Resources", "resources": "Resources",
@@ -507,7 +509,40 @@
"weapon-damage-small": "Weapon damage small", "weapon-damage-small": "Weapon damage small",
"combatProgressionStart": "Combat start threshold", "combatProgressionStart": "Combat start threshold",
"miracle": "Miracle", "miracle": "Miracle",
"titleStandard": "Standard Roll" "titleStandard": "Standard Roll",
"privateRoll": "Private Roll",
"current": "Current",
"max": "Max",
"speed": "Speed",
"bonuses": "Bonuses",
"handToHandAttacks": "Hand To Hand Attacks",
"beyondSkill": "Beyond Skill",
"letItFly": "Let It Fly!",
"class": "Class",
"mortal": "Mortal",
"alignment": "Alignment",
"age": "Age",
"height": "Height",
"weight": "Weight",
"eyes": "Eyes",
"hair": "Hair",
"magicUser": "Magic User",
"clericUser": "Cleric User",
"lastHdRoll": "Last HD roll",
"naturalDR": "Natural DR",
"magicalDR": "Magical DR",
"saveBonus": "Save bonus (1/5 levels)",
"spellBonus": "Spell bonus (1/5 levels)",
"miracleBonus": "Miracle bonus (1/5 levels)",
"devPointsTotal": "Dev. Points (Total)",
"devPointsRem": "Dev. Points (Rem.)",
"length": "Length",
"vision": "Vision",
"damageType": "Damage Type",
"components": "Components",
"coverRanged": "Cover vs ranged attacks",
"standing": "Standing",
"crouching": "Crouching"
}, },
"Miracle": { "Miracle": {
"FIELDS": { "FIELDS": {
@@ -563,6 +598,15 @@
}, },
"savingThrow": { "savingThrow": {
"label": "Saving throw" "label": "Saving throw"
},
"damageDiceOverpowered": {
"label": "Overpowered Damage Dice"
},
"damageDiceOverpowered2": {
"label": "Overpowered 2 Damage Dice"
},
"damageDice": {
"label": "Damage Dice"
} }
} }
}, },
@@ -684,7 +728,8 @@
"label": "Min" "label": "Min"
} }
} }
} },
"autoDestruction": "Auto-Destruction"
}, },
"Skill": { "Skill": {
"Category": { "Category": {
@@ -809,6 +854,12 @@
}, },
"damageDice": { "damageDice": {
"label": "Damage dice" "label": "Damage dice"
},
"damageDiceOverpowered": {
"label": "Overpowered Damage Dice"
},
"damageDiceOverpowered2": {
"label": "Overpowered 2 Damage Dice"
} }
}, },
"Range": { "Range": {
@@ -843,7 +894,9 @@
} }
} }
}, },
"Warning": {}, "Warning": {
"defenseShieldOrder": "To avoid a hit without using the shield, roll Grit or Luck first — then roll the shield."
},
"Weapon": { "Weapon": {
"FIELDS": { "FIELDS": {
"isAgile": { "isAgile": {
@@ -988,6 +1041,18 @@
"diceResult": "Dice result", "diceResult": "Dice result",
"progressionCount": "Progression count:" "progressionCount": "Progression count:"
}, },
"Combat": {
"RollMonsters": "Roll Monsters",
"monstersNotRolledTitle": "Monsters Not Rolled",
"monstersNotRolledMsg": "Monsters have not rolled this second. Proceed anyway?",
"proceedYes": "Proceed",
"proceedNo": "Cancel",
"spellDRDialogTitle": "Spell Damage — Apply DR?",
"spellDRDialogMsg": "Enter a damage reduction value to subtract, or click No DR to apply full damage.",
"spellDRLabel": "DR:",
"spellNoDR": "No DR",
"spellApplyDR": "Apply DR"
},
"EquipmentCategories": { "EquipmentCategories": {
"ClassKit": "Class Kit", "ClassKit": "Class Kit",
"Clothing": "Clothing", "Clothing": "Clothing",
+230 -138
View File
@@ -129,93 +129,76 @@ Hooks.once("ready", function () {
} }
}) })
// Test if version below 13 Hooks.on("renderChatMessageHTML", (message, html, data) => {
let hookName = "renderChatMessage"
if (foundry.utils.isNewerVersion(game.version, "12.0",)) {
hookName = "renderChatMessageHTML"
}
Hooks.on(hookName, (message, html, data) => {
const typeMessage = data.message.flags.lethalFantasy?.typeMessage const typeMessage = data.message.flags.lethalFantasy?.typeMessage
// Message de demande de jet de dés // Message de demande de jet de dés
if (typeMessage === "askRoll") { if (typeMessage === "askRoll") {
// Affichage des boutons de jet de dés uniquement pour les joueurs // Affichage des boutons de jet de dés uniquement pour les joueurs
if (game.user.isGM) { if (game.user.isGM) {
html.find(".ask-roll-dice").each((i, btn) => { for (const btn of html.querySelectorAll(".ask-roll-dice")) {
btn.style.display = "none" btn.style.display = "none"
}) }
} else { } else {
html.find(".ask-roll-dice").click((event) => { for (const btn of html.querySelectorAll(".ask-roll-dice")) {
const btn = $(event.currentTarget) btn.addEventListener("click", () => {
const type = btn.data("type") const type = btn.dataset.type
const value = btn.data("value") const value = btn.dataset.value
const avantage = btn.data("avantage") ?? "=" const avantage = btn.dataset.avantage ?? "="
const character = game.user.character const character = game.user.character
if (type === SYSTEM.ROLL_TYPE.RESOURCE) character.rollResource(value) if (type === SYSTEM.ROLL_TYPE.RESOURCE) character.rollResource(value)
else if (type === SYSTEM.ROLL_TYPE.SAVE) character.rollSave(value, avantage) else if (type === SYSTEM.ROLL_TYPE.SAVE) character.rollSave(value, avantage)
}) })
} }
} }
}
// Gestion du survol et du clic sur les boutons de dégâts pour les GMs // Gestion du survol et du clic sur les boutons de dégâts pour les GMs
if (game.user.isGM) { if (game.user.isGM) {
// Show damage buttons only for GM // Show damage buttons only for GM
$(html).find(".li-apply-wounds").each((i, btn) => { for (const btn of html.querySelectorAll(".li-apply-wounds")) {
btn.style.display = "block" btn.style.display = "block"
}) }
$(html).find(".apply-wounds-btn").hover( for (const btn of html.querySelectorAll(".apply-wounds-btn")) {
function (event) { btn.addEventListener("mouseenter", () => {
// Mouse enter - select the token and pan to it const combatantId = btn.dataset.combatantId
let combatantId = $(this).data("combatant-id")
if (combatantId && game.combat) { if (combatantId && game.combat) {
let combatant = game.combat.combatants.get(combatantId) const combatant = game.combat.combatants.get(combatantId)
if (combatant?.token) { if (combatant?.token) {
let token = canvas.tokens.get(combatant.token.id) const token = canvas.tokens.get(combatant.token.id)
if (token) { if (token) {
token.control({ releaseOthers: true }) token.control({ releaseOthers: true })
canvas.animatePan(token.center) canvas.animatePan(token.center)
} }
} }
} }
},
function (event) {
// Mouse leave - release selection
canvas.tokens.releaseAll()
}
)
$(html).find(".apply-wounds-btn").click((event) => {
LethalFantasyUtils.applyDamage(message, event)
}) })
btn.addEventListener("mouseleave", () => canvas.tokens.releaseAll())
btn.addEventListener("click", event => LethalFantasyUtils.applyDamage(message, event))
}
} }
// Gestion du survol et du clic sur les boutons de défense // Gestion du survol et du clic sur les boutons de défense
$(html).find(".request-defense-btn").hover( for (const btn of html.querySelectorAll(".request-defense-btn")) {
function (event) { btn.addEventListener("mouseenter", () => {
// Mouse enter - select the token and pan to it const tokenId = btn.dataset.tokenId
let tokenId = $(this).data("token-id")
if (tokenId) { if (tokenId) {
let token = canvas.tokens.get(tokenId) const token = canvas.tokens.get(tokenId)
if (token) { if (token) {
token.control({ releaseOthers: true }) token.control({ releaseOthers: true })
canvas.animatePan(token.center) canvas.animatePan(token.center)
} }
} }
}, })
function (event) { btn.addEventListener("mouseleave", () => canvas.tokens.releaseAll())
// Mouse leave - release selection
canvas.tokens.releaseAll()
}
)
// Gestionnaire pour les boutons de demande de défense // Gestionnaire pour les boutons de demande de défense
$(html).find(".request-defense-btn").off("click").on("click", (event) => { btn.addEventListener("click", event => {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
const button = $(event.currentTarget) const combatantId = btn.dataset.combatantId
const combatantId = button.data("combatant-id") const tokenId = btn.dataset.tokenId
const tokenId = button.data("token-id")
// Récupérer le combattant soit du combat, soit directement du token // Récupérer le combattant soit du combat, soit directement du token
let combatant = null let combatant = null
@@ -247,9 +230,15 @@ Hooks.on(hookName, (message, html, data) => {
const weaponName = message.rolls[0]?.rollName || "weapon" const weaponName = message.rolls[0]?.rollName || "weapon"
const attackRoll = message.rolls[0]?.rollTotal || 0 const attackRoll = message.rolls[0]?.rollTotal || 0
const defenderName = combatant.name const defenderName = combatant.name
const attackWeaponId = message.rolls[0]?.rollTarget?.weapon?.id || message.rolls[0]?.rollTarget?.weapon?._id
const attackRollType = message.rolls[0]?.type const attackRollType = message.rolls[0]?.type
const attackRollKey = message.rolls[0]?.rollTarget?.rollKey const rollTargetData = message.rolls[0]?.rollTarget
// For spell/miracle attacks, rollTarget IS the spell item (serialised as its data object).
// For weapon attacks, rollTarget is a plain skill+weapon object and weapon.id is the weapon.
const isSpellMiracleAttack = attackRollType === "spell-attack" || attackRollType === "miracle-attack"
const attackWeaponId = isSpellMiracleAttack
? (rollTargetData?._id || rollTargetData?.id)
: (rollTargetData?.weapon?.id || rollTargetData?.weapon?._id)
const attackRollKey = rollTargetData?.rollKey
console.log(`[LF] request-defense-btn | attackRollType=${attackRollType} defender=${defenderName} defenderType=${combatant.actor?.type}`) console.log(`[LF] request-defense-btn | attackRollType=${attackRollType} defender=${defenderName} defenderType=${combatant.actor?.type}`)
const attackD30result = message.rolls[0]?.options?.D30result || null const attackD30result = message.rolls[0]?.options?.D30result || null
const attackD30message = message.rolls[0]?.options?.D30message || null const attackD30message = message.rolls[0]?.options?.D30message || null
@@ -265,33 +254,37 @@ Hooks.on(hookName, (message, html, data) => {
} }
// Préparer le message de demande de défense // Préparer le message de demande de défense
// Récupérer l'acteur attaquant pour vérifier le mode d'attaque // isRanged: true si le monstre était en mode ranged (via rollTarget.attackMode stocké dans le roll)
// OU si l'attaquant utilisait une arme ranged (weapon-attack avec weaponType === "ranged")
const attacker = game.actors.get(attackerId) const attacker = game.actors.get(attackerId)
const isRangedAttack = attacker?.type === "monster" && attacker.system.attackMode === "ranged" const rollTargetOptions = message.rolls[0]?.options?.rollTarget
const attackerWeapon = rollTargetOptions?.weapon
const isRangedAttack = (rollTargetOptions?.attackMode === "ranged")
|| (attacker?.type === "monster" && attacker.system.attackMode === "ranged")
|| (attackerWeapon?.system?.weaponType === "ranged")
|| (rollTargetOptions?.isRangedAttack === true)
const defenseMsg = { const defenseMsg = {
type: "requestDefense", type: "requestDefense",
attackerName: attackerName, attackerName,
attackerId: attackerId, attackerId,
defenderName: defenderName, defenderName,
weaponName: weaponName, weaponName,
attackRoll: attackRoll, attackRoll,
attackWeaponId: attackWeaponId, attackWeaponId,
attackRollType: attackRollType, attackRollType,
attackRollKey: attackRollKey, attackRollKey,
attackD30result: attackD30result, attackD30result,
attackD30message: attackD30message, attackD30message,
attackRerollContext: attackRerollContext, attackRerollContext,
combatantId: combatantId, combatantId,
tokenId: tokenId, tokenId,
isRanged: isRangedAttack isRanged: isRangedAttack
} }
// Envoyer le message socket à l'utilisateur contrôlant le combatant // Envoyer le message socket à l'utilisateur contrôlant le combatant
// Only consider active (online) users; fall back to any active GM for unowned/GM monsters. // Only consider active (online) users; fall back to any active GM for unowned/GM monsters.
let owners = game.users.filter(u => let owners = game.users.filter(u => u.active && combatant.actor.testUserPermission(u, "OWNER"))
u.active && combatant.actor.testUserPermission(u, "OWNER")
)
if (owners.length === 0) { if (owners.length === 0) {
owners = game.users.filter(u => u.active && u.isGM) owners = game.users.filter(u => u.active && u.isGM)
} }
@@ -317,10 +310,7 @@ Hooks.on(hookName, (message, html, data) => {
messageSent = true messageSent = true
} else { } else {
// Sinon, envoyer via socket // Sinon, envoyer via socket
game.socket.emit(`system.${SYSTEM.id}`, { game.socket.emit(`system.${SYSTEM.id}`, { ...defenseMsg, userId: owner.id })
...defenseMsg,
userId: owner.id
})
messageSent = true messageSent = true
} }
}) })
@@ -330,58 +320,81 @@ Hooks.on(hookName, (message, html, data) => {
ui.notifications.info(`Defense request sent to ${defenderName}'s controller`) ui.notifications.info(`Defense request sent to ${defenderName}'s controller`)
} }
}) })
}
// Gestionnaire pour les boutons de jet de dégâts (armes et résultats de combat) // Gestionnaire pour les boutons de jet de dégâts (armes et résultats de combat)
$(html).find(".damage-roll-btn, .roll-damage-btn").off("click").on("click", async (event) => { for (const btn of html.querySelectorAll(".damage-roll-btn, .roll-damage-btn")) {
btn.addEventListener("click", async event => {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
const button = $(event.currentTarget) const weaponId = btn.dataset.weaponId
const weaponId = button.data("weapon-id") const attackKey = btn.dataset.attackKey
const attackKey = button.data("attack-key") const attackerId = btn.dataset.attackerId
let attackerId = button.data("attacker-id") const defenderId = btn.dataset.defenderId
const defenderId = button.data("defender-id") const defenderTokenId = btn.dataset.defenderTokenId || null
const defenderTokenId = button.data("defender-token-id") || null const extraShieldDr = Number(btn.dataset.extraShieldDr || 0)
const extraShieldDr = Number(button.data("extra-shield-dr") || 0) const damageType = btn.dataset.damageType
const damageType = button.data("damage-type") const damageFormula = btn.dataset.damageFormula
const damageFormula = button.data("damage-formula") const damageModifier = btn.dataset.damageModifier
const damageModifier = button.data("damage-modifier") const isMonster = btn.dataset.isMonster
const isMonster = button.data("is-monster")
// Récupérer l'acteur (soit depuis le message, soit depuis attackerId) // Récupérer l'acteur (soit depuis le message, soit depuis attackerId)
let actor = attackerId ? game.actors.get(attackerId) : game.actors.get(message.rolls[0]?.actorId) const actor = attackerId ? game.actors.get(attackerId) : game.actors.get(message.rolls[0]?.actorId)
if (!actor) { if (!actor) {
ui.notifications.error("Actor not found") ui.notifications.error("Actor not found")
return return
} }
// Pour les sorts, rouler les dés de dégâts avec option bypass DR // Pour les sorts, rouler les dés de dégâts avec DR manuelle optionnelle
if (damageType === "spell" && damageFormula) { if (damageType === "spell" && damageFormula) {
const bypassArmor = await foundry.applications.api.DialogV2.confirm({ const manualDR = await foundry.applications.api.DialogV2.wait({
window: { title: "Spell Damage" }, window: { title: game.i18n.localize("LETHALFANTASY.Combat.spellDRDialogTitle") },
classes: ["lethalfantasy"], classes: ["lethalfantasy"],
content: "<p>Does this spell's damage bypass armor DR?</p>", position: { width: 320 },
yes: { label: "Yes (ignore armor)", icon: "fa-solid fa-wand-magic-sparkles" }, content: `<div style="padding:0.5rem 0">
no: { label: "No (apply armor DR)", icon: "fa-solid fa-shield" } <p style="margin-bottom:0.6rem">${game.i18n.localize("LETHALFANTASY.Combat.spellDRDialogMsg")}</p>
<div style="display:flex;align-items:center;gap:0.5rem">
<label style="font-weight:bold">${game.i18n.localize("LETHALFANTASY.Combat.spellDRLabel")}</label>
<input type="number" name="manualDr" value="0" min="0" style="width:5rem"/>
</div>
</div>`,
buttons: [
{
action: "noDR",
label: game.i18n.localize("LETHALFANTASY.Combat.spellNoDR"),
icon: "fa-solid fa-wand-magic-sparkles",
callback: () => 0
},
{
action: "applyDR",
label: game.i18n.localize("LETHALFANTASY.Combat.spellApplyDR"),
icon: "fa-solid fa-shield",
callback: (event, button) => Number(button.form?.elements?.manualDr?.value) || 0
},
{
action: "cancel",
label: game.i18n.localize("LETHALFANTASY.Combat.proceedNo"),
callback: () => "cancel"
}
],
rejectClose: false
}) })
if (manualDR === null || manualDR === "cancel") return
const rollOpts = { const rollOpts = {
type: "spell-damage", type: "spell-damage",
rollType: "spell-damage", rollType: "spell-damage",
rollName: damageFormula, rollName: damageFormula,
isDamage: true, isDamage: true,
rollData: { isDamage: true }, rollData: { isDamage: true },
bypassArmor: bypassArmor ?? false, manualDR: manualDR,
defenderId, defenderId,
defenderTokenId, defenderTokenId,
actorId: actor.id, actorId: actor.id,
actorName: actor.name, actorName: actor.name,
actorImage: actor.img actorImage: actor.img
} }
const roll = new LethalFantasyRoll(damageFormula, {}, rollOpts) await documents.LethalFantasyRoll.rollSpellDamageToMessage(damageFormula, rollOpts)
await roll.evaluate()
roll.options.rollTotal = roll.total
if (game?.dice3d) await game.dice3d.showForRoll(roll, game.user, true)
await roll.toMessage()
return return
} }
@@ -392,7 +405,7 @@ Hooks.on(hookName, (message, html, data) => {
} }
// Pour les monstres, utiliser prepareMonsterRoll // Pour les monstres, utiliser prepareMonsterRoll
if (isMonster || actor.type === "monster") { if (isMonster === "true" || actor.type === "monster") {
await actor.system.prepareMonsterRoll("monster-damage", weaponId, undefined, undefined, damageModifier) await actor.system.prepareMonsterRoll("monster-damage", weaponId, undefined, undefined, damageModifier)
return return
} }
@@ -408,25 +421,20 @@ Hooks.on(hookName, (message, html, data) => {
const rollType = damageType === "small" ? "weapon-damage-small" : "weapon-damage-medium" const rollType = damageType === "small" ? "weapon-damage-small" : "weapon-damage-medium"
await actor.prepareRoll(rollType, weaponId, undefined, defenderId, defenderTokenId, extraShieldDr) await actor.prepareRoll(rollType, weaponId, undefined, defenderId, defenderTokenId, extraShieldDr)
}) })
}
// Masquer les boutons de dommages dans les messages de résultat de combat si l'utilisateur n'est pas l'attaquant // Masquer les boutons de dommages dans les messages de résultat de combat si l'utilisateur n'est pas l'attaquant
$(html).find(".roll-damage-btn").each(function() { for (const btn of html.querySelectorAll(".roll-damage-btn")) {
const button = $(this) const attackerId = btn.dataset.attackerId
const attackerId = button.data("attacker-id")
if (attackerId) { if (attackerId) {
const attacker = game.actors.get(attackerId) const attacker = game.actors.get(attackerId)
// Masquer le bouton si l'utilisateur n'est pas GM et ne possède pas l'attaquant // Masquer le bouton si l'utilisateur n'est pas GM et ne possède pas l'attaquant
if (!game.user.isGM && !attacker?.testUserPermission(game.user, "OWNER")) { if (!game.user.isGM && !attacker?.testUserPermission(game.user, "OWNER")) {
button.hide() btn.style.display = "none"
}
} }
} }
}) })
})
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
LethalFantasyUtils.pushCombatOptions(html, options);
});
// Hook pour ajouter les données d'attaque au message de défense // Hook pour ajouter les données d'attaque au message de défense
Hooks.on("preCreateChatMessage", (message) => { Hooks.on("preCreateChatMessage", (message) => {
@@ -518,19 +526,31 @@ Hooks.on("createChatMessage", async (message) => {
}) })
} }
// Si le défenseur est un personnage qui perd, proposer Grit/Luck (seulement s'il a des points) // Reaction phase — both sides may use grit/luck/shield/mulligan before the outcome is resolved.
// Seulement si l'utilisateur actuel est le propriétaire du défenseur // After a mulligan reroll (either side), the comparison restarts so both sides can react to the new numbers.
let defenderHandledBonus = false let defenderHandledBonus = false
let attackerHandledBonus = false
let shieldReaction = null let shieldReaction = null
let shieldBlocked = false let shieldBlocked = false
const isSpellOrMiracle = attackRollType === "spell-attack" || attackRollType === "miracle-attack" const isSpellOrMiracle = attackRollType === "spell-attack" || attackRollType === "miracle-attack"
if (defender && defenseRoll < attackRoll && isPrimaryController(defender) && !isSpellOrMiracle) {
// These persist across mulligan restarts (once used they stay consumed)
const shieldData = LethalFantasyUtils.getShieldReactionData(defender) const shieldData = LethalFantasyUtils.getShieldReactionData(defender)
let canRerollDefense = LethalFantasyUtils.hasD30Reroll(defenseD30message) let canRerollDefense = LethalFantasyUtils.hasD30Reroll(defenseD30message)
let canShieldReact = !!shieldData let canShieldReact = !!shieldData
let canAdHocShield = !shieldData let canAdHocShield = !shieldData
let attackRollFinal = attackRoll
let canRerollAttack = LethalFantasyUtils.hasD30Reroll(attackD30message)
let mulliganRestart = false
while (defenseRoll < attackRoll) { do {
mulliganRestart = false
defenderHandledBonus = false
attackerHandledBonus = false
// ── Defense reaction loop ──────────────────────────────────────────────
if (defender && defenseRoll < attackRollFinal && isPrimaryController(defender) && !isSpellOrMiracle) {
while (defenseRoll < attackRollFinal) {
const currentGrit = Number(defender.system?.grit?.current) || 0 const currentGrit = Number(defender.system?.grit?.current) || 0
const currentLuck = Number(defender.system?.luck?.current) || 0 const currentLuck = Number(defender.system?.luck?.current) || 0
const buttons = [] const buttons = []
@@ -563,7 +583,7 @@ Hooks.on("createChatMessage", async (message) => {
if (canRerollDefense) { if (canRerollDefense) {
buttons.push({ buttons.push({
action: "rerollDefense", action: "rerollDefense",
label: "Re-roll defense", label: "Re-roll defense (Mulligan)",
icon: "fa-solid fa-rotate-right", icon: "fa-solid fa-rotate-right",
callback: () => "rerollDefense" callback: () => "rerollDefense"
}) })
@@ -577,7 +597,6 @@ Hooks.on("createChatMessage", async (message) => {
callback: () => "shieldReact" callback: () => "shieldReact"
}) })
} else if (canAdHocShield) { } else if (canAdHocShield) {
// No pre-configured shield — offer ad-hoc shield option (useful for monsters)
buttons.push({ buttons.push({
action: "adHocShield", action: "adHocShield",
label: "Roll ad-hoc shield (choose dice + DR)", label: "Roll ad-hoc shield (choose dice + DR)",
@@ -599,7 +618,7 @@ Hooks.on("createChatMessage", async (message) => {
content: ` content: `
<div class="grit-luck-dialog"> <div class="grit-luck-dialog">
<div class="combat-status"> <div class="combat-status">
<p><strong>${attackerName}</strong> rolled <strong>${attackRoll}</strong></p> <p><strong>${attackerName}</strong> rolled <strong>${attackRollFinal}</strong></p>
<p><strong>${defenderName}</strong> currently has <strong>${defenseRoll}</strong></p> <p><strong>${defenderName}</strong> currently has <strong>${defenseRoll}</strong></p>
${defenseD30message ? `<p class="bonus-info">D30 special: ${defenseD30message.description}</p>` : ""} ${defenseD30message ? `<p class="bonus-info">D30 special: ${defenseD30message.description}</p>` : ""}
</div> </div>
@@ -615,21 +634,21 @@ Hooks.on("createChatMessage", async (message) => {
defenderHandledBonus = true defenderHandledBonus = true
if (choice === "grit") { if (choice === "grit") {
const bonusRoll = await LethalFantasyUtils.rollBonusDie("1d6", defender, (total) => `<p><strong>${defenderName}</strong> spends 1 Grit and rolls <strong>${total}</strong> for defense.</p>`) const bonusRoll = await LethalFantasyUtils.rollBonusDie("1d6", defender, total => `<p><strong>${defenderName}</strong> spends 1 Grit and rolls <strong>${total}</strong> for defense.</p>`)
defenseRoll += bonusRoll defenseRoll += bonusRoll
await defender.update({ "system.grit.current": currentGrit - 1 }) await defender.update({ "system.grit.current": currentGrit - 1 })
continue continue
} }
if (choice === "luck") { if (choice === "luck") {
const bonusRoll = await LethalFantasyUtils.rollBonusDie("1d6", defender, (total) => `<p><strong>${defenderName}</strong> spends 1 Luck and rolls <strong>${total}</strong> for defense.</p>`) const bonusRoll = await LethalFantasyUtils.rollBonusDie("1d6", defender, total => `<p><strong>${defenderName}</strong> spends 1 Luck and rolls <strong>${total}</strong> for defense.</p>`)
defenseRoll += bonusRoll defenseRoll += bonusRoll
await defender.update({ "system.luck.current": currentLuck - 1 }) await defender.update({ "system.luck.current": currentLuck - 1 })
continue continue
} }
if (choice === "bonusDie") { if (choice === "bonusDie") {
const bonusDie = await LethalFantasyUtils.promptCombatBonusDie(defenderName, "attack", defenseRoll, attackRoll) const bonusDie = await LethalFantasyUtils.promptCombatBonusDie(defenderName, "attack", defenseRoll, attackRollFinal)
if (!bonusDie) continue if (!bonusDie) continue
const bonusRoll = await LethalFantasyUtils.rollBonusDie(bonusDie, defender, (total, formula) => `<p><strong>${defenderName}</strong> adds <strong>${formula.toUpperCase()}</strong> and rolls <strong>${total}</strong> for defense.</p>`) const bonusRoll = await LethalFantasyUtils.rollBonusDie(bonusDie, defender, (total, formula) => `<p><strong>${defenderName}</strong> adds <strong>${formula.toUpperCase()}</strong> and rolls <strong>${total}</strong> for defense.</p>`)
defenseRoll += bonusRoll defenseRoll += bonusRoll
@@ -642,8 +661,10 @@ Hooks.on("createChatMessage", async (message) => {
canRerollDefense = false canRerollDefense = false
if (!reroll) continue if (!reroll) continue
defenseRoll = reroll.options?.rollTotal || reroll.total || oldDefenseRoll defenseRoll = reroll.options?.rollTotal || reroll.total || oldDefenseRoll
await createReactionMessage(defender, `<p><strong>${defenderName}</strong> uses Mulligan and re-rolls defense: <strong>${oldDefenseRoll}</strong> → <strong>${defenseRoll}</strong>.</p>`) await createReactionMessage(defender, `<p><strong>${defenderName}</strong> uses Mulligan and re-rolls defense: <strong>${oldDefenseRoll}</strong> → <strong>${defenseRoll}</strong>. Both sides may now react to the new numbers.</p>`)
continue // Restart the full comparison so both sides can react to the new roll
mulliganRestart = true
break
} }
if (choice === "shieldReact" && canShieldReact) { if (choice === "shieldReact" && canShieldReact) {
@@ -652,7 +673,7 @@ Hooks.on("createChatMessage", async (message) => {
defenseRoll = newDefenseTotal defenseRoll = newDefenseTotal
canShieldReact = false canShieldReact = false
if (newDefenseTotal >= attackRoll) { if (newDefenseTotal >= attackRollFinal) {
shieldBlocked = true shieldBlocked = true
shieldReaction = { shieldReaction = {
damageReduction: shieldData.damageReduction, damageReduction: shieldData.damageReduction,
@@ -661,19 +682,19 @@ Hooks.on("createChatMessage", async (message) => {
} }
await createReactionMessage( await createReactionMessage(
defender, defender,
`<p><strong>${defenderName}</strong> rolls <strong>${shieldData.label}</strong> and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal}${attackRoll}). <strong>Shield blocked the attack!</strong> Both armor DR and shield DR <strong>${shieldData.damageReduction}</strong> will apply to damage.</p>` `<p><strong>${defenderName}</strong> rolls <strong>${shieldData.label}</strong> and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal}${attackRollFinal}). <strong>Shield blocked the attack!</strong> Both armor DR and shield DR <strong>${shieldData.damageReduction}</strong> will apply to damage.</p>`
) )
} else { } else {
shieldReaction = null shieldReaction = null
await createReactionMessage( await createReactionMessage(
defender, defender,
`<p><strong>${defenderName}</strong> rolls <strong>${shieldData.label}</strong> and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal} < ${attackRoll}). Shield did not block — normal hit, armor DR only.</p>` `<p><strong>${defenderName}</strong> rolls <strong>${shieldData.label}</strong> and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal} < ${attackRollFinal}). Shield did not block — normal hit, armor DR only.</p>`
) )
} }
} }
if (choice === "adHocShield") { if (choice === "adHocShield") {
const adHoc = await LethalFantasyUtils.promptAdHocShield(defenderName, attackRoll, defenseRoll) const adHoc = await LethalFantasyUtils.promptAdHocShield(defenderName, attackRollFinal, defenseRoll)
if (!adHoc) continue if (!adHoc) continue
const shieldBonus = await LethalFantasyUtils.rollBonusDie(adHoc.formula, defender) const shieldBonus = await LethalFantasyUtils.rollBonusDie(adHoc.formula, defender)
const newDefenseTotal = defenseRoll + shieldBonus const newDefenseTotal = defenseRoll + shieldBonus
@@ -681,7 +702,7 @@ Hooks.on("createChatMessage", async (message) => {
canShieldReact = false canShieldReact = false
canAdHocShield = false canAdHocShield = false
if (newDefenseTotal >= attackRoll) { if (newDefenseTotal >= attackRollFinal) {
shieldBlocked = true shieldBlocked = true
shieldReaction = { shieldReaction = {
damageReduction: adHoc.damageReduction, damageReduction: adHoc.damageReduction,
@@ -690,27 +711,23 @@ Hooks.on("createChatMessage", async (message) => {
} }
await createReactionMessage( await createReactionMessage(
defender, defender,
`<p><strong>${defenderName}</strong> rolls <strong>${adHoc.formula.toUpperCase()}</strong> shield and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal}${attackRoll}). <strong>Shield blocked the attack!</strong> Both armor DR and shield DR <strong>${adHoc.damageReduction}</strong> will apply to damage.</p>` `<p><strong>${defenderName}</strong> rolls <strong>${adHoc.formula.toUpperCase()}</strong> shield and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal}${attackRollFinal}). <strong>Shield blocked the attack!</strong> Both armor DR and shield DR <strong>${adHoc.damageReduction}</strong> will apply to damage.</p>`
) )
} else { } else {
shieldReaction = null shieldReaction = null
await createReactionMessage( await createReactionMessage(
defender, defender,
`<p><strong>${defenderName}</strong> rolls <strong>${adHoc.formula.toUpperCase()}</strong> shield and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal} < ${attackRoll}). Shield did not block — normal hit, armor DR only.</p>` `<p><strong>${defenderName}</strong> rolls <strong>${adHoc.formula.toUpperCase()}</strong> shield and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal} < ${attackRollFinal}). Shield did not block — normal hit, armor DR only.</p>`
) )
} }
} }
} }
} }
let attackRollFinal = attackRoll if (mulliganRestart) continue
let attackerHandledBonus = false
// Si l'attaquant est un personnage qui perd et a du Grit // ── Attack reaction loop ───────────────────────────────────────────────
// Seulement si l'utilisateur actuel est le propriétaire de l'attaquant (pas le MJ)
if (!defenderHandledBonus && attacker && attackRollFinal <= defenseRoll && isPrimaryController(attacker)) { if (!defenderHandledBonus && attacker && attackRollFinal <= defenseRoll && isPrimaryController(attacker)) {
let canRerollAttack = LethalFantasyUtils.hasD30Reroll(attackD30message)
while (attackRollFinal <= defenseRoll) { while (attackRollFinal <= defenseRoll) {
const currentGrit = Number(attacker.system?.grit?.current) || 0 const currentGrit = Number(attacker.system?.grit?.current) || 0
const buttons = [] const buttons = []
@@ -734,7 +751,7 @@ Hooks.on("createChatMessage", async (message) => {
if (canRerollAttack && attackRerollContext) { if (canRerollAttack && attackRerollContext) {
buttons.push({ buttons.push({
action: "rerollAttack", action: "rerollAttack",
label: "Re-roll attack", label: "Re-roll attack (Mulligan)",
icon: "fa-solid fa-rotate-right", icon: "fa-solid fa-rotate-right",
callback: () => "rerollAttack" callback: () => "rerollAttack"
}) })
@@ -769,7 +786,7 @@ Hooks.on("createChatMessage", async (message) => {
attackerHandledBonus = true attackerHandledBonus = true
if (choice === "grit") { if (choice === "grit") {
const attackBonus = await LethalFantasyUtils.rollBonusDie("1d6", attacker, (total) => `<p><strong>${attackerName}</strong> spends 1 Grit and rolls <strong>${total}</strong> for attack.</p>`) const attackBonus = await LethalFantasyUtils.rollBonusDie("1d6", attacker, total => `<p><strong>${attackerName}</strong> spends 1 Grit and rolls <strong>${total}</strong> for attack.</p>`)
attackRollFinal += attackBonus attackRollFinal += attackBonus
await attacker.update({ "system.grit.current": currentGrit - 1 }) await attacker.update({ "system.grit.current": currentGrit - 1 })
continue continue
@@ -789,10 +806,14 @@ Hooks.on("createChatMessage", async (message) => {
canRerollAttack = false canRerollAttack = false
if (!reroll) continue if (!reroll) continue
attackRollFinal = reroll.options?.rollTotal || reroll.total || oldAttackRoll attackRollFinal = reroll.options?.rollTotal || reroll.total || oldAttackRoll
await createReactionMessage(attacker, `<p><strong>${attackerName}</strong> uses Mulligan and re-rolls attack: <strong>${oldAttackRoll}</strong> → <strong>${attackRollFinal}</strong>.</p>`) await createReactionMessage(attacker, `<p><strong>${attackerName}</strong> uses Mulligan and re-rolls attack: <strong>${oldAttackRoll}</strong> → <strong>${attackRollFinal}</strong>. Both sides may now react to the new numbers.</p>`)
// Restart the full comparison so both sides can react to the new roll
mulliganRestart = true
break
} }
} }
} }
} while (mulliganRestart)
const shieldDamageReduction = shieldBlocked ? shieldReaction.damageReduction : 0 const shieldDamageReduction = shieldBlocked ? shieldReaction.damageReduction : 0
const outcome = shieldBlocked ? "shielded-hit" : (attackRollFinal > defenseRoll ? "hit" : "miss") const outcome = shieldBlocked ? "shielded-hit" : (attackRollFinal > defenseRoll ? "hit" : "miss")
@@ -823,6 +844,73 @@ Hooks.on("createChatMessage", async (message) => {
} }
}) })
// Hook: deduct aether when a spell-attack or spell-power roll is posted to chat
Hooks.on("createChatMessage", async (message) => {
if (!["spell-attack", "spell-power"].includes(message.rolls[0]?.options?.rollType)) return
const actorId = message.rolls[0]?.options?.actorId
if (!actorId) return
const actor = game.actors.get(actorId)
if (!actor) return
// Only the primary controller (player owner or GM) handles this
const activePlayerOwners = game.users.filter(u => u.active && !u.isGM && actor.testUserPermission(u, "OWNER"))
const isPrimary = activePlayerOwners.length > 0
? activePlayerOwners[0].id === game.user.id
: game.user.isGM
if (!isPrimary) return
const rollTarget = message.rolls[0]?.options?.rollTarget
const spellId = rollTarget?.id || rollTarget?._id
const spell = spellId ? actor.items.get(spellId) : null
if (!spell || spell.type !== "spell") return
const cost = Number(spell.system?.cost) || 0
if (cost <= 0) return
const currentAether = Number(actor.system.aetherPoints?.value) || 0
const newAether = Math.max(0, currentAether - cost)
await actor.update({ "system.aetherPoints.value": newAether })
await ChatMessage.create({
content: `<p>🔮 <strong>${actor.name}</strong> casts <em>${spell.name}</em> — spends <strong>${cost}</strong> Aether <span style="color:#888;">(${currentAether}${newAether})</span>.</p>`,
speaker: ChatMessage.getSpeaker({ actor })
})
})
// Hook: deduct grace when a miracle-attack or miracle-power roll is posted to chat
Hooks.on("createChatMessage", async (message) => {
if (!["miracle-attack", "miracle-power"].includes(message.rolls[0]?.options?.rollType)) return
const actorId = message.rolls[0]?.options?.actorId
if (!actorId) return
const actor = game.actors.get(actorId)
if (!actor) return
const activePlayerOwners = game.users.filter(u => u.active && !u.isGM && actor.testUserPermission(u, "OWNER"))
const isPrimary = activePlayerOwners.length > 0
? activePlayerOwners[0].id === game.user.id
: game.user.isGM
if (!isPrimary) return
const rollTarget = message.rolls[0]?.options?.rollTarget
const miracleId = rollTarget?.id || rollTarget?._id
const miracle = miracleId ? actor.items.get(miracleId) : null
if (!miracle || miracle.type !== "miracle") return
const cost = Number(miracle.system?.level) || 0
if (cost <= 0) return
const currentGrace = Number(actor.system.divinityPoints?.value) || 0
const newGrace = Math.max(0, currentGrace - cost)
await actor.update({ "system.divinityPoints.value": newGrace })
await ChatMessage.create({
content: `<p>✨ <strong>${actor.name}</strong> invokes <em>${miracle.name}</em> — spends <strong>${cost}</strong> Grace <span style="color:#888;">(${currentGrace}${newGrace})</span>.</p>`,
speaker: ChatMessage.getSpeaker({ actor })
})
})
// Hook pour appliquer automatiquement les dégâts si une cible est définie // Hook pour appliquer automatiquement les dégâts si une cible est définie
Hooks.on("createChatMessage", async (message) => { Hooks.on("createChatMessage", async (message) => {
// Vérifier si c'est un message de dégâts avec un defenderId // Vérifier si c'est un message de dégâts avec un defenderId
@@ -876,12 +964,14 @@ Hooks.on("createChatMessage", async (message) => {
const damageTotal = message.rolls[0]?.options?.rollTotal || message.rolls[0]?.total || 0 const damageTotal = message.rolls[0]?.options?.rollTotal || message.rolls[0]?.total || 0
const weaponName = message.rolls[0]?.options?.rollName || "Unknown Weapon" const weaponName = message.rolls[0]?.options?.rollName || "Unknown Weapon"
const attackerName = message.rolls[0]?.options?.actorName || "Unknown Attacker" const attackerName = message.rolls[0]?.options?.actorName || "Unknown Attacker"
const rollType = message.rolls[0]?.options?.rollType
// Calculer les DR // Calculer les DR — les sorts utilisent une DR manuelle saisie par l'utilisateur
const bypassArmor = message.rolls[0]?.options?.bypassArmor || false const isSpellDamage = rollType === "spell-damage"
const armorDR = bypassArmor ? 0 : (defender.computeDamageReduction() || 0) const manualDR = message.rolls[0]?.options?.manualDR ?? 0
const extraShieldDr = Number(message.rolls[0]?.options?.extraShieldDr) || 0 const extraShieldDr = Number(message.rolls[0]?.options?.extraShieldDr) || 0
const totalDR = armorDR + extraShieldDr const armorDR = isSpellDamage ? manualDR : (defender.computeDamageReduction() || 0)
const totalDR = isSpellDamage ? manualDR : armorDR + extraShieldDr
const finalDamage = Math.max(0, damageTotal - totalDR) const finalDamage = Math.max(0, damageTotal - totalDR)
// Prefer the token ID stored in roll options (set at attack time when the exact token is known). // Prefer the token ID stored in roll options (set at attack time when the exact token is known).
@@ -914,7 +1004,9 @@ Hooks.on("createChatMessage", async (message) => {
{ {
targetName: defender.name, targetName: defender.name,
damage: finalDamage, damage: finalDamage,
drText: bypassArmor ? "Armor DR bypassed (spell)" : (totalDR > 0 ? `Armor DR: ${armorDR}${extraShieldDr > 0 ? ` + Shield DR: ${extraShieldDr}` : ""}` : ""), drText: isSpellDamage
? (manualDR > 0 ? `Spell DR: ${manualDR}` : "No DR applied")
: (totalDR > 0 ? `Armor DR: ${armorDR}${extraShieldDr > 0 ? ` + Shield DR: ${extraShieldDr}` : ""}` : ""),
weaponName: weaponName, weaponName: weaponName,
attackerName: attackerName, attackerName: attackerName,
rawDamage: damageTotal rawDamage: damageTotal
+56 -10
View File
@@ -18,6 +18,7 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
actions: { actions: {
initiativePlus: LethalFantasyCombatTracker.#initiativePlus, initiativePlus: LethalFantasyCombatTracker.#initiativePlus,
initiativeMinus: LethalFantasyCombatTracker.#initiativeMinus, initiativeMinus: LethalFantasyCombatTracker.#initiativeMinus,
rollMonsterProgression: LethalFantasyCombatTracker.#rollMonsterProgression,
}, },
}); });
@@ -49,6 +50,15 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
c.update({ 'initiative': newInit }); c.update({ 'initiative': newInit });
} }
/**
* Roll progression dice for all monster combatants that are eligible this round.
* @param {Event} ev Click event.
*/
static async #rollMonsterProgression(ev) {
ev.preventDefault();
await game.combat.rollMonsterProgression();
}
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
// Display Combat settings // Display Combat settings
@@ -109,18 +119,12 @@ export class LethalFantasyCombat extends Combat {
} }
async rollInitiative(ids, options) { async rollInitiative(ids, options) {
console.log("%%%%%%%%% Roll Initiative", ids, options);
ids = typeof ids === "string" ? [ids] : ids; ids = typeof ids === "string" ? [ids] : ids;
let messages = [];
let rollMode = game.settings.get("core", "rollMode");
let updates = [];
for (let cId of ids) { for (let cId of ids) {
const c = this.combatants.get(cId); const c = this.combatants.get(cId);
const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id); const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
if (game.user.isGM && playerOwner) { if (game.user.isGM && playerOwner) {
console.log("Rolling initiative for", c.actor.name);
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollInitiative", userId: playerOwner.id, actorId: c.actor.id, combatId: this.id, combatantId: c.id }); game.socket.emit(`system.${SYSTEM.id}`, { type: "rollInitiative", userId: playerOwner.id, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
} else { } else {
await c.actor.system.rollInitiative(this.id, c.id); await c.actor.system.rollInitiative(this.id, c.id);
@@ -130,6 +134,36 @@ export class LethalFantasyCombat extends Combat {
return this; return this;
} }
/** Roll progression dice for all eligible monster combatants this round. Called manually by the GM. */
async rollMonsterProgression() {
const currentRound = this.round;
const monsters = this.combatants.filter(c => c.actor?.type === "monster" && !c.isDefeated);
if (monsters.length === 0) {
ui.notifications.warn("No monsters in combat.");
return;
}
let rolled = 0;
for (let c of monsters) {
if (c.initiative !== null && currentRound >= c.initiative) {
await c.actor.system.rollProgressionDice(this.id, c.id);
rolled++;
}
}
if (rolled === 0) {
const earliest = monsters.reduce((min, c) => (c.initiative !== null && c.initiative < min) ? c.initiative : min, Infinity);
if (earliest === Infinity) {
ui.notifications.warn("Monsters have no initiative set. Roll initiative first.");
} else {
ui.notifications.info(`No monsters act yet — earliest monster initiative is ${earliest} (current round: ${currentRound}).`);
}
} else {
this._monsterProgressionRolledRound = currentRound;
}
}
resetProgression(cId) { resetProgression(cId) {
let c = this.combatants.get(cId); let c = this.combatants.get(cId);
c.update({ 'system.progressionCount': 0 }); c.update({ 'system.progressionCount': 0 });
@@ -151,15 +185,12 @@ export class LethalFantasyCombat extends Combat {
} }
async nextTurn() { async nextTurn() {
console.log("NEXT TURN");
let turn = this.turn ?? -1; let turn = this.turn ?? -1;
let skipDefeated = this.settings.skipDefeated; let skipDefeated = this.settings.skipDefeated;
// Determine the next turn number // Determine the next turn number
let next = null; let next = null;
for (let [i, t] of this.turns.entries()) { for (let [i, t] of this.turns.entries()) {
console.log("Turn", t);
if (i <= turn) continue; if (i <= turn) continue;
if (skipDefeated && t.isDefeated) continue; if (skipDefeated && t.isDefeated) continue;
next = i; next = i;
@@ -183,7 +214,6 @@ export class LethalFantasyCombat extends Combat {
this.turnsDone = false this.turnsDone = false
let turn = this.turn === null ? null : 0; // Preserve the fact that it's no-one's turn currently. let turn = this.turn === null ? null : 0; // Preserve the fact that it's no-one's turn currently.
console.log("ROUND", this);
let advanceTime = Math.max(this.turns.length - this.turn, 0) * CONFIG.time.turnTime; let advanceTime = Math.max(this.turns.length - this.turn, 0) * CONFIG.time.turnTime;
advanceTime += CONFIG.time.roundTime; advanceTime += CONFIG.time.roundTime;
@@ -201,8 +231,24 @@ export class LethalFantasyCombat extends Combat {
return this; return this;
} }
// Warn if eligible monsters have not rolled progression dice this round
const eligibleMonsters = this.combatants.filter(
c => c.actor?.type === "monster" && !c.isDefeated && c.initiative !== null && this.round >= c.initiative
);
if (eligibleMonsters.length > 0 && this._monsterProgressionRolledRound !== this.round) {
const proceed = await foundry.applications.api.DialogV2.confirm({
window: { title: game.i18n.localize("LETHALFANTASY.Combat.monstersNotRolledTitle") },
content: `<p>${game.i18n.localize("LETHALFANTASY.Combat.monstersNotRolledMsg")}</p>`,
yes: { label: game.i18n.localize("LETHALFANTASY.Combat.proceedYes") },
no: { label: game.i18n.localize("LETHALFANTASY.Combat.proceedNo") },
rejectClose: false,
});
if (!proceed) return this;
}
for (let c of this.combatants) { for (let c of this.combatants) {
if (nextRound >= c.initiative) { if (nextRound >= c.initiative) {
if (c.actor.type === "monster") continue; // Monsters roll manually via the "Roll Monsters" button
const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id); const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
if (game.user.isGM && playerOwner) { if (game.user.isGM && playerOwner) {
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", userId: playerOwner.id, progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id }); game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", userId: playerOwner.id, progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
+4 -1
View File
@@ -142,11 +142,14 @@ export async function rollFreeDie(dieType, count = 1, explode = false) {
` `
const rollMode = game.settings.get("core", "rollMode") const rollMode = game.settings.get("core", "rollMode")
// Normalize old-style rollMode keys (v12/v13) to new-style (v14), fallback to "public"
const modeMap = { publicroll: "public", gmroll: "gm", blindroll: "blind", selfroll: "self" }
const mode = modeMap[rollMode] ?? rollMode ?? "public"
const msgData = { const msgData = {
speaker: ChatMessage.getSpeaker(), speaker: ChatMessage.getSpeaker(),
content, content,
sound: CONFIG.sounds.dice, sound: CONFIG.sounds.dice,
mode,
} }
ChatMessage.applyRollMode(msgData, rollMode)
await ChatMessage.create(msgData) await ChatMessage.create(msgData)
} }
+78 -6
View File
@@ -22,6 +22,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
divinityPointsMinus: LethalFantasyCharacterSheet.#onDivinityPointsMinus, divinityPointsMinus: LethalFantasyCharacterSheet.#onDivinityPointsMinus,
aetherPointsPlus: LethalFantasyCharacterSheet.#onAetherPointsPlus, aetherPointsPlus: LethalFantasyCharacterSheet.#onAetherPointsPlus,
aetherPointsMinus: LethalFantasyCharacterSheet.#onAetherPointsMinus, aetherPointsMinus: LethalFantasyCharacterSheet.#onAetherPointsMinus,
rollSpellDamage: LethalFantasyCharacterSheet.#onRollSpellDamage,
}, },
} }
@@ -70,10 +71,10 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "LETHALFANTASY.Label.biography" }, biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "LETHALFANTASY.Label.biography" },
} }
if (this.actor.system.biodata.magicUser) { if (this.actor.system.biodata.magicUser) {
tabs.spells = { id: "spells", group: "sheet", icon: "fa-sharp-duotone fa-solid fa-wand-magic-sparkles", label: "LETHALFANTASY.Label.spells" } tabs.spells = { id: "spells", group: "sheet", icon: "fa-solid fa-wand-magic-sparkles", label: "LETHALFANTASY.Label.spells" }
} }
if (this.actor.system.biodata.clericUser) { if (this.actor.system.biodata.clericUser) {
tabs.miracles = { id: "miracles", group: "sheet", icon: "fa-sharp-duotone fa-solid fa-hands-praying", label: "LETHALFANTASY.Label.miracles" } tabs.miracles = { id: "miracles", group: "sheet", icon: "fa-solid fa-hands-praying", label: "LETHALFANTASY.Label.miracles" }
} }
for (const v of Object.values(tabs)) { for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] === v.id v.active = this.tabGroups[v.group] === v.id
@@ -172,7 +173,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
}) })
if (!roll) return null if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { messageMode: roll.options.rollMode })
} }
static async #onRollInitiative(event, target) { static async #onRollInitiative(event, target) {
@@ -219,6 +220,75 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
this.actor.update({ "system.aetherPoints.value": points }) this.actor.update({ "system.aetherPoints.value": points })
} }
/**
* Handles spell damage roll from the spell sheet tab.
* Shows a DR dialog then rolls the appropriate damage formula.
* @param {PointerEvent} event
* @param {HTMLElement} target
*/
static async #onRollSpellDamage(event, target) {
if (this.isEditMode) return
const itemId = target.dataset.itemId
const tier = target.dataset.damageTier
const spell = this.actor.items.get(itemId)
if (!spell) return
const formulaMap = {
standard: spell.system.damageDice,
overpowered: spell.system.damageDiceOverpowered,
overpowered2: spell.system.damageDiceOverpowered2,
}
const formula = formulaMap[tier]
if (!formula) return
const manualDR = await foundry.applications.api.DialogV2.wait({
window: { title: game.i18n.localize("LETHALFANTASY.Combat.spellDRDialogTitle") },
classes: ["lethalfantasy"],
position: { width: 320 },
content: `<div style="padding:0.5rem 0">
<p style="margin-bottom:0.6rem">${game.i18n.localize("LETHALFANTASY.Combat.spellDRDialogMsg")}</p>
<div style="display:flex;align-items:center;gap:0.5rem">
<label style="font-weight:bold">${game.i18n.localize("LETHALFANTASY.Combat.spellDRLabel")}</label>
<input type="number" name="manualDr" value="0" min="0" style="width:5rem"/>
</div>
</div>`,
buttons: [
{
action: "noDR",
label: game.i18n.localize("LETHALFANTASY.Combat.spellNoDR"),
icon: "fa-solid fa-wand-magic-sparkles",
callback: () => 0
},
{
action: "applyDR",
label: game.i18n.localize("LETHALFANTASY.Combat.spellApplyDR"),
icon: "fa-solid fa-shield",
callback: (event, button) => Number(button.form?.elements?.manualDr?.value) || 0
},
{
action: "cancel",
label: game.i18n.localize("LETHALFANTASY.Combat.proceedNo"),
callback: () => "cancel"
}
],
rejectClose: false
})
if (manualDR === null || manualDR === "cancel") return
const rollOpts = {
type: "spell-damage",
rollType: "spell-damage",
rollName: `${spell.name}${formula}`,
isDamage: true,
rollData: { isDamage: true },
manualDR,
actorId: this.actor.id,
actorName: this.actor.name,
actorImage: this.actor.img
}
await LethalFantasyRoll.rollSpellDamageToMessage(formula, rollOpts)
}
static #onCreateEquipment(event, target) { static #onCreateEquipment(event, target) {
} }
@@ -259,9 +329,11 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
async _onRoll(event, target) { async _onRoll(event, target) {
if (this.isEditMode) return if (this.isEditMode) return
const rollType = event.target.dataset.rollType const el = event.currentTarget
let rollKey = event.target.dataset.rollKey; const rollType = el.dataset.rollType
let rollDice = event.target.dataset?.rollDice; if (!rollType) return
let rollKey = el.dataset.rollKey
let rollDice = el.dataset.rollDice
this.actor.prepareRoll(rollType, rollKey, rollDice) this.actor.prepareRoll(rollType, rollKey, rollDice)
+4 -2
View File
@@ -111,11 +111,13 @@ export default class LethalFantasyMonsterSheet extends LethalFantasyActorSheet {
}) })
if (!roll) return null if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { messageMode: roll.options.rollMode })
} }
static async #onRollInitiative(event, target) { static async #onRollInitiative(event, target) {
await this.document.system.rollInitiative(event, target) const combat = game.combat
const combatant = combat?.combatants.find(c => c.actorId === this.document.id)
await this.document.system.rollInitiative(combat?.id, combatant?.id)
} }
getBestWeaponClassSkill(skills, rollType, multiplier = 1.0) { getBestWeaponClassSkill(skills, rollType, multiplier = 1.0) {
+55 -1
View File
@@ -108,6 +108,10 @@
} }
], ],
"description": "Possible Flawless or Legendary Defense or Add D20E to Defense" "description": "Possible Flawless or Legendary Defense or Add D20E to Defense"
},
"saving_throws": {
"type": "save_auto_success",
"description": "Saving Throw Succeeds Regardless of Opposing Roll"
} }
}, },
"29": { "29": {
@@ -145,6 +149,11 @@
"type": "gain_grit", "type": "gain_grit",
"amount": 1, "amount": 1,
"description": "Gain 1 Grit" "description": "Gain 1 Grit"
},
"saving_throws": {
"type": "gain_grit",
"amount": 1,
"description": "Gain 1 Grit"
} }
}, },
"28": { "28": {
@@ -199,6 +208,12 @@
"amount": 1, "amount": 1,
"target": "skill", "target": "skill",
"description": "Add 1 to Skill Roll" "description": "Add 1 to Skill Roll"
},
"saving_throws": {
"type": "bonus_flat",
"amount": 1,
"target": "save",
"description": "Add 1 to Saving Throw"
} }
}, },
"21": { "21": {
@@ -239,6 +254,12 @@
"ranged_defense": { "ranged_defense": {
"type": "recover_pain", "type": "recover_pain",
"description": "Defender Recovers or ignores any flash of pain" "description": "Defender Recovers or ignores any flash of pain"
},
"saving_throws": {
"type": "bonus_dice",
"dice": "D6",
"target": "save",
"description": "Granted D6 (1-6) Saving Throw Modifier for this Saving Throw Attempt"
} }
}, },
"20": { "20": {
@@ -349,6 +370,12 @@
} }
], ],
"description": "Possible 20/20 defense that avoids Any Attack Except a Lethal Strike or adds D12 to defense" "description": "Possible 20/20 defense that avoids Any Attack Except a Lethal Strike or adds D12 to defense"
},
"saving_throws": {
"type": "bonus_flat",
"amount": 20,
"target": "save",
"description": "20 Added to Saving Throw"
} }
}, },
"15": { "15": {
@@ -391,6 +418,12 @@
"shield_bash" "shield_bash"
], ],
"description": "Kick, Punch or Shield Bash" "description": "Kick, Punch or Shield Bash"
},
"saving_throws": {
"type": "bonus_flat",
"amount": 1,
"target": "save",
"description": "Add 1 to Saving Throw"
} }
}, },
"13": {}, "13": {},
@@ -445,6 +478,12 @@
"shield_bash" "shield_bash"
], ],
"description": "Kick, Punch or Shield Bash" "description": "Kick, Punch or Shield Bash"
},
"saving_throws": {
"type": "bonus_flat",
"amount": 1,
"target": "save",
"description": "Add 1 to Saving Throw"
} }
}, },
"8": { "8": {
@@ -475,6 +514,10 @@
"ranged_defense": { "ranged_defense": {
"type": "mulligan", "type": "mulligan",
"description": "Mulligan, Can Choose to Re-Roll This Defense" "description": "Mulligan, Can Choose to Re-Roll This Defense"
},
"saving_throws": {
"type": "mulligan",
"description": "Mulligan, Can Re-Roll This Saving Throw"
} }
}, },
"7": { "7": {
@@ -528,6 +571,12 @@
"shield_bash" "shield_bash"
], ],
"description": "Kick, Punch, or Shield Bash" "description": "Kick, Punch, or Shield Bash"
},
"saving_throws": {
"type": "bonus_flat",
"amount": 1,
"target": "save",
"description": "Add 1 to Saving Throw"
} }
}, },
"3": { "3": {
@@ -608,7 +657,12 @@
}, },
"arcane_spell_attack": { "arcane_spell_attack": {
"type": "spell_calamity", "type": "spell_calamity",
"description": "Possible Spell Calamity or Catastrophe" "description": "A possible spell calamity has occurred"
},
"melee_attack": {
"type": "fumble",
"detail": "melee_fumble",
"description": "Possible Fumble"
} }
} }
}, },
+9 -1
View File
@@ -85,11 +85,18 @@ export const RANGE_CHOICES = {
"pointblank": { label: "Point Blank (Special)", value: "pointblank" }, "pointblank": { label: "Point Blank (Special)", value: "pointblank" },
"short": { label: "Short (+0)", value: "0" }, "short": { label: "Short (+0)", value: "0" },
"medium": { label: "Medium (Red +5)", value: "+5" }, "medium": { label: "Medium (Red +5)", value: "+5" },
"long": { label: "Long (Purle +7)", value: "+7" }, "long": { label: "Long (Purple +7)", value: "+7" },
"extreme": { label: "Extreme (Grey +9)", value: "+9" }, "extreme": { label: "Extreme (Grey +9)", value: "+9" },
"beyondskill": { label: "Beyond Skill (Blue +11)", value: "beyondskill" } "beyondskill": { label: "Beyond Skill (Blue +11)", value: "beyondskill" }
} }
export const ATTACKER_MOVEMENT_CHOICES = {
"none": { label: "None / Stationary (D20E Favor)", favor: true, value: "2D20kh" },
"walk": { label: "Walk (D20E)", value: "D20" },
"incombat": { label: "In Combat (D20E)", value: "D20" },
"run": { label: "Jog/Run/Sprint (D20E Disfavor)", disfavor: true, value: "2D20kl" }
}
export const ATTACKER_AIM_CHOICES = { export const ATTACKER_AIM_CHOICES = {
"simple": { label: "Simple (+0)", value: "0" }, "simple": { label: "Simple (+0)", value: "0" },
"careful": { label: "Careful (Red +5)", value: "+4" }, "careful": { label: "Careful (Red +5)", value: "+4" },
@@ -321,6 +328,7 @@ export const SYSTEM = {
RANGE_CHOICES, RANGE_CHOICES,
FAVOR_CHOICES, FAVOR_CHOICES,
ATTACKER_AIM_CHOICES, ATTACKER_AIM_CHOICES,
ATTACKER_MOVEMENT_CHOICES,
MORTAL_CHOICES, MORTAL_CHOICES,
SPELL_CRITICAL, SPELL_CRITICAL,
MIRACLE_TYPES, MIRACLE_TYPES,
+19 -2
View File
@@ -198,6 +198,22 @@ export default class LethalFantasyActor extends Actor {
case "miracle-power": case "miracle-power":
rollTarget = this.items.find((i) => (i.type === "miracle" || i.type == "spell") && i.id === rollKey) rollTarget = this.items.find((i) => (i.type === "miracle" || i.type == "spell") && i.id === rollKey)
rollTarget.rollKey = rollKey rollTarget.rollKey = rollKey
if (rollType === "spell-attack" || rollType === "spell-power") {
const cost = Number(rollTarget.system?.cost) || 0
const currentAether = Number(this.system.aetherPoints?.value) || 0
if (cost > currentAether) {
ui.notifications.warn(`${this.name} cannot cast ${rollTarget.name}: insufficient Aether (needs ${cost}, has ${currentAether}).`)
return
}
}
if (rollType === "miracle-attack" || rollType === "miracle-power") {
const cost = Number(rollTarget.system?.level) || 0
const currentGrace = Number(this.system.divinityPoints?.value) || 0
if (cost > currentGrace) {
ui.notifications.warn(`${this.name} cannot invoke ${rollTarget.name}: insufficient Grace (needs ${cost}, has ${currentGrace}).`)
return
}
}
break break
case "shield-roll": { case "shield-roll": {
rollTarget = this.items.find((i) => i.type === "shield" && i.id === rollKey) rollTarget = this.items.find((i) => i.type === "shield" && i.id === rollKey)
@@ -245,7 +261,8 @@ export default class LethalFantasyActor extends Actor {
weapon: weapon, weapon: weapon,
weaponSkillModifier: skill.weaponSkillModifier, weaponSkillModifier: skill.weaponSkillModifier,
rollKey: rollKey, rollKey: rollKey,
combat: foundry.utils.duplicate(this.system.combat) combat: foundry.utils.duplicate(this.system.combat),
isRangedAttack: weapon.system.weaponType === "ranged"
} }
if (rollType === "weapon-damage-small" || rollType === "weapon-damage-medium") { if (rollType === "weapon-damage-small" || rollType === "weapon-damage-medium") {
rollTarget.grantedDice = this.system.granted.damageDice rollTarget.grantedDice = this.system.granted.damageDice
@@ -263,7 +280,7 @@ export default class LethalFantasyActor extends Actor {
break break
default: default:
ui.notifications.error(game.i18n.localize("LETHALFANTASY.Notifications.rollTypeNotFound") + String(rollType)) ui.notifications.error(game.i18n.localize("LETHALFANTASY.Notifications.rollTypeNotFound") + String(rollType))
break return
} }
// In all cases // In all cases
+12 -8
View File
@@ -25,7 +25,8 @@ export default class D30Roll {
RANGED_DEFENSE: "ranged_defense", RANGED_DEFENSE: "ranged_defense",
ARCANE_SPELL_ATTACK: "arcane_spell_attack", ARCANE_SPELL_ATTACK: "arcane_spell_attack",
ARCANE_SPELL_DEFENSE: "arcane_spell_defense", ARCANE_SPELL_DEFENSE: "arcane_spell_defense",
SKILL_ROLLS: "skill_rolls" SKILL_ROLLS: "skill_rolls",
SAVING_THROWS: "saving_throws"
} }
/** /**
@@ -111,17 +112,16 @@ export default class D30Roll {
if (externalType === "weapon-attack") { if (externalType === "weapon-attack") {
if (!weapon) { if (!weapon) {
console.warn("D30Roll | Weapon object required for weapon-attack type") console.warn("D30Roll | Weapon object required for weapon-attack type")
return this.ROLL_TYPES.MELEE_ATTACK // Default to melee // Fall through to use options.isRanged if available, otherwise default melee
} }
return weapon.system?.weaponType === "ranged" return (options.isRanged || weapon?.system?.weaponType === "ranged")
? this.ROLL_TYPES.RANGED_ATTACK ? this.ROLL_TYPES.RANGED_ATTACK
: this.ROLL_TYPES.MELEE_ATTACK : this.ROLL_TYPES.MELEE_ATTACK
} }
// Monster attacks - default to melee // Monster attacks - check options.isRanged (set from rollTarget.attackMode) or weapon type
if (externalType === "monster-attack") { if (externalType === "monster-attack") {
// Check if weapon object has range information if (options.isRanged || weapon?.system?.weaponType === "ranged") {
if (weapon?.system?.weaponType === "ranged") {
return this.ROLL_TYPES.RANGED_ATTACK return this.ROLL_TYPES.RANGED_ATTACK
} }
return this.ROLL_TYPES.MELEE_ATTACK return this.ROLL_TYPES.MELEE_ATTACK
@@ -138,11 +138,15 @@ export default class D30Roll {
} }
// Skill types // Skill types
if (externalType === "skill" || externalType === "monster-skill" || if (externalType === "skill" || externalType === "monster-skill" || externalType === "challenge") {
externalType === "save" || externalType === "challenge") {
return this.ROLL_TYPES.SKILL_ROLLS return this.ROLL_TYPES.SKILL_ROLLS
} }
// Saving throw types
if (externalType === "save") {
return options.isSpellSave ? this.ROLL_TYPES.ARCANE_SPELL_DEFENSE : this.ROLL_TYPES.SAVING_THROWS
}
// If no match, return null // If no match, return null
console.warn(`D30Roll | Unknown external roll type: ${externalType}`) console.warn(`D30Roll | Unknown external roll type: ${externalType}`)
return null return null
+251 -30
View File
@@ -237,6 +237,7 @@ export default class LethalFantasyRoll extends Roll {
baseFormula = "D20" baseFormula = "D20"
hasModifier = true hasModifier = true
hasChangeDice = false hasChangeDice = false
hasFavor = true
options.rollTarget.value = options.rollTarget.actorModifiers.levelSpellModifier + options.rollTarget.actorModifiers.intSpellModifier options.rollTarget.value = options.rollTarget.actorModifiers.levelSpellModifier + options.rollTarget.actorModifiers.intSpellModifier
options.rollTarget.charModifier = options.rollTarget.actorModifiers.intSpellModifier options.rollTarget.charModifier = options.rollTarget.actorModifiers.intSpellModifier
hasStaticModifier = options.rollType === "spell-power" hasStaticModifier = options.rollType === "spell-power"
@@ -253,6 +254,7 @@ export default class LethalFantasyRoll extends Roll {
dice = "1D20" dice = "1D20"
baseFormula = "D20" baseFormula = "D20"
hasChangeDice = false hasChangeDice = false
hasFavor = true
options.rollTarget.value = options.rollTarget.actorModifiers.levelMiracleModifier + options.rollTarget.actorModifiers.chaMiracleModifier options.rollTarget.value = options.rollTarget.actorModifiers.levelMiracleModifier + options.rollTarget.actorModifiers.chaMiracleModifier
options.rollTarget.charModifier = options.rollTarget.actorModifiers.chaMiracleModifier options.rollTarget.charModifier = options.rollTarget.actorModifiers.chaMiracleModifier
hasStaticModifier = options.rollType === "miracle-power" hasStaticModifier = options.rollType === "miracle-power"
@@ -272,6 +274,7 @@ export default class LethalFantasyRoll extends Roll {
hasChangeDice = false hasChangeDice = false
hasMaxValue = false hasMaxValue = false
hasExplode = false hasExplode = false
hasFavor = true
options.rollTarget.value = 0 options.rollTarget.value = 0
} else if (options.rollType.includes("weapon-damage")) { } else if (options.rollType.includes("weapon-damage")) {
@@ -319,8 +322,8 @@ export default class LethalFantasyRoll extends Roll {
hasModifier = false hasModifier = false
} }
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)])) const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes);
console.log("Roll mode", rollModes)
const fieldRollMode = new foundry.data.fields.StringField({ const fieldRollMode = new foundry.data.fields.StringField({
choices: rollModes, choices: rollModes,
@@ -335,6 +338,10 @@ export default class LethalFantasyRoll extends Roll {
let modifier = "+0" let modifier = "+0"
let targetName let targetName
// True for any ranged attack: PC weapon (ranged type) or monster attack (ranged mode)
const isRangedAttack = (options.rollType === "weapon-attack" && options.rollTarget?.weapon?.system?.weaponType === "ranged")
|| (options.rollType === "monster-attack" && options.rollTarget?.attackMode === "ranged")
let dialogContext = { let dialogContext = {
rollType: options.rollType, rollType: options.rollType,
rollTarget: options.rollTarget, rollTarget: options.rollTarget,
@@ -359,7 +366,8 @@ export default class LethalFantasyRoll extends Roll {
modifier, modifier,
saveSpell: false, saveSpell: false,
favor: "none", favor: "none",
targetName targetName,
isRangedAttack
} }
let rollContext let rollContext
if (options.rollContext) { if (options.rollContext) {
@@ -369,7 +377,9 @@ export default class LethalFantasyRoll extends Roll {
beyondSkill = !!rollContext.beyondSkill beyondSkill = !!rollContext.beyondSkill
letItFly = !!rollContext.letItFly letItFly = !!rollContext.letItFly
saveSpell = !!rollContext.saveSpell saveSpell = !!rollContext.saveSpell
rollContext.visibility ||= rollContext.rollMode || game.settings.get("core", "rollMode") const _rawMode = rollContext.rollMode || game.settings.get("core", "rollMode")
const _modeMap = { publicroll: "public", gmroll: "gm", blindroll: "blind", selfroll: "self" }
rollContext.visibility ||= _modeMap[_rawMode] ?? _rawMode ?? "public"
rollContext.modifier ||= modifier rollContext.modifier ||= modifier
rollContext.favor ||= "none" rollContext.favor ||= "none"
rollContext.changeDice ||= `${dice}` rollContext.changeDice ||= `${dice}`
@@ -389,7 +399,7 @@ export default class LethalFantasyRoll extends Roll {
label: label, label: label,
callback: (event, button, dialog) => { callback: (event, button, dialog) => {
console.log("Roll context", event, button, dialog) console.log("Roll context", event, button, dialog)
let position = dialog.position let position = dialog?.position
game.user.setFlag(SYSTEM.id, "roll-dialog-pos", foundry.utils.duplicate(position)) game.user.setFlag(SYSTEM.id, "roll-dialog-pos", foundry.utils.duplicate(position))
const output = Array.from(button.form.elements).reduce((obj, input) => { const output = Array.from(button.form.elements).reduce((obj, input) => {
if (input.name) obj[input.name] = input.value if (input.name) obj[input.name] = input.value
@@ -400,22 +410,22 @@ export default class LethalFantasyRoll extends Roll {
}, },
], ],
actions: { actions: {
"selectGranted": (event, button, dialog) => { "selectGranted": (event, button) => {
hasGrantedDice = event.target.checked hasGrantedDice = event.target.checked
}, },
"selectBeyondSkill": (event, button, dialog) => { "selectBeyondSkill": (event, button) => {
beyondSkill = button.checked beyondSkill = button.checked
}, },
"selectPointBlank": (event, button, dialog) => { "selectPointBlank": (event, button) => {
pointBlank = button.checked pointBlank = button.checked
}, },
"selectLetItFly": (event, button, dialog) => { "selectLetItFly": (event, button) => {
letItFly = button.checked letItFly = button.checked
}, },
"saveSpellCheck": (event, button, dialog) => { "saveSpellCheck": (event, button) => {
saveSpell = button.checked saveSpell = button.checked
}, },
"gotoToken": (event, button, dialog) => { "gotoToken": (event, button) => {
let tokenId = $(button).data("tokenId") let tokenId = $(button).data("tokenId")
let token = canvas.tokens?.get(tokenId) let token = canvas.tokens?.get(tokenId)
if (token) { if (token) {
@@ -589,12 +599,17 @@ export default class LethalFantasyRoll extends Roll {
} }
options.D30result = rollD30.total options.D30result = rollD30.total
// Récupérer le message D30 correspondant // Compute isRanged for D30: covers defense (isRangedDefense), monster ranged attacks (attackMode),
// and PC weapon attacks (isRangedAttack or weaponType)
const isRangedForD30 = options.isRangedDefense
|| options.rollTarget?.attackMode === "ranged"
|| options.rollTarget?.isRangedAttack === true
|| options.rollTarget?.weapon?.system?.weaponType === "ranged"
const d30Message = D30Roll.getResult( const d30Message = D30Roll.getResult(
rollD30.total, rollD30.total,
options.rollType, options.rollType,
options.rollTarget?.weapon, options.rollTarget?.weapon,
{ isRanged: options.isRangedDefense } { isRanged: isRangedForD30, isSpellSave: saveSpell }
) )
options.D30message = d30Message options.D30message = d30Message
} }
@@ -675,7 +690,7 @@ export default class LethalFantasyRoll extends Roll {
/* ***********************************************************/ /* ***********************************************************/
static async promptInitiative(options = {}) { static async promptInitiative(options = {}) {
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)])) const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
const fieldRollMode = new foundry.data.fields.StringField({ const fieldRollMode = new foundry.data.fields.StringField({
choices: rollModes, choices: rollModes,
blank: false, blank: false,
@@ -707,7 +722,7 @@ export default class LethalFantasyRoll extends Roll {
buttons: [ buttons: [
{ {
label: label, label: label,
callback: (event, button, dialog) => { callback: (event, button) => {
const output = Array.from(button.form.elements).reduce((obj, input) => { const output = Array.from(button.form.elements).reduce((obj, input) => {
if (input.name) obj[input.name] = input.value if (input.name) obj[input.name] = input.value
return obj return obj
@@ -729,7 +744,7 @@ export default class LethalFantasyRoll extends Roll {
let initRoll = new Roll(formula, options.data) let initRoll = new Roll(formula, options.data)
await initRoll.evaluate() await initRoll.evaluate()
let msg = await initRoll.toMessage({ flavor: `Initiative for ${options.actorName}` }, { rollMode: rollContext.visibility }) let msg = await initRoll.toMessage({ flavor: `Initiative for ${options.actorName}` }, { messageMode: rollContext.visibility })
if (game?.dice3d && initRoll.dice?.length) { if (game?.dice3d && initRoll.dice?.length) {
await game.dice3d.waitFor3DAnimationByMessageID(msg.id) await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
} }
@@ -743,7 +758,7 @@ export default class LethalFantasyRoll extends Roll {
/* ***********************************************************/ /* ***********************************************************/
static async promptCombatAction(options = {}) { static async promptCombatAction(options = {}) {
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)])) const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
const fieldRollMode = new foundry.data.fields.StringField({ const fieldRollMode = new foundry.data.fields.StringField({
choices: rollModes, choices: rollModes,
blank: false, blank: false,
@@ -772,10 +787,19 @@ export default class LethalFantasyRoll extends Roll {
let buttons = [] let buttons = []
if (currentAction) { if (currentAction) {
if (currentAction.type === "weapon") { if (currentAction.type === "weapon") {
let weaponLabel = "Roll progression dice"
if (currentAction.rangedMode) {
// Compute loading count from the speed formula (e.g. "3+1d6" → load=3)
const speedStr = currentAction.system?.speed?.[currentAction.rangedMode] ?? ""
const rangedLoad = currentAction.rangedLoad ?? (Number(speedStr.split("+")[0]) || 0)
if (rangedLoad > 0 && !currentAction.weaponLoaded) {
weaponLabel = "Load weapon"
}
}
buttons.push({ buttons.push({
action: "roll", action: "roll",
label: "Roll progression dice", label: weaponLabel,
callback: (event, button, dialog) => { callback: (event, button) => {
let pos = $('#combat-action-dialog').position() let pos = $('#combat-action-dialog').position()
game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", pos) game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", pos)
return "rollProgressionDice" return "rollProgressionDice"
@@ -801,7 +825,7 @@ export default class LethalFantasyRoll extends Roll {
buttons.push({ buttons.push({
action: "roll", action: "roll",
label: label, label: label,
callback: (event, button, dialog) => { callback: (event, button) => {
let pos = $('#combat-action-dialog').position() let pos = $('#combat-action-dialog').position()
game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", foundry.utils.duplicate(pos)) game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", foundry.utils.duplicate(pos))
return "rollLethargyDice" return "rollLethargyDice"
@@ -812,7 +836,7 @@ export default class LethalFantasyRoll extends Roll {
buttons.push({ buttons.push({
action: "roll", action: "roll",
label: "Select action", label: "Select action",
callback: (event, button, dialog) => { callback: (event, button) => {
let pos = $('#combat-action-dialog').position() let pos = $('#combat-action-dialog').position()
game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", foundry.utils.duplicate(pos)) game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", foundry.utils.duplicate(pos))
const output = Array.from(button.form.elements).reduce((obj, input) => { const output = Array.from(button.form.elements).reduce((obj, input) => {
@@ -827,7 +851,7 @@ export default class LethalFantasyRoll extends Roll {
buttons.push({ buttons.push({
action: "cancel", action: "cancel",
label: "Other action, not listed here", label: "Other action, not listed here",
callback: (event, button, dialog) => { callback: (event, button) => {
let pos = $('#combat-action-dialog').position() let pos = $('#combat-action-dialog').position()
game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", foundry.utils.duplicate(pos)) game.user.setFlag(SYSTEM.id, "combat-action-dialog-pos", foundry.utils.duplicate(pos))
return null; return null;
@@ -900,7 +924,8 @@ export default class LethalFantasyRoll extends Roll {
await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction)) await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
return return
} else { } else {
let message = `Spell/Miracle ${currentAction.name} ready to be cast on next second !` // Last counting second — announce ready and transition immediately (no extra second consumed)
let message = `Casting time : ${currentAction.name}, count : ${time}/${time} — ready to cast next second !`
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) }) ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
currentAction.castingTime = 1 currentAction.castingTime = 1
currentAction.spellStatus = "toBeCasted" currentAction.spellStatus = "toBeCasted"
@@ -977,7 +1002,7 @@ export default class LethalFantasyRoll extends Roll {
} }
// Range weapon loading // Range weapon loading
if (!currentAction.weaponLoaded && currentAction.rangedLoad) { if (!currentAction.weaponLoaded && currentAction.rangedLoad) {
if (currentAction.progressionCount <= currentAction.rangedLoad) { if (currentAction.progressionCount < currentAction.rangedLoad) {
let message = `Ranged weapon ${currentAction.name} is loading, loading count : ${currentAction.progressionCount}/${currentAction.rangedLoad}` let message = `Ranged weapon ${currentAction.name} is loading, loading count : ${currentAction.progressionCount}/${currentAction.rangedLoad}`
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) }) ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
currentAction.progressionCount += 1 currentAction.progressionCount += 1
@@ -1000,7 +1025,7 @@ export default class LethalFantasyRoll extends Roll {
let max = roll.dice[0].faces - 1 let max = roll.dice[0].faces - 1
max = Math.min(currentAction.progressionCount, max) max = Math.min(currentAction.progressionCount, max)
let msg = await roll.toMessage({ flavor: `Progression Roll for ${currentAction.name}, progression count : ${currentAction.progressionCount}/${max}` }, { rollMode: rollContext.visibility }) let msg = await roll.toMessage({ flavor: `Progression Roll for ${currentAction.name}, progression count : ${currentAction.progressionCount}/${max}` }, { messageMode: rollContext.visibility })
if (game?.dice3d) { if (game?.dice3d) {
await game.dice3d.waitFor3DAnimationByMessageID(msg.id) await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
} }
@@ -1042,7 +1067,7 @@ export default class LethalFantasyRoll extends Roll {
/* ***********************************************************/ /* ***********************************************************/
static async promptRangedDefense(options = {}) { static async promptRangedDefense(options = {}) {
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes); const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes);
const fieldRollMode = new foundry.data.fields.StringField({ const fieldRollMode = new foundry.data.fields.StringField({
choices: rollModes, choices: rollModes,
blank: false, blank: false,
@@ -1074,7 +1099,7 @@ export default class LethalFantasyRoll extends Roll {
buttons: [ buttons: [
{ {
label: label, label: label,
callback: (event, button, dialog) => { callback: (event, button) => {
const output = Array.from(button.form.elements).reduce((obj, input) => { const output = Array.from(button.form.elements).reduce((obj, input) => {
if (input.name) obj[input.name] = input.value if (input.name) obj[input.name] = input.value
return obj return obj
@@ -1123,6 +1148,8 @@ export default class LethalFantasyRoll extends Roll {
options = { ...options, ...rollContext } options = { ...options, ...rollContext }
options.rollName = "Ranged Defense" options.rollName = "Ranged Defense"
options.rollType = "weapon-defense" options.rollType = "weapon-defense"
options.type = options.rollType // Required: this.type reads options.type
options.rollMode = rollContext.visibility // Required: callers pass roll.options.rollMode to toMessage
const rollBase = new this(rollContext.movement, options.data, rollData) const rollBase = new this(rollContext.movement, options.data, rollData)
const rollModifier = new Roll(modifierFormula, options.data, rollData) const rollModifier = new Roll(modifierFormula, options.data, rollData)
@@ -1190,6 +1217,161 @@ export default class LethalFantasyRoll extends Roll {
return rollBase return rollBase
} }
/**
* Prompts the GM for ranged attack context (movement, range, target size, aim) when a monster
* attacks with a ranged weapon, then evaluates an exploding D20 attack roll with the resulting modifiers.
*
* @param {Object} options Options for the roll.
* @param {string} options.actorId The attacker actor ID.
* @param {string} options.actorName The attacker actor name.
* @param {Object} options.rollTarget The rollTarget containing attackModifier and related data.
* @returns {Promise<LethalFantasyRoll|null>} The resulting roll, or null if cancelled.
*/
static async promptRangedAttack(options = {}) {
const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes)
const fieldRollMode = new foundry.data.fields.StringField({
choices: rollModes,
blank: false,
default: "public",
})
let dialogContext = {
attackerMovementChoices: SYSTEM.ATTACKER_MOVEMENT_CHOICES,
rangeChoices: SYSTEM.RANGE_CHOICES,
sizeChoices: SYSTEM.SIZE_CHOICES,
attackerAimChoices: SYSTEM.ATTACKER_AIM_CHOICES,
movement: "none",
range: "short",
size: "+5",
attackerAim: "simple",
fieldRollMode,
rollModes
}
const content = await foundry.applications.handlebars.renderTemplate("systems/fvtt-lethal-fantasy/templates/range-attack-dialog.hbs", dialogContext)
const label = game.i18n.localize("LETHALFANTASY.Label.rangeAttackRoll")
const rollContext = await foundry.applications.api.DialogV2.wait({
window: { title: "Ranged Attack" },
classes: ["lethalfantasy"],
content,
buttons: [
{
label,
callback: (event, button) => {
const output = Array.from(button.form.elements).reduce((obj, input) => {
if (input.name) obj[input.name] = input.value
return obj
}, {})
return output
},
},
],
rejectClose: false
})
if (rollContext === null) return null
// Handle pointblank: attacker at point blank gets favor (standing still easier to aim)
if (rollContext.range === "pointblank") {
rollContext.movement = rollContext.movement.replace("kh", "")
rollContext.movement = rollContext.movement.replace("kl", "")
rollContext.movement += "kh" // Favor for attacker at point blank
rollContext.range = "0"
}
// Handle beyondskill: extreme range gives disfavor to attacker
if (rollContext.range === "beyondskill") {
rollContext.movement = rollContext.movement.replace("kh", "")
rollContext.movement = rollContext.movement.replace("kl", "")
rollContext.movement += "kl" // Disfavor for attacker beyond skill range
rollContext.range = "+11"
}
// Compute contextual penalty: range + target_size, reduced by aim bonus and attack modifier
const attackModifier = options.rollTarget?.attackModifier ?? 0
const contextualPenalty = Number(rollContext.range) + Number(rollContext.size)
const aimBonus = Number(rollContext.attackerAim || 0)
const fullModifier = contextualPenalty - aimBonus - attackModifier
let modifierFormula
if (fullModifier === 0) {
modifierFormula = "0"
} else {
const modAbs = Math.abs(fullModifier)
modifierFormula = `D${modAbs + 1} -1`
}
const rollData = { ...rollContext }
options = { ...options, ...rollContext }
options.rollName = "Ranged Attack"
options.rollType = options.rollType || "monster-attack"
options.type = options.rollType // Required: this.type reads options.type, used to build weaponDamageOptions in toHTML
options.rollMode = rollContext.visibility // Required: callers pass roll.options.rollMode to toMessage
options.isRangedAttack = true
const rollBase = new this(rollContext.movement, options.data, rollData)
const rollModifier = new Roll(modifierFormula, options.data, rollData)
rollModifier.evaluate()
await rollBase.evaluate()
const rollD30 = await new Roll("1D30").evaluate()
options.D30result = rollD30.total
options.D30message = D30Roll.getResult(rollD30.total, options.rollType, undefined, { isRanged: true })
// Determine favor from dice formula
let badResult = 0
if (rollContext.movement.includes("kh")) {
rollData.favor = "favor"
badResult = Math.min(rollBase.terms[0].results[0].result, rollBase.terms[0].results[1]?.result || 20)
}
if (rollContext.movement.includes("kl")) {
rollData.favor = "disfavor"
badResult = Math.max(rollBase.terms[0].results[0].result, rollBase.terms[0].results[1]?.result || 1)
}
const dice = rollContext.movement
const maxValue = 20
let rollTotal = -1
let diceResults = []
let diceResult = rollBase.dice[0].results[0].result
diceResults.push({ dice: `${dice.toUpperCase()}`, value: diceResult })
let diceSum = diceResult
// Exploding dice
while (diceResult === maxValue) {
const r = await new Roll(dice).evaluate()
diceResult = r.dice[0].results[0].result
diceResults.push({ dice: `${dice.toUpperCase()}-1`, value: diceResult - 1 })
diceSum += (diceResult - 1)
}
if (fullModifier !== 0) {
diceResults.push({ dice: `${rollModifier.formula.toUpperCase()}`, value: rollModifier.total })
if (fullModifier > 0) {
// Net penalty: subtract from roll
rollTotal = Math.max(diceSum - rollModifier.total, 0)
} else {
// Net bonus: add to roll
rollTotal = diceSum + rollModifier.total
}
} else {
rollTotal = diceSum
}
rollBase.options = { ...rollBase.options, ...options }
rollBase.options.resultType = undefined
rollBase.options.rollTotal = rollTotal
rollBase.options.diceResults = diceResults
rollBase.options.rollTarget = options.rollTarget
rollBase.options.titleFormula = `1D20E + ${modifierFormula}`
rollBase.options.D30result = options.D30result
rollBase.options.D30message = options.D30message
rollBase.options.rollName = "Ranged Attack"
rollBase.options.badResult = badResult
rollBase.options.rollData = foundry.utils.duplicate(rollData)
return rollBase
}
/** /**
* Creates a title based on the given type. * Creates a title based on the given type.
* *
@@ -1331,11 +1513,11 @@ export default class LethalFantasyRoll extends Roll {
* *
* @param {Object} [messageData={}] Additional data to include in the message. * @param {Object} [messageData={}] Additional data to include in the message.
* @param {Object} options Options for message creation. * @param {Object} options Options for message creation.
* @param {string} options.rollMode The mode of the roll (e.g., public, private). * @param {string} options.messageMode The mode of the roll (e.g., public, private).
* @param {boolean} [options.create=true] Whether to create the message. * @param {boolean} [options.create=true] Whether to create the message.
* @returns {Promise} - A promise that resolves when the message is created. * @returns {Promise} - A promise that resolves when the message is created.
*/ */
async toMessage(messageData = {}, { rollMode, create = true } = {}) { async toMessage(messageData = {}, { messageMode, create = true } = {}) {
return await super.toMessage( return await super.toMessage(
{ {
isSave: this.isSave, isSave: this.isSave,
@@ -1353,8 +1535,47 @@ export default class LethalFantasyRoll extends Roll {
rollData: this.rollData, rollData: this.rollData,
...messageData, ...messageData,
}, },
{ rollMode, create }, { messageMode, create },
) )
} }
/**
* Evaluate a spell/miracle damage formula with per-die explosion, then post to chat.
* Explosion dice are shown manually via showForRoll; the main roll is shown automatically
* by toMessage() (which triggers Dice So Nice via its createChatMessage hook).
* Append "NE" to the formula to disable explosion.
*
* @param {string} formula Dice formula, e.g. "1d8", "2d6", "1d8NE"
* @param {Object} rollOpts Options for LethalFantasyRoll (rollType, actorId, defenderId, etc.)
* @returns {Promise<ChatMessage>}
*/
static async rollSpellDamageToMessage(formula, rollOpts) {
const roll = new LethalFantasyRoll(formula, {}, rollOpts)
await roll.evaluate()
const shouldExplode = !/NE$/i.test(formula)
const diceResults = []
let diceSum = 0
for (const term of roll.dice) {
const singleDice = `1D${term.faces}`
for (const r of term.results) {
let diceResult = r.result
diceResults.push({ dice: singleDice.toUpperCase(), value: diceResult })
diceSum += diceResult
if (shouldExplode && term.faces > 0) {
while (diceResult === term.faces) {
const xr = await new Roll(singleDice).evaluate()
if (game?.dice3d) await game.dice3d.showForRoll(xr, game.user, true)
// Optional chaining guards against unexpected roll structure
diceResult = xr.dice?.[0]?.results?.[0]?.result ?? (term.faces - 1)
diceResults.push({ dice: `${singleDice.toUpperCase()}-1`, value: diceResult - 1 })
diceSum += (diceResult - 1)
}
}
}
}
roll.options.diceResults = diceResults
roll.options.rollTotal = diceSum
return roll.toMessage()
}
} }
+7 -2
View File
@@ -297,7 +297,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
}) })
if (!roll) return null if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { messageMode: roll.options.rollMode })
} }
async rollInitiative(combatId = undefined, combatantId = undefined) { async rollInitiative(combatId = undefined, combatantId = undefined) {
@@ -318,7 +318,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
}) })
if (!roll) return null if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { messageMode: roll.options.rollMode })
} }
async rollProgressionDice(combatId, combatantId, rollProgressionCount) { async rollProgressionDice(combatId, combatantId, rollProgressionCount) {
@@ -356,6 +356,11 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
} }
} }
if (weaponsChoices.length === 0) {
ui.notifications.warn(`${this.parent.name} has no weapons or spells available for combat. Add a weapon to the character sheet first.`)
return
}
let roll = await LethalFantasyRoll.promptCombatAction({ let roll = await LethalFantasyRoll.promptCombatAction({
actorId: this.parent.id, actorId: this.parent.id,
actorName: this.parent.name, actorName: this.parent.name,
+3
View File
@@ -35,6 +35,9 @@ export default class LethalFantasyMiracle extends foundry.abstract.TypeDataModel
schema.attackRoll = new fields.StringField({ required: true, initial: "" }) schema.attackRoll = new fields.StringField({ required: true, initial: "" })
schema.powerRoll = new fields.StringField({ required: true, initial: "" }) schema.powerRoll = new fields.StringField({ required: true, initial: "" })
schema.damageDice = new fields.StringField({ required: false, initial: "" })
schema.damageDiceOverpowered = new fields.StringField({ required: false, initial: "" })
schema.damageDiceOverpowered2 = new fields.StringField({ required: false, initial: "" })
return schema return schema
} }
+22 -6
View File
@@ -166,6 +166,22 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
*/ */
async roll(rollType, rollTarget, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) { async roll(rollType, rollTarget, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) {
const hasTarget = false const hasTarget = false
// Ranged monster defense uses the ranged defense dialog (movement, range, size modifiers)
if (rollType === "monster-defense" && rollTarget?.isRangedDefense === true) {
let roll = await LethalFantasyRoll.promptRangedDefense({
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
rollTarget,
defenderId,
defenderTokenId,
})
if (!roll) return null
await roll.toMessage({}, { messageMode: roll.options.rollMode })
return
}
let roll = await LethalFantasyRoll.prompt({ let roll = await LethalFantasyRoll.prompt({
rollType, rollType,
rollTarget, rollTarget,
@@ -180,7 +196,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
}) })
if (!roll) return null if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { messageMode: roll.options.rollMode })
} }
async prepareMonsterRoll(rollType, rollKey, rollDice = undefined, tokenId = undefined, damageModifier = undefined, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) { async prepareMonsterRoll(rollType, rollKey, rollDice = undefined, tokenId = undefined, damageModifier = undefined, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) {
@@ -192,6 +208,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
const attacksSet = this.attackMode === "ranged" ? this.rangedAttacks : this.attacks const attacksSet = this.attackMode === "ranged" ? this.rangedAttacks : this.attacks
rollTarget = foundry.utils.duplicate(attacksSet[rollKey]) rollTarget = foundry.utils.duplicate(attacksSet[rollKey])
rollTarget.rollKey = rollKey rollTarget.rollKey = rollKey
rollTarget.attackMode = this.attackMode
if (rollType === "monster-defense") { if (rollType === "monster-defense") {
rollTarget.isRangedDefense = game.lethalFantasy?.nextDefenseData?.isRanged ?? false rollTarget.isRangedDefense = game.lethalFantasy?.nextDefenseData?.isRanged ?? false
} }
@@ -232,7 +249,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
await roll.toMessage({ await roll.toMessage({
flavor, flavor,
speaker: ChatMessage.getSpeaker({ actor: this.parent }) speaker: ChatMessage.getSpeaker({ actor: this.parent })
}) }, { messageMode: roll.options.rollMode ?? game.settings.get("core", "rollMode") })
return return
} }
case "weapon-damage-small": case "weapon-damage-small":
@@ -269,7 +286,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
return return
} }
rollTarget = skill rollTarget = skill
rollTarget.weapon = weapon rollTarget.weapon = foundry.utils.duplicate(weapon)
rollTarget.weaponSkillModifier = skill.weaponSkillModifier rollTarget.weaponSkillModifier = skill.weaponSkillModifier
rollTarget.rollKey = rollKey rollTarget.rollKey = rollKey
rollTarget.combat = foundry.utils.duplicate(this.combat) rollTarget.combat = foundry.utils.duplicate(this.combat)
@@ -283,7 +300,6 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
// In all cases // In all cases
if (rollTarget) { if (rollTarget) {
rollTarget.tokenId = tokenId rollTarget.tokenId = tokenId
console.log(rollTarget)
await this.roll(rollType, rollTarget, defenderId, defenderTokenId, extraShieldDr) await this.roll(rollType, rollTarget, defenderId, defenderTokenId, extraShieldDr)
} }
} }
@@ -304,7 +320,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
}) })
if (!roll) return null if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { messageMode: roll.options.rollMode })
} }
async rollProgressionDice(combatId, combatantId) { async rollProgressionDice(combatId, combatantId) {
@@ -316,7 +332,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
return return
} }
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes) const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes)
const fieldRollMode = new foundry.data.fields.StringField({ const fieldRollMode = new foundry.data.fields.StringField({
choices: rollModes, choices: rollModes,
blank: false, blank: false,
+2
View File
@@ -40,6 +40,8 @@ export default class LethalFantasySpell extends foundry.abstract.TypeDataModel {
schema.attackRoll = new fields.StringField({ required: true, initial: "" }) schema.attackRoll = new fields.StringField({ required: true, initial: "" })
schema.powerRoll = new fields.StringField({ required: true, initial: "" }) schema.powerRoll = new fields.StringField({ required: true, initial: "" })
schema.damageDice = new fields.StringField({ required: false, initial: "" }) schema.damageDice = new fields.StringField({ required: false, initial: "" })
schema.damageDiceOverpowered = new fields.StringField({ required: false, initial: "" })
schema.damageDiceOverpowered2 = new fields.StringField({ required: false, initial: "" })
return schema return schema
} }
+37 -24
View File
@@ -324,7 +324,7 @@ export default class LethalFantasyUtils {
<p>Attack roll: <strong>${attackRoll}</strong></p> <p>Attack roll: <strong>${attackRoll}</strong></p>
</div> </div>
<div class="weapon-selection"> <div class="weapon-selection">
<label for="defense-attack">Choose your defense attack:</label> <label for="defense-attack">Choose your defense weapon:</label>
<select id="defense-attack" name="attackKey" style="width: 100%; margin-top: 8px;"> <select id="defense-attack" name="attackKey" style="width: 100%; margin-top: 8px;">
${attacksHTML} ${attacksHTML}
</select> </select>
@@ -401,7 +401,7 @@ export default class LethalFantasyUtils {
defenderTokenId, defenderTokenId,
isRanged: true isRanged: true
} }
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { messageMode: roll.options.rollMode })
} }
return return
} }
@@ -711,6 +711,7 @@ export default class LethalFantasyUtils {
${totalBonus > 0 ? `<p class="bonus-info">Bonus already added: +${totalBonus}</p>` : ''} ${totalBonus > 0 ? `<p class="bonus-info">Bonus already added: +${totalBonus}</p>` : ''}
</div> </div>
<p class="offer-text">You are losing! Spend Grit or Luck to add 1D6 to your defense?</p> <p class="offer-text">You are losing! Spend Grit or Luck to add 1D6 to your defense?</p>
<p class="shield-warning"><i class="fa-solid fa-triangle-exclamation"></i> If you intend to use a shield, you must spend Grit or Luck <strong>first</strong> — the shield roll comes after.</p>
</div> </div>
` `
@@ -853,7 +854,7 @@ export default class LethalFantasyUtils {
` `
} else if (data.attackRollType === "monster-attack") { } else if (data.attackRollType === "monster-attack") {
damageButton = ` damageButton = `
<div class="attack-result-damage"> <div class="attack-result-damage single-btn">
<button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-defender-token-id="${data.defenderTokenId || ""}" data-extra-shield-dr="${data.shieldDamageReduction || 0}" data-attack-key="${data.attackRollKey}" data-damage-type="monster"> <button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-defender-token-id="${data.defenderTokenId || ""}" data-extra-shield-dr="${data.shieldDamageReduction || 0}" data-attack-key="${data.attackRollKey}" data-damage-type="monster">
<i class="fa-solid fa-burst"></i> Damage <i class="fa-solid fa-burst"></i> Damage
</button> </button>
@@ -861,21 +862,26 @@ export default class LethalFantasyUtils {
` `
} else if (data.attackRollType === "spell-attack" || data.attackRollType === "miracle-attack") { } else if (data.attackRollType === "spell-attack" || data.attackRollType === "miracle-attack") {
const attacker = game.actors.get(data.attackerId) const attacker = game.actors.get(data.attackerId)
const spell = attacker?.items.get(data.attackWeaponId) const spell = attacker?.items.get(data.attackWeaponId || data.attackRollKey)
const damageDice = spell?.system?.damageDice const tiers = [
if (damageDice) { { formula: spell?.system?.damageDice, label: "Standard" },
damageButton = ` { formula: spell?.system?.damageDiceOverpowered, label: "Overpowered" },
<div class="attack-result-damage"> { formula: spell?.system?.damageDiceOverpowered2, label: "Overpowered 2" },
].filter(t => t.formula)
if (tiers.length) {
const buttons = tiers.map(t => {
const escapedFormula = Handlebars.escapeExpression(t.formula)
return `
<button class="roll-damage-btn" <button class="roll-damage-btn"
data-attacker-id="${data.attackerId}" data-attacker-id="${data.attackerId}"
data-defender-id="${data.defenderId}" data-defender-id="${data.defenderId}"
data-defender-token-id="${data.defenderTokenId || ""}" data-defender-token-id="${data.defenderTokenId || ""}"
data-damage-type="spell" data-damage-type="spell"
data-damage-formula="${damageDice}"> data-damage-formula="${escapedFormula}">
<i class="fa-solid fa-wand-magic-sparkles"></i> Spell Damage (${damageDice}) <i class="fa-solid fa-wand-magic-sparkles"></i> ${t.label} (${escapedFormula})
</button> </button>`
</div> }).join("")
` damageButton = `<div class="attack-result-damage spell-damage">${buttons}</div>`
} }
} }
} }
@@ -902,10 +908,10 @@ export default class LethalFantasyUtils {
</div> </div>
<div class="combat-result-text"> <div class="combat-result-text">
${outcome === "shielded-hit" ${outcome === "shielded-hit"
? `<i class="fa-solid fa-shield"></i> <strong>${data.attackerName}</strong> hits <strong>${data.defenderName}</strong>, but the shield blocked — apply armor DR + shield DR <strong>${data.shieldDamageReduction || 0}</strong>.` ? `<i class="fa-solid fa-shield"></i> <strong>${data.defenderName}</strong> has blocked with shield — apply armor DR + shield DR <strong>${data.shieldDamageReduction || 0}</strong>.`
: isAttackWin : isAttackWin
? `<i class="fa-solid fa-circle-check"></i> <strong>${data.attackerName}</strong> hits <strong>${data.defenderName}</strong>!` ? `<i class="fa-solid fa-circle-check"></i> <strong>${data.attackerName}</strong> hits <strong>${data.defenderName}</strong>!`
: `<i class="fa-solid fa-shield-halved"></i> <strong>${data.defenderName}</strong> parries the attack!` : `<i class="fa-solid fa-shield-halved"></i> <strong>${data.defenderName}</strong> avoided the attack!`
} }
</div> </div>
${damageButton} ${damageButton}
@@ -1092,25 +1098,32 @@ export default class LethalFantasyUtils {
static async applyDamage(message, event) { static async applyDamage(message, event) {
// Récupérer les données du message // Récupérer les données du message
let combatantId = event.currentTarget.dataset.combatantId let combatantId = event.currentTarget.dataset.combatantId
if (!combatantId || !game.combat) { if (!combatantId) {
ui.notifications.error("No combatant selected") ui.notifications.error("No combatant selected")
return return
} }
let combatant = game.combat.combatants.get(combatantId) // Try to find the target: first as a combat combatant, then as a scene token
if (!combatant) { let targetActor = null
ui.notifications.error("Combatant not found") if (game.combat) {
return const combatant = game.combat.combatants.get(combatantId)
if (combatant) {
targetActor = combatant.token?.actor || game.actors.get(combatant.actorId)
}
}
if (!targetActor) {
// Fall back to scene token lookup (non-combat tokens use tokenId as their combatantId)
const token = canvas.tokens?.placeables?.find(t => t.id === combatantId)
targetActor = token?.actor
} }
let targetActor = combatant.token?.actor || game.actors.get(combatant.actorId)
if (!targetActor) { if (!targetActor) {
ui.notifications.error("Target actor not found") ui.notifications.error("Target actor not found")
return return
} }
// Récupérer les données de dégâts du message // Récupérer les données de dégâts du message
let damageTotal = message.rolls[0]?.total || 0 // Use options.rollTotal (includes weapon modifier bonus) rather than roll.total (dice formula only)
let damageTotal = message.rolls[0]?.options?.rollTotal ?? message.rolls[0]?.total ?? 0
let weaponName = message.rolls[0]?.options?.rollName || "Unknown Weapon" let weaponName = message.rolls[0]?.options?.rollName || "Unknown Weapon"
// Calculer les DR // Calculer les DR
@@ -1188,7 +1201,7 @@ export default class LethalFantasyUtils {
ChatMessage.create({ ChatMessage.create({
user: game.user.id, user: game.user.id,
speaker: { alias: targetActor.name }, speaker: { alias: targetActor.name },
rollMode: "gmroll", mode: "gm",
content: messageContent content: messageContent
}) })
} }
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000583 MANIFEST-000623
+8 -8
View File
@@ -1,8 +1,8 @@
2026/05/01-23:33:08.433602 7f8fb27bf6c0 Recovering log #581 2026/05/25-11:43:40.059603 7f88315ff6c0 Recovering log #621
2026/05/01-23:33:08.476792 7f8fb27bf6c0 Delete type=3 #579 2026/05/25-11:43:40.071136 7f88315ff6c0 Delete type=3 #619
2026/05/01-23:33:08.476868 7f8fb27bf6c0 Delete type=0 #581 2026/05/25-11:43:40.071202 7f88315ff6c0 Delete type=0 #621
2026/05/01-23:33:55.878970 7f8d1bfff6c0 Level-0 table #586: started 2026/05/25-12:29:17.727995 7f87e2ffd6c0 Level-0 table #626: started
2026/05/01-23:33:55.881418 7f8d1bfff6c0 Level-0 table #586: 0 bytes OK 2026/05/25-12:29:17.728028 7f87e2ffd6c0 Level-0 table #626: 0 bytes OK
2026/05/01-23:33:55.924908 7f8d1bfff6c0 Delete type=0 #584 2026/05/25-12:29:17.733783 7f87e2ffd6c0 Delete type=0 #624
2026/05/01-23:33:56.035970 7f8d1bfff6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.740143 7f87e2ffd6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
2026/05/01-23:33:56.036022 7f8d1bfff6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.740167 7f87e2ffd6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
+8 -8
View File
@@ -1,8 +1,8 @@
2026/04/30-14:38:06.808992 7f3f35bff6c0 Recovering log #577 2026/05/24-09:22:43.041326 7fdfa95ff6c0 Recovering log #617
2026/04/30-14:38:06.818757 7f3f35bff6c0 Delete type=3 #575 2026/05/24-09:22:43.083988 7fdfa95ff6c0 Delete type=3 #615
2026/04/30-14:38:06.818831 7f3f35bff6c0 Delete type=0 #577 2026/05/24-09:22:43.084045 7fdfa95ff6c0 Delete type=0 #617
2026/04/30-14:38:35.518816 7f3ee77fe6c0 Level-0 table #582: started 2026/05/24-09:42:00.304351 7fdf5affd6c0 Level-0 table #622: started
2026/04/30-14:38:35.518836 7f3ee77fe6c0 Level-0 table #582: 0 bytes OK 2026/05/24-09:42:00.304423 7fdf5affd6c0 Level-0 table #622: 0 bytes OK
2026/04/30-14:38:35.525869 7f3ee77fe6c0 Delete type=0 #580 2026/05/24-09:42:00.311333 7fdf5affd6c0 Delete type=0 #620
2026/04/30-14:38:35.538258 7f3ee77fe6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334170 7fdf5affd6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
2026/04/30-14:38:35.538288 7f3ee77fe6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334370 7fdf5affd6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000580 MANIFEST-000620
+8 -8
View File
@@ -1,8 +1,8 @@
2026/05/01-23:33:08.486839 7f8fb17bd6c0 Recovering log #578 2026/05/25-11:43:40.077580 7f87e37fe6c0 Recovering log #618
2026/05/01-23:33:08.536613 7f8fb17bd6c0 Delete type=3 #576 2026/05/25-11:43:40.087750 7f87e37fe6c0 Delete type=3 #616
2026/05/01-23:33:08.536667 7f8fb17bd6c0 Delete type=0 #578 2026/05/25-11:43:40.087800 7f87e37fe6c0 Delete type=0 #618
2026/05/01-23:33:55.999594 7f8d1bfff6c0 Level-0 table #583: started 2026/05/25-12:29:17.758832 7f87e2ffd6c0 Level-0 table #623: started
2026/05/01-23:33:55.999624 7f8d1bfff6c0 Level-0 table #583: 0 bytes OK 2026/05/25-12:29:17.758858 7f87e2ffd6c0 Level-0 table #623: 0 bytes OK
2026/05/01-23:33:56.035856 7f8d1bfff6c0 Delete type=0 #581 2026/05/25-12:29:17.764622 7f87e2ffd6c0 Delete type=0 #621
2026/05/01-23:33:56.036000 7f8d1bfff6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.777473 7f87e2ffd6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
2026/05/01-23:33:56.036042 7f8d1bfff6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.784124 7f87e2ffd6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
+8 -8
View File
@@ -1,8 +1,8 @@
2026/04/30-14:38:06.823818 7f3f353fe6c0 Recovering log #574 2026/05/24-09:22:43.091828 7fdfa8dfe6c0 Recovering log #614
2026/04/30-14:38:06.834104 7f3f353fe6c0 Delete type=3 #572 2026/05/24-09:22:43.131041 7fdfa8dfe6c0 Delete type=3 #612
2026/04/30-14:38:06.834187 7f3f353fe6c0 Delete type=0 #574 2026/05/24-09:22:43.131104 7fdfa8dfe6c0 Delete type=0 #614
2026/04/30-14:38:35.525993 7f3ee77fe6c0 Level-0 table #579: started 2026/05/24-09:42:00.326388 7fdf5affd6c0 Level-0 table #619: started
2026/04/30-14:38:35.526019 7f3ee77fe6c0 Level-0 table #579: 0 bytes OK 2026/05/24-09:42:00.326417 7fdf5affd6c0 Level-0 table #619: 0 bytes OK
2026/04/30-14:38:35.532067 7f3ee77fe6c0 Delete type=0 #577 2026/05/24-09:42:00.334051 7fdf5affd6c0 Delete type=0 #617
2026/04/30-14:38:35.538267 7f3ee77fe6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334205 7fdf5affd6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
2026/04/30-14:38:35.538302 7f3ee77fe6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334364 7fdf5affd6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000585 MANIFEST-000625
+8 -8
View File
@@ -1,8 +1,8 @@
2026/05/01-23:33:08.376215 7f8fb0fbc6c0 Recovering log #583 2026/05/25-11:43:40.044921 7f87e3fff6c0 Recovering log #623
2026/05/01-23:33:08.417318 7f8fb0fbc6c0 Delete type=3 #581 2026/05/25-11:43:40.054992 7f87e3fff6c0 Delete type=3 #621
2026/05/01-23:33:08.417396 7f8fb0fbc6c0 Delete type=0 #583 2026/05/25-11:43:40.055048 7f87e3fff6c0 Delete type=0 #623
2026/05/01-23:33:55.962045 7f8d1bfff6c0 Level-0 table #588: started 2026/05/25-12:29:17.710484 7f87e2ffd6c0 Level-0 table #628: started
2026/05/01-23:33:55.962068 7f8d1bfff6c0 Level-0 table #588: 0 bytes OK 2026/05/25-12:29:17.710568 7f87e2ffd6c0 Level-0 table #628: 0 bytes OK
2026/05/01-23:33:55.999439 7f8d1bfff6c0 Delete type=0 #586 2026/05/25-12:29:17.716928 7f87e2ffd6c0 Delete type=0 #626
2026/05/01-23:33:56.035992 7f8d1bfff6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.740121 7f87e2ffd6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2026/05/01-23:33:56.036035 7f8d1bfff6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.758707 7f87e2ffd6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
+8 -8
View File
@@ -1,8 +1,8 @@
2026/04/30-14:38:06.795186 7f3f353fe6c0 Recovering log #579 2026/05/24-09:22:42.993966 7fdfa8dfe6c0 Recovering log #619
2026/04/30-14:38:06.805935 7f3f353fe6c0 Delete type=3 #577 2026/05/24-09:22:43.035467 7fdfa8dfe6c0 Delete type=3 #617
2026/04/30-14:38:06.805994 7f3f353fe6c0 Delete type=0 #579 2026/05/24-09:22:43.035518 7fdfa8dfe6c0 Delete type=0 #619
2026/04/30-14:38:35.512680 7f3ee77fe6c0 Level-0 table #584: started 2026/05/24-09:42:00.319082 7fdf5affd6c0 Level-0 table #624: started
2026/04/30-14:38:35.512729 7f3ee77fe6c0 Level-0 table #584: 0 bytes OK 2026/05/24-09:42:00.319109 7fdf5affd6c0 Level-0 table #624: 0 bytes OK
2026/04/30-14:38:35.518704 7f3ee77fe6c0 Delete type=0 #582 2026/05/24-09:42:00.326261 7fdf5affd6c0 Delete type=0 #622
2026/04/30-14:38:35.538247 7f3ee77fe6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334196 7fdf5affd6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2026/04/30-14:38:35.538281 7f3ee77fe6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334355 7fdf5affd6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000280 MANIFEST-000320
+8 -8
View File
@@ -1,8 +1,8 @@
2026/05/01-23:33:08.590994 7f8fb1fbe6c0 Recovering log #278 2026/05/25-11:43:40.107633 7f8830dfe6c0 Recovering log #318
2026/05/01-23:33:08.636941 7f8fb1fbe6c0 Delete type=3 #276 2026/05/25-11:43:40.118039 7f8830dfe6c0 Delete type=3 #316
2026/05/01-23:33:08.636992 7f8fb1fbe6c0 Delete type=0 #278 2026/05/25-11:43:40.118104 7f8830dfe6c0 Delete type=0 #318
2026/05/01-23:33:56.204694 7f8d1bfff6c0 Level-0 table #283: started 2026/05/25-12:29:17.777484 7f87e2ffd6c0 Level-0 table #323: started
2026/05/01-23:33:56.204728 7f8d1bfff6c0 Level-0 table #283: 0 bytes OK 2026/05/25-12:29:17.777511 7f87e2ffd6c0 Level-0 table #323: 0 bytes OK
2026/05/01-23:33:56.238272 7f8d1bfff6c0 Delete type=0 #281 2026/05/25-12:29:17.784021 7f87e2ffd6c0 Delete type=0 #321
2026/05/01-23:33:56.371888 7f8d1bfff6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.784188 7f87e2ffd6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
2026/05/01-23:33:56.426259 7f8d1bfff6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.803354 7f87e2ffd6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
+8 -8
View File
@@ -1,8 +1,8 @@
2026/04/30-14:38:06.849252 7f3f353fe6c0 Recovering log #274 2026/05/24-09:22:43.194643 7fdfa8dfe6c0 Recovering log #314
2026/04/30-14:38:06.859072 7f3f353fe6c0 Delete type=3 #272 2026/05/24-09:22:43.231409 7fdfa8dfe6c0 Delete type=3 #312
2026/04/30-14:38:06.859126 7f3f353fe6c0 Delete type=0 #274 2026/05/24-09:22:43.231470 7fdfa8dfe6c0 Delete type=0 #314
2026/04/30-14:38:35.538433 7f3ee77fe6c0 Level-0 table #279: started 2026/05/24-09:42:00.341818 7fdf5affd6c0 Level-0 table #319: started
2026/04/30-14:38:35.538452 7f3ee77fe6c0 Level-0 table #279: 0 bytes OK 2026/05/24-09:42:00.341853 7fdf5affd6c0 Level-0 table #319: 0 bytes OK
2026/04/30-14:38:35.544715 7f3ee77fe6c0 Delete type=0 #277 2026/05/24-09:42:00.348538 7fdf5affd6c0 Delete type=0 #317
2026/04/30-14:38:35.567736 7f3ee77fe6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.367125 7fdf5affd6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
2026/04/30-14:38:35.567785 7f3ee77fe6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.367348 7fdf5affd6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000579 MANIFEST-000619
+8 -8
View File
@@ -1,8 +1,8 @@
2026/05/01-23:33:08.543693 7f8fb0fbc6c0 Recovering log #577 2026/05/25-11:43:40.093877 7f87e3fff6c0 Recovering log #617
2026/05/01-23:33:08.586596 7f8fb0fbc6c0 Delete type=3 #575 2026/05/25-11:43:40.103670 7f87e3fff6c0 Delete type=3 #615
2026/05/01-23:33:08.586670 7f8fb0fbc6c0 Delete type=0 #577 2026/05/25-11:43:40.103720 7f87e3fff6c0 Delete type=0 #617
2026/05/01-23:33:55.925044 7f8d1bfff6c0 Level-0 table #582: started 2026/05/25-12:29:17.764689 7f87e2ffd6c0 Level-0 table #622: started
2026/05/01-23:33:55.925074 7f8d1bfff6c0 Level-0 table #582: 0 bytes OK 2026/05/25-12:29:17.764705 7f87e2ffd6c0 Level-0 table #622: 0 bytes OK
2026/05/01-23:33:55.961939 7f8d1bfff6c0 Delete type=0 #580 2026/05/25-12:29:17.770486 7f87e2ffd6c0 Delete type=0 #620
2026/05/01-23:33:56.035982 7f8d1bfff6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.784104 7f87e2ffd6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2026/05/01-23:33:56.036029 7f8d1bfff6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/05/25-12:29:17.784130 7f87e2ffd6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
+8 -8
View File
@@ -1,8 +1,8 @@
2026/04/30-14:38:06.836968 7f3ee7fff6c0 Recovering log #573 2026/05/24-09:22:43.141936 7fdf5bfff6c0 Recovering log #613
2026/04/30-14:38:06.846980 7f3ee7fff6c0 Delete type=3 #571 2026/05/24-09:22:43.189387 7fdf5bfff6c0 Delete type=3 #611
2026/04/30-14:38:06.847050 7f3ee7fff6c0 Delete type=0 #573 2026/05/24-09:22:43.189438 7fdf5bfff6c0 Delete type=0 #613
2026/04/30-14:38:35.532186 7f3ee77fe6c0 Level-0 table #578: started 2026/05/24-09:42:00.311436 7fdf5affd6c0 Level-0 table #618: started
2026/04/30-14:38:35.532209 7f3ee77fe6c0 Level-0 table #578: 0 bytes OK 2026/05/24-09:42:00.311459 7fdf5affd6c0 Level-0 table #618: 0 bytes OK
2026/04/30-14:38:35.538132 7f3ee77fe6c0 Delete type=0 #576 2026/05/24-09:42:00.318964 7fdf5affd6c0 Delete type=0 #616
2026/04/30-14:38:35.538276 7f3ee77fe6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334187 7fdf5affd6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2026/04/30-14:38:35.538295 7f3ee77fe6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/05/24-09:42:00.334334 7fdf5affd6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
+4 -4
View File
@@ -387,11 +387,11 @@
min-width: 6rem; min-width: 6rem;
max-width: 6rem; max-width: 6rem;
} }
min-width: 10rem; min-width: 11rem;
max-width: 10rem; max-width: 11rem;
.input { .input {
min-width: 2.5rem; min-width: 3.5rem;
max-width: 2.5rem; max-width: 3.5rem;
} }
} }
.granted { .granted {
+69 -12
View File
@@ -145,9 +145,11 @@
} }
.grit-luck-dialog { .grit-luck-dialog {
color: var(--color-text-dark-primary, #191813);
.combat-status { .combat-status {
padding: 12px; padding: 12px;
background: linear-gradient(to bottom, rgba(42, 41, 32, 0.8) 0%, rgba(26, 25, 16, 0.9) 100%); background: linear-gradient(to bottom, rgba(42, 41, 32, 0.88) 0%, rgba(26, 25, 16, 0.95) 100%);
border: 1px solid rgba(212, 175, 55, 0.5); border: 1px solid rgba(212, 175, 55, 0.5);
border-radius: 6px; border-radius: 6px;
margin-bottom: 16px; margin-bottom: 16px;
@@ -171,11 +173,27 @@
} }
.offer-text { .offer-text {
color: #f0e6d2; color: var(--color-text-dark-primary, #191813);
font-size: calc(var(--font-size-standard) * 1); font-size: calc(var(--font-size-standard) * 1);
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
margin: 0 0 8px 0;
}
.shield-warning {
color: #7a4000;
background: rgba(255, 160, 0, 0.12);
border: 1px solid rgba(255, 160, 0, 0.4);
border-radius: 5px;
font-size: calc(var(--font-size-standard) * 0.88);
padding: 6px 10px;
margin: 0; margin: 0;
text-align: center;
i {
color: #c07000;
margin-right: 5px;
}
} }
} }
@@ -283,33 +301,72 @@
} }
.attack-result-damage { .attack-result-damage {
display: flex; display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px; gap: 8px;
justify-content: center;
&.single-btn {
grid-template-columns: 1fr;
max-width: 280px;
margin: 0 auto;
}
&.spell-damage {
grid-template-columns: 1fr;
width: 100%;
}
.roll-damage-btn { .roll-damage-btn {
padding: 10px 16px; padding: 10px 14px;
background: linear-gradient(to bottom, #8b0000 0%, #660000 100%); background: linear-gradient(to bottom, #8b0000 0%, #660000 100%);
border: 1px solid #ff0000; border: 1px solid #4b0000;
border-radius: 6px; border-radius: 6px;
color: #f0e6d2; color: #f0e6d2;
font-weight: 600; font-weight: 600;
font-size: calc(var(--font-size-standard) * 0.9);
text-align: center;
white-space: nowrap;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
transition: left 0.5s;
}
&:hover::before {
left: 100%;
}
i {
font-size: calc(var(--font-size-standard) * 1.1);
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
flex-shrink: 0;
}
&:hover { &:hover {
background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%); background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
transform: translateY(-2px); transform: translateY(-2px);
border-color: #5b0000;
} }
&:active { &:active {
transform: translateY(0); transform: translateY(0);
} box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 3px rgba(0, 0, 0, 0.3);
i {
margin-right: 6px;
} }
} }
} }
+65 -10
View File
@@ -176,6 +176,22 @@
} }
} }
.dialog-warning {
margin: 0.4rem 0.2rem 0.2rem;
padding: 0.35rem 0.5rem;
border-left: 3px solid #c8941a;
background: rgba(200, 148, 26, 0.12);
border-radius: 3px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 0.9);
color: #7a5400;
line-height: 1.4;
i {
color: #c8941a;
margin-right: 0.4rem;
}
}
.lethalfantasy, .lethalfantasy,
.fvtt-lethal-fantasy, .fvtt-lethal-fantasy,
.message.lethalfantasy, .message.lethalfantasy,
@@ -1269,33 +1285,72 @@
} }
.attack-result-damage { .attack-result-damage {
display: flex; display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px; gap: 8px;
justify-content: center;
&.single-btn {
grid-template-columns: 1fr;
max-width: 280px;
margin: 0 auto;
}
&.spell-damage {
grid-template-columns: 1fr;
width: 100%;
}
.roll-damage-btn { .roll-damage-btn {
padding: 10px 16px; padding: 10px 14px;
background: linear-gradient(to bottom, #8b0000 0%, #660000 100%); background: linear-gradient(to bottom, #8b0000 0%, #660000 100%);
border: 1px solid #ff0000; border: 1px solid #4b0000;
border-radius: 6px; border-radius: 6px;
color: #f0e6d2; color: #f0e6d2;
font-weight: 600; font-weight: 600;
font-size: calc(var(--font-size-standard) * 0.9);
text-align: center;
white-space: nowrap;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
transition: left 0.5s;
}
&:hover::before {
left: 100%;
}
i {
font-size: calc(var(--font-size-standard) * 1.1);
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
flex-shrink: 0;
}
&:hover { &:hover {
background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%); background: linear-gradient(to bottom, #a00000 0%, #7b0000 100%);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
transform: translateY(-2px); transform: translateY(-2px);
border-color: #5b0000;
} }
&:active { &:active {
transform: translateY(0); transform: translateY(0);
} box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 3px rgba(0, 0, 0, 0.3);
i {
margin-right: 6px;
} }
} }
} }
+19 -19
View File
@@ -9,95 +9,95 @@
<legend>{{localize "LETHALFANTASY.Label.biodata"}}</legend> <legend>{{localize "LETHALFANTASY.Label.biodata"}}</legend>
<div class="biodata"> <div class="biodata">
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Class</span> <span class="name">{{localize "LETHALFANTASY.Label.class"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.class systemFields.biodata.fields.class
value=system.biodata.class value=system.biodata.class
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Level</span> <span class="name">{{localize "LETHALFANTASY.Label.level"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.level systemFields.biodata.fields.level
value=system.biodata.level value=system.biodata.level
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Mortal</span> <span class="name">{{localize "LETHALFANTASY.Label.mortal"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.mortal systemFields.biodata.fields.mortal
value=system.biodata.mortal value=system.biodata.mortal
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Alignment</span> <span class="name">{{localize "LETHALFANTASY.Label.alignment"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.alignment systemFields.biodata.fields.alignment
value=system.biodata.alignment value=system.biodata.alignment
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Age</span> <span class="name">{{localize "LETHALFANTASY.Label.age"}}</span>
{{formInput systemFields.biodata.fields.age value=system.biodata.age}} {{formInput systemFields.biodata.fields.age value=system.biodata.age}}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Height</span> <span class="name">{{localize "LETHALFANTASY.Label.height"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.height systemFields.biodata.fields.height
value=system.biodata.height value=system.biodata.height
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Weight</span> <span class="name">{{localize "LETHALFANTASY.Label.weight"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.weight systemFields.biodata.fields.weight
value=system.biodata.weight value=system.biodata.weight
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Eyes</span> <span class="name">{{localize "LETHALFANTASY.Label.eyes"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.eyes systemFields.biodata.fields.eyes
value=system.biodata.eyes value=system.biodata.eyes
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Hair</span> <span class="name">{{localize "LETHALFANTASY.Label.hair"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.hair systemFields.biodata.fields.hair
value=system.biodata.hair value=system.biodata.hair
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Dev. Points (Total)</span> <span class="name">{{localize "LETHALFANTASY.Label.devPointsTotal"}}</span>
{{formInput {{formInput
systemFields.developmentPoints.fields.total systemFields.developmentPoints.fields.total
value=system.developmentPoints.total value=system.developmentPoints.total
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Dev. Points (Rem.)</span> <span class="name">{{localize "LETHALFANTASY.Label.devPointsRem"}}</span>
{{formInput {{formInput
systemFields.developmentPoints.fields.remaining systemFields.developmentPoints.fields.remaining
value=system.developmentPoints.remaining value=system.developmentPoints.remaining
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Magic User</span> <span class="name">{{localize "LETHALFANTASY.Label.magicUser"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.magicUser systemFields.biodata.fields.magicUser
value=system.biodata.magicUser value=system.biodata.magicUser
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Cleric User</span> <span class="name">{{localize "LETHALFANTASY.Label.clericUser"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.clericUser systemFields.biodata.fields.clericUser
value=system.biodata.clericUser value=system.biodata.clericUser
}} }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Save bonus (1/5levels)</span> <span class="name">{{localize "LETHALFANTASY.Label.saveBonus"}}</span>
{{formInput {{formInput
systemFields.modifiers.fields.saveModifier systemFields.modifiers.fields.saveModifier
value=system.modifiers.saveModifier value=system.modifiers.saveModifier
@@ -107,7 +107,7 @@
{{#if system.biodata.magicUser}} {{#if system.biodata.magicUser}}
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Spell bonus (1/5levels)</span> <span class="name">{{localize "LETHALFANTASY.Label.spellBonus"}}</span>
{{formInput {{formInput
systemFields.modifiers.fields.levelSpellModifier systemFields.modifiers.fields.levelSpellModifier
value=system.modifiers.levelSpellModifier value=system.modifiers.levelSpellModifier
@@ -117,7 +117,7 @@
{{/if}} {{/if}}
{{#if system.biodata.clericUser}} {{#if system.biodata.clericUser}}
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Miracle bonus (1/5levels)</span> <span class="name">{{localize "LETHALFANTASY.Label.miracleBonus"}}</span>
{{formInput {{formInput
systemFields.modifiers.fields.levelMiracleModifier systemFields.modifiers.fields.levelMiracleModifier
value=system.modifiers.levelMiracleModifier value=system.modifiers.levelMiracleModifier
@@ -127,7 +127,7 @@
{{/if}} {{/if}}
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Last HD roll</span> <span class="name">{{localize "LETHALFANTASY.Label.lastHdRoll"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.hpPerLevel systemFields.biodata.fields.hpPerLevel
value=system.biodata.hpPerLevel value=system.biodata.hpPerLevel
@@ -136,7 +136,7 @@
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Natural DR</span> <span class="name">{{localize "LETHALFANTASY.Label.naturalDR"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.naturalDR systemFields.biodata.fields.naturalDR
value=system.biodata.naturalDR value=system.biodata.naturalDR
@@ -145,7 +145,7 @@
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Magical DR</span> <span class="name">{{localize "LETHALFANTASY.Label.magicalDR"}}</span>
{{formInput {{formInput
systemFields.biodata.fields.magicDR systemFields.biodata.fields.magicDR
value=system.biodata.magicDR value=system.biodata.magicDR
+2 -2
View File
@@ -5,12 +5,12 @@
<legend>{{localize "LETHALFANTASY.Label.divinityPoints"}}</legend> <legend>{{localize "LETHALFANTASY.Label.divinityPoints"}}</legend>
<div class="miracle-details"> <div class="miracle-details">
<div class="miracle-detail"> <div class="miracle-detail">
<span>Current</span> <span>{{localize "LETHALFANTASY.Label.current"}}</span>
{{formField systemFields.divinityPoints.fields.value value=system.divinityPoints.value localize=true}} {{formField systemFields.divinityPoints.fields.value value=system.divinityPoints.value localize=true}}
<a data-action="divinityPointsPlus"><i class="fa-solid fa-hexagon-plus"></i></a> <a data-action="divinityPointsPlus"><i class="fa-solid fa-hexagon-plus"></i></a>
<a data-action="divinityPointsMinus"><i class="fa-solid fa-hexagon-minus"></i></a> <a data-action="divinityPointsMinus"><i class="fa-solid fa-hexagon-minus"></i></a>
<span>Max</span> <span>{{localize "LETHALFANTASY.Label.max"}}</span>
{{formField systemFields.divinityPoints.fields.max value=system.divinityPoints.max localize=true {{formField systemFields.divinityPoints.fields.max value=system.divinityPoints.max localize=true
disabled=isPlayMode}} disabled=isPlayMode}}
</div> </div>
+21 -2
View File
@@ -5,12 +5,12 @@
<legend>{{localize "LETHALFANTASY.Label.aetherPoints"}}</legend> <legend>{{localize "LETHALFANTASY.Label.aetherPoints"}}</legend>
<div class="spell-details"> <div class="spell-details">
<div class="spell-detail"> <div class="spell-detail">
<span>Current</span> <span>{{localize "LETHALFANTASY.Label.current"}}</span>
{{formField systemFields.aetherPoints.fields.value value=system.aetherPoints.value localize=true}} {{formField systemFields.aetherPoints.fields.value value=system.aetherPoints.value localize=true}}
<a data-action="aetherPointsPlus"><i class="fa-solid fa-hexagon-plus"></i></a> <a data-action="aetherPointsPlus"><i class="fa-solid fa-hexagon-plus"></i></a>
<a data-action="aetherPointsMinus"><i class="fa-solid fa-hexagon-minus"></i></a> <a data-action="aetherPointsMinus"><i class="fa-solid fa-hexagon-minus"></i></a>
<span>Max</span> <span>{{localize "LETHALFANTASY.Label.max"}}</span>
{{formField systemFields.aetherPoints.fields.max value=system.aetherPoints.max localize=true {{formField systemFields.aetherPoints.fields.max value=system.aetherPoints.max localize=true
disabled=isPlayMode}} disabled=isPlayMode}}
</div> </div>
@@ -37,6 +37,25 @@
<i class="fa-duotone fa-solid fa-stars" data-roll-type="spell-power" data-roll-key="{{item.id}}"></i> <i class="fa-duotone fa-solid fa-stars" data-roll-type="spell-power" data-roll-key="{{item.id}}"></i>
</a> </a>
{{#if item.system.damageDice}}
<a data-action="rollSpellDamage" data-item-id="{{item.id}}" data-damage-tier="standard"
data-tooltip="Spell Damage (Standard)">
<i class="fa-solid fa-wand-magic-sparkles"></i>S
</a>
{{/if}}
{{#if item.system.damageDiceOverpowered}}
<a data-action="rollSpellDamage" data-item-id="{{item.id}}" data-damage-tier="overpowered"
data-tooltip="Spell Damage (Overpowered)">
<i class="fa-solid fa-wand-magic-sparkles"></i>O
</a>
{{/if}}
{{#if item.system.damageDiceOverpowered2}}
<a data-action="rollSpellDamage" data-item-id="{{item.id}}" data-damage-tier="overpowered2"
data-tooltip="Spell Damage (Overpowered 2)">
<i class="fa-solid fa-wand-magic-sparkles"></i>O2
</a>
{{/if}}
<div class="controls"> <div class="controls">
<a data-tooltip="{{localize 'LETHALFANTASY.Edit'}}" data-action="edit" data-item-id="{{item.id}}" <a data-tooltip="{{localize 'LETHALFANTASY.Edit'}}" data-action="edit" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a> data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
+7 -7
View File
@@ -40,32 +40,32 @@
{{#if (eq rollData.favor "favor")}} {{#if (eq rollData.favor "favor")}}
<div class="detail-badge favor-badge"> <div class="detail-badge favor-badge">
<i class="fa-solid fa-sparkles"></i> <i class="fa-solid fa-sparkles"></i>
<span>Favor</span> <span>{{localize "LETHALFANTASY.Label.favor"}}</span>
</div> </div>
{{/if}} {{/if}}
{{#if (eq rollData.favor "disfavor")}} {{#if (eq rollData.favor "disfavor")}}
<div class="detail-badge disfavor-badge"> <div class="detail-badge disfavor-badge">
<i class="fa-solid fa-skull"></i> <i class="fa-solid fa-skull"></i>
<span>Disfavor</span> <span>{{localize "LETHALFANTASY.Label.disfavor"}}</span>
</div> </div>
{{/if}} {{/if}}
{{#if rollData.letItFly}} {{#if rollData.letItFly}}
<div class="detail-badge special-badge"> <div class="detail-badge special-badge">
<i class="fa-solid fa-bow-arrow"></i> <i class="fa-solid fa-bow-arrow"></i>
<span>Let It Fly!</span> <span>{{localize "LETHALFANTASY.Label.letItFly"}}</span>
</div> </div>
{{/if}} {{/if}}
{{#if rollData.pointBlank}} {{#if rollData.pointBlank}}
<div class="detail-badge special-badge"> <div class="detail-badge special-badge">
<i class="fa-solid fa-bullseye-arrow"></i> <i class="fa-solid fa-bullseye-arrow"></i>
<span>Point Blank</span> <span>{{localize "LETHALFANTASY.Label.pointBlank"}}</span>
</div> </div>
{{/if}} {{/if}}
{{#if rollData.beyondSkill}} {{#if rollData.beyondSkill}}
<div class="detail-badge special-badge"> <div class="detail-badge special-badge">
<i class="fa-solid fa-target-lock"></i> <i class="fa-solid fa-target-lock"></i>
<span>Beyond Skill</span> <span>{{localize "LETHALFANTASY.Label.beyondSkill"}}</span>
</div> </div>
{{/if}} {{/if}}
@@ -111,7 +111,7 @@
{{#unless isPrivate}} {{#unless isPrivate}}
<div class="result-section"> <div class="result-section">
<div class="main-result"> <div class="main-result">
<div class="result-label">Total</div> <div class="result-label">{{localize "LETHALFANTASY.Label.total"}}</div>
<div class="result-value {{#if (eq resultType 'success')}}success{{else}}failure{{/if}}"> <div class="result-value {{#if (eq resultType 'success')}}success{{else}}failure{{/if}}">
{{total}} {{total}}
</div> </div>
@@ -177,7 +177,7 @@
{{else}} {{else}}
<div class="private-result"> <div class="private-result">
<i class="fa-solid fa-eye-slash"></i> <i class="fa-solid fa-eye-slash"></i>
<span>Private Roll</span> <span>{{localize "LETHALFANTASY.Label.privateRoll"}}</span>
</div> </div>
{{/unless}} {{/unless}}
+8
View File
@@ -13,6 +13,14 @@
<span>{{ localize "COMBAT.End" }}</span> <span>{{ localize "COMBAT.End" }}</span>
</button> </button>
{{#if combat.round}}
<button type="button" class="combat-control combat-control-lg" data-action="rollMonsterProgression"
data-tooltip="{{ localize 'LETHALFANTASY.Combat.RollMonsters' }}">
<i class="fa-solid fa-dragon" inert></i>
<span>{{ localize "LETHALFANTASY.Combat.RollMonsters" }}</span>
</button>
{{/if}}
<!-- <button type="button" class="inline-control combat-control icon fa-solid fa-arrow-right" data-action="nextTurn" <!-- <button type="button" class="inline-control combat-control icon fa-solid fa-arrow-right" data-action="nextTurn"
data-tooltip aria-label="{{ localize "COMBAT.TurnNext" }}"></button> --> data-tooltip aria-label="{{ localize "COMBAT.TurnNext" }}"></button> -->
<button type="button" class="inline-control combat-control icon fa-solid fa-forward-step" data-action="nextRound" <button type="button" class="inline-control combat-control icon fa-solid fa-forward-step" data-action="nextRound"
+4 -1
View File
@@ -7,7 +7,7 @@
{{formField systemFields.miracleType value=system.miracleType}} {{formField systemFields.miracleType value=system.miracleType}}
{{formField systemFields.level value=system.level}} {{formField systemFields.level value=system.level}}
<label>Components</label> <label>{{localize "LETHALFANTASY.Label.components"}}</label>
<div class="shift-right"> <div class="shift-right">
{{formField systemFields.components.fields.verbal value=system.components.verbal}} {{formField systemFields.components.fields.verbal value=system.components.verbal}}
{{formField systemFields.components.fields.somatic value=system.components.somatic}} {{formField systemFields.components.fields.somatic value=system.components.somatic}}
@@ -27,6 +27,9 @@
{{formField systemFields.areaAffected value=system.areaAffected}} {{formField systemFields.areaAffected value=system.areaAffected}}
{{formField systemFields.duration value=system.duration}} {{formField systemFields.duration value=system.duration}}
{{formField systemFields.savingThrow value=system.savingThrow}} {{formField systemFields.savingThrow value=system.savingThrow}}
{{formField systemFields.damageDice value=system.damageDice}}
{{formField systemFields.damageDiceOverpowered value=system.damageDiceOverpowered}}
{{formField systemFields.damageDiceOverpowered2 value=system.damageDiceOverpowered2}}
+5 -5
View File
@@ -6,23 +6,23 @@
<div class="biodata"> <div class="biodata">
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Alignment</span> <span class="name">{{localize "LETHALFANTASY.Label.alignment"}}</span>
{{formInput systemFields.biodata.fields.alignment value=system.biodata.alignment }} {{formInput systemFields.biodata.fields.alignment value=system.biodata.alignment }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Height</span> <span class="name">{{localize "LETHALFANTASY.Label.height"}}</span>
{{formInput systemFields.biodata.fields.height value=system.biodata.height }} {{formInput systemFields.biodata.fields.height value=system.biodata.height }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Weight</span> <span class="name">{{localize "LETHALFANTASY.Label.weight"}}</span>
{{formInput systemFields.biodata.fields.weight value=system.biodata.weight }} {{formInput systemFields.biodata.fields.weight value=system.biodata.weight }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Length</span> <span class="name">{{localize "LETHALFANTASY.Label.length"}}</span>
{{formInput systemFields.biodata.fields.length value=system.biodata.length }} {{formInput systemFields.biodata.fields.length value=system.biodata.length }}
</div> </div>
<div class="biodata-elem"> <div class="biodata-elem">
<span class="name">Vision</span> <span class="name">{{localize "LETHALFANTASY.Label.vision"}}</span>
{{formInput systemFields.biodata.fields.vision value=system.biodata.vision }} {{formInput systemFields.biodata.fields.vision value=system.biodata.vision }}
</div> </div>
+1 -1
View File
@@ -160,7 +160,7 @@
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>Hand To Hand Attacks</legend> <legend>{{localize "LETHALFANTASY.Label.handToHandAttacks"}}</legend>
<div class="attacks"> <div class="attacks">
{{#each system.combatHTH as |item key|}} {{#each system.combatHTH as |item key|}}
<div class="attack" data-attack-key="{{key}}" > <div class="attack" data-attack-key="{{key}}" >
+45
View File
@@ -0,0 +1,45 @@
<div class="lethalfantasy-range-defense-dialog">
<fieldSet class="">
<legend>{{localize "LETHALFANTASY.Label.rangeAttackDialog"}}</legend>
<div class="field-section">
<span class="field-name">Attacker Movement :</span>
<select name="movement" data-tooltip-direction="UP">
{{selectOptions attackerMovementChoices selected=movement}}
</select>
</div>
<div class="field-section">
<span class="field-name">Range :</span>
<select name="range" data-tooltip-direction="UP">
{{selectOptions rangeChoices selected=range}}
</select>
</div>
<div class="field-section">
<span class="field-name">Target Size :</span>
<select name="size" data-tooltip-direction="UP">
{{selectOptions sizeChoices selected=size}}
</select>
</div>
<div class="field-section">
<span class="field-name">Aim :</span>
<select name="attackerAim" data-tooltip-direction="UP">
{{selectOptions attackerAimChoices selected=attackerAim}}
</select>
</div>
</fieldSet>
<fieldSet>
<legend>{{localize "LETHALFANTASY.Roll.visibility"}}</legend>
<span class="fieldset-centered">
<select name="visibility">
{{selectOptions rollModes selected=visibility localize=true}}
</select>
</span>
</fieldSet>
</div>
+5 -3
View File
@@ -55,8 +55,7 @@
<div class="dialog-save">Add Granted Attack Dice <div class="dialog-save">Add Granted Attack Dice
<input type="checkbox" data-action="selectGranted" name="granted" /> <input type="checkbox" data-action="selectGranted" name="granted" />
</div> </div>
{{#if rollTarget.weapon}} {{#if isRangedAttack}}
{{#if (eq rollTarget.weapon.system.weaponType "melee")}}{{else}}
<div class="dialog-save">Point Blank Range Attack <div class="dialog-save">Point Blank Range Attack
<input <input
type="checkbox" type="checkbox"
@@ -84,13 +83,16 @@
</select> </select>
</div> </div>
{{/if}} {{/if}}
{{/if}}
{{/if}} {{/if}}
{{#if (match rollType "defense")}} {{#if (match rollType "defense")}}
<div class="dialog-save">Add Granted Defense Dice <div class="dialog-save">Add Granted Defense Dice
<input type="checkbox" data-action="selectGranted" name="granted" /> <input type="checkbox" data-action="selectGranted" name="granted" />
</div> </div>
<div class="dialog-warning">
<i class="fa-solid fa-triangle-exclamation"></i>
{{localize "LETHALFANTASY.Warning.defenseShieldOrder"}}
</div>
{{/if}} {{/if}}
{{#if (match rollType "damage")}} {{#if (match rollType "damage")}}
<div class="dialog-save">Add Granted Damage Dice <div class="dialog-save">Add Granted Damage Dice
+3 -3
View File
@@ -22,9 +22,9 @@
{{formField systemFields.hascover value=system.hascover}} {{formField systemFields.hascover value=system.hascover}}
{{#if system.hascover}} {{#if system.hascover}}
<label>Cover vs ranged attacks</label> <label>{{localize "LETHALFANTASY.Label.coverRanged"}}</label>
<div class="shift-right"> <div class="shift-right">
<label>Standing </label> <label>{{localize "LETHALFANTASY.Label.standing"}}</label>
<div class="flexrow">{{formField <div class="flexrow">{{formField
systemFields.standing.fields.min systemFields.standing.fields.min
value=system.standing.min value=system.standing.min
@@ -33,7 +33,7 @@
</div> </div>
</div> </div>
<div class="shift-right"> <div class="shift-right">
<label>Crouching</label> <label>{{localize "LETHALFANTASY.Label.crouching"}}</label>
<div class="flexrow">{{formField <div class="flexrow">{{formField
systemFields.crouching.fields.min systemFields.crouching.fields.min
value=system.crouching.min value=system.crouching.min
+3 -1
View File
@@ -7,7 +7,7 @@
{{formField systemFields.level value=system.level}} {{formField systemFields.level value=system.level}}
{{formField systemFields.cost value=system.cost}} {{formField systemFields.cost value=system.cost}}
<label>Components</label> <label>{{localize "LETHALFANTASY.Label.components"}}</label>
<div class="shift-right"> <div class="shift-right">
{{formField systemFields.components.fields.verbal value=system.components.verbal}} {{formField systemFields.components.fields.verbal value=system.components.verbal}}
{{formField systemFields.components.fields.somatic value=system.components.somatic}} {{formField systemFields.components.fields.somatic value=system.components.somatic}}
@@ -31,6 +31,8 @@
{{formField systemFields.extraAetherPoints value=system.extraAetherPoints}} {{formField systemFields.extraAetherPoints value=system.extraAetherPoints}}
{{formField systemFields.criticalType value=system.criticalType}} {{formField systemFields.criticalType value=system.criticalType}}
{{formField systemFields.damageDice value=system.damageDice}} {{formField systemFields.damageDice value=system.damageDice}}
{{formField systemFields.damageDiceOverpowered value=system.damageDiceOverpowered}}
{{formField systemFields.damageDiceOverpowered2 value=system.damageDiceOverpowered2}}
<fieldset> <fieldset>
+5 -5
View File
@@ -10,14 +10,14 @@
{{formField systemFields.weaponType value=system.weaponType localize=true}} {{formField systemFields.weaponType value=system.weaponType localize=true}}
{{formField systemFields.weaponClass value=system.weaponClass localize=true}} {{formField systemFields.weaponClass value=system.weaponClass localize=true}}
<label>Damage Type</label> <label>{{localize "LETHALFANTASY.Label.damageType"}}</label>
<div class="shift-right"> <div class="shift-right">
{{formField systemFields.damageType.fields.typeP value=system.damageType.typeP}} {{formField systemFields.damageType.fields.typeP value=system.damageType.typeP}}
{{formField systemFields.damageType.fields.typeB value=system.damageType.typeB}} {{formField systemFields.damageType.fields.typeB value=system.damageType.typeB}}
{{formField systemFields.damageType.fields.typeS value=system.damageType.typeS}} {{formField systemFields.damageType.fields.typeS value=system.damageType.typeS}}
</div> </div>
<label>Damage</label> <label>{{localize "LETHALFANTASY.Label.damage"}}</label>
<div class="shift-right"> <div class="shift-right">
{{formField systemFields.damage.fields.damageS value=system.damage.damageS}} {{formField systemFields.damage.fields.damageS value=system.damage.damageS}}
{{formField systemFields.damage.fields.damageM value=system.damage.damageM}} {{formField systemFields.damage.fields.damageM value=system.damage.damageM}}
@@ -34,7 +34,7 @@
{{/if}} {{/if}}
{{#if (eq system.weaponType "ranged")}} {{#if (eq system.weaponType "ranged")}}
<label>Speed</label> <label>{{localize "LETHALFANTASY.Label.speed"}}</label>
<div class="shift-right"> <div class="shift-right">
{{formField systemFields.speed.fields.simpleAim value=system.speed.simpleAim}} {{formField systemFields.speed.fields.simpleAim value=system.speed.simpleAim}}
{{formField systemFields.speed.fields.carefulAim value=system.speed.carefulAim}} {{formField systemFields.speed.fields.carefulAim value=system.speed.carefulAim}}
@@ -47,7 +47,7 @@
{{formField systemFields.defense value=system.defense}} {{formField systemFields.defense value=system.defense}}
<label>Range</label> <label>{{localize "LETHALFANTASY.Label.range"}}</label>
<div class="shift-right"> <div class="shift-right">
{{formField systemFields.weaponRange.fields.pointBlank value=system.weaponRange.pointBlank}} {{formField systemFields.weaponRange.fields.pointBlank value=system.weaponRange.pointBlank}}
{{formField systemFields.weaponRange.fields.short value=system.weaponRange.short}} {{formField systemFields.weaponRange.fields.short value=system.weaponRange.short}}
@@ -60,7 +60,7 @@
{{formField systemFields.equipped value=system.equipped}} {{formField systemFields.equipped value=system.equipped}}
<label>Bonuses</label> <label>{{localize "LETHALFANTASY.Label.bonuses"}}</label>
<div class="shift-right"> <div class="shift-right">
{{formField systemFields.bonuses.fields.attackBonus value=system.bonuses.attackBonus}} {{formField systemFields.bonuses.fields.attackBonus value=system.bonuses.attackBonus}}
{{formField systemFields.bonuses.fields.defenseBonus value=system.bonuses.defenseBonus}} {{formField systemFields.bonuses.fields.defenseBonus value=system.bonuses.defenseBonus}}