Compare commits

..

4 Commits
13.0.12 ... v13

Author SHA1 Message Date
43ecca8be1 Merge pull request 'v13.0.13 - L'épanouissement d'Illysis' (#777) from VincentVk/foundryvtt-reve-de-dragon:v13 into v13
All checks were successful
Release Creation / build (release) Successful in 2m5s
Reviewed-on: #777
2025-10-18 18:04:36 +02:00
e21f7e398a Création de tâches dans la fenêtre de jets 2025-10-18 00:52:14 +02:00
e16f89743a Affichage des ajustements V2 2025-10-18 00:52:14 +02:00
a6c593c100 Corrections premiers retours 2025-10-18 00:52:14 +02:00
42 changed files with 252 additions and 147 deletions

View File

@@ -1,4 +1,17 @@
# 13.0
## 13.0.13 - L'épanouissement d'Illysis
- Fix d'erreur au chargement de templates RollDialog
- Nouvelle fenêtre de jets de dés
- Fix: affichage des points de tâche
- Fix: affichage des ajustements cohérent
- L'ouverture depuis les caractéristiques permet plusieurs types de jets
- On peut créer ou modifier les tâches dans la fenêtre de jets de tâches
- attaque/défense
- les maladresses sont affichées dans le résultat du jet
- le message au défenseur s'affiche correctement
- la difficulté d'attaque s'applique à la défense
- on peut choisir les particulières en rapidité
## 13.0.12 - La méditation d'Illysis

View File

@@ -707,6 +707,10 @@ select,
display: flex;
flex-direction: column;
}
.system-foundryvtt-reve-de-dragon .chat-message div.roll-chat div.chat-details div,
.system-foundryvtt-reve-de-dragon .dialog-content div.roll-chat div.chat-details div {
display: block;
}
.system-foundryvtt-reve-de-dragon .chat-message div.roll-chat div.chat-actions,
.system-foundryvtt-reve-de-dragon .dialog-content div.roll-chat div.chat-actions {
grid-area: actions;
@@ -757,7 +761,10 @@ select,
.system-foundryvtt-reve-de-dragon .window-header {
background: rgba(0, 0, 0, 0.75);
}
.system-foundryvtt-reve-de-dragon .application .window-content,
.system-foundryvtt-reve-de-dragon .application .window-content {
margin: 0;
padding: 0.2rem;
}
.system-foundryvtt-reve-de-dragon .window-app.sheet .window-content {
margin: 0.2rem;
padding: 0;
@@ -1640,8 +1647,9 @@ select,
height: 2rem;
}
.system-foundryvtt-reve-de-dragon .window-app .window-content,
.system-foundryvtt-reve-de-dragon .window-app.sheet .window-content .sheet-body {
background: #f5f5f0 url(../assets/ui/bg_left.webp) no-repeat left top;
.system-foundryvtt-reve-de-dragon .window-app.sheet .window-content .sheet-body,
.system-foundryvtt-reve-de-dragon .application .window-content {
background: url(../assets/ui/bg_left.webp) no-repeat left top;
}
.system-foundryvtt-reve-de-dragon section.sheet-body {
padding: 0.25rem 0.5rem;
@@ -2316,7 +2324,7 @@ select,
pointer-events: all;
}
.system-foundryvtt-reve-de-dragon div.horloge-roue div.horloge-cercle {
background: hsl(60, 20%, 95%) url(../assets/ui/bg_left.webp) no-repeat left top;
background: hsla(60, 20%, 90%, 0.8);
top: 2%;
left: 2%;
width: 96%;

View File

@@ -12,7 +12,10 @@
background: rgba(0,0,0,0.75);
}
.application .window-content,
.application .window-content {
margin: 0;
padding: 0.2rem;
}
.window-app.sheet .window-content {
margin: 0.2rem;
padding: 0;
@@ -955,8 +958,10 @@
}
}
.window-app .window-content, .window-app.sheet .window-content .sheet-body{
background: rgb(245,245,240) url(../assets/ui/bg_left.webp) no-repeat left top;
.window-app .window-content,
.window-app.sheet .window-content .sheet-body,
.application .window-content {
background: url(../assets/ui/bg_left.webp) no-repeat left top;
}
section.sheet-body {
@@ -1677,7 +1682,7 @@
}
div.horloge-roue div.horloge-cercle {
background: hsl(60, 20%, 95%) url(../assets/ui/bg_left.webp) no-repeat left top;
background: hsla(60, 20%, 90%, 0.8);
top: 2%; left: 2%; width: 96%; height: 96%; border-radius: 50%;
}

View File

@@ -37,6 +37,9 @@
text-align: justify;
display: flex;
flex-direction: column;
div {
display: block;
}
}
div.chat-actions {
grid-area: actions;

View File

@@ -342,7 +342,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
/* -------------------------------------------- */
async createEmptyTache() {
await this.actor.createItem('tache', 'Nouvelle tache');
await this.actor.createItem(ITEM_TYPES.tache, 'Nouvelle tache')
}
_getActionCombat(event) {

View File

@@ -387,7 +387,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
const rollData = {
ids: { actorId: this.id },
type: { allowed: [PART_COMP], current: PART_COMP },
type: { allowed: DEFAULT_ROLL_TYPES, current: PART_COMP },
selected: {
carac: { key: caracName },
comp: options.resistance ? { key: undefined, forced: true } : undefined

View File

@@ -55,7 +55,7 @@ export const RDD_CONFIG = {
particuliere: {
force: { key: 'force', descr: 'en force', img: 'systems/foundryvtt-reve-de-dragon/assets/ui/part-force.svg'},
finesse: { key: 'finesse', descr: 'en finesse', img: 'systems/foundryvtt-reve-de-dragon/assets/ui/part-finesse.svg'},
rapidite: { key: 'finesse', descr: 'en rapidité', img: 'systems/foundryvtt-reve-de-dragon/assets/ui/part-rapidite.svg'},
rapidite: { key: 'rapidite', descr: 'en rapidité', img: 'systems/foundryvtt-reve-de-dragon/assets/ui/part-rapidite.svg'},
}
}

View File

@@ -47,7 +47,7 @@ export class RdDBonus {
penetration: RdDBonus._peneration(rollData),
dmgTactique: RdDBonus.dmgBonus(rollData.tactique),
dmgParticuliere: RdDBonus._dmgParticuliere(rollData),
dmgSurprise: RdDBonus.dmgBonus(rollData.ajustements?.attaqueDefenseurSurpris.used),
dmgSurprise: RdDBonus.dmgBonus(rollData.ajustements?.attaqueDefenseurSurpris?.used),
mortalite: RdDBonus._calculMortalite(rollData, isEntiteIncarnee),
dmgActor: RdDBonus.bonusDmg(actor, rollData.selectedCarac?.label.toLowerCase(), dmgArme),
dmgForceInsuffisante: Math.min(0, actor.getForce() - forceRequise)

View File

@@ -15,9 +15,8 @@ import { RdDItemCompetence } from "./item-competence.js";
import { MAP_PHASE, RdDInitiative } from "./initiative.mjs";
import RollDialog from "./roll/roll-dialog.mjs";
import { PART_DEFENSE } from "./roll/roll-part-defense.mjs";
import { RollDialogAdapter } from "./roll/roll-dialog-adapter.mjs";
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll/roll-constants.mjs";
import { OptionsAvancees, ROLL_DIALOG_V2, ROLL_DIALOG_V2_TEST } from "./settings/options-avancees.js";
import { DIFF, ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll/roll-constants.mjs";
import { OptionsAvancees, ROLL_DIALOG_V2 } from "./settings/options-avancees.js";
import { MappingCreatureArme } from "./item/mapping-creature-arme.mjs";
import { RollBasicParts } from "./roll/roll-basic-parts.mjs";
@@ -380,7 +379,7 @@ export class RdDCombat {
if (defenderToken && Misc.isFirstConnectedGM()) {
const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(msg.attackerId, msg.attackerToken.id, msg.defenderToken.id)
rddCombat?.removeChatMessageActionsPasseArme(msg.paramChatDefense.attackerRoll.passeArme)
if (msg.defenderRoll.ids) {/* TODO: delete roll V1 */
if (msg.defenderRoll.v2) {/* TODO: delete roll V1 */
RollDialog.loadRollData(msg.paramChatDefense)
rddCombat?._chatMessageDefenseV2(msg.paramChatDefense)
} else {
@@ -561,7 +560,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static isEchecTotal(rollData) {
if (rollData.ids /* roll V2*/) {
if (rollData.v2 /* roll V2*/) {
// TODO: en cas de demi-surprise à l'attaque, tout échec est un echec total.
// TODO: en cas de demi-surprise en défense, pas de changement à la règle de base
return rollData.rolled.isETotal
@@ -575,7 +574,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static isParticuliere(rollData) {
if (rollData.ids /* roll V2*/) {
if (rollData.v2 /* roll V2*/) {
return rollData.rolled.isPart
}
if (rollData.attackerRoll || !rollData.ajustements.surprise.used) {
@@ -586,7 +585,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static isReussite(rollData) {
if (rollData.ids /* roll V2*/) {
if (rollData.v2 /* roll V2*/) {
return rollData.rolled.isSuccess
}
if (!rollData.ajustements.surprise.used) {
@@ -686,11 +685,7 @@ export class RdDCombat {
async doRollAttaque(rollData, callbacks = []) {
// TODO V2 await this.proposerAjustementTirLancer(rollData)
await RollDialog.create(rollData, {
onRollDone: (dialog) => {
if (!OptionsAvancees.isUsing(ROLL_DIALOG_V2_TEST))
dialog.close()
},
customChatMessage: true,
onRollDone: RollDialog.onRollDoneClose,
callbacks: [
async (roll) => await this.onAttaqueV2(roll),
...callbacks
@@ -892,7 +887,10 @@ export class RdDCombat {
/* -------------------------------------------- */
isPossession(attackerRoll) {
return attackerRoll.selectedCarac.label.toLowerCase() == 'possession';
const carac = attackerRoll.v2
? attackerRoll.current.carac?.label
: attackerRoll.selectedCarac.label
return carac?.toLowerCase() == 'possession';
}
/* -------------------------------------------- */
@@ -1067,7 +1065,7 @@ export class RdDCombat {
opponentId: this.attackerId,
},
type: { allowed: [ROLL_TYPE_DEFENSE], current: ROLL_TYPE_DEFENSE },
attackerRoll: RollDialogAdapter.mapActionAttaque(attackerRoll),
attackerRoll: attackerRoll,
passeArme: attackerRoll.passeArme,
})
}
@@ -1075,7 +1073,6 @@ export class RdDCombat {
async doRollDefense(rollData, callbacks = []) {
await RollDialog.create(rollData, {
onRollDone: RollDialog.onRollDoneClose,
customChatMessage: true,
callbacks: [
async (roll) => {
this.removeChatMessageActionsPasseArme(roll.passeArme);

View File

@@ -1,5 +1,5 @@
import { ChatUtility } from "../chat-utility.js"
import RollDialog from "./roll-dialog.mjs"
import RollDialog, { ALL_ROLL_TYPES } from "./roll-dialog.mjs"
import { RdDCarac } from "../rdd-carac.js"
import { RdDCombat } from "../rdd-combat.js"
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll-constants.mjs"
@@ -22,8 +22,10 @@ export default class ChatRollResult {
static onReady() {
foundry.applications.handlebars.loadTemplates({
'partial-infojet': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-infojet.hbs',
'partial-appel-chance': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-appel-chance.hbs',
'partial-attaque-particuliere': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-attaque-particuliere.hbs',
'partial-choix-maladresse': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-choix-maladresse.hbs',
'partial-maladresse': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-maladresse.hbs',
'partial-encaissement': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-encaissement.hbs',
'partial-recul-choc': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-recul-choc.hbs',
@@ -122,7 +124,7 @@ export default class ChatRollResult {
}
async buildRollHtml(roll) {
const template = `systems/foundryvtt-reve-de-dragon/templates/roll/result/chat-${roll.type.current}.hbs`
const template = ALL_ROLL_TYPES.find(it => it.code == roll.type.current).chatResultTemplate
const html = await renderTemplate(template, roll)
return await RdDTextEditor.enrichHTML(html, undefined, { showLink: false })
}
@@ -137,7 +139,6 @@ export default class ChatRollResult {
$(html).on("click", '.monter-tmr-normale', event => this.onClickMonteeTMR(event, 'normal'))
$(html).on("click", '.monter-tmr-rapide', event => this.onClickMonteeTMR(event, 'rapide'))
$(html).on("click", '.tirer-maladresse', event => this.onClickTirerMaladresse(event))
}
getCombat(roll) {
@@ -145,7 +146,7 @@ export default class ChatRollResult {
case ROLL_TYPE_DEFENSE:
return RdDCombat.rddCombatForAttackerAndDefender(roll.ids.opponentId, roll.ids.opponentTokenId, roll.ids.actorTokenId)
case ROLL_TYPE_ATTAQUE:
return RdDCombat.rddCombatForAttackerAndDefender(roll.ids.actorId, roll.ids.actorTokenId, roll.ids.opponentId)
return RdDCombat.rddCombatForAttackerAndDefender(roll.ids.actorId, roll.ids.actorTokenId, roll.ids.opponentTokenId)
}
return undefined
}
@@ -162,6 +163,7 @@ export default class ChatRollResult {
await this.saveChatMessageRoll(chatMessage, savedRoll)
const copy = foundry.utils.duplicate(savedRoll)
RollDialog.loadRollData(copy)
savedRoll.dmg = copy.current.attaque?.dmg
this.prepareDisplay(copy)
chatMessage.update({ content: await this.buildRollHtml(copy) })
chatMessage.render(true)
@@ -248,7 +250,7 @@ export default class ChatRollResult {
savedRoll.particuliere = choix
savedRoll.particulieres = [RDD_CONFIG.particuliere[choix]]
await this.updateChatMessage(chatMessage, savedRoll)
await this.getCombat(savedRoll)?.onAttaqueV2(savedRoll, callbacks)
await this.getCombat(savedRoll)?.onAttaqueV2(savedRoll)
}
async onClickFaireGouter(event) {
@@ -273,8 +275,7 @@ export default class ChatRollResult {
const chatMessage = ChatUtility.getChatMessage(event)
const typeMaladresse = event.currentTarget.attributes['data-maladresse'].value
const savedRoll = this.loadChatMessageRoll(chatMessage)
await RdDRollTables.getMaladresse({ arme: typeMaladresse == 'avec-arme' })
savedRoll.type.maladresse = true
savedRoll.maladresse = await RdDRollTables.getMaladresse({ arme: typeMaladresse == 'avec-arme', toChat: false })
savedRoll.type.retry = true
await this.updateChatMessage(chatMessage, savedRoll)
}

View File

@@ -13,7 +13,6 @@ export const ATTAQUE_ROLL_TYPES = [ROLL_TYPE_ATTAQUE]
export const COMBAT_ROLL_TYPES = [ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE]
export const DEMIREVE_ROLL_TYPES = [ROLL_TYPE_SORT]
export const DEFAULT_ROLL_TYPES = [ROLL_TYPE_COMP, ROLL_TYPE_TACHE, ROLL_TYPE_MEDITATION, ROLL_TYPE_CUISINE, ROLL_TYPE_OEUVRE, ROLL_TYPE_JEU]
export const ALL_ROLL_TYPES = [...DEFAULT_ROLL_TYPES, ...COMBAT_ROLL_TYPES, ...DEMIREVE_ROLL_TYPES]
export const DIFF = {

View File

@@ -8,7 +8,7 @@ import { RdDItemArme } from "../item/arme.js";
import { RdDBonus } from "../rdd-bonus.js";
import { ITEM_TYPES, RDD_CONFIG } from "../constants.js";
import { CARACS } from "../rdd-carac.js";
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_OEUVRE } from "./roll-constants.mjs";
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE, ROLL_TYPE_OEUVRE } from "./roll-constants.mjs";
import { PART_ATTAQUE } from "./roll-part-attaque.mjs";
/* -------------------------------------------- */
@@ -27,8 +27,8 @@ export class RollDialogAdapter {
RollDialogAdapter.setRollDataRolled(rollData, rolled, rollTitle)
RollDialogAdapter.adjustRollDataForV1(rollData)
RollDialogAdapter.adjustAttaqueParticuliere(rollData)
RollDialogAdapter.adjustAttaqueDmg(rollData)
RollDialogAdapter.adjustDemiSurprise(rollData)
return rolled
}
@@ -96,14 +96,7 @@ export class RollDialogAdapter {
rolled.niveauNecessaire = RdDResolutionTable.findNiveauNecessaire(rollData.selectedCarac.value, rolled.roll)
rolled.ajustementNecessaire = rolled.niveauNecessaire - diff
}
rollData.ajustements = rollData.ajustements.map(aj => {
return {
used: true,
label: aj.label,
value: aj.diff,
descr: aj.diff == undefined ? aj.label : undefined
}
})
rollData.ajustements = rollData.ajustements.map(aj => { return { label: aj.label, value: aj.value } })
}
static adjustDemiSurprise(rollData) {
@@ -112,6 +105,18 @@ export class RollDialogAdapter {
}
}
static adjustAttaqueDmg(rollData) {
switch (rollData.type.current) {
case ROLL_TYPE_ATTAQUE:
rollData.dmg = RdDBonus.dmgRollV2(rollData, rollData.current.attaque)
break
case ROLL_TYPE_DEFENSE:
rollData.dmg = RdDBonus.dmgRollV2(rollData.attackerRoll, rollData.attackerRoll.current.attaque)
break
}
}
static adjustAttaqueParticuliere(rollData) {
if (rollData.type.current != ROLL_TYPE_ATTAQUE || !rollData.rolled.isPart) {
return

View File

@@ -48,7 +48,7 @@ import { ActorImpacts } from "../technical/actor-impacts.mjs";
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
const ALL_ROLL_TYPES = [
export const ALL_ROLL_TYPES = [
new RollTypeComp(),
new RollTypeTache(),
new RollTypeAttaque(),
@@ -175,11 +175,11 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
{
static onCloseDoNothing() {
}
static onRollDoneDoNothing(dialog) {
static onRollDoneDoNothing(dialog, roll) {
dialog.render()
}
static onRollDoneClose(dialog) {
if (!OptionsAvancees.isUsing(ROLL_DIALOG_V2_TEST))
static onRollDoneClose(dialog, roll) {
if (roll.type.retry || !OptionsAvancees.isUsing(ROLL_DIALOG_V2_TEST))
dialog.close()
}
@@ -199,7 +199,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
ChatRollResult.onReady()
foundry.applications.handlebars.loadTemplates(ALL_ROLL_TYPES.map(m => m.template))
foundry.applications.handlebars.loadTemplates(ALL_ROLL_TYPES.map(m => m.chatResultTemplate))
foundry.applications.handlebars.loadTemplates(ROLL_PARTS.map(p => p.template))
ROLL_PARTS.forEach(p => p.onReady())
@@ -316,6 +316,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
constructor(rollData, rollOptions) {
super()
this.hooks = []
this.rollData = RollDialog.$prepareRollData(rollData)
this.rollOptions = {
callbacks: [
@@ -323,14 +324,28 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
async r => await r.active.actor.appliquerAppelMoral(r),
...(rollOptions.callbacks ?? [])
],
customChatMessage: rollOptions.customChatMessage,
onRollDone: rollOptions.onRollDone ?? RollDialog.onRollDoneDoNothing,
onClose: rollOptions.onClose ?? RollDialog.onCloseDoNothing
}
this.chatRollResult = new ChatRollResult();
this.chatRollResult = new ChatRollResult()
this.selectType()
this.registerHooks(rollData);
}
registerHooks(rollData) {
ROLL_PARTS.filter(p => p.isValid(rollData))
.forEach(p => p.getHooks(this).forEach(h => {
const hook = h.hook;
const id = Hooks.on(hook, h.fn)
this.hooks.push({ hook, id })
}))
}
unregisterHooks() {
this.hooks.forEach(h => Hooks.off(h.hook, h.id))
}
selectType() {
const selectedType = this.getSelectedType();
this.rollData.type.label = selectedType.title(this.rollData)
@@ -386,7 +401,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
return RollDialog.getActiveParts(rollData)
.map(p => p.getAjustements(rollData))
.reduce((a, b) => a.concat(b))
.sort((a, b) => a.diff == undefined ? 1 : b.diff == undefined ? -1 : 0)
.sort((a, b) => a.value == undefined ? 1 : b.value == undefined ? -1 : 0)
}
async buildHTMLTable(carac, diff) {
@@ -408,7 +423,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
visibleRollParts.forEach(p => p.prepareContext(rollData))
RollDialog.calculAjustements(rollData)
RollDialog.calculAjustement(rollData)
const templates = RollDialog.getActiveParts(rollData).map(p => p.toTemplateData())
const context = await super._prepareContext()
@@ -430,12 +445,11 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
}
}
static calculAjustements(rollData) {
static calculAjustement(rollData) {
rollData.ajustements = RollDialog.getAjustements(rollData)
rollData.ajustements.forEach(it => it.isDiff = it.diff != undefined)
rollData.current.totaldiff = rollData.ajustements
.map(adj => adj.diff)
.filter(d => d != undefined)
.filter(a => a.value != undefined)
.map(a => a.value)
.reduce(Misc.sum(), 0)
}
@@ -443,13 +457,14 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
return ALL_ROLL_TYPES.find(m => m.code == this.rollData.type.current)
}
async close(options){
if (this.rollOptions.onClose){
async close(options) {
if (this.rollOptions.onClose) {
this.rollOptions.onClose()
}
this.unregisterHooks()
return await super.close(options)
}
async roll() {
const roll = RollDialog.saveParts(this.rollData)
@@ -475,13 +490,14 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
await impacts.applyImpacts()
selectedRollType.onApplyImpacts(roll, impacts)
await this.chatRollResult.display(roll, impacts)
this.rollOptions.onRollDone(this)
this.rollOptions.onRollDone(this, roll)
}
static loadRollData(roll) {
RollDialog.$prepareRollData(roll)
RollDialog.calculAjustements(roll)
RollDialog.calculAjustement(roll)
roll.v2 = true
return roll
}
async defaultCallback(roll, rolled) {

View File

@@ -63,14 +63,9 @@ export class RollPartAttaque extends RollPartSelect {
getAjustements(rollData) {
const current = this.getCurrent(rollData)
const ajustements = []
if (current.tactique) {
ajustements.push({ label: current.tactique.label, diff: current.tactique.attaque })
}
if (rollData.opponent?.surprise) {
ajustements.push({ label: rollData.opponent.surprise.label, diff: rollData.opponent.surprise.attaque })
}
return ajustements
const tactique = current.tactique ? [{ label: current.tactique.label, value: current.tactique.attaque }] : []
const surprise = rollData.opponent?.surprise ? [{ label: rollData.opponent.surprise.label, value: rollData.opponent.surprise.attaque }] : []
return [...tactique, ...surprise]
}

View File

@@ -35,7 +35,7 @@ export class RollPartCheckbox extends RollPart {
getAjustements(rollData) {
const current = this.getCurrent(rollData)
if (current.checked) {
return [{ label: this.getCheckboxLabelAjustement(rollData), diff: current.value }]
return [{ label: this.getCheckboxLabelAjustement(rollData), value: current.value }]
}
return []
}

View File

@@ -47,7 +47,7 @@ export class RollPartCoeur extends RollPartSelect {
if (current.key != '') {
return [{
label: "Coeur pour " + current.label,
diff: current.value
value: current.value
}]
}
return []

View File

@@ -57,7 +57,7 @@ export class RollPartConditions extends RollPart {
getAjustements(rollData) {
const current = this.getCurrent(rollData)
if (current.value != 0) {
return [{ label: DESCR_CONDITIONS, diff: current.value }]
return [{ label: DESCR_CONDITIONS, value: current.value }]
}
return []
}

View File

@@ -110,7 +110,7 @@ export class RollPartDefense extends RollPartSelect {
isArmeDisparate(rollData) {
const armeDefense = this.getCurrent(rollData).arme
if (armeDefense) {
const armeAttaque = rollData.attackerRoll?.arme
const armeAttaque = rollData.attackerRoll?.current.attaque.arme
return RdDItemArme.defenseArmeParade(armeAttaque, armeDefense) == 'sign'
}
return false
@@ -123,7 +123,11 @@ export class RollPartDefense extends RollPartSelect {
return { diff: 0, type: DIFF.LIBRE }
}
else {
return { diff: rollData.attackerRoll.diff ?? 0, type: DIFF.DEFENSE }
const attackerRoll = rollData.attackerRoll
const diff = attackerRoll.v2
? attackerRoll.selected.diff.value
: attackerRoll.diff
return { diff: diff ?? 0, type: DIFF.DEFENSE }
}
}
}

View File

@@ -66,7 +66,7 @@ export class RollPartDiff extends RollPart {
const current = this.getCurrent(rollData)
return [{
label: current.label,
diff: current.value
value: current.value
}]
}

View File

@@ -72,9 +72,10 @@ export class RollPartMeditation extends RollPartSelect {
}
getAjustements(rollData) {
const malusEchecs = { label: "Méditation", diff: this.getMalusEchecs(rollData) }
const malusConditions = { label: "Conditions", diff: this.getMalusConditions(rollData) }
return [malusConditions, ...(malusEchecs.diff == 0 ? [] : [malusEchecs])]
const malus = this.getMalusEchecs(rollData)
const malusEchecs = malusEchecs == 0 ? [] : [{ label: "Méditation", value: malus }]
const malusConditions = { label: "Conditions", value: this.getMalusConditions(rollData) }
return [malusConditions, ...malusEchecs]
}
$selectMeditation(rollData, key) {

View File

@@ -16,7 +16,7 @@ export class RollPartSelect extends RollPart {
getAjustements(rollData) {
const current = this.getCurrent(rollData)
if (current) {
return [{ label: current.label, diff: current.value }]
return [{ label: current.label, value: current.value }]
}
return []
}

View File

@@ -76,8 +76,8 @@ export class RollPartSign extends RollPart {
const current = this.getCurrent(rollData)
if (current.surprise == 'demi') {
return [
{ label: 'Significative requise ' + Misc.getFractionOneN(current.diviseur), diff: undefined },
...current.reasons.map(it => { return { label: '<i class="fa-solid fa-triangle-exclamation"></i> ' + it, diff: undefined } })
{ label: 'Significative requise ' + Misc.getFractionOneN(current.diviseur) },
...current.reasons.map(it => { return { label: '<i class="fa-solid fa-triangle-exclamation"></i> ' + it } })
]
}
return []

View File

@@ -94,16 +94,11 @@ export class RollPartSort extends RollPartSelect {
getAjustements(rollData) {
const current = this.getCurrent(rollData)
if (current) {
const reserve = current.isReserve ?
[{ label: `Mise en réserve en ${this.getCoord(rollData)}` }] : []
const bonusCase = current.bonusCase ?
[{ label: `Bonus case +${current.bonusCase}%` }] : []
return [
{ label: current.label, diff: current.value },
...bonusCase,
{ label: `Rêve ${current.ptreve}` },
...reserve
]
const sort = { label: current.label, value: current.value }
const reserve = current.isReserve ? [{ label: `Mise en réserve en ${this.getCoord(rollData)}` }] : []
const bonusCase = current.bonusCase ? [{ label: `Bonus case +${current.bonusCase}%` }] : []
const reve = { label: `Rêve ${current.ptreve}` }
return [sort, ...bonusCase, reve, ...reserve]
}
return []
}

View File

@@ -18,10 +18,12 @@ export class RollPartTache extends RollPartSelect {
loadRefs(rollData) {
const refs = this.getRefs(rollData)
const selected = this.getSelected(rollData)
refs.forced = selected.forced
refs.all = rollData.active.actor.itemTypes[ITEM_TYPES.tache]
.filter(tache => !selected.forced || tache.id == selected.key)
.filter(tache => tache.system.points_de_tache_courant < tache.system.points_de_tache)
.map(tache => RollPartTache.$extractTache(tache, rollData.active.actor))
refs.taches = refs.all
if (refs.taches.length > 0) {
this.$selectTache(rollData)
@@ -46,6 +48,8 @@ export class RollPartTache extends RollPartSelect {
async _onRender(rollDialog, context, options) {
const selectTache = rollDialog.element.querySelector(`roll-section[name="${this.code}"] select[name="select-tache"]`)
const buttonCreate = rollDialog.element.querySelector(`roll-section[name="${this.code}"] button[name="create-tache"]`)
const buttonEdit = rollDialog.element.querySelector(`roll-section[name="${this.code}"] button[name="edit-tache"]`)
selectTache.addEventListener("change", e => {
const selectOptions = e.currentTarget.options
@@ -53,14 +57,43 @@ export class RollPartTache extends RollPartSelect {
this.$selectTache(rollDialog.rollData, selectOptions[index]?.value)
rollDialog.render()
})
buttonCreate?.addEventListener(
"click", async e => {
e.preventDefault()
await rollDialog.rollData.active.actor.createItem(ITEM_TYPES.tache, 'Nouvelle tache')
})
buttonEdit?.addEventListener(
"click", e => {
e.preventDefault()
const current = this.getCurrent(rollDialog.rollData)
current.tache?.sheet.render(true)
})
}
getHooks(rollDialog) {
return [
{ hook: "createItem", fn: (item, options, id) => this.onCreateUpdateItem(rollDialog, item, options, id) },
{ hook: "updateItem", fn: (item, options, id) => this.onCreateUpdateItem(rollDialog, item, options, id) }
]
}
onCreateUpdateItem(rollDialog, item, options, id) {
if (item.type == ITEM_TYPES.tache && item.parent?.id == rollDialog.rollData.active.actor.id) {
this.loadRefs(rollDialog.rollData)
rollDialog.render()
}
}
impactOtherPart(part, rollData) {
if (this.visible(rollData)) {
const current = this.getCurrent(rollData)
switch (part.code) {
case PART_CARAC: return part.filterCaracs(rollData, [current?.tache.system.carac])
case PART_COMP: return part.filterComps(rollData, [current.comp?.name])
if (current.tache) {
switch (part.code) {
case PART_CARAC: return part.filterCaracs(rollData, [current?.tache.system.carac])
case PART_COMP: return part.filterComps(rollData, [current.comp?.name])
}
}
}
return undefined

View File

@@ -15,10 +15,6 @@ export class RollPartTricher extends RollPart {
current.resultat = Misc.inRange(current.resultat == undefined ? -1 : current.resultat, -1, 100)
}
getAjustements(rollData) {
return []
}
async _onRender(rollDialog, context, options) {
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)

View File

@@ -6,6 +6,8 @@ export const ROLLDIALOG_SECTION = {
CONDITIONS: 'conditions',
AJUSTEMENTS: 'ajustements',
}
export class RollPart {
static settingKey(rollPart, key) { return `roll-part-${rollPart.code}.${key}` }
@@ -104,10 +106,9 @@ export class RollPart {
return { code: this.code, name: this.name, template: this.template, section: this.section }
}
getAjustements(rollData) {
return []
}
getAjustements(rollData) { return [] }
async _onRender(rollDialog, context, options) { }
getHooks() { return [] }
}

View File

@@ -12,7 +12,7 @@ export class RollTypeTache extends RollType {
title(rollData) {
const current = rollData.current[PART_TACHE]
const tache = current?.tache
return `travaille à sa tâche: ${tache.name ?? ''}`
return tache ? `travaille à sa tâche: ${tache.name}` : `n'a pas de tâches à travailler`
}
onSelect(rollData) {

View File

@@ -1,4 +1,3 @@
{{log rolled}}
<div>
<span {{#if ajustements}}class="tooltip-overflow tooltip-dotted" {{/if}}>
<span>

View File

@@ -11,7 +11,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> 'partial-infojet'}}
</div>
<div class="chat-details">
@@ -19,9 +19,9 @@
{{#if rolled.isSuccess}}
<span>
<strong>{{opponent.name}}</strong> doit se défendre à <strong>{{current.diff.value}}</strong>,
{{#if (eq current.dmg.mortalite 'empoignade')}}
{{#if (eq dmg.mortalite 'empoignade')}}
ou {{active.name}} marquera un point d'empoignade
{{else if (eq current.dmg.mortalite 'non-mortel')}}
{{else if (eq dmg.mortalite 'non-mortel')}}
ou encaisser à <span class="rdd-roll-norm">{{plusMoins dmg.total}} (non-mortel)</span>
{{else}}
ou encaisser à <span class="rdd-roll-echec">{{plusMoins dmg.total}}</span>
@@ -56,11 +56,12 @@
<p>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.hbs"}}
</p>
</div>
<div class="chat-actions">
{{> 'partial-attaque-particuliere'}}
{{> 'partial-maladresse'}}
</div>
<div class="chat-actions">
{{> 'partial-choix-maladresse'}}
{{> 'partial-attaque-particuliere'}}
{{!-- TODO: maladresses --}}
</div>

View File

@@ -4,16 +4,16 @@
<img src="{{current.comp.comp.img}}" data-tooltip="{{current.comp.label}}" />
</div>
<div class="chat-header">
{{active.name}} fait un jet de {{current.comp.label}}
{{active.name}} fait un jet {{#if (eq current.comp.key '')}}sans compétence{{else}}de {{current.comp.label}}{{/if}}
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
{{current.carac.label}}{{#unless (eq current.comp.key '')}} / {{current.comp.label}}{{/unless}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
</div>
<div class="chat-details">
<p>Qualité {{rolled.ptQualite}}, points de tâche {{rolled.ptQualite}}
<p>Qualité {{rolled.ptQualite}}, points de tâche {{rolled.ptTache}}
</p>
{{> 'partial-info-appel-moral'}}
</div>

View File

@@ -14,7 +14,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> "partial-infojet"}}
</div>
<div class="chat-details">

View File

@@ -11,7 +11,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> 'partial-infojet'}}
</div>
<div class="chat-details">
@@ -42,9 +42,11 @@
</span>
{{/if}}
{{> 'partial-info-appel-moral'}}
</div>
<div class="chat-actions">
{{> 'partial-maladresse'}}
</div>
<div class="chat-actions">
{{> 'partial-choix-maladresse'}}
{{> 'partial-recul-choc'}}
{{> 'partial-encaissement'}}
</div>

View File

@@ -9,7 +9,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -9,7 +9,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -9,7 +9,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -16,7 +16,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> 'partial-infojet'}}
</div>
<hr>

View File

@@ -9,7 +9,7 @@
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
<br>{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -0,0 +1,9 @@
{{#if show.maladresse}}
{{#unless maladresse}}
<a class='chat-card-button tirer-maladresse' data-maladresse='{{show.maladresse}}'
data-tooltip="Tirer la maladresse">
<img src="systems/foundryvtt-reve-de-dragon/assets/ui/maladresse.svg"/> Tirer une maladresse
{{#if (eq show.maladresse 'avec-arme')}}armé{{else}}non armé{{/if}}
</a>
{{/unless}}
{{/if}}

View File

@@ -0,0 +1,26 @@
{{#if ajustements}}
<div>
<span class="tooltip-overflow tooltip-dotted" >
<span>
<span>{{rolled.caracValue}} à {{plusMoins rolled.finalLevel}}</span>
<span>= {{rolled.score}}%</span>
{{#if (and rolled.factorHtml (ne rolled.factorHtml 1))}}
<span class="rdd-diviseur">&times;{{{rolled.factorHtml}}}</span>
{{/if}}
</span>
<div class="tooltiptext ttt-ajustements">
{{#each ajustements as |item key|}}
<div class="{{#if item.strong}}strong-text{{/if}}">
{{{item.label}}}{{#if item.value includeZero=true}}: {{plusMoins item.value}}{{/if}}
</div>
{{/each}}
</div>
</span>
</div>
{{/if}}
<div>
<span>{{rolled.roll}} : </span><span class="rdd-roll-{{rolled.code}} strong-text">{{rolled.quality}}</span>
{{#if rolled.ajustementNecessaire}}
<span class="rdd-niveau-requis">(Réussite si {{plusMoins rolled.niveauNecessaire}} / avec niveau {{plusMoins rolled.ajustementNecessaire}}) </span>
{{/if}}
</div>

View File

@@ -1,13 +1,6 @@
{{#if show.maladresse}}
{{#if type.maladresse}}
<span class='chat-card-info'>
<img src="systems/foundryvtt-reve-de-dragon/assets/ui/maladresse.svg"/> Maladresse!
</span>
{{else}}
<a class='chat-card-button tirer-maladresse' data-maladresse='{{show.maladresse}}'
data-tooltip="Tirer la maladresse">
<img src="systems/foundryvtt-reve-de-dragon/assets/ui/maladresse.svg"/> Tirer une maladresse
{{#if (eq show.maladresse 'avec-arme')}}armé{{else}}non armé{{/if}}
</a>
{{/if}}
{{/if}}
{{#if maladresse}}
<span class='chat-card-info'>
<img src="systems/foundryvtt-reve-de-dragon/assets/ui/maladresse.svg"/> Maladresse!
</span>
<div >{{{maladresse}}}</div>
{{/if}}

View File

@@ -2,21 +2,16 @@
<span class="tooltip tooltip-dotted">
<span class="roll-part-resolution">Jet: {{rollData.current.carac.value}} à {{plusMoins rollData.current.totaldiff}}</span>
<div class="tooltiptext ttt-ajustements">
{{#each rollData.ajustements as |ajust|}}
{{#if ajust}}
{{#each rollData.ajustements as |item|}}
<div>
{{#if ajust.descr}}
{{{ajust.descr}}}
{{else}}
{{{ajust.label}}}{{#if ajust.isDiff}}: {{plusMoins ajust.diff}}{{/if}}
{{/if}}
{{{item.label}}}{{#if item.value includeZero=true}}: {{plusMoins item.value}}{{/if}}
</div>
{{/if}}
{{/each}}
</div>
</span>
{{#if rollData.current.significative.used}}
<br><span>
<br>
<span>
Significative requise <span class="rdd-diviseur">&times;{{{rollData.current.significative.label}}}</span>!
</span>
{{/if}}

View File

@@ -7,7 +7,14 @@
{{selectOptions refs.taches selected=current.key valueAttr="key" labelAttr="label"}}
</select>
<selected-numeric-value>{{plusMoins current.value}}</selected-numeric-value>
{{#unless refs.forced}}
<button name="create-tache" data-tooltip="Créer une nouvelle tâche"><i class="fa-solid fa-circle-plus"></i></button>
{{#if refs.taches.length}}
<button name="edit-tache" data-tooltip="Modifier la tâche"><i class="fa-solid fa-edit"></i></button>
{{/if}}
{{/unless}}
</subline>
{{#if refs.taches.length}}
<subline>
Points de tâche: {{current.tache.system.points_de_tache_courant}} /
{{#if current.tache.system.cacher_points_de_tache}}
@@ -25,4 +32,5 @@
{{#if current.tache.system.periodicite}}
<subline>Périodicité: {{current.tache.system.periodicite}}</subline>
{{/if}}
{{/if}}
</roll-part-detail>