Merge branch 'fix-1-1' into 'dev_1.1'

Petits fixes en 1.1

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!81
This commit is contained in:
Leratier Bretonnien 2020-12-18 06:57:01 +00:00
commit 3b33ee79f8
8 changed files with 42 additions and 17 deletions

View File

@ -435,6 +435,10 @@ export class RdDActorSheet extends ActorSheet {
this.actor.setPointsDeSeuil(event.currentTarget.value); this.actor.setPointsDeSeuil(event.currentTarget.value);
} ); } );
html.find('#attribut-protection-edit').change((event) => {
this.actor.updateProtectionValue( event.currentTarget.attributes.name.value, parseInt(event.target.value) );
} );
// On stress change // On stress change
html.find('.compteur-edit').change((event) => { html.find('.compteur-edit').change((event) => {
let fieldName = event.currentTarget.attributes.name.value; let fieldName = event.currentTarget.attributes.name.value;

View File

@ -528,12 +528,19 @@ export class RdDActor extends Actor {
async updateCompteurValue( fieldName, fieldValue ) async updateCompteurValue( fieldName, fieldValue )
{ {
//console.log("Update", fieldName, fieldValue); //console.log("Update", fieldName, fieldValue);
let content;
let compteurs = duplicate(this.data.data.compteurs); let compteurs = duplicate(this.data.data.compteurs);
compteurs[fieldName].value = fieldValue; compteurs[fieldName].value = fieldValue;
await this.update( {"data.compteurs": compteurs } ); await this.update( {"data.compteurs": compteurs } );
} }
/* -------------------------------------------- */
async updateProtectionValue( fieldName, fieldValue )
{
let attributs = duplicate(this.data.data.attributs);
attributs[fieldName].value = fieldValue;
await this.update( {"data.attributs": attributs } );
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** Teste si le conteneur de destination a suffisament de capacité /** Teste si le conteneur de destination a suffisament de capacité
* pour recevoir le nouvel objet * pour recevoir le nouvel objet
@ -1133,7 +1140,7 @@ export class RdDActor extends Actor {
action: r => this._appliquerAjoutExperience(r) action: r => this._appliquerAjoutExperience(r)
}; };
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _appliquerAjoutExperience(rollData) { async _appliquerAjoutExperience(rollData) {
let xpResult = this.appliquerExperience( rollData.rolled, rollData.selectedCarac.label, (rollData.competence) ? rollData.competence.data.name: undefined ); let xpResult = this.appliquerExperience( rollData.rolled, rollData.selectedCarac.label, (rollData.competence) ? rollData.competence.data.name: undefined );
@ -1312,10 +1319,6 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollCompetence( name ) { async rollCompetence( name ) {
if (name == 'queue') {
await this.ajouterQueue({chat: true});
return;
}
let rollData = { let rollData = {
competence: duplicate(this.getCompetence(name)), competence: duplicate(this.getCompetence(name)),
needSignificative : !this.isEntiteCauchemar() && this.data.data.sante.sonne.value needSignificative : !this.isEntiteCauchemar() && this.data.data.sante.sonne.value
@ -1389,6 +1392,7 @@ export class RdDActor extends Actor {
label: 'Jet de Tâche ' + tache.name, label: 'Jet de Tâche ' + tache.name,
callbacks: [ callbacks: [
this.createCallbackExperience(), this.createCallbackExperience(),
{ condition: r=> r.rolled.isETotal, action: r => this._tacheETotal(r)},
{ action: r => this._tacheResult(r) } { action: r => this._tacheResult(r) }
] ]
} ); } );
@ -1400,7 +1404,7 @@ export class RdDActor extends Actor {
// Mise à jour de la tache // Mise à jour de la tache
rollData.tache.data.points_de_tache_courant += rollData.rolled.ptTache; rollData.tache.data.points_de_tache_courant += rollData.rolled.ptTache;
this.updateEmbeddedEntity( "OwnedItem", rollData.tache); this.updateEmbeddedEntity( "OwnedItem", rollData.tache);
this.santeIncDec( "fatigue", -rollData.tache.data.fatigue); this.santeIncDec( "fatigue", rollData.tache.data.fatigue);
// Message de résultat // Message de résultat
ChatUtility.chatWithRollMode({ ChatUtility.chatWithRollMode({
@ -1418,6 +1422,11 @@ export class RdDActor extends Actor {
}, this.name); }, this.name);
} }
_tacheETotal(rollData) {
rollData.tache.data.difficulte --;
this.updateEmbeddedEntity( "OwnedItem", rollData.tache);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_competenceResult(rollData) { _competenceResult(rollData) {
ChatUtility.chatWithRollMode({ ChatUtility.chatWithRollMode({
@ -1688,7 +1697,8 @@ export class RdDActor extends Actor {
this.updateEmbeddedEntity("OwnedItem", update); this.updateEmbeddedEntity("OwnedItem", update);
} }
} }
protection = Math.max(protection - Misc.toInt(arme.data.penetration), 0); const penetration = arme ? Misc.toInt(arme.data.penetration) : 0;
protection = Math.max(protection - penetration, 0);
protection += this.getProtectionNaturelle(); protection += this.getProtectionNaturelle();
console.log("Final protect", protection); console.log("Final protect", protection);
return protection; return protection;

View File

@ -58,13 +58,17 @@ export class RdDCalendrier extends Application {
} }
// nombre astral // nombre astral
if ( game.user.isGM) { if ( game.user.isGM) {
this.listeNombreAstral = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral")); this.listeNombreAstral = this._loadListNombreAstral();
this.rebuildListeNombreAstral(); // Ensure always up-to-date this.rebuildListeNombreAstral(); // Ensure always up-to-date
} }
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral); console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
} }
_loadListNombreAstral() {
return Object.values(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral"));
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static get defaultOptions() { static get defaultOptions() {
const options = super.defaultOptions; const options = super.defaultOptions;
@ -114,7 +118,7 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */ /* -------------------------------------------- */
getNombreAstral( index ) { getNombreAstral( index ) {
const liste = this.listeNombreAstral || game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral") const liste = this.listeNombreAstral || this._loadListNombreAstral();
let astralData = liste.find( (nombreAstral, i) => nombreAstral.index == index ); let astralData = liste.find( (nombreAstral, i) => nombreAstral.index == index );
return astralData.nombreAstral || "N/A"; return astralData.nombreAstral || "N/A";
} }

View File

@ -296,7 +296,9 @@ export class RdDCombat {
switch (categorie) { switch (categorie) {
case 'tir': case 'tir':
case 'lancer': case 'lancer':
return items.filter(item => item.data.competence.toLowerCase().match("bouclier")); return items.filter(item =>
item.type == 'arme' &&
item.data.competence.toLowerCase().match("bouclier"));
default: default:
return items.filter(item => { return items.filter(item => {
if (item.type == 'competencecreature') { if (item.type == 'competencecreature') {

View File

@ -35,7 +35,7 @@ export class RdDRoll extends Dialog {
etat: actor.data.data.compteurs.etat.value, etat: actor.data.data.compteurs.etat.value,
carac: actor.data.data.carac, carac: actor.data.data.carac,
finalLevel: 0, finalLevel: 0,
diffConditions: 0, diffConditions: rollData.arme ? RdDBonus.bonusAttaque(rollData.surpriseDefenseur) :0,
diffLibre: 0, diffLibre: 0,
editLibre: true, editLibre: true,
editConditions: true, editConditions: true,
@ -110,7 +110,6 @@ export class RdDRoll extends Dialog {
rollData.dmg = rollData.attackerRoll ? rollData.attackerRoll.dmg : RdDBonus.dmg(rollData, actor.getBonusDegat()); rollData.dmg = rollData.attackerRoll ? rollData.attackerRoll.dmg : RdDBonus.dmg(rollData, actor.getBonusDegat());
rollData.finalLevel = rollLevel; rollData.finalLevel = rollLevel;
rollData.caracValue = caracValue; rollData.caracValue = caracValue;
rollData.diffConditions = RdDBonus.bonusAttaque(rollData.surpriseDefenseur);
rollData.coupsNonMortels = (rollData.attackerRoll ? rollData.attackerRoll.dmg.mortalite : rollData.dmg.mortalite) == 'non-mortel'; rollData.coupsNonMortels = (rollData.attackerRoll ? rollData.attackerRoll.dmg.mortalite : rollData.dmg.mortalite) == 'non-mortel';
let dmgText = Misc.toSignedString(rollData.dmg.total); let dmgText = Misc.toSignedString(rollData.dmg.total);
if (rollData.coupsNonMortels) { if (rollData.coupsNonMortels) {

View File

@ -78,7 +78,7 @@ function _cumulSegmentsFatigue(matrix) {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
const fatigueMatrix = _buildAllSegmentsFatigue(30); const fatigueMatrix = _buildAllSegmentsFatigue(60);
const cumulFatigueMatrix = _cumulSegmentsFatigue(fatigueMatrix); const cumulFatigueMatrix = _cumulSegmentsFatigue(fatigueMatrix);
const fatigueMalus = [ 0, 0, 0, -1, -1, -1, -2, -3, -4, -5, -6, -7 ]; // Provides the malus for each segment of fatigue const fatigueMalus = [ 0, 0, 0, -1, -1, -1, -2, -3, -4, -5, -6, -7 ]; // Provides the malus for each segment of fatigue

View File

@ -81,7 +81,7 @@
"protection": { "protection": {
"type": "number", "type": "number",
"value": 0, "value": 0,
"label": "Protection", "label": "Protection naturelle",
"derivee": false "derivee": false
} }
} }
@ -189,7 +189,7 @@
"protection": { "protection": {
"type": "number", "type": "number",
"value": 0, "value": 0,
"label": "Protection", "label": "Protection naturelle",
"derivee": false "derivee": false
} }
}, },

View File

@ -125,7 +125,13 @@
<ul class="carac-list"> <ul class="carac-list">
{{#each data.attributs as |attr key|}} {{#each data.attributs as |attr key|}}
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="competence flexrow list-item" data-attribute="{{key}}">
<span class="competence-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} : {{attr.value}}</span> <span class="competence-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} :
{{#if (eq key 'protection')}}
<input id="attribut-protection-edit" type="text" name="{{key}}" value="{{attr.value}}" data-dtype="number"/><span/>
{{else}}
{{attr.value}}
{{/if}}
</span>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>