forked from public/foundryvtt-reve-de-dragon
Corrections premiers retours
This commit is contained in:
@@ -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
|
||||
|
@@ -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'},
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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"
|
||||
@@ -24,6 +24,7 @@ export default class ChatRollResult {
|
||||
foundry.applications.handlebars.loadTemplates({
|
||||
'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 +123,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 +138,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) {
|
||||
@@ -248,7 +248,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 +273,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)
|
||||
}
|
||||
|
@@ -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 = {
|
||||
|
@@ -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())
|
||||
|
||||
@@ -323,11 +323,10 @@ 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()
|
||||
}
|
||||
|
||||
@@ -475,7 +474,7 @@ 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) {
|
||||
|
@@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user