Le lancer des armes
On peut maintenant configurer une arme de mélée pour être lancée
This commit is contained in:
parent
eb0afffbd6
commit
cdde7c5f2f
@ -3199,7 +3199,9 @@ export class RdDActor extends Actor {
|
||||
signes: this.listItemsData("signedraconique"),
|
||||
caracReve: this.system.carac.reve.value,
|
||||
pointsReve: this.getReveActuel(),
|
||||
isRapide: isRapide
|
||||
isRapide: isRapide,
|
||||
isGM: game.user.isGM,
|
||||
hasPlayerOwner: this.hasPlayerOwner
|
||||
}
|
||||
|
||||
this.currentTMR = await RdDTMRDialog.create(this, tmrFormData);
|
||||
|
@ -177,7 +177,7 @@ export class RdDItemArme extends Item {
|
||||
equipe: true,
|
||||
rapide: true,
|
||||
force: 0,
|
||||
dommages: 0,
|
||||
dommages: "0",
|
||||
dommagesReels: 0,
|
||||
mortalite: 'non-mortel',
|
||||
competence: 'Corps à corps',
|
||||
|
@ -151,50 +151,61 @@ export class RdDCombatManager extends Combat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** Retourne une liste triée d'actions d'armes avec le split arme1 main / arme 2 main */
|
||||
/** Retourne une liste triée d'actions d'armes avec le split arme1 main / arme 2 main / lancer */
|
||||
static listActionsArmes(armes, competences, carac) {
|
||||
// Gestion des armes 1/2 mains
|
||||
let actionsArme = [];
|
||||
let actions = [];
|
||||
for (const arme of armes) {
|
||||
let action = duplicate(arme)
|
||||
if (action.system.equipe) {
|
||||
let compData = competences.find(c => c.name == action.system.competence)
|
||||
if (arme.system.equipe) {
|
||||
const dommages = arme.system.dommages;
|
||||
const tableauDommages = dommages.includes("/") ? dommages.split("/") : [dommages, dommages] ;
|
||||
if (arme.system.unemain && arme.system.deuxmains && !dommages.includes("/")) {
|
||||
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + arme.name + " ne sont pas corrects (ie sous la forme X/Y)");
|
||||
}
|
||||
if (arme.system.unemain) {
|
||||
actions.push(RdDCombatManager.$prepareAttaqueArme({
|
||||
arme: arme,
|
||||
infoMain: "(1 main)",
|
||||
dommagesReel: Number(tableauDommages[0]),
|
||||
competence: arme.system.competence,
|
||||
carac: carac,
|
||||
competences: competences
|
||||
}));
|
||||
}
|
||||
if (arme.system.deuxmains) {
|
||||
actions.push(RdDCombatManager.$prepareAttaqueArme({
|
||||
arme: arme,
|
||||
infoMain: "(2 mains)",
|
||||
dommagesReel: Number(tableauDommages[1]),
|
||||
competence: arme.system.competence.replace(" 1 main", " 2 mains"),
|
||||
carac: carac,
|
||||
competences: competences
|
||||
}));
|
||||
}
|
||||
if (arme.system.lancer) {
|
||||
actions.push(RdDCombatManager.$prepareAttaqueArme({
|
||||
arme: arme,
|
||||
infoMain: "(lancer)",
|
||||
dommagesReel: Number(tableauDommages[0]),
|
||||
competence: arme.system.lancer,
|
||||
carac: carac,
|
||||
competences: competences
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
return actions.sort(Misc.ascending(action => action.name + (action.system.infoMain ?? '')));
|
||||
}
|
||||
|
||||
actionsArme.push(action);
|
||||
action.action = 'attaque';
|
||||
action.system.dommagesReels = Number(action.system.dommages);
|
||||
action.system.niveau = compData.system.niveau;
|
||||
action.system.initiative = RdDCombatManager.calculInitiative(compData.system.niveau, carac[compData.system.defaut_carac].value);
|
||||
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
||||
if (action.system.unemain && !action.system.deuxmains) {
|
||||
action.system.mainInfo = "(1m)";
|
||||
} else if (!action.system.unemain && action.system.deuxmains) {
|
||||
action.system.mainInfo = "(2m)";
|
||||
} else if (action.system.unemain && action.system.deuxmains) {
|
||||
action.system.mainInfo = "(1m)";
|
||||
|
||||
const comp2m = action.system.competence.replace(" 1 main", " 2 mains"); // Replace !
|
||||
const comp = competences.find(c => c.name == comp2m)
|
||||
|
||||
const arme2main = duplicate(action);
|
||||
arme2main.system.mainInfo = "(2m)";
|
||||
arme2main.system.niveau = comp.system.niveau;
|
||||
arme2main.system.competence = comp2m;
|
||||
arme2main.system.initiative = RdDCombatManager.calculInitiative(arme2main.system.niveau, carac[comp.system.defaut_carac].value);
|
||||
actionsArme.push(arme2main);
|
||||
const containsSlash = action.system.dommages.includes("/");
|
||||
if (containsSlash) {
|
||||
const tableauDegats = action.system.dommages.split("/");
|
||||
action.system.dommagesReels = Number(tableauDegats[0]);
|
||||
arme2main.system.dommagesReels = Number(tableauDegats[1]);
|
||||
}
|
||||
else{
|
||||
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + action.name + " ne sont pas corrects (ie sous la forme X/Y)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return actionsArme.sort(Misc.ascending(armeData => armeData.name + (armeData.system.mainInfo ?? '')));
|
||||
static $prepareAttaqueArme(infoAttaque) {
|
||||
const comp = infoAttaque.competences.find(c => c.name == infoAttaque.competence);
|
||||
const attaque = duplicate(infoAttaque.arme);
|
||||
attaque.action = 'attaque';
|
||||
attaque.system.competence = infoAttaque.competence;
|
||||
attaque.system.dommagesReels = infoAttaque.dommagesReel;
|
||||
attaque.system.infoMain = infoAttaque.infoMain;
|
||||
attaque.system.niveau = comp.system.niveau;
|
||||
attaque.system.initiative = RdDCombatManager.calculInitiative(comp.system.niveau, infoAttaque.carac[comp.system.defaut_carac].value);
|
||||
return attaque;
|
||||
}
|
||||
|
||||
static listActionsCreature(competences) {
|
||||
|
@ -203,6 +203,7 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-potion.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-competence-lancer.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-herbesoin-ingredient.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-heures.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-initpremierround.html',
|
||||
|
@ -644,6 +644,7 @@
|
||||
"force": "0",
|
||||
"resistance": 0,
|
||||
"competence": "",
|
||||
"lancer": "",
|
||||
"cout": 0,
|
||||
"portee_courte": 0,
|
||||
"magique": false,
|
||||
|
@ -5,7 +5,15 @@
|
||||
<tr id="tmrrow1">
|
||||
<td>
|
||||
{{#if (eq mode "visu")}}
|
||||
<div class="flex-group-center">
|
||||
<h4>Visualisation!</h4>
|
||||
</div>
|
||||
{{else}}
|
||||
{{#if (and isGM hasPlayerOwner)}}
|
||||
<div class="flex-group-center">
|
||||
<h4>Le gardien gére les TMR du joueur, le joueur ne peut pas monter dans les TMR!</h4>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="flex-group-center">
|
||||
<img class="small-button-direction" id='dir-top-left' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top-left.svg'>
|
||||
<img class="small-button-direction" id='dir-top' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top.svg'>
|
||||
@ -16,7 +24,6 @@
|
||||
<img class="small-button-direction" id='dir-bottom' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom.svg'>
|
||||
<img class="small-button-direction" id='dir-bottom-right' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom-right.svg'>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="flex-group-center lire-signe-draconique">
|
||||
<a>Lire un signe draconique</a>
|
||||
</div>
|
||||
@ -43,6 +50,7 @@
|
||||
Fatigue
|
||||
<span id="tmr-fatigue-table">{{{fatigue.html}}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
5
templates/enum-competence-lancer.html
Normal file
5
templates/enum-competence-lancer.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{#each (trier @root.competences) as |competence key|}}
|
||||
{{#if (eq competence.system.categorie 'lancer')}}
|
||||
<option value="{{competence.name}}">{{competence.name}}</option>
|
||||
{{/if}}
|
||||
{{/each}}
|
@ -7,7 +7,7 @@
|
||||
data-combatant-id="{{../combatant.id}}"
|
||||
data-action-index="{{action.index}}"
|
||||
title="{{action.name}}">
|
||||
<label>{{action.name}} {{action.system.mainInfo}}</label>
|
||||
<label>{{action.name}} {{action.system.infoMain}}</label>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
|
@ -6,7 +6,7 @@
|
||||
data-combatant-id="{{../combatant.id}}"
|
||||
data-action-index="{{action.index}}"
|
||||
title="{{action.name}}">
|
||||
<label>init: {{action.name}} {{action.system.mainInfo}}</label>
|
||||
<label>init: {{action.name}} {{action.system.infoMain}}</label>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{#each commandes as |commande key|}}
|
||||
|
@ -11,6 +11,15 @@
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="system.lancer">Compétence de lancer</label>
|
||||
<select name="system.lancer" data-dtype="String">
|
||||
{{#select system.lancer}}
|
||||
<option value="">- lancer impossible -</option>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-competence-lancer.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="system.dommages">Dommages </label>
|
||||
<input class="attribute-value" type="text" name="system.dommages" value="{{system.dommages}}" data-dtype="String"/>
|
||||
|
Loading…
Reference in New Issue
Block a user