Gestion armures

This commit is contained in:
LeRatierBretonnien 2020-06-23 23:34:12 +02:00
parent 30a9f08f73
commit d24be22c5e
14 changed files with 101 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -65,6 +65,9 @@ export class RdDActorSheet extends ActorSheet {
arme.data.niveau = melee.data.niveau arme.data.niveau = melee.data.niveau
} }
} }
// To avoid armour and so on...
data.data.armes_seules = duplicate( this._checkNull(data.itemsByType['arme']));
if (data.competenceByCategory && data.competenceByCategory.melee) { if (data.competenceByCategory && data.competenceByCategory.melee) {
//Specific case for Esquive and Corps à Corps //Specific case for Esquive and Corps à Corps
@ -88,9 +91,9 @@ export class RdDActorSheet extends ActorSheet {
data.data.armures = this._checkNull(data.itemsByType['armure']); data.data.armures = this._checkNull(data.itemsByType['armure']);
data.data.livres = this._checkNull(data.itemsByType['livre']); data.data.livres = this._checkNull(data.itemsByType['livre']);
data.data.potions = this._checkNull(data.itemsByType['potions']); data.data.potions = this._checkNull(data.itemsByType['potions']);
data.data.herbes = this._checkNull(data.itemsByType['potions']); data.data.herbes = this._checkNull(data.itemsByType['herbes']);
data.data.competenceByCategory = data.competenceByCategory; data.data.competenceByCategory = data.competenceByCategory;
data.data.armes = data.itemsByType.arme; //data.data.armes = data.itemsByType.arme;
//console.log(">>>>> data update"); //console.log(">>>>> data update");
return data; return data;
@ -119,6 +122,13 @@ export class RdDActorSheet extends ActorSheet {
li.slideUp(200, () => this.render(false)); li.slideUp(200, () => this.render(false));
}); });
// Equip Inventory Item
html.find('.item-equip').click(ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.equiperObjet(li.data("itemId"));
this.render(true);
});
// Roll Carac // Roll Carac
html.find('.carac-label a').click((event) => { html.find('.carac-label a').click((event) => {
let caracName = event.currentTarget.attributes.name.value; let caracName = event.currentTarget.attributes.name.value;
@ -138,45 +148,45 @@ export class RdDActorSheet extends ActorSheet {
}); });
// On carac change // On carac change
$(".carac-value").change((event) => { html.find('.carac-value').change((event) => {
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", ""); let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
//console.log("Value changed :", event, caracName); //console.log("Value changed :", event, caracName);
this.actor.updateCarac( caracName, parseInt(event.target.value) ); this.actor.updateCarac( caracName, parseInt(event.target.value) );
} ); } );
// On competence change // On competence change
$(".competence-value").change((event) => { html.find('.competence-value').change((event) => {
let compName = event.currentTarget.attributes.compname.value; let compName = event.currentTarget.attributes.compname.value;
//console.log("Competence changed :", compName); //console.log("Competence changed :", compName);
this.actor.updateCompetence( compName, parseInt(event.target.value) ); this.actor.updateCompetence( compName, parseInt(event.target.value) );
} ); } );
// On competence change // On competence change
$(".competence-xp").change((event) => { html.find('.competence-xp').change((event) => {
let compName = event.currentTarget.attributes.compname.value; let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXP( compName, parseInt(event.target.value) ); this.actor.updateCompetenceXP( compName, parseInt(event.target.value) );
} ); } );
$("#vie-plus").click((event) => { html.find('#vie-plus').click((event) => {
this.actor.santeIncDec("vie", 1); this.actor.santeIncDec("vie", 1);
this.render(true); this.render(true);
}); });
$("#vie-moins").click((event) => { html.find('#vie-moins').click((event) => {
this.actor.santeIncDec("vie", -1); this.actor.santeIncDec("vie", -1);
this.render(true); this.render(true);
}); });
$("#endurance-plus").click((event) => { html.find('#endurance-plus').click((event) => {
this.actor.santeIncDec("endurance", 1); this.actor.santeIncDec("endurance", 1);
this.render(true); this.render(true);
}); });
$("#endurance-moins").click((event) => { html.find('#endurance-moins').click((event) => {
this.actor.santeIncDec("endurance", -1); this.actor.santeIncDec("endurance", -1);
this.render(true); this.render(true);
}); });
$("#fatigue-plus").click((event) => { html.find('#fatigue-plus').click((event) => {
this.actor.santeIncDec("fatigue", 1); this.actor.santeIncDec("fatigue", 1);
this.render(true); this.render(true);
}); });
$("#fatigue-moins").click((event) => { html.find('#fatigue-moins').click((event) => {
this.actor.santeIncDec("fatigue", -1); this.actor.santeIncDec("fatigue", -1);
this.render(true); this.render(true);
}); });

View File

@ -394,11 +394,25 @@ export class RdDActor extends Actor {
} }
} }
/* -------------------------------------------- */
equiperObjet( itemID )
{
let item = this.getOwnedItem(itemID);
if ( item && item.data.data )
item.data.data.equipe = !item.data.data.equipe;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
computeArmure( locData ) computeArmure( locData )
{ {
/* TODO */ let protection = 0;
return 0; for (const item of this.data.items) {
if (item.type == "armure" && item.data.equipe) {
protection += item.data.protection;
}
}
console.log("Final protect", protection);
return protection;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -93,12 +93,12 @@ export class RdDRollDialog extends Dialog {
}); });
// Update ! // Update !
$('#bonusmalus').click((event) => { html.find('#bonusmalus').click((event) => {
rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus
//console.log("BM CLICKED !!!", rollData.bmValue, rollData.competence.data.niveau, parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue) ); //console.log("BM CLICKED !!!", rollData.bmValue, rollData.competence.data.niveau, parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue) );
updateRollResult(rollData); updateRollResult(rollData);
}); });
$('#carac').click((event) => { html.find('#carac').click((event) => {
let caracKey = event.currentTarget.value; let caracKey = event.currentTarget.value;
rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac
//console.log("CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue); //console.log("CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue);

View File

@ -77,6 +77,7 @@ export class RdDUtility {
//Items //Items
'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-arme-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-arme-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-armure-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-categorie.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-categorie.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-base.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-base.html',

View File

@ -2,10 +2,10 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "L'implémentation de Rêve de Dragon pour FoundryVTT", "description": "L'implémentation de Rêve de Dragon pour FoundryVTT",
"version": "0.7.4", "version": "0.7.5",
"minimumCoreVersion": "0.6.0", "minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.6.2", "compatibleCoreVersion": "0.6.2",
"templateVersion": 13, "templateVersion": 14,
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
"esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ],
"styles": ["styles/simple.css"], "styles": ["styles/simple.css"],

View File

@ -330,7 +330,8 @@
"quantite": 1, "quantite": 1,
"encombrement": 0, "encombrement": 0,
"equipe": false, "equipe": false,
"pa": 0, "protection": 0,
"deterioration": 0,
"malus": 0, "malus": 0,
"cout": 0 "cout": 0
}, },

View File

@ -306,13 +306,27 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
<ol class="item-list"> <ol class="item-list">
{{#each actor.items as |item id|}} {{#each data.armes_seules as |item id|}}
<li class="item flexrow" data-item-id="{{item._id}}"> <li class="item flexrow" data-item-id="{{item._id}}">
<img src="{{item.img}}" title="{{item.name}}" width="24" height="24"/> <img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<h4 class="item-name">{{item.name}}</h4> <h4 class="item-name">{{item.name}}</h4>
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-control item-equip" title="Equiper">{{#if item.data.equipe}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
<ol class="item-list">
{{#each data.armures as |item id|}}
<li class="item flexrow" data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<h4 class="item-name">{{item.name}}</h4>
<div class="item-controls">
<a class="item-control item-equip" title="Equiper">{{#if item.data.equipe}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}

View File

@ -0,0 +1,39 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
<label for="xp">Protection</label>
<input class="attribute-value" type="text" name="data.protection" value="{{data.protection}}" data-dtype="Number"/>
</div>
<div class="form-group">
<label for="xp">Encombrement </label>
<input class="attribute-value" type="text" name="data.encombrement" value="{{data.encombrement}}" data-dtype="Number"/>
</div>
<div class="form-group">
<label for="xp">Détérioration</label>
<input class="attribute-value" type="text" name="data.deterioration" value="{{data.deterioration}}" data-dtype="Number"/>
</div>
<div class="form-group">
<label for="xp">Malus Armure </label>
<input class="attribute-value" type="text" name="data.malus" value="{{data.malus}}" data-dtype="Number"/>
</div>
<div class="form-group">
<label for="xp">Prix (sols) </label>
<input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number"/>
</div>
<header class="header-field">
<span>Description : </span>
</header>
<div class="form-group" style="height:200px">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</section>
</form>