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