#38 - Gestion des armes 1/2mains
This commit is contained in:
parent
73441000a2
commit
1c2a60017d
@ -62,7 +62,8 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
|
|
||||||
// Force empty arme, at least for Esquive
|
// Force empty arme, at least for Esquive
|
||||||
if (data.itemsByType.arme == undefined ) data.itemsByType.arme = [];
|
if (data.itemsByType.arme == undefined ) data.itemsByType.arme = [];
|
||||||
for (const arme of data.itemsByType.arme) {
|
let arme2mains = []; // tablea contenant la duplication des armes 1m/2m
|
||||||
|
for (const arme of data.itemsByType.arme) {
|
||||||
arme.data.niveau = 0; // Per default, TODO to be fixed
|
arme.data.niveau = 0; // Per default, TODO to be fixed
|
||||||
for ( const melee of data.competenceByCategory.melee ) {
|
for ( const melee of data.competenceByCategory.melee ) {
|
||||||
if (melee.name == arme.data.competence )
|
if (melee.name == arme.data.competence )
|
||||||
@ -76,8 +77,19 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
if (lancer.name == arme.data.competence )
|
if (lancer.name == arme.data.competence )
|
||||||
arme.data.niveau = lancer.data.niveau
|
arme.data.niveau = lancer.data.niveau
|
||||||
}
|
}
|
||||||
|
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
||||||
|
if (arme.data.unemain && arme.data.deuxmains) {
|
||||||
|
let arme2main = duplicate(arme);
|
||||||
|
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
|
||||||
|
for ( const melee of data.competenceByCategory.melee ) {
|
||||||
|
if (melee.name == arme2main.data.competence )
|
||||||
|
arme2main.data.niveau = melee.data.niveau
|
||||||
|
}
|
||||||
|
arme2mains.push(arme2main);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
data.itemsByType.arme = data.itemsByType.arme.concat(arme2mains); // Merge all cases
|
||||||
|
|
||||||
// To avoid armour and so on...
|
// To avoid armour and so on...
|
||||||
data.data.combat = duplicate( RdDUtility.checkNull(data.itemsByType['arme']));
|
data.data.combat = duplicate( RdDUtility.checkNull(data.itemsByType['arme']));
|
||||||
|
|
||||||
@ -237,7 +249,8 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
// Roll Weapon1
|
// Roll Weapon1
|
||||||
html.find('.arme-label a').click((event) => {
|
html.find('.arme-label a').click((event) => {
|
||||||
let armeName = event.currentTarget.text;
|
let armeName = event.currentTarget.text;
|
||||||
this.actor.rollArme( armeName);
|
let competenceName = event.currentTarget.attributes['data-competence-name'].value;
|
||||||
|
this.actor.rollArme( armeName, competenceName);
|
||||||
});
|
});
|
||||||
// Display TMR, normal
|
// Display TMR, normal
|
||||||
html.find('.visu-tmr a').click((event) => {
|
html.find('.visu-tmr a').click((event) => {
|
||||||
|
@ -1032,13 +1032,15 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
rollArme( armeName )
|
rollArme( armeName, competenceName=undefined )
|
||||||
{
|
{
|
||||||
let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
|
let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
|
||||||
if ( armeItem && armeItem.data.competence )
|
if (armeItem ) {
|
||||||
this.rollCompetence( armeItem.data.competence, armeItem );
|
if ( competenceName == undefined) competenceName = armeItem.data.competence;
|
||||||
else
|
this.rollCompetence( competenceName, armeItem );
|
||||||
this.rollCompetence( armeName ); //Bypass mode!
|
} else {
|
||||||
|
this.rollCompetence( armeName ); //Bypass mode!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1059,7 +1061,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
if ( competence.type == 'competencecreature') { // Specific case for Creatures
|
if ( competence.type == 'competencecreature') { // Specific case for Creatures
|
||||||
if ( competence.data.iscombat ) {
|
if ( competence.data.iscombat ) {
|
||||||
armeItem = { name: name, data: { dommages: competence.data.dommages} };
|
armeItem = { name: name, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
|
||||||
}
|
}
|
||||||
competence.data.defaut_carac = "carac_creature"; // Fake default competence
|
competence.data.defaut_carac = "carac_creature"; // Fake default competence
|
||||||
competence.data.categorie = "creature"; // Fake default competence
|
competence.data.categorie = "creature"; // Fake default competence
|
||||||
@ -1068,6 +1070,16 @@ export class RdDActor extends Actor {
|
|||||||
rollData.carac = { carac_creature: { label: name, value: competence.data.carac_value } };
|
rollData.carac = { carac_creature: { label: name, value: competence.data.carac_value } };
|
||||||
} else { // Usual competence
|
} else { // Usual competence
|
||||||
rollData.competence = competence;
|
rollData.competence = competence;
|
||||||
|
armeItem.data.dommagesReels = armeItem.data.dommages; // Per default
|
||||||
|
if ( !armeItem.data.unemain && !armeItem.data.deuxmains) // Force default
|
||||||
|
armeItem.data.unemain = true;
|
||||||
|
if (armeItem.data.unemain && armeItem.data.deuxmains) { // manage 1/2 main
|
||||||
|
//console.log("Weapon", armeItem.data.dommages);
|
||||||
|
if ( name.toLowerCase().includes("1 main") )
|
||||||
|
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[0]);
|
||||||
|
else // 2 mains
|
||||||
|
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[1]);
|
||||||
|
}
|
||||||
rollData.arme = armeItem;
|
rollData.arme = armeItem;
|
||||||
rollData.carac = this.data.data.carac;
|
rollData.carac = this.data.data.carac;
|
||||||
}
|
}
|
||||||
|
@ -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": "Rêve de Dragon RPG for FoundryVTT",
|
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||||
"version": "0.9.77",
|
"version": "0.9.78",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 47,
|
"templateVersion": 48,
|
||||||
"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"],
|
||||||
|
@ -537,15 +537,17 @@
|
|||||||
"quantite": 1,
|
"quantite": 1,
|
||||||
"encombrement": 0,
|
"encombrement": 0,
|
||||||
"equipe": false,
|
"equipe": false,
|
||||||
"dommages": 0,
|
"dommages": "0",
|
||||||
"force": 0,
|
"force": "0",
|
||||||
"resistance": 0,
|
"resistance": 0,
|
||||||
"competence": "",
|
"competence": "",
|
||||||
"cout": 0,
|
"cout": 0,
|
||||||
"portee_courte": 0,
|
"portee_courte": 0,
|
||||||
"portee_moyenne": 0,
|
"portee_moyenne": 0,
|
||||||
"portee_extreme": 0,
|
"portee_extreme": 0,
|
||||||
"rapide": false
|
"rapide": false,
|
||||||
|
"deuxmains": false,
|
||||||
|
"unemain": false
|
||||||
},
|
},
|
||||||
"munition": {
|
"munition": {
|
||||||
"description": "",
|
"description": "",
|
||||||
|
@ -320,7 +320,7 @@
|
|||||||
<ol class="item-list">
|
<ol class="item-list">
|
||||||
{{#each data.combat as |arme key|}}
|
{{#each data.combat as |arme key|}}
|
||||||
<li class="item flexrow" data-item-id="{{arme._id}}">
|
<li class="item flexrow" data-item-id="{{arme._id}}">
|
||||||
<span class="arme-label" name="data.armes[{{key}}].name"><a>{{arme.name}}</a></span>
|
<span class="arme-label" name="data.armes[{{key}}].name"><a data-competence-name="{{arme.data.competence}}">{{arme.name}}</a></span>
|
||||||
<span class="competence-label" name="data.armes[{{key}}].data.competence">{{arme.data.competence}}</span>
|
<span class="competence-label" name="data.armes[{{key}}].data.competence">{{arme.data.competence}}</span>
|
||||||
<span class="competence-label" name="data.armes[{{key}}].data.niveau">{{numberFormat arme.data.niveau decimals=0 sign=true}}</span>
|
<span class="competence-label" name="data.armes[{{key}}].data.niveau">{{numberFormat arme.data.niveau decimals=0 sign=true}}</span>
|
||||||
<span class="competence-label" name="data.armes[{{key}}].data.dommages">{{numberFormat arme.data.dommages decimals=0 sign=true}}</span>
|
<span class="competence-label" name="data.armes[{{key}}].data.dommages">{{numberFormat arme.data.dommages decimals=0 sign=true}}</span>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
{{#if arme}}
|
{{#if arme}}
|
||||||
<div>
|
<div>
|
||||||
<label>Arme : {{arme.name}}</label>
|
<label>Arme : {{arme.name}}</label>
|
||||||
<label>Degats : {{arme.data.dommages}}</label>
|
<label>Degats : {{arme.data.dommagesReels}}</label>
|
||||||
<label for="xp">Coups Non Mortels ? </label>
|
<label for="xp">Coups Non Mortels ? </label>
|
||||||
<input class="attribute-value" type="checkbox" id="coupsNonMortels" name="coupsNonMortels" {{#if coupsNonMortels}}checked{{/if}}/>
|
<input class="attribute-value" type="checkbox" id="coupsNonMortels" name="coupsNonMortels" {{#if coupsNonMortels}}checked{{/if}}/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="niveau">Dommmages </label>
|
<label for="niveau">Dommmages </label>
|
||||||
<input class="attribute-value" type="text" name="data.dommages" value="{{data.dommages}}" data-dtype="Number"/>
|
<input class="attribute-value" type="text" name="data.dommages" value="{{data.dommages}}" data-dtype="String"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="xp">Résistance </label>
|
<label for="xp">Résistance </label>
|
||||||
@ -30,12 +30,20 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="xp">Force min. </label>
|
<label for="xp">Force min. </label>
|
||||||
<input class="attribute-value" type="text" name="data.force" value="{{data.force}}" data-dtype="Number"/>
|
<input class="attribute-value" type="text" name="data.force" value="{{data.force}}" data-dtype="String"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="xp">Arme rapide ? </label>
|
<label for="xp">Arme rapide ? </label>
|
||||||
<input class="attribute-value" type="checkbox" name="data.rapide" {{#if data.rapide}}checked{{/if}}/>
|
<input class="attribute-value" type="checkbox" name="data.rapide" {{#if data.rapide}}checked{{/if}}/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="xp">A Une main ? </label>
|
||||||
|
<input class="attribute-value" type="checkbox" name="data.unemain" {{#if data.unemain}}checked{{/if}}/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="xp">A Deux mains ? </label>
|
||||||
|
<input class="attribute-value" type="checkbox" name="data.deuxmains" {{#if data.deuxmains}}checked{{/if}}/>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="xp">Portée courte </label>
|
<label for="xp">Portée courte </label>
|
||||||
<input class="attribute-value" type="text" name="data.portee_courte" value="{{data.portee_courte}}" data-dtype="Number"/>
|
<input class="attribute-value" type="text" name="data.portee_courte" value="{{data.portee_courte}}" data-dtype="Number"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user