#52 Gestion astrologie
This commit is contained in:
parent
5aba029da9
commit
59a54b8a90
@ -1259,9 +1259,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _appliquerAjoutExperience(rollData) {
|
||||
// TODO: si pas de compétence, minimum 1 pour carac
|
||||
// TODO: appliquer l'expérience automatiquement
|
||||
async _appliquerAjoutExperience(rollData) {
|
||||
this.appliquerExperience( rollData.rolled, rollData.selectedCarac.label, (rollData.competence) ? rollData.competence.data.name: undefined );
|
||||
let xpmsg = RdDResolutionTable.buildXpMessage(rollData.rolled, rollData.finalLevel);
|
||||
let message = ChatUtility.prepareChatMessage('gmroll', this.name);
|
||||
message.content = "<strong>" + rollData.selectedCarac.label + "</strong>"
|
||||
@ -1515,8 +1514,31 @@ export class RdDActor extends Actor {
|
||||
return game.system.rdd.calendrier.getAjustementAstrologique(this.data.data.heure);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
appliquerExperience( rolled, caracName, competenceName = undefined ) {
|
||||
// TODO gestion derobe/tir/lance/melee
|
||||
if (caracName == 'derobee') caracName = 'agilite';
|
||||
|
||||
if ( rolled.isPart && rolled.finalLevel < 0) {
|
||||
if ( !compentenceName) {
|
||||
this.actor.data.data.carac[caracName].xp += 1;
|
||||
} else {
|
||||
let competence = RdDUtility.findCompetence( this.data.items, competenceName );
|
||||
let xpCarac = Math.floor(Math.abs(rolled.finalLevel) / 2);
|
||||
if ( xpCarac == 0 ) {
|
||||
competence.data.xp += 1; // XP en priorité à la compétencence
|
||||
} else
|
||||
competence.data.xp += Math.ceil(Math.abs(rolled.finalLevel) / 2); // XP majoritaire en compentece (ie cas impair)
|
||||
this.actor.data.data.carac[caracName].xp += xpCarac;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async ajouteNombreAstral( data ) {
|
||||
// Gestion expérience (si existante)
|
||||
this.appliquerExperience( request.rolled, "vue", "astrologie");
|
||||
|
||||
// Ajout du nombre astral
|
||||
const item = {name: "Nombre Astral", type: "nombreastral", data:
|
||||
{ value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex( Number(data.date) ) } };
|
||||
|
@ -239,6 +239,7 @@ export class RdDCalendrier extends Application {
|
||||
let nbAstral = this.getNombreAstral( request.date );
|
||||
let nbAstralFaux = nbAstral;
|
||||
request.isValid = true;
|
||||
request.rolled = rolled;
|
||||
if ( !rolled .isSuccess ) {
|
||||
request.isValid = false;
|
||||
while ( nbAstralFaux == nbAstral ) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
<header class="sheet-header">
|
||||
<div class="header-fields">
|
||||
<h1 class="charname">Astrologie</h1>
|
||||
<h1 class="charname">Horoscope</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user