Gestion des attaques ciblées
This commit is contained in:
parent
05026d454b
commit
577eccbbd3
@ -70,6 +70,16 @@ export class HeritiersActor extends Actor {
|
||||
return armes
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getOtherMeleeWeapons(excludeArme) {
|
||||
let armes = []
|
||||
for (let arme of this.items) {
|
||||
if ( HeritiersUtility.isArmeMelee(arme) && arme.id != excludeArme._id) {
|
||||
armes.push(this.prepareArme(arme))
|
||||
}
|
||||
}
|
||||
return armes
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getMonnaies() {
|
||||
return this.items.filter(it => it.type == "monnaie")
|
||||
}
|
||||
@ -613,6 +623,7 @@ export class HeritiersActor extends Actor {
|
||||
rollData.caracKey = key
|
||||
rollData.arme = arme
|
||||
rollData.mode = "arme"
|
||||
rollData.armes = this.getOtherMeleeWeapons(arme)
|
||||
if (rollData.defenderTokenId && arme.system.isMelee ) {
|
||||
rollData.cacheDifficulte = true
|
||||
}
|
||||
@ -634,6 +645,7 @@ export class HeritiersActor extends Actor {
|
||||
rollData.caracKey = key
|
||||
rollData.arme = duplicate(arme)
|
||||
rollData.mode = "attaquebrutale"
|
||||
rollData.armes = this.getOtherMeleeWeapons(arme)
|
||||
rollData.rulesMalus.push({ name: "Attaque brutale", value: -2 } )
|
||||
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||
rollDialog.render(true)
|
||||
@ -650,6 +662,7 @@ export class HeritiersActor extends Actor {
|
||||
rollData.carac = this.system.caracteristiques[key]
|
||||
rollData.caracKey = key
|
||||
rollData.arme = duplicate(arme)
|
||||
rollData.armes = this.getOtherMeleeWeapons(arme)
|
||||
rollData.mode = "attaquecharge"
|
||||
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||
rollDialog.render(true)
|
||||
|
@ -93,6 +93,13 @@ export const HERITIERS_CONFIG = {
|
||||
"30": "Divine"
|
||||
},
|
||||
|
||||
attaqueCible: {
|
||||
"none": "Aucune",
|
||||
"membre": "Membre",
|
||||
"main": "Main",
|
||||
"tete": "Tête/Coeur"
|
||||
},
|
||||
|
||||
categorieArme : {
|
||||
"trait": "Arme de trait",
|
||||
"poing": "Arme de poing",
|
||||
|
@ -5,7 +5,7 @@ export class HeritiersRollDialog extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, rollData) {
|
||||
|
||||
let options = { classes: ["HeritiersDialog"], width: 320, height: 'fit-content', 'z-index': 99999 };
|
||||
let options = { classes: ["HeritiersDialog"], width: 420, height: 'fit-content', 'z-index': 99999 };
|
||||
let html = await renderTemplate('systems/fvtt-les-heritiers/templates/roll-dialog-generic.html', rollData);
|
||||
|
||||
return new HeritiersRollDialog(actor, rollData, html, options);
|
||||
@ -119,6 +119,12 @@ export class HeritiersRollDialog extends Dialog {
|
||||
html.find('#attaqueDos').change((event) => {
|
||||
this.rollData.attaqueDos = event.currentTarget.checked
|
||||
})
|
||||
html.find('#bonus-attaque-seconde-arme').change((event) => {
|
||||
this.rollData.secondeArme = String(event.currentTarget.value)
|
||||
})
|
||||
html.find('#attaque-cible').change((event) => {
|
||||
this.rollData.attaqueCible = String(event.currentTarget.value)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
@ -338,14 +338,31 @@ export class HeritiersUtility {
|
||||
/* -------------------------------------------- */
|
||||
static computeArmeDegats(rollData, actor) {
|
||||
rollData.degatsArme = rollData.arme.system.degats + rollData.marge
|
||||
if (rollData.arme.system.categorie == "lourde") {
|
||||
rollData.degatsArme += actor.system.caracteristiques.for.value
|
||||
if (rollData.attaqueDeuxArmes != 0 && rollData.secondeArme ) {
|
||||
let secondeArme = actor.items.get(secondeArme)
|
||||
if (secondeArme) {
|
||||
rollData.degatsArme += secondeArme.system.degats
|
||||
rollData.degatsArme += actor.system.caracteristiques.for.value
|
||||
}
|
||||
} else {
|
||||
if (rollData.arme.system.categorie == "lourde") {
|
||||
rollData.degatsArme += actor.system.caracteristiques.for.value
|
||||
}
|
||||
if (rollData.arme.system.categorie == "blanche" || rollData.arme.system.categorie == "improvise") {
|
||||
rollData.degatsArme += Math.max(0, actor.system.caracteristiques.for.value - 2)
|
||||
}
|
||||
if (rollData.mode == "attaquecharge") {
|
||||
rollData.degatsArme += 3
|
||||
}
|
||||
}
|
||||
if (rollData.arme.system.categorie == "blanche" || rollData.arme.system.categorie == "improvise") {
|
||||
rollData.degatsArme += Math.max(0, actor.system.caracteristiques.for.value - 2)
|
||||
if (rollData.attaqueCible == "membre") {
|
||||
rollData.degatsArme -= 2
|
||||
}
|
||||
if (rollData.mode == "attaquecharge") {
|
||||
rollData.degatsArme += 3
|
||||
if (rollData.attaqueCible == "main") {
|
||||
rollData.degatsArme -= 3
|
||||
}
|
||||
if (rollData.attaqueCible == "tete") {
|
||||
rollData.degatsArme *= 3
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,6 +434,7 @@ export class HeritiersUtility {
|
||||
}
|
||||
rollData.diceFormula += `+${ruleMalus}`
|
||||
|
||||
// Gestion bonus attaque à plusieurs
|
||||
let bonusAttaque = rollData.bonusAttaquePlusieurs
|
||||
if (rollData.attaqueDos) {
|
||||
bonusAttaque = 2
|
||||
@ -426,6 +444,24 @@ export class HeritiersUtility {
|
||||
}
|
||||
rollData.diceFormula += `+${bonusAttaque}`
|
||||
|
||||
// Gestion attaque avec 2 armes
|
||||
if (rollData.attaqueDeuxArmes != 0) {
|
||||
rollData.diceFormula += `+${rollData.attaqueDeuxArmes}`
|
||||
}
|
||||
// Gestion des attaques ciblées
|
||||
if (rollData.attaqueCible != "none") {
|
||||
if ( rollData.attaqueCible == "membre") {
|
||||
rollData.diceFormula += `-2`
|
||||
}
|
||||
if ( rollData.attaqueCible == "main") {
|
||||
rollData.diceFormula += `-3`
|
||||
}
|
||||
if ( rollData.attaqueCible == "tete") {
|
||||
rollData.diceFormula += `-6`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
|
||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
rollData.roll = myRoll
|
||||
@ -576,8 +612,11 @@ export class HeritiersUtility {
|
||||
sdList: game.system.lesheritiers.config.seuilsDifficulte,
|
||||
sdValue: -1,
|
||||
bonusAttaquePlusieurs: 0,
|
||||
attaqueDeuxArmes: 0,
|
||||
attaqueDos: false,
|
||||
bonusMalusContext: 0,
|
||||
attaqueCible: "none",
|
||||
config: game.system.lesheritiers.config,
|
||||
rulesMalus : []
|
||||
}
|
||||
return rollData
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "fvtt-les-heritiers",
|
||||
"description": "Les Héritiers pour FoundryVTT",
|
||||
"version": "10.0.37",
|
||||
"version": "10.1.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Uberwald/LeRatierBretonnien",
|
||||
@ -19,7 +19,7 @@
|
||||
"gridUnits": "m",
|
||||
"license": "LICENSE.txt",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/raw/branch/master/system.json",
|
||||
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.37.zip",
|
||||
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.1.0.zip",
|
||||
"languages": [
|
||||
{
|
||||
"lang": "fr",
|
||||
|
@ -23,6 +23,14 @@
|
||||
{{#if isSuccess}}
|
||||
<li>Marge : {{marge}}</li>
|
||||
<li>Degats de l'arme : {{degatsArme}}</li>
|
||||
|
||||
{{#if (eq attaqueCible "membre")}}
|
||||
<li><strong>Cible un membre : La cible a -2 de malus sur ces actions avec ce membre (mouvement 2 si jambes)</strong></li>
|
||||
{{/if}}
|
||||
{{#if (eq attaqueCible "main")}}
|
||||
<li><strong>Cible une main : La cible ne peut plus utiliser sa main</strong></li>
|
||||
{{/if}}
|
||||
|
||||
{{#if isCriticalSuccess}}
|
||||
<Li>Critique : Aubaine ou +2 aux dégats ci-dessus</li>
|
||||
{{/if}}
|
||||
|
@ -89,6 +89,44 @@
|
||||
<span class="roll-dialog-label">Attaque dans le dos ?</span>
|
||||
<input type="checkbox" class="item-field-label-short" id="attaqueDos" {{checked attaqueDos}}/>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Attaque à deux armes </span>
|
||||
<select class="roll-dialog-label" id="bonus-attaque-deux-armes" type="text" value="{{attaqueDeuxArmes}}"
|
||||
data-dtype="Number">
|
||||
{{#select attaqueDeuxArmes}}
|
||||
<option value="0">Aucun</option>
|
||||
<option value="-4">Deux armes à 1 main</option>
|
||||
<option value="-2">Deux armes naturelles"</option>
|
||||
<option value="-2">Avec spécialisation "Mauvaise Main"</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Seconde arme</span>
|
||||
<select class="roll-dialog-label" id="bonus-attaque-seconde-arme" type="text" value="{{secondeArme}}"
|
||||
data-dtype="String">
|
||||
{{#select secondeArme}}
|
||||
{{#each armes as |arme idx|}}
|
||||
<option value="{{arme.id}}">{{arme.name}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if arme}}
|
||||
<li class="flexrow item">
|
||||
<label class="roll-dialog-label">Ataque ciblée : </label>
|
||||
<select class="roll-dialog-label" type="text" id="attaque-cible" value="{{attaqueCible}}" data-dtype="String">
|
||||
{{#select attaqueCible}}
|
||||
{{#each config.attaqueCible as |categ key|}}
|
||||
<option value="{{key}}">{{categ}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
|
||||
{{/if}}
|
||||
|
||||
<div class="flexrow">
|
||||
|
Loading…
Reference in New Issue
Block a user