diff --git a/module/actor-sheet.js b/module/actor-sheet.js index b2cdb406..6423b518 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -216,7 +216,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet { // Points de reve actuel this.html.find('.roll-reve-actuel').click(async event => await this.actor.rollReveActuel({ resistance: false })) - this.html.find('.button-reve-resistance').click(async event => await this.actor.rollReveActuel({ diff: -8, resistance: true })) + this.html.find('.button-reve-resistance').click(async event => await this.actor.rollReveResistance()) this.html.find('.action-empoignade').click(async event => await RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor))) this.html.find('.roll-arme').click(async event => { diff --git a/module/actor/base-actor-reve.js b/module/actor/base-actor-reve.js index 73644566..74598c0f 100644 --- a/module/actor/base-actor-reve.js +++ b/module/actor/base-actor-reve.js @@ -26,7 +26,7 @@ import { BASE_CORPS_A_CORPS, BASE_ESQUIVE, CATEGORIES_COMPETENCES_CREATURES } fr import { RollDataAjustements } from "../rolldata-ajustements-v1.js"; import { MappingCreatureArme } from "../item/mapping-creature-arme.mjs"; import RollDialog from "../roll/roll-dialog.mjs"; -import { DEFAULT_ROLL_TYPES, DIFF, ROLL_TYPE_ATTAQUE, ROLL_TYPE_COMP } from "../roll/roll-constants.mjs"; +import { DEFAULT_ROLL_TYPES, DIFF, ROLL_TYPE_ATTAQUE, ROLL_TYPE_COMP, ROLL_TYPE_REVE_RESISTANCE } from "../roll/roll-constants.mjs"; import { OptionsAvancees, ROLL_DIALOG_V2 } from "../settings/options-avancees.js"; import { RdDInitiative } from "../initiative.mjs"; import { RdDItemCompetenceCreature } from "../item-competencecreature.js"; @@ -155,7 +155,7 @@ export class RdDBaseActorReve extends RdDBaseActor { async remiseANeuf() { } async ajoutExperience(rollData, hideChatMessage = 'show') { } - computeResumeBlessure() { return []} + computeResumeBlessure() { return [] } countBlessures(filter = it => !it.isContusion()) { return 0 } async santeIncDec(name, inc, isCritique) { } @@ -411,13 +411,33 @@ export class RdDBaseActorReve extends RdDBaseActor { }) } /* -------------------------------------------- */ + async rollReveResistance(diff = -8) { + return await RollDialog.create( + { + ids: { actorId: this.id }, + type: { + allowed: [ROLL_TYPE_REVE_RESISTANCE], + current: ROLL_TYPE_REVE_RESISTANCE, + resistance: true + }, + selected: { + carac: { key: CARACS.REVE_ACTUEL, forced: true }, + comp: { key: undefined, forced: true }, + diff: { type: DIFF.DEFAUT, value: diff } + } + }, + { + onRollDone: (dialog, roll) => RollDialog.onRollDoneClose(dialog, roll) + }) + } + async rollReveActuel({ diff = 0, resistance = false }) { if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) { const rollData = { ids: { actorId: this.id }, type: { - allowed: [ROLL_TYPE_COMP], - current: ROLL_TYPE_COMP, + allowed: [ROLL_TYPE_REVE_RESISTANCE], + current: ROLL_TYPE_REVE_RESISTANCE, resistance: resistance }, selected: { diff --git a/module/roll/roll-constants.mjs b/module/roll/roll-constants.mjs index 686470bf..b8547c0e 100644 --- a/module/roll/roll-constants.mjs +++ b/module/roll/roll-constants.mjs @@ -10,6 +10,7 @@ export const ROLL_TYPE_OEUVRE = 'oeuvre' export const ROLL_TYPE_SORT = 'sort' export const ROLL_TYPE_TACHE = 'tache' export const ROLL_TYPE_APPEL_CHANCE = 'appel-chance' +export const ROLL_TYPE_REVE_RESISTANCE = 'reve-resistance' export const ATTAQUE_ROLL_TYPES = [ROLL_TYPE_ATTAQUE] export const COMBAT_ROLL_TYPES = [ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE] diff --git a/module/roll/roll-dialog.mjs b/module/roll/roll-dialog.mjs index 92057480..666fefa5 100644 --- a/module/roll/roll-dialog.mjs +++ b/module/roll/roll-dialog.mjs @@ -51,6 +51,7 @@ import { RollTypePossession } from "./roll-type-possession.mjs"; import { RollPartPossession } from "./roll-part-possession.mjs"; import { RollPartApprecier } from "./roll-part-apprecier.mjs"; import { RollTypeAppelChance } from "./roll-type-appel-chance.mjs"; +import { RollTypeReveResistance } from "./roll-type-resistance.mjs"; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api @@ -67,7 +68,7 @@ export const ALL_ROLL_TYPES = [ new RollTypeOeuvre(), new RollTypeJeu(), new RollTypeAppelChance(), - // new RollTypeResistance ?? + new RollTypeReveResistance(), // new RollTypeFixedCarac ?? ] diff --git a/module/roll/roll-type-appel-chance.mjs b/module/roll/roll-type-appel-chance.mjs index 20d39fde..aca761e4 100644 --- a/module/roll/roll-type-appel-chance.mjs +++ b/module/roll/roll-type-appel-chance.mjs @@ -2,19 +2,6 @@ import { CARACS } from "../rdd-carac.js" import { DIFF, ROLL_TYPE_APPEL_CHANCE } from "./roll-constants.mjs" import { RollType } from "./roll-type.mjs" -const SPECIAL_ROLL_TYPES_DETAILS = { - label: "fait appel à la chance", - icon: `systems/foundryvtt-reve-de-dragon/assets/ui/chance.svg`, - rollData: { - selected: { - carac: { key: CARACS.CHANCE_ACTUELLE, forced: true }, - diff: { value: 0, type: '' }, - comp: { key: '', forced: true }, - conditions: { hide: true } - } - } -} - export class RollTypeAppelChance extends RollType { get code() { return ROLL_TYPE_APPEL_CHANCE } get name() { return `fait appel à la chance` } diff --git a/module/roll/roll-type-resistance.mjs b/module/roll/roll-type-resistance.mjs new file mode 100644 index 00000000..3646de80 --- /dev/null +++ b/module/roll/roll-type-resistance.mjs @@ -0,0 +1,31 @@ +import { CARACS } from "../rdd-carac.js" +import { DIFF, ROLL_TYPE_REVE_RESISTANCE } from "./roll-constants.mjs" +import { RollType } from "./roll-type.mjs" + +export class RollTypeReveResistance extends RollType { + get code() { return ROLL_TYPE_REVE_RESISTANCE } + get name() { return `fait un jet de résistance` } + get icon() { return `systems/foundryvtt-reve-de-dragon/assets/ui/resistance.svg` } + get chatResultTemplate() { return `systems/foundryvtt-reve-de-dragon/templates/roll/result/chat-reve-resistance.hbs` } + + title(rollData) { + return this.name + } + + setRollDataType(rollData) { + foundry.utils.mergeObject(rollData, { + selected: { + carac: { key: CARACS.REVE_ACTUEL, forced: true }, + diff: { value: -8, type: '' }, + comp: { key: '', forced: true }, + conditions: { hide: true } + } + }) + super.setRollDataType(rollData) + } + + onSelect(rollData) { + this.setDiffType(rollData, DIFF.DEFAUT) + } + +} \ No newline at end of file diff --git a/templates/roll/result/chat-reve-resistance.hbs b/templates/roll/result/chat-reve-resistance.hbs new file mode 100644 index 00000000..e83672f1 --- /dev/null +++ b/templates/roll/result/chat-reve-resistance.hbs @@ -0,0 +1,24 @@ +