HUD + liste de talents
This commit is contained in:
parent
6b508c96be
commit
5ab6b99ef6
@ -48,6 +48,7 @@ export class HawkmoonActorSheet extends ActorSheet {
|
|||||||
profils: duplicate(this.actor.getProfils() || {}),
|
profils: duplicate(this.actor.getProfils() || {}),
|
||||||
combat: this.actor.getCombatValues(),
|
combat: this.actor.getCombatValues(),
|
||||||
equipements: duplicate(this.actor.getEquipments()),
|
equipements: duplicate(this.actor.getEquipments()),
|
||||||
|
initiative: this.actor.getFlag("world", "last-initiative") || -1,
|
||||||
description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}),
|
description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}),
|
||||||
habitat: await TextEditor.enrichHTML(this.object.system.biodata.habitat, {async: true}),
|
habitat: await TextEditor.enrichHTML(this.object.system.biodata.habitat, {async: true}),
|
||||||
options: this.options,
|
options: this.options,
|
||||||
|
@ -490,6 +490,11 @@ export class HawkmoonActor extends Actor {
|
|||||||
return talents
|
return talents
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
buildListeAdversites() {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCommonRollData(attrKey = undefined, compId = undefined, compName = undefined) {
|
getCommonRollData(attrKey = undefined, compId = undefined, compName = undefined) {
|
||||||
let rollData = HawkmoonUtility.getBasicRollData()
|
let rollData = HawkmoonUtility.getBasicRollData()
|
||||||
|
71
modules/hawkmoon-hud.js
Normal file
71
modules/hawkmoon-hud.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
export class HawkmoonTokenHud {
|
||||||
|
|
||||||
|
static init() {
|
||||||
|
// Integration du TokenHUD
|
||||||
|
Hooks.on('renderTokenHUD', (app, html, data) => { HawkmoonTokenHud.addTokenHudExtensions(app, html, data._id) });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async removeExtensionHud(app, html, tokenId) {
|
||||||
|
html.find('.control-icon.hawkmoon-adversite').remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async addExtensionHud(app, html, tokenId) {
|
||||||
|
|
||||||
|
let token = canvas.tokens.get(tokenId)
|
||||||
|
let actor = token.actor
|
||||||
|
app.hasExtension = true
|
||||||
|
|
||||||
|
const hudData = { actor: actor }
|
||||||
|
|
||||||
|
const controlIconActions = html.find('.control-icon[data-action=combat]');
|
||||||
|
// initiative
|
||||||
|
await HawkmoonTokenHud._configureSubMenu(controlIconActions, 'systems/fvtt-hawkmoon-cyd/templates/hud-adversites.html', hudData,
|
||||||
|
(event) => {
|
||||||
|
let adversite = event.currentTarget.attributes['data-action-index'].value
|
||||||
|
let value = Number(event.currentTarget.attributes['data-action-value'].value)
|
||||||
|
hudData.actor.incDecAdversite( adversite, value)
|
||||||
|
} )
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async addTokenHudExtensions(app, html, tokenId) {
|
||||||
|
const controlIconCombat = html.find('.control-icon[data-action=combat]')
|
||||||
|
if (controlIconCombat.length>0 ) {
|
||||||
|
HawkmoonTokenHud.addExtensionHud(app, html, tokenId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async _configureSubMenu(insertionPoint, template, hudData, onMenuItem) {
|
||||||
|
const hud = $(await renderTemplate(template, hudData))
|
||||||
|
const list = hud.find('div.hawkmoon-hud-list')
|
||||||
|
|
||||||
|
HawkmoonTokenHud._toggleHudListActive(hud, list);
|
||||||
|
|
||||||
|
hud.find('img.hawkmoon-hud-togglebutton').click(event => HawkmoonTokenHud._toggleHudListActive(hud, list));
|
||||||
|
list.find('.hawkmoon-hud-adversite').click(onMenuItem);
|
||||||
|
|
||||||
|
insertionPoint.after(hud);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static _showControlWhen(control, condition) {
|
||||||
|
if (condition) {
|
||||||
|
control.show()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
control.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static _toggleHudListActive(hud, list) {
|
||||||
|
hud.toggleClass('active')
|
||||||
|
HawkmoonTokenHud._showControlWhen(list, hud.hasClass('active'))
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,7 @@ import { HawkmoonUtility } from "./hawkmoon-utility.js";
|
|||||||
import { HawkmoonCombat } from "./hawkmoon-combat.js";
|
import { HawkmoonCombat } from "./hawkmoon-combat.js";
|
||||||
import { HawkmoonItem } from "./hawkmoon-item.js";
|
import { HawkmoonItem } from "./hawkmoon-item.js";
|
||||||
import { HawkmoonAutomation } from "./hawkmoon-automation.js";
|
import { HawkmoonAutomation } from "./hawkmoon-automation.js";
|
||||||
|
import { HawkmoonTokenHud } from "./hawkmoon-hud.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Foundry VTT Initialization */
|
/* Foundry VTT Initialization */
|
||||||
@ -64,6 +65,7 @@ Hooks.once("init", async function () {
|
|||||||
|
|
||||||
HawkmoonUtility.init()
|
HawkmoonUtility.init()
|
||||||
HawkmoonAutomation.init()
|
HawkmoonAutomation.init()
|
||||||
|
HawkmoonTokenHud.init()
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -110,7 +112,8 @@ function registerUsageCount(registerKey) {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
Hooks.once("ready", function () {
|
Hooks.once("ready", function () {
|
||||||
|
|
||||||
HawkmoonUtility.ready();
|
HawkmoonUtility.ready()
|
||||||
|
|
||||||
// User warning
|
// User warning
|
||||||
if (!game.user.isGM && game.user.character == undefined) {
|
if (!game.user.isGM && game.user.character == undefined) {
|
||||||
ui.notifications.info("Attention ! Aucun personnage n'est relié au joueur !");
|
ui.notifications.info("Attention ! Aucun personnage n'est relié au joueur !");
|
||||||
|
@ -154,6 +154,7 @@ export class HawkmoonUtility {
|
|||||||
'systems/fvtt-hawkmoon-cyd/templates/partial-item-prix.html',
|
'systems/fvtt-hawkmoon-cyd/templates/partial-item-prix.html',
|
||||||
'systems/fvtt-hawkmoon-cyd/templates/partial-sante-etat.html',
|
'systems/fvtt-hawkmoon-cyd/templates/partial-sante-etat.html',
|
||||||
'systems/fvtt-hawkmoon-cyd/templates/partial-automation.html',
|
'systems/fvtt-hawkmoon-cyd/templates/partial-automation.html',
|
||||||
|
'systems/fvtt-hawkmoon-cyd/templates/hud-adversites.html',
|
||||||
]
|
]
|
||||||
return loadTemplates(templatePaths);
|
return loadTemplates(templatePaths);
|
||||||
}
|
}
|
||||||
@ -216,8 +217,8 @@ export class HawkmoonUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getActorFromRollData(rollData) {
|
static getActorFromRollData(rollData) {
|
||||||
let actor = game.actors.get( rollData.actorId)
|
let actor = game.actors.get(rollData.actorId)
|
||||||
if (rollData.tokenId) {
|
if (rollData.tokenId) {
|
||||||
let token = canvas.tokens.placeables.find(t => t.id == rollData.tokenId)
|
let token = canvas.tokens.placeables.find(t => t.id == rollData.tokenId)
|
||||||
if (token) {
|
if (token) {
|
||||||
@ -307,7 +308,7 @@ export class HawkmoonUtility {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static computeResult(rollData) {
|
static computeResult(rollData) {
|
||||||
rollData.diceResult = rollData.roll.terms[0].results[0].result
|
rollData.diceResult = rollData.roll.terms[0].results[0].result
|
||||||
if (rollData.mainDice.includes("d20") ) {
|
if (rollData.mainDice.includes("d20")) {
|
||||||
let diceValue = rollData.roll.terms[0].results[0].result
|
let diceValue = rollData.roll.terms[0].results[0].result
|
||||||
if (diceValue % 2 == 1) {
|
if (diceValue % 2 == 1) {
|
||||||
//console.log("PAIR/IMP2", diceValue)
|
//console.log("PAIR/IMP2", diceValue)
|
||||||
@ -340,8 +341,8 @@ export class HawkmoonUtility {
|
|||||||
rollData.attr = duplicate(actor.system.attributs[rollData.attrKey])
|
rollData.attr = duplicate(actor.system.attributs[rollData.attrKey])
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rollData.maitriseId != "none") {
|
if (rollData.maitriseId != "none") {
|
||||||
rollData.selectedMaitrise = rollData.maitrises.find(p => p.id == rollData.maitriseId )
|
rollData.selectedMaitrise = rollData.maitrises.find(p => p.id == rollData.maitriseId)
|
||||||
rollData.diceFormula = "2" + rollData.mainDice + "kh"
|
rollData.diceFormula = "2" + rollData.mainDice + "kh"
|
||||||
} else {
|
} else {
|
||||||
rollData.diceFormula = "1" + rollData.mainDice
|
rollData.diceFormula = "1" + rollData.mainDice
|
||||||
@ -353,14 +354,14 @@ export class HawkmoonUtility {
|
|||||||
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
|
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
|
||||||
rollData.diceFormula += `+${rollData.attr.value}+${rollData.competence.system.niveau}+${rollData.modificateur}+${compmod}`
|
rollData.diceFormula += `+${rollData.attr.value}+${rollData.competence.system.niveau}+${rollData.modificateur}+${compmod}`
|
||||||
|
|
||||||
if ( rollData.selectedTalents && rollData.selectedTalents.length > 0) {
|
if (rollData.selectedTalents && rollData.selectedTalents.length > 0) {
|
||||||
for (let id of rollData.selectedTalents) {
|
for (let id of rollData.selectedTalents) {
|
||||||
let talent = rollData.talents.find(t => t._id == id)
|
let talent = rollData.talents.find(t => t._id == id)
|
||||||
let bonusOK = true
|
let bonusOK = true
|
||||||
if ( talent.system.baCost ) {
|
if (talent.system.baCost) {
|
||||||
bonusOK = actor.checkBonneAventure( talent.system.baCost)
|
bonusOK = actor.checkBonneAventure(talent.system.baCost)
|
||||||
if ( bonusOK ) {
|
if (bonusOK) {
|
||||||
actor.changeBonneAventure( -talent.system.baCost )
|
actor.changeBonneAventure(-talent.system.baCost)
|
||||||
} else {
|
} else {
|
||||||
ui.notifications.warn("Vous n'avez pas assez de points de Bonne Aventure !")
|
ui.notifications.warn("Vous n'avez pas assez de points de Bonne Aventure !")
|
||||||
}
|
}
|
||||||
@ -522,7 +523,7 @@ export class HawkmoonUtility {
|
|||||||
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||||
rollData.armeDefense = defender.getBestDefenseValue()
|
rollData.armeDefense = defender.getBestDefenseValue()
|
||||||
rollData.targetVigueur = defender.getVigueur()
|
rollData.targetVigueur = defender.getVigueur()
|
||||||
if ( rollData.armeDefense) {
|
if (rollData.armeDefense) {
|
||||||
rollData.difficulte = rollData.armeDefense.system.totalDefensif
|
rollData.difficulte = rollData.armeDefense.system.totalDefensif
|
||||||
} else {
|
} else {
|
||||||
ui.notifications.warn("Aucune arme de défense équipée, difficulté manuelle à positionner.")
|
ui.notifications.warn("Aucune arme de défense équipée, difficulté manuelle à positionner.")
|
||||||
@ -580,13 +581,13 @@ export class HawkmoonUtility {
|
|||||||
let message = game.messages.get(li.attr("data-message-id"))
|
let message = game.messages.get(li.attr("data-message-id"))
|
||||||
let rollData = message.getFlag("world", "hawkmoon-roll")
|
let rollData = message.getFlag("world", "hawkmoon-roll")
|
||||||
let actor = this.getActorFromRollData(rollData)
|
let actor = this.getActorFromRollData(rollData)
|
||||||
return (!rollData.isReroll && actor.getBonneAventure() > 0 )
|
return (!rollData.isReroll && actor.getBonneAventure() > 0)
|
||||||
}
|
}
|
||||||
let canApplyPE = function (li) {
|
let canApplyPE = function (li) {
|
||||||
let message = game.messages.get(li.attr("data-message-id"))
|
let message = game.messages.get(li.attr("data-message-id"))
|
||||||
let rollData = message.getFlag("world", "hawkmoon-roll")
|
let rollData = message.getFlag("world", "hawkmoon-roll")
|
||||||
let actor = this.getActorFromRollData(rollData)
|
let actor = this.getActorFromRollData(rollData)
|
||||||
return (!rollData.isReroll && actor.getEclat() > 0 )
|
return (!rollData.isReroll && actor.getEclat() > 0)
|
||||||
}
|
}
|
||||||
options.push(
|
options.push(
|
||||||
{
|
{
|
||||||
@ -643,4 +644,21 @@ export class HawkmoonUtility {
|
|||||||
d.render(true);
|
d.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************************/
|
||||||
|
static async __create_talents_table() {
|
||||||
|
let compName = "fvtt-hawkmoon-cyd.talents-cellule"
|
||||||
|
const compData = await HawkmoonUtility.loadCompendium(compName)
|
||||||
|
let talents = compData.map(i => i.toObject())
|
||||||
|
|
||||||
|
let htmlTab = "<table border='1'><tbody>";
|
||||||
|
for (let entryData of talents) {
|
||||||
|
console.log(entryData)
|
||||||
|
htmlTab += `<tr><td>@UUID[Compendium.${compName}.${entryData._id}]{${entryData.name}}</td>`
|
||||||
|
htmlTab += `<td>${entryData.system.description}</td>`;
|
||||||
|
//htmlTab += `<td>${entryData.system.resumebonus}</td>`;
|
||||||
|
htmlTab += "</tr>\n";
|
||||||
|
}
|
||||||
|
htmlTab += "</table>";
|
||||||
|
await JournalEntry.create({ name: 'Liste des Talents de Cellule', content: htmlTab });
|
||||||
|
}
|
||||||
}
|
}
|
2
packs/aides-de-jeu.db
Normal file
2
packs/aides-de-jeu.db
Normal file
File diff suppressed because one or more lines are too long
@ -790,6 +790,7 @@ ul, li {
|
|||||||
width: fit-content;
|
width: fit-content;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
min-width: 6rem;
|
min-width: 6rem;
|
||||||
|
min-height: 1.2rem;
|
||||||
flex-basis: auto;
|
flex-basis: auto;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
line-height: 1rem;
|
line-height: 1rem;
|
||||||
@ -896,6 +897,22 @@ ul, li {
|
|||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hud-adversite-container {
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
width: 64px;
|
||||||
|
min-height: 64px;
|
||||||
|
}
|
||||||
|
.hud-adversite-text {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size:0.9rem;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -85%);
|
||||||
|
}
|
||||||
|
|
||||||
.actor-icon {
|
.actor-icon {
|
||||||
float: left;
|
float: left;
|
||||||
width: 48px;
|
width: 48px;
|
||||||
|
13
system.json
13
system.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "fvtt-hawkmoon-cyd",
|
"id": "fvtt-hawkmoon-cyd",
|
||||||
"description": "Hawmoon RPG for FoundryVTT (CYD system - French)",
|
"description": "Hawmoon RPG for FoundryVTT (CYD system - French)",
|
||||||
"version": "10.1.1",
|
"version": "10.1.2",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Uberwald/LeRatierBretonnien",
|
"name": "Uberwald/LeRatierBretonnien",
|
||||||
@ -35,7 +35,7 @@
|
|||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
"license": "LICENSE.txt",
|
"license": "LICENSE.txt",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/raw/branch/master/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/raw/branch/master/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/archive/fvtt-hawkmoon-cyd-10.1.1.zip",
|
"download": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/archive/fvtt-hawkmoon-cyd-10.1.2.zip",
|
||||||
"packs": [
|
"packs": [
|
||||||
{
|
{
|
||||||
"type": "Item",
|
"type": "Item",
|
||||||
@ -117,6 +117,15 @@
|
|||||||
"system": "fvtt-hawkmoon-cyd",
|
"system": "fvtt-hawkmoon-cyd",
|
||||||
"private": false,
|
"private": false,
|
||||||
"flags": {}
|
"flags": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "JournalEntry",
|
||||||
|
"label": "Aides de Jeu",
|
||||||
|
"name": "aides-de-jeu",
|
||||||
|
"path": "packs/aides-de-jeu.db",
|
||||||
|
"system": "fvtt-hawkmoon-cyd",
|
||||||
|
"private": false,
|
||||||
|
"flags": {}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primaryTokenAttribute": "sante.vigueur",
|
"primaryTokenAttribute": "sante.vigueur",
|
||||||
|
@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
<ul class="item-list alternate-list">
|
<ul class="item-list alternate-list">
|
||||||
<li class="item flexrow">
|
<li class="item flexrow">
|
||||||
<button class="chat-card-button roll-initiative">Initiative</button>
|
<button class="chat-card-button roll-initiative">Initiative (actuelle : {{initiative}} )</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
48
templates/hud-adversites.html
Normal file
48
templates/hud-adversites.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<div class="control-icon hawkmoon-adversite ">
|
||||||
|
<img class="hawkmoon-hud-togglebutton" src="icons/svg/sword.svg" width="36" height="36" title="Action" />
|
||||||
|
<div class="hawkmoon-hud-list tokenhudext right">
|
||||||
|
|
||||||
|
<div class="flexrow tokenhudicon">
|
||||||
|
<div class="hawkmoon-hud-adversite hud-adversite-container" data-action-value="-1"
|
||||||
|
data-action-index="bleue" title="Adversite Bleue">
|
||||||
|
<img class="icon-adversite" src="systems/fvtt-hawkmoon-cyd/assets/icons/gemme_bleue.webp">
|
||||||
|
<div class="hud-adversite-text"> -1</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hawkmoon-hud-adversite hud-adversite-container" data-action-value="+1"
|
||||||
|
data-action-index="bleue" title="Adversite Bleue">
|
||||||
|
<img class="icon-adversite" src="systems/fvtt-hawkmoon-cyd/assets/icons/gemme_bleue.webp">
|
||||||
|
<div class="hud-adversite-text"> +1</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flexrow tokenhudicon">
|
||||||
|
<div class="hawkmoon-hud-adversite hud-adversite-container" data-action-value="-1"
|
||||||
|
data-action-index="rouge" title="Adversite Rouge">
|
||||||
|
<img class="icon-adversite" src="systems/fvtt-hawkmoon-cyd/assets/icons/gemme_rouge.webp">
|
||||||
|
<div class="hud-adversite-text"> -1</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hawkmoon-hud-adversite hud-adversite-container" data-action-value="+1"
|
||||||
|
data-action-index="rouge" title="Adversite Rouge">
|
||||||
|
<img class="icon-adversite" src="systems/fvtt-hawkmoon-cyd/assets/icons/gemme_rouge.webp">
|
||||||
|
<div class="hud-adversite-text"> +1</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flexrow tokenhudicon">
|
||||||
|
<div class="hawkmoon-hud-adversite hud-adversite-container" data-action-value="-1"
|
||||||
|
data-action-index="noire" title="Adversite Noire">
|
||||||
|
<img class="icon-adversite" src="systems/fvtt-hawkmoon-cyd/assets/icons/gemme_noire.webp">
|
||||||
|
<div class="hud-adversite-text"> -1</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hawkmoon-hud-adversite hud-adversite-container" data-action-value="+1"
|
||||||
|
data-action-index="noire" title="Adversite Noire">
|
||||||
|
<img class="icon-adversite" src="systems/fvtt-hawkmoon-cyd/assets/icons/gemme_noire.webp">
|
||||||
|
<div class="hud-adversite-text"> +1</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user