Gestion assommer/charge
This commit is contained in:
parent
5e5ddd1c3b
commit
6497369d7f
@ -158,6 +158,22 @@ export class HeritiersActorSheet extends ActorSheet {
|
|||||||
let armeId = li.data("item-id")
|
let armeId = li.data("item-id")
|
||||||
this.actor.rollAttaqueArme(armeId)
|
this.actor.rollAttaqueArme(armeId)
|
||||||
})
|
})
|
||||||
|
html.find('.roll-attaque-brutale-arme').click((event) => {
|
||||||
|
const li = $(event.currentTarget).parents(".item")
|
||||||
|
let armeId = li.data("item-id")
|
||||||
|
this.actor.rollAttaqueBrutaleArme(armeId)
|
||||||
|
})
|
||||||
|
html.find('.roll-attaque-charge-arme').click((event) => {
|
||||||
|
const li = $(event.currentTarget).parents(".item")
|
||||||
|
let armeId = li.data("item-id")
|
||||||
|
this.actor.rollAttaqueChargeArme(armeId)
|
||||||
|
})
|
||||||
|
html.find('.roll-assomer-arme').click((event) => {
|
||||||
|
const li = $(event.currentTarget).parents(".item")
|
||||||
|
let armeId = li.data("item-id")
|
||||||
|
this.actor.rollAssomerArme(armeId)
|
||||||
|
})
|
||||||
|
|
||||||
html.find('.roll-pouvoir').click((event) => {
|
html.find('.roll-pouvoir').click((event) => {
|
||||||
const li = $(event.currentTarget).parents(".item")
|
const li = $(event.currentTarget).parents(".item")
|
||||||
let pouvoirId = li.data("item-id")
|
let pouvoirId = li.data("item-id")
|
||||||
|
@ -55,25 +55,7 @@ export class HeritiersActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
prepareArme(arme) {
|
prepareArme(arme) {
|
||||||
arme = duplicate(arme)
|
arme = duplicate(arme)
|
||||||
let combat = this.getCombatValues()
|
arme.system.isMelee = HeritiersUtility.isArmeMelee(arme)
|
||||||
if (arme.system.typearme == "contact" || arme.system.typearme == "contactjet") {
|
|
||||||
let bonusDefense = 0
|
|
||||||
arme.system.competence = duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "mêlée"))
|
|
||||||
arme.system.attrKey = "pui"
|
|
||||||
arme.system.totalDegats = arme.system.degats + "+" + combat.bonusDegatsTotal
|
|
||||||
arme.system.totalOffensif = this.system.attributs.pui.value + arme.system.competence.system.niveau + arme.system.bonusmaniementoff
|
|
||||||
arme.system.totalDefensif = combat.defenseTotal + arme.system.competence.system.niveau + arme.system.seuildefense + bonusDefense
|
|
||||||
arme.system.isdefense = true
|
|
||||||
}
|
|
||||||
if (arme.system.typearme == "jet" || arme.system.typearme == "tir") {
|
|
||||||
arme.system.competence = duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "armes à distance"))
|
|
||||||
arme.system.attrKey = "adr"
|
|
||||||
arme.system.totalOffensif = this.system.attributs.adr.value + arme.system.competence.system.niveau + arme.system.bonusmaniementoff
|
|
||||||
arme.system.totalDegats = arme.system.degats
|
|
||||||
if (arme.system.isdefense) {
|
|
||||||
arme.system.totalDefensif = combat.defenseTotal + arme.system.competence.system.niveau + arme.system.seuildefense
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return arme
|
return arme
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,46 +86,46 @@ export class HeritiersActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------- --------------------- */
|
/* ----------------------- --------------------- */
|
||||||
getItemSorted( types) {
|
getItemSorted(types) {
|
||||||
let items = this.items.filter(item => types.includes(item.type )) || []
|
let items = this.items.filter(item => types.includes(item.type)) || []
|
||||||
HeritiersUtility.sortArrayObjectsByName(items)
|
HeritiersUtility.sortArrayObjectsByName(items)
|
||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
getEquipments() {
|
getEquipments() {
|
||||||
return this.getItemSorted( ["equipement", "accessoire"] )
|
return this.getItemSorted(["equipement", "accessoire"])
|
||||||
}
|
}
|
||||||
getAvantages() {
|
getAvantages() {
|
||||||
return this.getItemSorted( ["avantage"])
|
return this.getItemSorted(["avantage"])
|
||||||
}
|
}
|
||||||
getDesavantages() {
|
getDesavantages() {
|
||||||
return this.getItemSorted( ["desavantage"])
|
return this.getItemSorted(["desavantage"])
|
||||||
}
|
}
|
||||||
getMonnaies() {
|
getMonnaies() {
|
||||||
return this.getItemSorted( ["monnaie"])
|
return this.getItemSorted(["monnaie"])
|
||||||
}
|
}
|
||||||
getArmors() {
|
getArmors() {
|
||||||
return this.getItemSorted( ["protection"])
|
return this.getItemSorted(["protection"])
|
||||||
}
|
}
|
||||||
getTalents() {
|
getTalents() {
|
||||||
return this.getItemSorted( ["talent"])
|
return this.getItemSorted(["talent"])
|
||||||
}
|
}
|
||||||
getContacts() {
|
getContacts() {
|
||||||
return this.getItemSorted( ["contact"])
|
return this.getItemSorted(["contact"])
|
||||||
}
|
}
|
||||||
getAtouts() {
|
getAtouts() {
|
||||||
return this.getItemSorted( ["atoutfeerique"])
|
return this.getItemSorted(["atoutfeerique"])
|
||||||
}
|
}
|
||||||
getCapacites() {
|
getCapacites() {
|
||||||
return this.getItemSorted( ["capacitenaturelle"])
|
return this.getItemSorted(["capacitenaturelle"])
|
||||||
}
|
}
|
||||||
getFee() {
|
getFee() {
|
||||||
return this.items.find(item => item.type =="fee")
|
return this.items.find(item => item.type == "fee")
|
||||||
}
|
}
|
||||||
getProfils() {
|
getProfils() {
|
||||||
return this.getItemSorted( ["profil"])
|
return this.getItemSorted(["profil"])
|
||||||
}
|
}
|
||||||
getPouvoirs() {
|
getPouvoirs() {
|
||||||
return this.getItemSorted( ["pouvoir"])
|
return this.getItemSorted(["pouvoir"])
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSkills() {
|
getSkills() {
|
||||||
@ -173,8 +155,8 @@ export class HeritiersActor extends Actor {
|
|||||||
organizeUtileSkills(kind = "mental") {
|
organizeUtileSkills(kind = "mental") {
|
||||||
let comp = {}
|
let comp = {}
|
||||||
for (let key in game.system.lesheritiers.config.competenceProfil) {
|
for (let key in game.system.lesheritiers.config.competenceProfil) {
|
||||||
if ( game.system.lesheritiers.config.competenceProfil[key].kind == kind)
|
if (game.system.lesheritiers.config.competenceProfil[key].kind == kind)
|
||||||
comp[key] = { skills: [], niveau: this.system.competences[key].niveau }
|
comp[key] = { skills: [], niveau: this.system.competences[key].niveau }
|
||||||
}
|
}
|
||||||
for (let item of this.items) {
|
for (let item of this.items) {
|
||||||
if (item.type == "competence") {
|
if (item.type == "competence") {
|
||||||
@ -297,7 +279,7 @@ export class HeritiersActor extends Actor {
|
|||||||
let item = this.items.find(item => item.id == itemId)
|
let item = this.items.find(item => item.id == itemId)
|
||||||
if (item) {
|
if (item) {
|
||||||
console.log("Item ", item, itemField, dataType, value)
|
console.log("Item ", item, itemField, dataType, value)
|
||||||
if (dataType) {
|
if (dataType) {
|
||||||
if (dataType.toLowerCase() == "number") {
|
if (dataType.toLowerCase() == "number") {
|
||||||
value = Number(value)
|
value = Number(value)
|
||||||
} else {
|
} else {
|
||||||
@ -313,14 +295,14 @@ export class HeritiersActor extends Actor {
|
|||||||
getPvMalus() {
|
getPvMalus() {
|
||||||
if (this.system.pv.value > 0) {
|
if (this.system.pv.value > 0) {
|
||||||
if (this.system.pv.value < this.system.pv.max / 2) {
|
if (this.system.pv.value < this.system.pv.max / 2) {
|
||||||
return -1
|
return { name: "Santé", value: -1 }
|
||||||
}
|
}
|
||||||
if (this.system.pv.value < 5) {
|
if (this.system.pv.value < 5) {
|
||||||
return -2
|
return { name: "Santé", value: -2 }
|
||||||
}
|
}
|
||||||
return 0
|
return { name: "Santé", value: 0 }
|
||||||
}
|
}
|
||||||
return "Moribond(e)"
|
return { name: "Moribond(e)", value: -50 }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -482,19 +464,21 @@ export class HeritiersActor extends Actor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCurrentParade() {
|
getCurrentParade() {
|
||||||
if ( this.system.statutmasque == "masque") {
|
if (this.system.statutmasque == "masque") {
|
||||||
return this.system.combat.parade.masquee
|
return this.system.combat.parade.masquee
|
||||||
}
|
}
|
||||||
return this.system.combat.parade.demasquee
|
return this.system.combat.parade.demasquee
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCurrentEsquive() {
|
getCurrentEsquive() {
|
||||||
if ( this.system.statutmasque == "masque") {
|
if (this.system.statutmasque == "masque") {
|
||||||
return this.system.combat.esquive.masquee
|
return this.system.combat.esquive.masquee
|
||||||
}
|
}
|
||||||
return this.system.combat.esquive.demasquee
|
return this.system.combat.esquive.demasquee
|
||||||
}
|
}
|
||||||
|
getCurrentResistancePhysique() {
|
||||||
|
return this.system.combat.resistancephysique.value
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getTricherie() {
|
getTricherie() {
|
||||||
return this.system.rang.tricherie.value
|
return this.system.rang.tricherie.value
|
||||||
@ -511,7 +495,19 @@ export class HeritiersActor extends Actor {
|
|||||||
tricherie.value = Math.min(tricherie.value, tricherie.max)
|
tricherie.value = Math.min(tricherie.value, tricherie.max)
|
||||||
this.update({ 'system.rang.tricherie': tricherie })
|
this.update({ 'system.rang.tricherie': tricherie })
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
getPireCompetence(compName1, compName2) {
|
||||||
|
let comp1 = this.items.find( it => it.name == compName1)
|
||||||
|
let comp2 = this.items.find( it => it.name == compName2)
|
||||||
|
if ( comp1 && comp2 ) {
|
||||||
|
if (comp1.system.niveau > comp2.system.niveau) {
|
||||||
|
return comp1
|
||||||
|
} else {
|
||||||
|
return comp2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCommonRollData(compId = undefined, compName = undefined) {
|
getCommonRollData(compId = undefined, compName = undefined) {
|
||||||
let rollData = HeritiersUtility.getBasicRollData()
|
let rollData = HeritiersUtility.getBasicRollData()
|
||||||
@ -527,7 +523,7 @@ export class HeritiersActor extends Actor {
|
|||||||
rollData.useTricherie = false
|
rollData.useTricherie = false
|
||||||
rollData.useSpecialite = false
|
rollData.useSpecialite = false
|
||||||
rollData.useHeritage = false
|
rollData.useHeritage = false
|
||||||
rollData.pvMalus = this.getPvMalus()
|
rollData.rulesMalus.push(this.getPvMalus())
|
||||||
|
|
||||||
if (compId) {
|
if (compId) {
|
||||||
rollData.competence = duplicate(this.items.get(compId) || {})
|
rollData.competence = duplicate(this.items.get(compId) || {})
|
||||||
@ -585,7 +581,7 @@ export class HeritiersActor extends Actor {
|
|||||||
let rollData = this.getCommonRollData()
|
let rollData = this.getCommonRollData()
|
||||||
rollData.mode = "competence"
|
rollData.mode = "competence"
|
||||||
console.log("Compkey", compKey)
|
console.log("Compkey", compKey)
|
||||||
rollData.competence = {name: this.system.competences[compKey].label, system: { niveau: this.system.competences[compKey].niveau }}
|
rollData.competence = { name: this.system.competences[compKey].label, system: { niveau: this.system.competences[compKey].niveau } }
|
||||||
console.log("RollDatra", rollData)
|
console.log("RollDatra", rollData)
|
||||||
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||||
rollDialog.render(true)
|
rollDialog.render(true)
|
||||||
@ -599,13 +595,15 @@ export class HeritiersActor extends Actor {
|
|||||||
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||||
rollDialog.render(true)
|
rollDialog.render(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollAttaqueArme(armeId) {
|
async rollAttaqueArme(armeId) {
|
||||||
let arme = this.items.get(armeId)
|
let arme = this.items.get(armeId)
|
||||||
if (arme) {
|
if (arme) {
|
||||||
let competenceName = "Tir"
|
let competenceName = "Tir"
|
||||||
let key = "prec"
|
let key = "prec"
|
||||||
if (arme.system.categorie == "blanche" || arme.system.categorie == "improvise") {
|
arme.system.isMelee = HeritiersUtility.isArmeMelee(arme)
|
||||||
|
if ( arme.system.isMelee) {
|
||||||
competenceName = "Mêlée"
|
competenceName = "Mêlée"
|
||||||
key = "agi"
|
key = "agi"
|
||||||
}
|
}
|
||||||
@ -614,16 +612,70 @@ export class HeritiersActor extends Actor {
|
|||||||
rollData.caracKey = key
|
rollData.caracKey = key
|
||||||
rollData.arme = duplicate(arme)
|
rollData.arme = duplicate(arme)
|
||||||
rollData.mode = "arme"
|
rollData.mode = "arme"
|
||||||
|
if (rollData.defenderTokenId && arme.system.isMelee ) {
|
||||||
|
rollData.cacheDifficulte = true
|
||||||
|
}
|
||||||
|
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||||
|
rollDialog.render(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollAttaqueBrutaleArme(armeId) {
|
||||||
|
let arme = this.items.get(armeId)
|
||||||
|
if (arme) {
|
||||||
|
let key = "for"
|
||||||
|
let competenceName = "Mêlée"
|
||||||
|
let rollData = this.getCommonRollData(undefined, competenceName)
|
||||||
|
rollData.carac = this.system.caracteristiques[key]
|
||||||
|
rollData.caracKey = key
|
||||||
|
rollData.arme = duplicate(arme)
|
||||||
|
rollData.mode = "attaquebrutale"
|
||||||
|
rollData.rulesMalus.push({ name: "Attaque brutale", value: -2 } )
|
||||||
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||||
rollDialog.render(true)
|
rollDialog.render(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollAttaqueChargeArme(armeId) {
|
||||||
|
let arme = this.items.get(armeId)
|
||||||
|
if (arme) {
|
||||||
|
let key = "agi"
|
||||||
|
let pireCompetence = this.getPireCompetence("Mêlée", "Mouvement")
|
||||||
|
let rollData = this.getCommonRollData(undefined, pireCompetence.name)
|
||||||
|
rollData.carac = this.system.caracteristiques[key]
|
||||||
|
rollData.caracKey = key
|
||||||
|
rollData.arme = duplicate(arme)
|
||||||
|
rollData.mode = "attaquecharge"
|
||||||
|
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||||
|
rollDialog.render(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollAssomerArme(armeId) {
|
||||||
|
let arme = this.items.get(armeId)
|
||||||
|
if (arme) {
|
||||||
|
let competenceName = "Mêlée"
|
||||||
|
let rollData = this.getCommonRollData(undefined, competenceName)
|
||||||
|
rollData.carac = this.system.caracteristiques["agi"]
|
||||||
|
rollData.caracKey = "agi"
|
||||||
|
rollData.arme = duplicate(arme)
|
||||||
|
rollData.mode = "assommer"
|
||||||
|
if (rollData.defenderTokenId) {
|
||||||
|
rollData.cacheDifficulte = true
|
||||||
|
}
|
||||||
|
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||||
|
rollDialog.render(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollPouvoir(pouvoirId) {
|
async rollPouvoir(pouvoirId) {
|
||||||
let pouvoir = this.items.get(pouvoirId)
|
let pouvoir = this.items.get(pouvoirId)
|
||||||
if (pouvoir) {
|
if (pouvoir) {
|
||||||
let rollData = this.getCommonRollData(undefined, undefined)
|
let rollData = this.getCommonRollData(undefined, undefined)
|
||||||
if ( pouvoir.system.feeriemasque != "autre") {
|
if (pouvoir.system.feeriemasque != "autre") {
|
||||||
rollData.pouvoirBase = duplicate(this.system.rang[pouvoir.system.feeriemasque.toLowerCase()])
|
rollData.pouvoirBase = duplicate(this.system.rang[pouvoir.system.feeriemasque.toLowerCase()])
|
||||||
rollData.pouvoirBase.label = "Féerie"
|
rollData.pouvoirBase.label = "Féerie"
|
||||||
rollData.carac = duplicate(this.system.caracteristiques[pouvoir.system.carac])
|
rollData.carac = duplicate(this.system.caracteristiques[pouvoir.system.carac])
|
||||||
|
@ -62,6 +62,7 @@ export class HeritiersItemSheet extends ItemSheet {
|
|||||||
options: this.options,
|
options: this.options,
|
||||||
owner: this.document.isOwner,
|
owner: this.document.isOwner,
|
||||||
config: game.system.lesheritiers.config,
|
config: game.system.lesheritiers.config,
|
||||||
|
isArmeMelee: HeritiersUtility.isArmeMelee(this.object),
|
||||||
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
|
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
|
||||||
mr: (this.object.type == 'specialisation'),
|
mr: (this.object.type == 'specialisation'),
|
||||||
isGM: game.user.isGM
|
isGM: game.user.isGM
|
||||||
|
@ -110,14 +110,8 @@ export class HeritiersRollDialog extends Dialog {
|
|||||||
html.find('#bonus-malus-context').change((event) => {
|
html.find('#bonus-malus-context').change((event) => {
|
||||||
this.rollData.bonusMalusContext = Number(event.currentTarget.value)
|
this.rollData.bonusMalusContext = Number(event.currentTarget.value)
|
||||||
})
|
})
|
||||||
html.find('#useTricherie').change((event) => {
|
|
||||||
this.rollData.useTricherie = event.currentTarget.checked
|
|
||||||
})
|
|
||||||
html.find('#useSpecialite').change((event) => {
|
html.find('#useSpecialite').change((event) => {
|
||||||
this.rollData.useSpecialite = event.currentTarget.checked
|
this.rollData.useSpecialite = event.currentTarget.checked
|
||||||
})
|
})
|
||||||
html.find('#useHeritage').change((event) => {
|
|
||||||
this.rollData.useHeritage = event.currentTarget.checked
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -290,11 +290,11 @@ export class HeritiersUtility {
|
|||||||
if (isTricherieHeritage) {
|
if (isTricherieHeritage) {
|
||||||
let resTab = [rollData.roll.terms[0].results[0].result, rollData.roll.terms[0].results[1].result, rollData.roll.terms[0].results[2].result]
|
let resTab = [rollData.roll.terms[0].results[0].result, rollData.roll.terms[0].results[1].result, rollData.roll.terms[0].results[2].result]
|
||||||
rollData.diceResult = resTab[0] + "," + resTab[1] + "," + resTab[2]
|
rollData.diceResult = resTab[0] + "," + resTab[1] + "," + resTab[2]
|
||||||
let subResult = Math.max(Math.max(resTab[0], resTab[1]), resTab[2])
|
let foundryTotal = resTab[0] + resTab[1] + resTab[2]
|
||||||
if (resTab[1] == 1) { resTab[1] -= 4 }
|
if (resTab[1] == 1) { resTab[1] -= 4 }
|
||||||
if (resTab[2] == 1) { resTab[2] -= 6 }
|
if (resTab[2] == 1) { resTab[2] -= 6 }
|
||||||
if (resTab[2] == 2) { resTab[2] -= 7 }
|
if (resTab[2] == 2) { resTab[2] -= 7 }
|
||||||
rollData.finalResult = rollData.roll.total - subResult + Math.max(Math.max(resTab[0], resTab[1]), resTab[2])
|
rollData.finalResult = rollData.roll.total - foundryTotal + Math.max(Math.max(resTab[0], resTab[1]), resTab[2])
|
||||||
|
|
||||||
// Gestion des résultats spéciaux
|
// Gestion des résultats spéciaux
|
||||||
resTab = resTab.sort()
|
resTab = resTab.sort()
|
||||||
@ -344,6 +344,9 @@ export class HeritiersUtility {
|
|||||||
if (rollData.arme.system.categorie == "blanche" || rollData.arme.system.categorie == "improvise") {
|
if (rollData.arme.system.categorie == "blanche" || rollData.arme.system.categorie == "improvise") {
|
||||||
rollData.degatsArme += Math.max(0, actor.system.caracteristiques.for.value - 2)
|
rollData.degatsArme += Math.max(0, actor.system.caracteristiques.for.value - 2)
|
||||||
}
|
}
|
||||||
|
if (rollData.mode == "attaquecharge") {
|
||||||
|
rollData.degatsArme += 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -368,19 +371,24 @@ export class HeritiersUtility {
|
|||||||
this.createChatWithRollMode(rollData.alias, {
|
this.createChatWithRollMode(rollData.alias, {
|
||||||
content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-cc-result.html`, rollData)
|
content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-cc-result.html`, rollData)
|
||||||
}, rollData, "selfroll")
|
}, rollData, "selfroll")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async displayAsssomer(rollData, actor, nomAttaque, etatAssomer, valeurDefense) {
|
||||||
|
rollData.defenderMode = nomAttaque
|
||||||
|
rollData.etatAssommer = etatAssomer
|
||||||
|
rollData.defenderValue = valeurDefense
|
||||||
|
rollData.marge = 0
|
||||||
|
this.computeMarge(rollData, valeurDefense)
|
||||||
|
rollData.dureeAssommer = (rollData.marge) ? rollData.marge*2 : 1
|
||||||
|
this.createChatWithRollMode(rollData.alias, {
|
||||||
|
content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-assommer-result.html`, rollData)
|
||||||
|
}, rollData, "selfroll")
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async rollHeritiers(rollData) {
|
static async rollHeritiers(rollData) {
|
||||||
|
|
||||||
let actor = this.getActorFromRollData(rollData)
|
let actor = this.getActorFromRollData(rollData)
|
||||||
|
|
||||||
if (typeof (rollData.pvMalus) != "number") {
|
|
||||||
ui.notifications.warn("Votre personnage est Moribond(e). Aucun jet autorisé")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//rollData.actionImg = "systems/fvtt-les-heritiers/assets/icons/" + actor.system.attributs[rollData.attrKey].labelnorm + ".webp"
|
//rollData.actionImg = "systems/fvtt-les-heritiers/assets/icons/" + actor.system.attributs[rollData.attrKey].labelnorm + ".webp"
|
||||||
rollData.carac = duplicate(actor.system.caracteristiques[rollData.caracKey])
|
rollData.carac = duplicate(actor.system.caracteristiques[rollData.caracKey])
|
||||||
|
|
||||||
@ -403,7 +411,11 @@ export class HeritiersUtility {
|
|||||||
} else {
|
} else {
|
||||||
rollData.diceFormula += `+${rollData.carac.value}+${rangValue}+${rollData.bonusMalusContext}`
|
rollData.diceFormula += `+${rollData.carac.value}+${rangValue}+${rollData.bonusMalusContext}`
|
||||||
}
|
}
|
||||||
rollData.diceFormula += `+${rollData.pvMalus}`
|
let ruleMalus = 0
|
||||||
|
for (let malus of rollData.rulesMalus) {
|
||||||
|
ruleMalus += malus.value
|
||||||
|
}
|
||||||
|
rollData.diceFormula += `+${ruleMalus}`
|
||||||
|
|
||||||
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
|
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
|
||||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||||
@ -420,7 +432,9 @@ export class HeritiersUtility {
|
|||||||
content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData)
|
content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData)
|
||||||
}, rollData)
|
}, rollData)
|
||||||
|
|
||||||
if (rollData.defenderTokenId && rollData.arme) {
|
// Gestion attaque standard
|
||||||
|
if ( (rollData.mode == "arme" || rollData.mode == "attaquebrutale" || rollData.mode == "attaquecharge") &&
|
||||||
|
rollData.defenderTokenId && rollData.arme) {
|
||||||
if (rollData.arme.system.categorie != "trait" && rollData.arme.system.categorie != "poing" && rollData.arme.system.categorie != "epaule" ) {
|
if (rollData.arme.system.categorie != "trait" && rollData.arme.system.categorie != "poing" && rollData.arme.system.categorie != "epaule" ) {
|
||||||
await this.displayUneDefense(rollData, actor, "Parade", rollData.defenderParade)
|
await this.displayUneDefense(rollData, actor, "Parade", rollData.defenderParade)
|
||||||
await this.displayUneDefense(rollData, actor, "Esquive", rollData.defenderEsquive)
|
await this.displayUneDefense(rollData, actor, "Esquive", rollData.defenderEsquive)
|
||||||
@ -430,6 +444,13 @@ export class HeritiersUtility {
|
|||||||
ui.notifications.warn("Pas de difficulté positionnée pour l'attaque à distance.")
|
ui.notifications.warn("Pas de difficulté positionnée pour l'attaque à distance.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Gestion assomer
|
||||||
|
if (rollData.mode == "assommer" && rollData.defenderTokenId && rollData.arme) {
|
||||||
|
await this.displayAsssomer(rollData, actor, "Assommer", "Surprise", rollData.defenderResistancePhysique)
|
||||||
|
await this.displayAsssomer(rollData, actor, "Assommer", "Conscient, Résistance+6", rollData.defenderResistancePhysique+6)
|
||||||
|
await this.displayAsssomer(rollData, actor, "Assommer", "Conscient, Parade", rollData.defenderParade)
|
||||||
|
await this.displayAsssomer(rollData, actor, "Assommer", "Conscient, Esquive", rollData.defenderEsquive+6)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,6 +477,10 @@ export class HeritiersUtility {
|
|||||||
return game.users.filter(filter).map(user => user._id);
|
return game.users.filter(filter).map(user => user._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static isArmeMelee(arme) {
|
||||||
|
return (arme.type == "arme" && (arme.system.categorie == "lourde" || arme.system.categorie == "blanche" || arme.system.categorie == "improvise")) ? true : false
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getWhisperRecipients(rollMode, name) {
|
static getWhisperRecipients(rollMode, name) {
|
||||||
switch (rollMode) {
|
switch (rollMode) {
|
||||||
@ -541,7 +566,8 @@ export class HeritiersUtility {
|
|||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
sdList: game.system.lesheritiers.config.seuilsDifficulte,
|
sdList: game.system.lesheritiers.config.seuilsDifficulte,
|
||||||
sdValue: -1,
|
sdValue: -1,
|
||||||
bonusMalusContext: 0
|
bonusMalusContext: 0,
|
||||||
|
rulesMalus : []
|
||||||
}
|
}
|
||||||
return rollData
|
return rollData
|
||||||
}
|
}
|
||||||
@ -555,6 +581,7 @@ export class HeritiersUtility {
|
|||||||
rollData.defenderName = defender.name
|
rollData.defenderName = defender.name
|
||||||
rollData.defenderParade = defender.getCurrentParade()
|
rollData.defenderParade = defender.getCurrentParade()
|
||||||
rollData.defenderEsquive = defender.getCurrentEsquive()
|
rollData.defenderEsquive = defender.getCurrentEsquive()
|
||||||
|
rollData.defenderResistancePhysique = defender.getCurrentResistancePhysique()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,7 +1245,10 @@ ul, li {
|
|||||||
position:relative;
|
position:relative;
|
||||||
top:1px;
|
top:1px;
|
||||||
}
|
}
|
||||||
|
.button-sheet-roll-long1 {
|
||||||
|
max-width: 6.1rem;
|
||||||
|
min-width: 6.1rem;
|
||||||
|
}
|
||||||
.defense-sheet {
|
.defense-sheet {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "fvtt-les-heritiers",
|
"id": "fvtt-les-heritiers",
|
||||||
"description": "Les Héritiers pour FoundryVTT",
|
"description": "Les Héritiers pour FoundryVTT",
|
||||||
"version": "10.0.35",
|
"version": "10.0.36",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Uberwald/LeRatierBretonnien",
|
"name": "Uberwald/LeRatierBretonnien",
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
"license": "LICENSE.txt",
|
"license": "LICENSE.txt",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/raw/branch/master/system.json",
|
"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.35.zip",
|
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.36.zip",
|
||||||
"languages": [
|
"languages": [
|
||||||
{
|
{
|
||||||
"lang": "fr",
|
"lang": "fr",
|
||||||
|
@ -176,20 +176,6 @@
|
|||||||
<label class="item-field-label-long">Dissimulation : </label>
|
<label class="item-field-label-long">Dissimulation : </label>
|
||||||
<input type="text" class="item-field-label-short" name="system.combat.dissimulation.value" value="{{system.combat.dissimulation.value}}" data-dtype="Number" />
|
<input type="text" class="item-field-label-short" name="system.combat.dissimulation.value" value="{{system.combat.dissimulation.value}}" data-dtype="Number" />
|
||||||
</li>
|
</li>
|
||||||
<!-- <li class="item flexrow list-item items-title-bg">
|
|
||||||
<label class="item-field-label-long"><strong>Corps à Corps</strong></label>
|
|
||||||
<label class="item-field-label-medium">Masqué</label>
|
|
||||||
<input type="text" class="item-field-label-short" name="system.combat.corpsacorps.masquee" value="{{system.combat.corpsacorps.masquee}}" data-dtype="Number" />
|
|
||||||
<label class="item-field-label-medium">Démasqué</label>
|
|
||||||
<input type="text" class="item-field-label-short" name="system.combat.corpsacorps.demasquee" value="{{system.combat.corpsacorps.demasquee}}" data-dtype="Number" />
|
|
||||||
</li>
|
|
||||||
<li class="item flexrow list-item items-title-bg">
|
|
||||||
<label class="item-field-label-long"><strong>A distance</strong></label>
|
|
||||||
<label class="item-field-label-medium">Masqué</label>
|
|
||||||
<input type="text" class="item-field-label-short" name="system.combat.tir.masquee" value="{{system.combat.tir.masquee}}" data-dtype="Number" />
|
|
||||||
<label class="item-field-label-medium">Démasqué</label>
|
|
||||||
<input type="text" class="item-field-label-short" name="system.combat.tir.demasquee" value="{{system.combat.tir.demasquee}}" data-dtype="Number" />
|
|
||||||
</li> -->
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
@ -201,10 +187,10 @@
|
|||||||
<h3><label class="items-title-text">Armes</label></h3>
|
<h3><label class="items-title-text">Armes</label></h3>
|
||||||
</span>
|
</span>
|
||||||
<span class="item-field-label-short">
|
<span class="item-field-label-short">
|
||||||
<label class="short-label">Attaque</label>
|
<label class="short-label">Dégats</label>
|
||||||
</span>
|
</span>
|
||||||
<span class="item-field-label-short">
|
<span class="item-field-label-short">
|
||||||
<label class="short-label">Dégats</label>
|
<label class="short-label">Attaque</label>
|
||||||
</span>
|
</span>
|
||||||
<div class="item-filler"> </div>
|
<div class="item-filler"> </div>
|
||||||
<div class="item-controls item-controls-fixed">
|
<div class="item-controls item-controls-fixed">
|
||||||
@ -218,13 +204,26 @@
|
|||||||
<span class="item-name-label competence-name">{{arme.name}}</span>
|
<span class="item-name-label competence-name">{{arme.name}}</span>
|
||||||
|
|
||||||
<span class="item-field-label-short">
|
<span class="item-field-label-short">
|
||||||
<button class="roll-attaque-arme button-sheet-roll">Attaquer</button>
|
{{arme.system.degats}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="item-field-label-short">
|
<span class="item-field-label-short">
|
||||||
{{arme.system.degats}}
|
<button class="roll-attaque-arme button-sheet-roll">Attaque</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span class="item-field-label-short">
|
||||||
|
<button class="roll-assomer-arme button-sheet-roll">Assomer</button>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{{#if arme.system.isMelee}}
|
||||||
|
<span class="item-field-label-short">
|
||||||
|
<button class="roll-attaque-charge-arme button-sheet-roll">Charger</button>
|
||||||
|
</span>
|
||||||
|
<span class="item-field-label-short">
|
||||||
|
<button class="roll-attaque-brutale-arme button-sheet-roll button-sheet-roll-long1">Attaque brutale</button>
|
||||||
|
</span>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="item-filler"> </div>
|
<div class="item-filler"> </div>
|
||||||
<div class="item-controls item-controls-fixed">
|
<div class="item-controls item-controls-fixed">
|
||||||
<a class="item-control item-equip" title="Worn">{{#if arme.system.equipped}}<i
|
<a class="item-control item-equip" title="Worn">{{#if arme.system.equipped}}<i
|
||||||
|
30
templates/chat-assommer-result.html
Normal file
30
templates/chat-assommer-result.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<div class="chat-message-header">
|
||||||
|
{{#if actorImg}}
|
||||||
|
<img class="actor-icon" src="{{actorImg}}" alt="{{alias}}" />
|
||||||
|
{{/if}}
|
||||||
|
<h4 class=chat-actor-name>{{alias}}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
{{#if actionImg}}
|
||||||
|
<div>
|
||||||
|
<img class="chat-icon" src="{{actionImg}}" alt="{{name}}" />
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="flexcol">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li>Assomer {{defenderName}} en état de : {{etatAssommer}}</li>
|
||||||
|
|
||||||
|
{{#if isSuccess}}
|
||||||
|
<li>Marge : {{marge}}</li>
|
||||||
|
<li>{{defenderName}} est assomé pour {{dureeAssommer}} minutes !</li>
|
||||||
|
{{else}}
|
||||||
|
<li>{{defenderName}} n'a pas été assomé et est conscient la tentative !</li>
|
||||||
|
{{/if}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
@ -33,6 +33,9 @@
|
|||||||
|
|
||||||
{{#if arme}}
|
{{#if arme}}
|
||||||
<li>Attaque avec : {{arme.name}}</li>
|
<li>Attaque avec : {{arme.name}}</li>
|
||||||
|
{{#if (eq mode "assommer")}}
|
||||||
|
<li>Attaque pour assommer</li>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if pouvoir}}
|
{{#if pouvoir}}
|
||||||
|
@ -66,6 +66,13 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#each rulesMalus as |malus key|}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<span class="roll-dialog-label">{{malus.name}}</span>
|
||||||
|
<span class="small-label roll-dialog-label">{{malus.value}}</span>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Malus de Santé</span>
|
<span class="roll-dialog-label">Malus de Santé</span>
|
||||||
<span class="small-label roll-dialog-label">{{pvMalus}}</span>
|
<span class="small-label roll-dialog-label">{{pvMalus}}</span>
|
||||||
@ -93,6 +100,11 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if cacheDifficulte}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<span class="roll-dialog-label">Difficulté Cachée/Inconnue</span>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Difficulté</span>
|
<span class="roll-dialog-label">Difficulté</span>
|
||||||
<select class="status-small-label color-class-common" id ="sdValue" type="text" name="sdValue" value="sdValue" data-dtype="string" >
|
<select class="status-small-label color-class-common" id ="sdValue" type="text" name="sdValue" value="sdValue" data-dtype="string" >
|
||||||
@ -103,6 +115,7 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user