forked from public/foundryvtt-reve-de-dragon
Liste des ajustements
Après le travail sur les ChatMessage, centraliser les difficultés pour les dialog-roll afin d'afficher tous les ajustements sous forme de tooltips Les ajustements à améliorer: * malus armure * sur-encombrement * encombrement total + fix regression tâches + fix méditation isisPuritication
This commit is contained in:
105
module/actor.js
105
module/actor.js
@ -161,55 +161,65 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getReveActuel() {
|
||||
return this.data.data.reve.reve.value;
|
||||
return this.data.data.reve?.reve?.value ?? this.data.data.carac.reve.value;
|
||||
}
|
||||
|
||||
getChanceActuel() {
|
||||
return this.data.data.compteurs.chance.value;
|
||||
return this.data.data.compteurs.chance?.value ?? 10;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getForceValue() {
|
||||
return this.data.data.carac.force ? this.data.data.carac.force.value : this.data.data.carac.reve.value;
|
||||
return this.data.data.carac.force?.force ?? this.data.data.carac.reve.value;
|
||||
}
|
||||
getMoralTotal() {
|
||||
return this.data.data.compteurs.moral?.value ?? 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getBonusDegat() {
|
||||
// TODO: gérer séparation et +dom créature/entité indépendament de la compétence
|
||||
return Misc.toInt(this.data.data.attributs.plusdom.value);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getProtectionNaturelle() {
|
||||
return Misc.toInt(this.data.data.attributs.protection.value);
|
||||
}
|
||||
|
||||
getEtatGeneral() {
|
||||
return this.data.data.compteurs.etat.value;
|
||||
}
|
||||
getMalusArmure() {
|
||||
return this.data.data.attributs?.malusarmure?.value ?? 0;
|
||||
}
|
||||
getEncTotal() {
|
||||
return Math.floor(this.encTotal ?? 0);
|
||||
}
|
||||
getSurenc(){
|
||||
return this.data.data.compteurs?.surenc?.value ?? 0;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getCompetenceList() {
|
||||
return this.data.items.filter( (item) => item.type == 'competence');
|
||||
}
|
||||
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getCompetence(compName) {
|
||||
return RdDUtility.findCompetence(this.data.items, compName);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getTache( id ) {
|
||||
return this.data.items.find( item => item.type=='tache' && item._id == id );
|
||||
}
|
||||
getMeditation( id ) {
|
||||
return this.data.items.find( item => item.type=='meditation' && item._id == id );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getBestDraconic() {
|
||||
const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau);
|
||||
if (list.length==0)
|
||||
{
|
||||
return { name: "none", niveau: -11 };
|
||||
}
|
||||
}
|
||||
return duplicate(list[0]);
|
||||
}
|
||||
|
||||
getEncTotal() {
|
||||
return Math.floor(this.encTotal ?? 0);
|
||||
}
|
||||
|
||||
getSurenc(){
|
||||
return this.data.data.compteurs?.surenc?.value ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async deleteSortReserve(sortReserve) {
|
||||
@ -227,11 +237,6 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDiviseurSignificative() {
|
||||
return this.getSurprise() == 'demi' ? 2 : 1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSurprise() {
|
||||
if (this.isEntiteCauchemar()) {
|
||||
@ -506,7 +511,7 @@ export class RdDActor extends Actor {
|
||||
async combattreReveDeDragon(force){
|
||||
let draconic = this.getBestDraconic();
|
||||
let niveau = Math.max(0, draconic.data.niveau);
|
||||
let etat = this.data.data.compteurs.etat.value;
|
||||
let etat = this.getEtatGeneral();
|
||||
let difficulte = niveau - etat - force;
|
||||
let reveActuel = this.getReveActuel();
|
||||
let rolled = await RdDResolutionTable.roll(reveActuel, difficulte);
|
||||
@ -704,7 +709,7 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
detectSurEncombrement( ) {
|
||||
let diffEnc = Number(this.encTotal) - Number(this.data.data.attributs.encombrement.value);
|
||||
return Math.min(0, Math.ceil(diffEnc));
|
||||
return Math.max(0, Math.ceil(diffEnc));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1230,7 +1235,7 @@ export class RdDActor extends Actor {
|
||||
async ethylismeTest() {
|
||||
let rollData = {
|
||||
vieValue: this.data.data.sante.vie.value,
|
||||
etat: this.data.data.compteurs.etat.value - Math.min(0, this.data.data.compteurs.ethylisme.value), // Pour les jets d'Ethylisme, on ignore le degré d'éthylisme (p.162)
|
||||
etat: this.getEtatGeneral() - Math.min(0, this.data.data.compteurs.ethylisme.value), // Pour les jets d'Ethylisme, on ignore le degré d'éthylisme (p.162)
|
||||
diffNbDoses: -Number(this.data.data.compteurs.ethylisme.nb_doses || 0),
|
||||
finalLevel: 0,
|
||||
diffConditions: 0,
|
||||
@ -1423,6 +1428,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _appliquerAjoutExperience(rollData, display=true) {
|
||||
if (!this.isPersonnage()) return;
|
||||
let xpResult = this.appliquerExperience( rollData.rolled, rollData.selectedCarac.label, rollData.competence);
|
||||
if (display && xpResult.result ) {
|
||||
let xpmsg = "<br>Points d'expérience gagnés ! Carac: " + xpResult.xpCarac + ", Comp: " + xpResult.xpCompetence;
|
||||
@ -1634,7 +1640,7 @@ export class RdDActor extends Actor {
|
||||
this.currentTMR.maximize(); // Re-display TMR
|
||||
}
|
||||
// Final chat message
|
||||
await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-sort.html');
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-sort.html');
|
||||
|
||||
if (myReve.value == 0) { // 0 points de reve
|
||||
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
|
||||
@ -1653,7 +1659,7 @@ export class RdDActor extends Actor {
|
||||
label: 'Jet ' + Grammar.apostrophe('de', rollData.selectedCarac.label),
|
||||
callbacks: [
|
||||
this.createCallbackExperience(),
|
||||
{ action: this._onRollCaracResult }
|
||||
{ action: r => this._onRollCaracResult(r) }
|
||||
]
|
||||
}
|
||||
);
|
||||
@ -1663,7 +1669,7 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async _onRollCaracResult(rollData) {
|
||||
// Final chat message
|
||||
await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-general.html');
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1684,7 +1690,7 @@ export class RdDActor extends Actor {
|
||||
label: 'Jet ' +Grammar.apostrophe('de', name),
|
||||
callbacks: [
|
||||
this.createCallbackExperience(),
|
||||
{ action: this._competenceResult }
|
||||
{ action: r => this._competenceResult(r) }
|
||||
]
|
||||
} );
|
||||
dialog.render(true);
|
||||
@ -1708,11 +1714,6 @@ export class RdDActor extends Actor {
|
||||
await this.createOwnedItem( tache, { renderSheet: true } );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getTacheMeditation ( id ) {
|
||||
return this.data.items.find( item => item._id == id );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollTache( id ) {
|
||||
let tache = duplicate( this.getTache( id ) );
|
||||
@ -1749,7 +1750,7 @@ export class RdDActor extends Actor {
|
||||
this.updateEmbeddedEntity( "OwnedItem", rollData.tache);
|
||||
this.santeIncDec( "fatigue", rollData.tache.data.fatigue);
|
||||
|
||||
RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-tache.html');
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1760,24 +1761,26 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollMeditation( id ) {
|
||||
let meditation = duplicate( this.getTacheMeditation( id ) );
|
||||
let meditation = duplicate(this.getMeditation(id));
|
||||
let competence = duplicate(this.getCompetence(meditation.data.competence));
|
||||
competence.data.defaut_carac = "intellect"; // Meditation = tjs avec intellect
|
||||
let meditationData = {
|
||||
competence: competence,
|
||||
competence: competence,
|
||||
meditation: meditation,
|
||||
conditionMeditation: {
|
||||
isHeure: false,
|
||||
isVeture: false,
|
||||
isComportement: false,
|
||||
isPurification: false,
|
||||
},
|
||||
diffConditions: 0,
|
||||
editLibre: false,
|
||||
editConditions: true,
|
||||
isHeure: false,
|
||||
isVeture: false,
|
||||
isComportement: false,
|
||||
isPurification: false,
|
||||
carac : { }
|
||||
};
|
||||
meditationData.carac["intellect"] = duplicate(this.data.data.carac["intellect"]);
|
||||
|
||||
console.log("rollMedittion !!!", meditationData);
|
||||
console.log("rollMeditation !!!", meditationData);
|
||||
|
||||
const dialog = await RdDRoll.create(this, meditationData, {html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html'}, {
|
||||
name: 'jet-meditation',
|
||||
@ -1805,7 +1808,6 @@ export class RdDActor extends Actor {
|
||||
RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html');
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_meditationETotal(meditationData) {
|
||||
meditationData.meditation.data.malus--;
|
||||
@ -1814,14 +1816,13 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _competenceResult(rollData) {
|
||||
RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-competence.html')
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollAppelChance( )
|
||||
{
|
||||
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' };
|
||||
|
||||
const dialog = await RdDRoll.create(this, rollData,
|
||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html'},
|
||||
{
|
||||
@ -1841,7 +1842,7 @@ export class RdDActor extends Actor {
|
||||
if (rollData.rolled.isSuccess) {
|
||||
await this.chanceActuelleIncDec(-1)
|
||||
}
|
||||
RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-appelchance.html')
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1940,15 +1941,13 @@ export class RdDActor extends Actor {
|
||||
return {
|
||||
label: 'Rêve actuel',
|
||||
value: this.getReveActuel(),
|
||||
type: "number",
|
||||
ignoreEtatGeneral: true
|
||||
type: "number"
|
||||
};
|
||||
case 'chance-actuelle': case 'Chance actuelle':
|
||||
return {
|
||||
label: 'Chance actuelle',
|
||||
value: this.getChanceActuel(),
|
||||
type: "number",
|
||||
ignoreEtatGeneral: true
|
||||
type: "number"
|
||||
};
|
||||
}
|
||||
return RdDActor._findCaracByName(this.data.data.carac, caracName);
|
||||
@ -2210,7 +2209,7 @@ export class RdDActor extends Actor {
|
||||
await entite.setEntiteReveAccordee(this);
|
||||
}
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-accorder-cauchemar.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.html');
|
||||
if (rolled.isPart) {
|
||||
await this._appliquerAjoutExperience(rollData, true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user