v10.6.3 #613
@ -249,7 +249,7 @@ export class RdDActorSheet extends RdDBaseActorSheet {
|
|||||||
|
|
||||||
// Points de reve actuel
|
// Points de reve actuel
|
||||||
this.html.find('.ptreve-actuel a').click(async event => {
|
this.html.find('.ptreve-actuel a').click(async event => {
|
||||||
this.actor.rollCarac('reve-actuel');
|
this.actor.rollCarac('reve-actuel', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Roll Weapon1
|
// Roll Weapon1
|
||||||
|
@ -1764,6 +1764,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
forceAlcool: forceAlcool,
|
forceAlcool: forceAlcool,
|
||||||
nbDoses: nbDoses,
|
nbDoses: nbDoses,
|
||||||
selectedCarac: this.system.sante.vie,
|
selectedCarac: this.system.sante.vie,
|
||||||
|
jetResistance: 'ethylisme',
|
||||||
carac: this.system.carac,
|
carac: this.system.carac,
|
||||||
caracValue: this.system.sante.vie.max,
|
caracValue: this.system.sante.vie.max,
|
||||||
finalLevel: etat + forceAlcool - nbDoses
|
finalLevel: etat + forceAlcool - nbDoses
|
||||||
@ -1972,7 +1973,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
|
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
|
||||||
if (!this.isPersonnage()) return;
|
if (!this.isPersonnage()) return;
|
||||||
hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
|
hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
|
||||||
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
|
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence, rollData.jetResistance);
|
||||||
if (xpData) {
|
if (xpData) {
|
||||||
const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData);
|
const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData);
|
||||||
if (hideChatMessage) {
|
if (hideChatMessage) {
|
||||||
@ -2197,10 +2198,11 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollCarac(caracName) {
|
async rollCarac(caracName, jetResistance = undefined) {
|
||||||
let rollData = {
|
let rollData = {
|
||||||
selectedCarac: this.getCaracByName(caracName),
|
selectedCarac: this.getCaracByName(caracName),
|
||||||
competences: this.itemTypes['competence']
|
competences: this.itemTypes['competence'],
|
||||||
|
jetResistance: jetResistance ? caracName : undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this, rollData,
|
const dialog = await RdDRoll.create(this, rollData,
|
||||||
@ -2754,7 +2756,7 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _appliquerExperience(rolled, caracName, competence) {
|
async _appliquerExperience(rolled, caracName, competence, jetResistance) {
|
||||||
if (!this.isPersonnage()) return;
|
if (!this.isPersonnage()) return;
|
||||||
// Pas d'XP
|
// Pas d'XP
|
||||||
if (!rolled.isPart || rolled.finalLevel >= 0) {
|
if (!rolled.isPart || rolled.finalLevel >= 0) {
|
||||||
@ -2771,16 +2773,19 @@ export class RdDActor extends RdDBaseActor {
|
|||||||
if (caracName == 'Vie') caracName = 'constitution';
|
if (caracName == 'Vie') caracName = 'constitution';
|
||||||
if (caracName == 'derobee') caracName = 'agilite';
|
if (caracName == 'derobee') caracName = 'agilite';
|
||||||
if (caracName == 'reve-actuel') caracName = 'reve';
|
if (caracName == 'reve-actuel') caracName = 'reve';
|
||||||
|
|
||||||
let xp = Math.abs(rolled.finalLevel);
|
let xp = Math.abs(rolled.finalLevel);
|
||||||
// impair: arrondi inférieur en carac
|
// impair: arrondi inférieur en carac
|
||||||
let xpCarac = competence ? Math.floor(xp / 2) : Math.max(Math.floor(xp / 2), 1);
|
let xpCarac = competence ? Math.floor(xp / 2) : Math.max(Math.floor(xp / 2), 1);
|
||||||
|
|
||||||
let xpData = {
|
const xpCompetence = competence ? xp - xpCarac : 0;
|
||||||
alias: this.name,
|
if (jetResistance) {
|
||||||
caracName: caracName, xpCarac: xpCarac,
|
const message = `Jet de résistance ${jetResistance}, l'expérience est limitée à 1`;
|
||||||
competence: competence, xpCompetence: competence ? xp - xpCarac : 0
|
ui.notifications.info(message);
|
||||||
};
|
console.log(message)
|
||||||
|
// max 1 xp sur jets de résistance
|
||||||
|
xpCarac = Math.min(1, xpCarac);
|
||||||
|
}
|
||||||
|
let xpData = { alias: this.name, caracName, xpCarac, competence, xpCompetence };
|
||||||
|
|
||||||
await this._xpCompetence(xpData);
|
await this._xpCompetence(xpData);
|
||||||
await this._xpCarac(xpData);
|
await this._xpCarac(xpData);
|
||||||
|
Loading…
Reference in New Issue
Block a user