Compare commits
	
		
			7 Commits
		
	
	
		
			fvtt-les-h
			...
			fvtt-les-h
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 577eccbbd3 | |||
| 05026d454b | |||
| 6497369d7f | |||
| 5e5ddd1c3b | |||
| a72108db5b | |||
| 6a46faadc2 | |||
| e95f7de0c5 | 
@@ -61,6 +61,7 @@ export class HeritiersActorSheet extends ActorSheet {
 | 
			
		||||
      secretsdecouverts: await TextEditor.enrichHTML(this.object.system.biodata.secretsdecouverts, {async: true}),
 | 
			
		||||
      questions: await TextEditor.enrichHTML(this.object.system.biodata.questions, {async: true}),
 | 
			
		||||
      habitat: await TextEditor.enrichHTML(this.object.system.biodata.habitat, {async: true}),
 | 
			
		||||
      playernotes: await TextEditor.enrichHTML(this.object.system.biodata.playernotes, {async: true}),
 | 
			
		||||
      options: this.options,
 | 
			
		||||
      owner: this.document.isOwner,
 | 
			
		||||
      editScore: this.options.editScore,
 | 
			
		||||
@@ -157,6 +158,22 @@ export class HeritiersActorSheet extends ActorSheet {
 | 
			
		||||
      let armeId  = li.data("item-id")
 | 
			
		||||
      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) => {
 | 
			
		||||
      const li = $(event.currentTarget).parents(".item")
 | 
			
		||||
      let pouvoirId = li.data("item-id")
 | 
			
		||||
 
 | 
			
		||||
@@ -55,25 +55,7 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  prepareArme(arme) {
 | 
			
		||||
    arme = duplicate(arme)
 | 
			
		||||
    let combat = this.getCombatValues()
 | 
			
		||||
    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
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    arme.system.isMelee = HeritiersUtility.isArmeMelee(arme)
 | 
			
		||||
    return arme
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -88,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")
 | 
			
		||||
  }
 | 
			
		||||
@@ -104,46 +96,46 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -----------------------  --------------------- */
 | 
			
		||||
  getItemSorted( types) {
 | 
			
		||||
    let items = this.items.filter(item => types.includes(item.type )) || []
 | 
			
		||||
  getItemSorted(types) {
 | 
			
		||||
    let items = this.items.filter(item => types.includes(item.type)) || []
 | 
			
		||||
    HeritiersUtility.sortArrayObjectsByName(items)
 | 
			
		||||
    return items
 | 
			
		||||
  }
 | 
			
		||||
  getEquipments() {
 | 
			
		||||
    return this.getItemSorted( ["equipement", "accessoire"] )
 | 
			
		||||
    return this.getItemSorted(["equipement", "accessoire"])
 | 
			
		||||
  }
 | 
			
		||||
  getAvantages() {
 | 
			
		||||
    return this.getItemSorted( ["avantage"])
 | 
			
		||||
    return this.getItemSorted(["avantage"])
 | 
			
		||||
  }
 | 
			
		||||
  getDesavantages() {
 | 
			
		||||
    return this.getItemSorted( ["desavantage"])
 | 
			
		||||
    return this.getItemSorted(["desavantage"])
 | 
			
		||||
  }
 | 
			
		||||
  getMonnaies() {
 | 
			
		||||
    return this.getItemSorted( ["monnaie"])
 | 
			
		||||
    return this.getItemSorted(["monnaie"])
 | 
			
		||||
  }
 | 
			
		||||
  getArmors() {
 | 
			
		||||
    return this.getItemSorted( ["protection"])
 | 
			
		||||
    return this.getItemSorted(["protection"])
 | 
			
		||||
  }
 | 
			
		||||
  getTalents() {
 | 
			
		||||
    return this.getItemSorted( ["talent"])
 | 
			
		||||
    return this.getItemSorted(["talent"])
 | 
			
		||||
  }
 | 
			
		||||
  getContacts() {
 | 
			
		||||
    return this.getItemSorted( ["contact"])
 | 
			
		||||
    return this.getItemSorted(["contact"])
 | 
			
		||||
  }
 | 
			
		||||
  getAtouts() {
 | 
			
		||||
    return this.getItemSorted( ["atoutfeerique"])
 | 
			
		||||
    return this.getItemSorted(["atoutfeerique"])
 | 
			
		||||
  }
 | 
			
		||||
  getCapacites() {
 | 
			
		||||
    return this.getItemSorted( ["capacitenaturelle"])
 | 
			
		||||
    return this.getItemSorted(["capacitenaturelle"])
 | 
			
		||||
  }
 | 
			
		||||
  getFee() {
 | 
			
		||||
    return this.items.find(item => item.type =="fee")
 | 
			
		||||
    return this.items.find(item => item.type == "fee")
 | 
			
		||||
  }
 | 
			
		||||
  getProfils() {
 | 
			
		||||
    return this.getItemSorted( ["profil"])
 | 
			
		||||
    return this.getItemSorted(["profil"])
 | 
			
		||||
  }
 | 
			
		||||
  getPouvoirs() {
 | 
			
		||||
    return this.getItemSorted( ["pouvoir"])
 | 
			
		||||
    return this.getItemSorted(["pouvoir"])
 | 
			
		||||
  }
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getSkills() {
 | 
			
		||||
@@ -160,7 +152,7 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  prepareUtileSkill(item) {
 | 
			
		||||
    let specList = []
 | 
			
		||||
    if (item.system.categorie == "utile") {
 | 
			
		||||
    if (item && item.system.categorie && item.system.categorie == "utile") {
 | 
			
		||||
      for (let spec of item.system.specialites) {
 | 
			
		||||
        specList.push(spec.name)
 | 
			
		||||
      }
 | 
			
		||||
@@ -173,8 +165,8 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
  organizeUtileSkills(kind = "mental") {
 | 
			
		||||
    let comp = {}
 | 
			
		||||
    for (let key in game.system.lesheritiers.config.competenceProfil) {
 | 
			
		||||
      if ( game.system.lesheritiers.config.competenceProfil[key].kind == kind)
 | 
			
		||||
      comp[key] = { skills: [], niveau: this.system.competences[key].niveau }
 | 
			
		||||
      if (game.system.lesheritiers.config.competenceProfil[key].kind == kind)
 | 
			
		||||
        comp[key] = { skills: [], niveau: this.system.competences[key].niveau }
 | 
			
		||||
    }
 | 
			
		||||
    for (let item of this.items) {
 | 
			
		||||
      if (item.type == "competence") {
 | 
			
		||||
@@ -297,7 +289,7 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    let item = this.items.find(item => item.id == itemId)
 | 
			
		||||
    if (item) {
 | 
			
		||||
      console.log("Item ", item, itemField, dataType, value)
 | 
			
		||||
      if  (dataType) {
 | 
			
		||||
      if (dataType) {
 | 
			
		||||
        if (dataType.toLowerCase() == "number") {
 | 
			
		||||
          value = Number(value)
 | 
			
		||||
        } else {
 | 
			
		||||
@@ -313,14 +305,14 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
  getPvMalus() {
 | 
			
		||||
    if (this.system.pv.value > 0) {
 | 
			
		||||
      if (this.system.pv.value < this.system.pv.max / 2) {
 | 
			
		||||
        return -1
 | 
			
		||||
        return { name: "Santé", value: -1 }
 | 
			
		||||
      }
 | 
			
		||||
      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 }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
@@ -480,7 +472,23 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    }
 | 
			
		||||
    return talents
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getCurrentParade() {
 | 
			
		||||
    if (this.system.statutmasque == "masque") {
 | 
			
		||||
      return this.system.combat.parade.masquee
 | 
			
		||||
    }
 | 
			
		||||
    return this.system.combat.parade.demasquee
 | 
			
		||||
  }
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getCurrentEsquive() {
 | 
			
		||||
    if (this.system.statutmasque == "masque") {
 | 
			
		||||
      return this.system.combat.esquive.masquee
 | 
			
		||||
    }
 | 
			
		||||
    return this.system.combat.esquive.demasquee
 | 
			
		||||
  }
 | 
			
		||||
  getCurrentResistancePhysique() {
 | 
			
		||||
    return this.system.combat.resistancephysique.value
 | 
			
		||||
  }
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getTricherie() {
 | 
			
		||||
    return this.system.rang.tricherie.value
 | 
			
		||||
@@ -497,7 +505,19 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    tricherie.value = Math.min(tricherie.value, tricherie.max)
 | 
			
		||||
    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) {
 | 
			
		||||
    let rollData = HeritiersUtility.getBasicRollData()
 | 
			
		||||
@@ -513,7 +533,7 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    rollData.useTricherie = false
 | 
			
		||||
    rollData.useSpecialite = false
 | 
			
		||||
    rollData.useHeritage = false
 | 
			
		||||
    rollData.pvMalus = this.getPvMalus()
 | 
			
		||||
    rollData.rulesMalus.push(this.getPvMalus())
 | 
			
		||||
 | 
			
		||||
    if (compId) {
 | 
			
		||||
      rollData.competence = duplicate(this.items.get(compId) || {})
 | 
			
		||||
@@ -522,9 +542,15 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    }
 | 
			
		||||
    if (compName) {
 | 
			
		||||
      rollData.competence = duplicate(this.items.find(item => item.name.toLowerCase() == compName.toLowerCase()) || {})
 | 
			
		||||
      this.prepareUtileSkill(rollData.competence)
 | 
			
		||||
      rollData.actionImg = rollData.competence?.img
 | 
			
		||||
      if (rollData.competence && rollData.competence.name) {
 | 
			
		||||
        this.prepareUtileSkill(rollData.competence)
 | 
			
		||||
        rollData.actionImg = rollData.competence?.img
 | 
			
		||||
      } else {
 | 
			
		||||
        rollData.competence = undefined
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    HeritiersUtility.updateWithTarget(rollData)
 | 
			
		||||
 | 
			
		||||
    return rollData
 | 
			
		||||
  }
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
@@ -565,7 +591,7 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    let rollData = this.getCommonRollData()
 | 
			
		||||
    rollData.mode = "competence"
 | 
			
		||||
    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)
 | 
			
		||||
    let rollDialog = await HeritiersRollDialog.create(this, rollData)
 | 
			
		||||
    rollDialog.render(true)
 | 
			
		||||
@@ -579,31 +605,95 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    let rollDialog = await HeritiersRollDialog.create(this, rollData)
 | 
			
		||||
    rollDialog.render(true)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async rollAttaqueArme(armeId) {
 | 
			
		||||
    let arme = this.items.get(armeId)
 | 
			
		||||
    if (arme) {
 | 
			
		||||
      arme = duplicate(arme)
 | 
			
		||||
      arme.system.isMelee = HeritiersUtility.isArmeMelee(arme)
 | 
			
		||||
      let competenceName = "Tir"
 | 
			
		||||
      let key = "prec"
 | 
			
		||||
      if (arme.system.categorie == "blanche" || arme.system.categorie == "improvise") {
 | 
			
		||||
      if (  arme.system.isMelee) {
 | 
			
		||||
        competenceName = "Mêlée"
 | 
			
		||||
        key = "agi"
 | 
			
		||||
      }
 | 
			
		||||
      let rollData = this.getCommonRollData(undefined, competenceName)
 | 
			
		||||
      rollData.carac = this.system.caracteristiques[key]
 | 
			
		||||
      rollData.caracKey = key
 | 
			
		||||
      rollData.arme = duplicate(arme)
 | 
			
		||||
      rollData.arme = arme
 | 
			
		||||
      rollData.mode = "arme"
 | 
			
		||||
      rollData.armes = this.getOtherMeleeWeapons(arme)
 | 
			
		||||
      if (rollData.defenderTokenId && arme.system.isMelee ) {
 | 
			
		||||
        rollData.cacheDifficulte = true
 | 
			
		||||
      }
 | 
			
		||||
      console.log(">>>> ARME", rollData)
 | 
			
		||||
      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"
 | 
			
		||||
      arme.system.isMelee = HeritiersUtility.isArmeMelee(arme)
 | 
			
		||||
      let rollData = this.getCommonRollData(undefined, competenceName)
 | 
			
		||||
      rollData.carac = this.system.caracteristiques[key]
 | 
			
		||||
      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)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async rollAttaqueChargeArme(armeId) {
 | 
			
		||||
    let arme = this.items.get(armeId)
 | 
			
		||||
    if (arme) {
 | 
			
		||||
      let key = "agi"
 | 
			
		||||
      arme.system.isMelee = HeritiersUtility.isArmeMelee(arme)
 | 
			
		||||
      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.armes = this.getOtherMeleeWeapons(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"
 | 
			
		||||
      //arme.system.isMelee = HeritiersUtility.isArmeMelee(arme)
 | 
			
		||||
      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) {
 | 
			
		||||
    let pouvoir = this.items.get(pouvoirId)
 | 
			
		||||
    if (pouvoir) {
 | 
			
		||||
      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.label = "Féerie"
 | 
			
		||||
        rollData.carac = duplicate(this.system.caracteristiques[pouvoir.system.carac])
 | 
			
		||||
@@ -616,46 +706,4 @@ export class HeritiersActor extends Actor {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async rollArmeOffensif(armeId) {
 | 
			
		||||
    let arme = this.items.get(armeId)
 | 
			
		||||
    if (arme.type == "arme") {
 | 
			
		||||
      arme = this.prepareArme(arme)
 | 
			
		||||
    }
 | 
			
		||||
    let rollData = this.getCommonRollData(arme.system.attrKey, arme.system.competence._id)
 | 
			
		||||
    rollData.arme = arme
 | 
			
		||||
    HeritiersUtility.updateWithTarget(rollData)
 | 
			
		||||
    console.log("ARME!", rollData)
 | 
			
		||||
    let rollDialog = await HeritiersRollDialog.create(this, rollData)
 | 
			
		||||
    rollDialog.render(true)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async rollArmeDegats(armeId, targetVigueur = undefined) {
 | 
			
		||||
    let arme = this.items.get(armeId)
 | 
			
		||||
    if (arme.type == "arme") {
 | 
			
		||||
      arme = this.prepareArme(arme)
 | 
			
		||||
    }
 | 
			
		||||
    console.log("DEGATS", arme)
 | 
			
		||||
    let roll = new Roll("1d10+" + arme.system.totalDegats).roll({ async: false })
 | 
			
		||||
    await HeritiersUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"));
 | 
			
		||||
    let nbEtatPerdus = 0
 | 
			
		||||
    if (targetVigueur) {
 | 
			
		||||
      nbEtatPerdus = Math.floor(roll.total / targetVigueur)
 | 
			
		||||
    }
 | 
			
		||||
    let rollData = {
 | 
			
		||||
      arme: arme,
 | 
			
		||||
      finalResult: roll.total,
 | 
			
		||||
      alias: this.name,
 | 
			
		||||
      actorImg: this.img,
 | 
			
		||||
      actorId: this.id,
 | 
			
		||||
      actionImg: arme.img,
 | 
			
		||||
      targetVigueur: targetVigueur,
 | 
			
		||||
      nbEtatPerdus: nbEtatPerdus
 | 
			
		||||
    }
 | 
			
		||||
    HeritiersUtility.createChatWithRollMode(rollData.alias, {
 | 
			
		||||
      content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-degats-result.html`, rollData)
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -64,23 +64,42 @@ export const HERITIERS_CONFIG = {
 | 
			
		||||
    "demasque": "Démasqué"
 | 
			
		||||
  },
 | 
			
		||||
  seuilsDifficulte: {
 | 
			
		||||
    "0": "Aucun/Non applicable",
 | 
			
		||||
    "-1": "Aucun/Non applicable",
 | 
			
		||||
    "5": "Enfantine",
 | 
			
		||||
    "6": "Triviale",
 | 
			
		||||
    "7": "Moins Triviale",
 | 
			
		||||
    "8": "Aisée",
 | 
			
		||||
    "7": "Moins Aisée",
 | 
			
		||||
    "10": "Normale",
 | 
			
		||||
    "11": "Moins Normale",
 | 
			
		||||
    "12": "Compliquée",
 | 
			
		||||
    "13": "Plus Compliquée",
 | 
			
		||||
    "14": "Difficile",
 | 
			
		||||
    "15": "Plus Difficile",
 | 
			
		||||
    "16": "Très Difficile",
 | 
			
		||||
    "17": "Très Très Difficile",
 | 
			
		||||
    "18": "Critique",
 | 
			
		||||
    "19": "Plus Critique",
 | 
			
		||||
    "20": "Insurmontable",
 | 
			
		||||
    "20": "Très Insurmontable",
 | 
			
		||||
    "22": "Surhumaine",
 | 
			
		||||
    "23": "Très Surhumaine",
 | 
			
		||||
    "24": "Epique",
 | 
			
		||||
    "25": "Plus Epique",
 | 
			
		||||
    "26": "Légendaire",
 | 
			
		||||
    "26": "Très Légendaire",
 | 
			
		||||
    "28": "Mythique",
 | 
			
		||||
    "29": "Plus Mythique",
 | 
			
		||||
    "30": "Divine"
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  attaqueCible: {
 | 
			
		||||
    "none": "Aucune",
 | 
			
		||||
    "membre": "Membre",
 | 
			
		||||
    "main": "Main",
 | 
			
		||||
    "tete": "Tête/Coeur"
 | 
			
		||||
  },
 | 
			
		||||
  
 | 
			
		||||
  categorieArme : {
 | 
			
		||||
    "trait": "Arme de trait",
 | 
			
		||||
    "poing": "Arme de poing",
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,7 @@ export class HeritiersItemSheet extends ItemSheet {
 | 
			
		||||
      options: this.options,
 | 
			
		||||
      owner: this.document.isOwner,
 | 
			
		||||
      config: game.system.lesheritiers.config,
 | 
			
		||||
      isArmeMelee: HeritiersUtility.isArmeMelee(this.object),
 | 
			
		||||
      description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
 | 
			
		||||
      mr: (this.object.type == 'specialisation'),
 | 
			
		||||
      isGM: game.user.isGM
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
@@ -13,32 +13,46 @@ export class HeritiersRollDialog extends Dialog {
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  constructor(actor, rollData, html, options, close = undefined) {
 | 
			
		||||
    let buttons = {
 | 
			
		||||
      rolld8: {
 | 
			
		||||
        icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
        label: "Lancer 1d8",
 | 
			
		||||
        callback: () => { this.roll("d8") }
 | 
			
		||||
      },
 | 
			
		||||
      rolld10: {
 | 
			
		||||
        icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
        label: "Lancer 1d10",
 | 
			
		||||
        callback: () => { this.roll("d10") }
 | 
			
		||||
      },
 | 
			
		||||
      rolld12: {
 | 
			
		||||
        icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
        label: "Lancer 1d12",
 | 
			
		||||
        callback: () => { this.roll("d12") }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (rollData.tricherie) {
 | 
			
		||||
      buttons["rollTricherie"] = {
 | 
			
		||||
        icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
        label: "Lancer avec 1 Point de Tricherie",
 | 
			
		||||
        callback: () => { this.roll("tricherie") }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (rollData.heritage) {
 | 
			
		||||
      buttons["rollHeritage"] = {
 | 
			
		||||
        icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
        label: "Lancer avec 1 Point d'Héritage",
 | 
			
		||||
        callback: () => { this.roll("heritage") }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    buttons["Cancel"] = {
 | 
			
		||||
      icon: '<i class="fas fa-times"></i>',
 | 
			
		||||
      label: "Annuler",
 | 
			
		||||
      callback: () => { this.close() }
 | 
			
		||||
    }
 | 
			
		||||
    let conf = {
 | 
			
		||||
      title: "Test de Capacité",
 | 
			
		||||
      content: html,
 | 
			
		||||
      buttons:
 | 
			
		||||
      {
 | 
			
		||||
        rolld8: {
 | 
			
		||||
          icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
          label: "Lancer 1d8",
 | 
			
		||||
          callback: () => { this.roll("d8") }
 | 
			
		||||
        },
 | 
			
		||||
        rolld10: {
 | 
			
		||||
          icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
          label: "Lancer 1d10",
 | 
			
		||||
          callback: () => { this.roll("d10") }
 | 
			
		||||
        },
 | 
			
		||||
        rolld12: {
 | 
			
		||||
          icon: '<i class="fas fa-check"></i>',
 | 
			
		||||
          label: "Lancer 1d12",
 | 
			
		||||
          callback: () => { this.roll("d12") }
 | 
			
		||||
        },
 | 
			
		||||
        cancel: {
 | 
			
		||||
          icon: '<i class="fas fa-times"></i>',
 | 
			
		||||
          label: "Annuler",
 | 
			
		||||
          callback: () => { this.close() }
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      buttons: buttons,
 | 
			
		||||
      close: close
 | 
			
		||||
    }
 | 
			
		||||
    // Overwrite in case of carac only -> 1d10
 | 
			
		||||
@@ -64,7 +78,16 @@ export class HeritiersRollDialog extends Dialog {
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  roll(dice) {
 | 
			
		||||
    this.rollData.mainDice = dice
 | 
			
		||||
    if (dice == "heritage") {
 | 
			
		||||
      this.rollData.useHeritage = true
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      if (dice == "tricherie") {
 | 
			
		||||
        this.rollData.useTricherie = true
 | 
			
		||||
      } else {
 | 
			
		||||
        this.rollData.mainDice = dice
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    HeritiersUtility.rollHeritiers(this.rollData)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -87,14 +110,21 @@ export class HeritiersRollDialog extends Dialog {
 | 
			
		||||
    html.find('#bonus-malus-context').change((event) => {
 | 
			
		||||
      this.rollData.bonusMalusContext = Number(event.currentTarget.value)
 | 
			
		||||
    })
 | 
			
		||||
    html.find('#useTricherie').change((event) => {
 | 
			
		||||
      this.rollData.useTricherie = event.currentTarget.checked
 | 
			
		||||
    html.find('#bonus-attaque-plusieurs').change((event) => {
 | 
			
		||||
      this.rollData.bonusAttaquePlusieurs = Number(event.currentTarget.value)
 | 
			
		||||
    })
 | 
			
		||||
    html.find('#useSpecialite').change((event) => {
 | 
			
		||||
      this.rollData.useSpecialite = event.currentTarget.checked
 | 
			
		||||
    })
 | 
			
		||||
    html.find('#useHeritage').change((event) => {
 | 
			
		||||
      this.rollData.useHeritage = event.currentTarget.checked
 | 
			
		||||
    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)
 | 
			
		||||
    })
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -42,12 +42,12 @@ export class HeritiersUtility {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static sortByName(table) {  
 | 
			
		||||
  static sortByName(table) {
 | 
			
		||||
    return table.sort(function (a, b) {
 | 
			
		||||
      return a.name.localeCompare(b.name);
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static sortArrayObjectsByName(myArray) {
 | 
			
		||||
    myArray.sort((a, b) => {
 | 
			
		||||
@@ -269,91 +269,156 @@ export class HeritiersUtility {
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static computeMonnaieDetails(valueSC) {
 | 
			
		||||
    let po = Math.floor(valueSC / 400)
 | 
			
		||||
    let pa = Math.floor((valueSC - (po*400)) / 20)
 | 
			
		||||
    let sc = valueSC - (po*400) - (pa*20)
 | 
			
		||||
    let pa = Math.floor((valueSC - (po * 400)) / 20)
 | 
			
		||||
    let sc = valueSC - (po * 400) - (pa * 20)
 | 
			
		||||
    return {
 | 
			
		||||
      po: po, pa: pa, sc: sc, valueSC: valueSC 
 | 
			
		||||
      po: po, pa: pa, sc: sc, valueSC: valueSC
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static incDecHeritage() {
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static computeResult(actor, rollData) {
 | 
			
		||||
    rollData.diceResult = -1
 | 
			
		||||
    let resTab = []
 | 
			
		||||
    for ( let res of rollData.roll.terms[0].results) {
 | 
			
		||||
      rollData.diceResult = Math.max(res.result, rollData.diceResult)      
 | 
			
		||||
      resTab.push(res.result)
 | 
			
		||||
    }    
 | 
			
		||||
    let isFailure = false
 | 
			
		||||
    if (rollData.mainDice.includes("d10")) {
 | 
			
		||||
      if ( rollData.diceResult == 1) {
 | 
			
		||||
        rollData.finalResult -= 3
 | 
			
		||||
        isFailure = true
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (rollData.mainDice.includes("d12")) {
 | 
			
		||||
      if ( rollData.diceResult == 1 || rollData.diceResult == 2) {
 | 
			
		||||
        rollData.finalResult -= 5
 | 
			
		||||
        isFailure = true
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // Heritage/Tricherie management
 | 
			
		||||
    let isTricherieHeritage = rollData.useHeritage || rollData.useTricherie
 | 
			
		||||
 | 
			
		||||
    rollData.marge = 0
 | 
			
		||||
    if (!isFailure && (rollData.useHeritage || rollData.useTricherie)) {
 | 
			
		||||
 | 
			
		||||
    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]
 | 
			
		||||
      rollData.diceResult = resTab[0] + "," + resTab[1] + "," + resTab[2]
 | 
			
		||||
      let foundryTotal = resTab[0] + resTab[1] + resTab[2] 
 | 
			
		||||
      if (resTab[1] == 1) { resTab[1] -= 4 }
 | 
			
		||||
      if (resTab[2] == 1) { resTab[2] -= 6 }
 | 
			
		||||
      if (resTab[2] == 2) { resTab[2] -= 7 }
 | 
			
		||||
      rollData.finalResult = rollData.roll.total - foundryTotal + Math.max(Math.max(resTab[0], resTab[1]), resTab[2])
 | 
			
		||||
 | 
			
		||||
      // Gestion des résultats spéciaux
 | 
			
		||||
      resTab = resTab.sort()
 | 
			
		||||
      if ( (resTab[0] == resTab[1]) && (resTab[1] == resTab[2])) {
 | 
			
		||||
      if ((resTab[0] == resTab[1]) && (resTab[1] == resTab[2])) {
 | 
			
		||||
        rollData.marge = 7
 | 
			
		||||
        rollData.isSuccess = true
 | 
			
		||||
        rollData.isCriticalSuccess = true        
 | 
			
		||||
        rollData.isCriticalSuccess = true
 | 
			
		||||
        rollData.isBrelan = true
 | 
			
		||||
      }
 | 
			
		||||
      if ((resTab[0]+1 == resTab[1]) && (resTab[1]+1 == resTab[2]) ) {
 | 
			
		||||
      if ((resTab[0] + 1 == resTab[1]) && (resTab[1] + 1 == resTab[2])) {
 | 
			
		||||
        rollData.marge = 7
 | 
			
		||||
        rollData.isSuccess = true
 | 
			
		||||
        rollData.isCriticalSuccess = true        
 | 
			
		||||
      }      
 | 
			
		||||
      if ( rollData.useTricherie) {
 | 
			
		||||
        rollData.isCriticalSuccess = true
 | 
			
		||||
        rollData.isSuite = true
 | 
			
		||||
      }
 | 
			
		||||
      if (rollData.useTricherie) {
 | 
			
		||||
        actor.incDecTricherie(-1)
 | 
			
		||||
      }
 | 
			
		||||
      if ( rollData.useHeritage) {
 | 
			
		||||
      if (rollData.useHeritage) {
 | 
			
		||||
        this.incDecHeritage()
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
      rollData.finalResult = rollData.roll.total
 | 
			
		||||
      let rollValue = rollData.roll.terms[0].results[0].result
 | 
			
		||||
      rollData.diceResult = rollData.roll.terms[0].results[0].result
 | 
			
		||||
      if (rollData.mainDice.includes("d10")) {
 | 
			
		||||
        if (rollValue == 1) {
 | 
			
		||||
          rollData.finalResult -= 3 + rollValue // substract 3 and the 1 value that has been added
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (rollData.mainDice.includes("d12")) {
 | 
			
		||||
        if (rollValue == 1 || rollValue == 2) {
 | 
			
		||||
          rollData.finalResult -= 5 + rollValue // Remove also the dice result has it has been added already
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    //rollData.finalResult = Math.max(rollData.finalResult, 0)
 | 
			
		||||
    //console.log("Result : ", rollData)
 | 
			
		||||
    if (rollData.marge == 0 && rollData.sdValue > 0 ) {
 | 
			
		||||
      rollData.marge = rollData.finalResult - rollData.sdValue
 | 
			
		||||
      rollData.isSuccess = (rollData.finalResult >= rollData.sdValue)
 | 
			
		||||
      rollData.isCriticalSuccess = ((rollData.finalResult - rollData.sdValue) >= 7)
 | 
			
		||||
      rollData.isCriticalFailure = ((rollData.finalResult - rollData.sdValue) <= -7)
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static computeArmeDegats(rollData, actor) {
 | 
			
		||||
    rollData.degatsArme = rollData.arme.system.degats + rollData.marge
 | 
			
		||||
    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.attaqueCible == "membre") {
 | 
			
		||||
      rollData.degatsArme -= 2
 | 
			
		||||
    }
 | 
			
		||||
    if (rollData.attaqueCible == "main") {
 | 
			
		||||
      rollData.degatsArme -= 3
 | 
			
		||||
    }
 | 
			
		||||
    if (rollData.attaqueCible == "tete") {
 | 
			
		||||
      rollData.degatsArme *= 3
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static computeMarge(rollData, seuil) {
 | 
			
		||||
    if (rollData.marge == 0 && seuil >= 0) {
 | 
			
		||||
      rollData.marge = rollData.finalResult - seuil
 | 
			
		||||
      rollData.isSuccess = (rollData.finalResult >= seuil)
 | 
			
		||||
      rollData.isCriticalSuccess = ((rollData.finalResult - seuil) >= 7)
 | 
			
		||||
      rollData.isCriticalFailure = ((rollData.finalResult - seuil) <= -7)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static async displayUneDefense(rollData, actor, nomDefense, valeurDefense) {
 | 
			
		||||
    rollData.defenderMode = nomDefense
 | 
			
		||||
    rollData.defenderValue = valeurDefense
 | 
			
		||||
    rollData.marge = 0
 | 
			
		||||
    this.computeMarge(rollData, valeurDefense)
 | 
			
		||||
    if (rollData.isSuccess) {
 | 
			
		||||
      this.computeArmeDegats(rollData, actor)
 | 
			
		||||
    }
 | 
			
		||||
    this.createChatWithRollMode(rollData.alias, {
 | 
			
		||||
      content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-cc-result.html`, rollData)
 | 
			
		||||
    }, 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) {
 | 
			
		||||
 | 
			
		||||
    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.carac = duplicate(actor.system.caracteristiques[rollData.caracKey])
 | 
			
		||||
 | 
			
		||||
    rollData.nbDice = (rollData.useTricherie || rollData.useHeritage) ? 3 : 1
 | 
			
		||||
    rollData.diceFormula = rollData.nbDice + rollData.mainDice + "kh1"
 | 
			
		||||
    //console.log("BEFORE COMP", rollData)
 | 
			
		||||
    if (rollData.useTricherie || rollData.useHeritage) {
 | 
			
		||||
      rollData.diceFormula = "{1d8, 1d10, 1d12}"
 | 
			
		||||
    } else {
 | 
			
		||||
      rollData.diceFormula = "1" + rollData.mainDice + "kh1"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let rangValue = 0
 | 
			
		||||
    if (rollData.rang) {
 | 
			
		||||
      rangValue = rollData.rang.value
 | 
			
		||||
    } 
 | 
			
		||||
    }
 | 
			
		||||
    if (rollData.competence) {
 | 
			
		||||
      let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
 | 
			
		||||
      let specBonus = (rollData.useSpecialite) ? 1 : 0
 | 
			
		||||
@@ -363,34 +428,75 @@ export class HeritiersUtility {
 | 
			
		||||
    } else {
 | 
			
		||||
      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}`
 | 
			
		||||
 | 
			
		||||
    // Gestion bonus attaque à plusieurs
 | 
			
		||||
    let bonusAttaque = rollData.bonusAttaquePlusieurs
 | 
			
		||||
    if (rollData.attaqueDos) {
 | 
			
		||||
      bonusAttaque = 2
 | 
			
		||||
      if (rollData.bonusAttaquePlusieurs) { 
 | 
			
		||||
        bonusAttaque = 3 // Valeur max, cf règle page 197
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    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
 | 
			
		||||
    console.log(">>>> ", myRoll)
 | 
			
		||||
 | 
			
		||||
    rollData.finalResult = myRoll.total
 | 
			
		||||
    this.computeResult(actor, rollData)
 | 
			
		||||
    this.computeMarge(rollData, rollData.sdValue) // Calcul de la marge si seuil présent
 | 
			
		||||
 | 
			
		||||
    if (rollData.mode == "init") {
 | 
			
		||||
      actor.setFlag("world", "last-initiative", rollData.finalResult)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Compute damages, cf p 187
 | 
			
		||||
    if (rollData.arme && rollData.isSuccess) {
 | 
			
		||||
      rollData.degatsArme = rollData.arme.system.degats + rollData.marge
 | 
			
		||||
      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)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.createChatWithRollMode(rollData.alias, {
 | 
			
		||||
      content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData)
 | 
			
		||||
    }, rollData)
 | 
			
		||||
 | 
			
		||||
    // 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" ) {
 | 
			
		||||
        await this.displayUneDefense(rollData, actor, "Parade", rollData.defenderParade)
 | 
			
		||||
        await this.displayUneDefense(rollData, actor, "Esquive", rollData.defenderEsquive)
 | 
			
		||||
      } else if (rollData.sdValue) {
 | 
			
		||||
        this.displayUneDefense(rollData, actor, "A Distance", rollData.sdValue)
 | 
			
		||||
      } else {
 | 
			
		||||
        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) 
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
@@ -416,6 +522,10 @@ export class HeritiersUtility {
 | 
			
		||||
    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) {
 | 
			
		||||
    switch (rollMode) {
 | 
			
		||||
@@ -500,8 +610,14 @@ export class HeritiersUtility {
 | 
			
		||||
      rollId: randomID(16),
 | 
			
		||||
      rollMode: game.settings.get("core", "rollMode"),
 | 
			
		||||
      sdList: game.system.lesheritiers.config.seuilsDifficulte,
 | 
			
		||||
      sdValue: 0,
 | 
			
		||||
      bonusMalusContext: 0
 | 
			
		||||
      sdValue: -1,
 | 
			
		||||
      bonusAttaquePlusieurs: 0,
 | 
			
		||||
      attaqueDeuxArmes: 0,
 | 
			
		||||
      attaqueDos: false,
 | 
			
		||||
      bonusMalusContext: 0,
 | 
			
		||||
      attaqueCible: "none",
 | 
			
		||||
      config: game.system.lesheritiers.config,
 | 
			
		||||
      rulesMalus : []
 | 
			
		||||
    }
 | 
			
		||||
    return rollData
 | 
			
		||||
  }
 | 
			
		||||
@@ -512,18 +628,18 @@ export class HeritiersUtility {
 | 
			
		||||
    if (target) {
 | 
			
		||||
      rollData.defenderTokenId = target.id
 | 
			
		||||
      let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
 | 
			
		||||
      rollData.armeDefense = defender.getBestDefenseValue()
 | 
			
		||||
      rollData.targetVigueur = defender.getVigueur()
 | 
			
		||||
      if (rollData.armeDefense) {
 | 
			
		||||
        rollData.difficulte = rollData.armeDefense.system.totalDefensif
 | 
			
		||||
      } else {
 | 
			
		||||
        ui.notifications.warn("Aucune arme de défense équipée, difficulté manuelle à positionner.")
 | 
			
		||||
      }
 | 
			
		||||
      rollData.defenderName = defender.name
 | 
			
		||||
      rollData.defenderParade = defender.getCurrentParade()
 | 
			
		||||
      rollData.defenderEsquive = defender.getCurrentEsquive()
 | 
			
		||||
      rollData.defenderResistancePhysique = defender.getCurrentResistancePhysique()
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static createChatWithRollMode(name, chatOptions, rollData = undefined) {
 | 
			
		||||
  static createChatWithRollMode(name, chatOptions, rollData = undefined, rollMode = undefined) {
 | 
			
		||||
    if (rollMode == undefined) {
 | 
			
		||||
      rollMode = game.settings.get("core", "rollMode")
 | 
			
		||||
    }
 | 
			
		||||
    this.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions, rollData)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1245,7 +1245,10 @@ ul, li {
 | 
			
		||||
  position:relative;
 | 
			
		||||
  top:1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.button-sheet-roll-long1 {
 | 
			
		||||
  max-width: 6.1rem;
 | 
			
		||||
  min-width: 6.1rem;
 | 
			
		||||
}
 | 
			
		||||
.defense-sheet {
 | 
			
		||||
  border-radius: 4px;
 | 
			
		||||
  text-align: center;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "id": "fvtt-les-heritiers",
 | 
			
		||||
  "description": "Les Héritiers pour FoundryVTT",
 | 
			
		||||
  "version": "10.0.32",
 | 
			
		||||
  "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.32.zip",
 | 
			
		||||
  "download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.1.0.zip",
 | 
			
		||||
  "languages": [
 | 
			
		||||
    {
 | 
			
		||||
      "lang": "fr",
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,7 @@
 | 
			
		||||
          "habitat": "",
 | 
			
		||||
          "notes": "",
 | 
			
		||||
          "statut": "",
 | 
			
		||||
          "playernotes":"",
 | 
			
		||||
          "gmnotes": ""
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,16 @@
 | 
			
		||||
              <label class="item-field-label-short">Malus</label>
 | 
			
		||||
              <input type="text" class="item-field-label-short" value="{{pvMalus}}" data-dtype="Number" disabled />
 | 
			
		||||
              <span>  </span>
 | 
			
		||||
 | 
			
		||||
              <select class="item-field-label-medium" type="text" name="system.statutmasque" value="{{system.statutmasque}}" data-dtype="string">
 | 
			
		||||
                {{#select system.statutmasque}}
 | 
			
		||||
                  {{#each config.statutMasque as |categ cKey|}}
 | 
			
		||||
                    <option value="{{cKey}}">{{categ}}</option>
 | 
			
		||||
                  {{/each}}
 | 
			
		||||
                {{/select}}
 | 
			
		||||
                </select>
 | 
			
		||||
  
 | 
			
		||||
              <span>  </span>
 | 
			
		||||
              <label class="item-field-label-short">Tricherie</label>
 | 
			
		||||
              <input type="text" class="item-field-label-short" name="system.rang.tricherie.value" value="{{system.rang.tricherie.value}}" data-dtype="Number" />
 | 
			
		||||
              <input type="text" class="item-field-label-short" name="system.rang.tricherie.max" value="{{system.rang.tricherie.max}}" data-dtype="Number" />
 | 
			
		||||
 
 | 
			
		||||
@@ -176,20 +176,6 @@
 | 
			
		||||
          <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" />
 | 
			
		||||
        </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>
 | 
			
		||||
 | 
			
		||||
      <div class="flexcol">
 | 
			
		||||
@@ -201,10 +187,10 @@
 | 
			
		||||
                <h3><label class="items-title-text">Armes</label></h3>
 | 
			
		||||
              </span>
 | 
			
		||||
              <span class="item-field-label-short">
 | 
			
		||||
                <label class="short-label">Attaque</label>
 | 
			
		||||
                <label class="short-label">Dégats</label>
 | 
			
		||||
              </span>
 | 
			
		||||
              <span class="item-field-label-short">
 | 
			
		||||
                <label class="short-label">Dégats</label>
 | 
			
		||||
                <label class="short-label">Attaque</label>
 | 
			
		||||
              </span>
 | 
			
		||||
              <div class="item-filler"> </div>
 | 
			
		||||
              <div class="item-controls item-controls-fixed">
 | 
			
		||||
@@ -218,13 +204,26 @@
 | 
			
		||||
              <span class="item-name-label competence-name">{{arme.name}}</span>
 | 
			
		||||
 | 
			
		||||
              <span class="item-field-label-short">
 | 
			
		||||
                <button class="roll-attaque-arme button-sheet-roll">Attaquer</button>
 | 
			
		||||
                {{arme.system.degats}}
 | 
			
		||||
              </span>
 | 
			
		||||
 | 
			
		||||
              <span class="item-field-label-short">
 | 
			
		||||
                {{arme.system.degats}}
 | 
			
		||||
                <button class="roll-attaque-arme button-sheet-roll">Attaque</button>
 | 
			
		||||
              </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-controls item-controls-fixed">
 | 
			
		||||
                <a class="item-control item-equip" title="Worn">{{#if arme.system.equipped}}<i
 | 
			
		||||
@@ -645,18 +644,28 @@
 | 
			
		||||
      <div class="medium-editor item-text-long-line">
 | 
			
		||||
        {{editor description target="system.biodata.description" button=true owner=owner editable=editable}}
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <span>
 | 
			
		||||
        <h3>Notes diverses</h3>
 | 
			
		||||
      </span>
 | 
			
		||||
      <div class="medium-editor item-text-long-line">
 | 
			
		||||
        {{editor playernotes target="system.biodata.playernotes" button=true owner=owner editable=editable}}
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <span>
 | 
			
		||||
        <h3>Rêves étranges</h3>
 | 
			
		||||
      </span>
 | 
			
		||||
      <div class="medium-editor item-text-long-line">
 | 
			
		||||
        {{editor revesetranges target="system.biodata.revesetranges" button=true owner=owner editable=editable}}
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <span>
 | 
			
		||||
        <h3>Secrets découverts</h3>
 | 
			
		||||
      </span>
 | 
			
		||||
      <div class="medium-editor item-text-long-line">
 | 
			
		||||
        {{editor secretsdecouverts target="system.biodata.secretsdecouverts" button=true owner=owner editable=editable}}
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <span>
 | 
			
		||||
        <h3>Questions en suspens</h3>
 | 
			
		||||
      </span>
 | 
			
		||||
 
 | 
			
		||||
@@ -18,11 +18,13 @@
 | 
			
		||||
 | 
			
		||||
<div>
 | 
			
		||||
  <ul>
 | 
			
		||||
    <li>Arme : {{arme.name}} (+{{arme.system.totalDegats}})</li>
 | 
			
		||||
    <li>Dégats : {{finalResult}}</li>    
 | 
			
		||||
    {{#if targetVigueur}}
 | 
			
		||||
      <li>Vigueur de la cible : {{targetVigueur}}</li>    
 | 
			
		||||
      <li>Etats Combativité supplémentaires perdus (manuel): {{nbEtatPerdus}} </li>
 | 
			
		||||
    <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>
 | 
			
		||||
							
								
								
									
										42
									
								
								templates/chat-cc-result.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								templates/chat-cc-result.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
<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>Défense de {{defenderName}} : {{defenderMode}} ({{defenderValue}})</li>    
 | 
			
		||||
    
 | 
			
		||||
    {{#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}}
 | 
			
		||||
    {{else}}
 | 
			
		||||
      <li>Echec face à la {{defenderMode}} !</li>
 | 
			
		||||
    {{/if}}
 | 
			
		||||
 | 
			
		||||
  </ul>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -33,6 +33,9 @@
 | 
			
		||||
 | 
			
		||||
    {{#if arme}}
 | 
			
		||||
    <li>Attaque avec : {{arme.name}}</li>
 | 
			
		||||
      {{#if (eq mode "assommer")}}
 | 
			
		||||
      <li>Attaque pour assommer</li>
 | 
			
		||||
      {{/if}}
 | 
			
		||||
    {{/if}}
 | 
			
		||||
 | 
			
		||||
    {{#if pouvoir}}
 | 
			
		||||
@@ -42,26 +45,26 @@
 | 
			
		||||
 | 
			
		||||
    <li>Formule : {{diceFormula}}</li>
 | 
			
		||||
    <li>Résultat du dé : {{diceResult}} </li>  
 | 
			
		||||
    <li>Total : {{finalResult}} (Marge : {{marge}})</li>
 | 
			
		||||
    <li>Total : {{finalResult}} {{#if (gt sdValue "-1")}}(Marge : {{marge}}){{/if}}</li>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    {{#if sdValue}}
 | 
			
		||||
    {{#if (gt sdValue "-1")}}
 | 
			
		||||
    {{#if isSuccess}}
 | 
			
		||||
    <li class="chat-success">Succés...
 | 
			
		||||
      {{#if arme}}
 | 
			
		||||
      <li>Dégats : {{degatsArme}}</li>
 | 
			
		||||
      {{/if}}
 | 
			
		||||
    <li class="chat-success">Succès...
 | 
			
		||||
    </li>
 | 
			
		||||
    {{else}}
 | 
			
		||||
    <li class="chat-failure">Echec...</li>
 | 
			
		||||
    {{/if}}
 | 
			
		||||
    {{/if}}
 | 
			
		||||
 | 
			
		||||
    {{#if isBrelan}}
 | 
			
		||||
    <li class="chat-success">Brelan sur 3 dés !</li>
 | 
			
		||||
    {{/if}}
 | 
			
		||||
    {{#if isSuite}}
 | 
			
		||||
    <li class="chat-success">Suite sur 3 dés !</li>
 | 
			
		||||
    {{/if}}
 | 
			
		||||
 | 
			
		||||
    {{#if isCriticalSuccess}}
 | 
			
		||||
    <li class="chat-success">Réussite Critique !!!</li>
 | 
			
		||||
      {{#if arme}}
 | 
			
		||||
        <li>Vous pouvez augmenter les dégats de +2 ou bien bénéficier d'une Aubaine.</li>
 | 
			
		||||
      {{/if}}
 | 
			
		||||
    {{/if}}
 | 
			
		||||
    {{#if isCriticalFailure}}
 | 
			
		||||
    <li class="chat-failure">Echec Critique !!!</li>
 | 
			
		||||
 
 | 
			
		||||
@@ -66,23 +66,67 @@
 | 
			
		||||
      {{/if}}
 | 
			
		||||
    {{/if}}
 | 
			
		||||
 | 
			
		||||
    {{#each rulesMalus as |malus key|}}
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
      <span class="roll-dialog-label">Malus de Santé</span>
 | 
			
		||||
      <span class="small-label roll-dialog-label">{{pvMalus}}</span>
 | 
			
		||||
      <span class="roll-dialog-label">{{malus.name}}</span>
 | 
			
		||||
      <span class="small-label roll-dialog-label">{{malus.value}}</span>
 | 
			
		||||
    </div>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
 | 
			
		||||
    {{#if tricherie}}
 | 
			
		||||
    {{#if (and arme arme.system.isMelee)}}
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
      <span class="roll-dialog-label">Utiliser 1 point de Tricherie ({{tricherie}}) ?</span>
 | 
			
		||||
      <input type="checkbox" class="item-field-label-short" id="useTricherie" {{checked useTricherie}}/>
 | 
			
		||||
      <span class="roll-dialog-label">Attaque à plusieurs </span>
 | 
			
		||||
      <select class="roll-dialog-label" id="bonus-attaque-plusieurs" type="text" value="{{bonusAttaquePlusieurs}}"
 | 
			
		||||
        data-dtype="Number">
 | 
			
		||||
        {{#select bonusAttaquePlusieurs}}
 | 
			
		||||
        <option value="0">0</option>
 | 
			
		||||
        <option value="1">+1</option>
 | 
			
		||||
        <option value="2">+2</option>
 | 
			
		||||
        {{/select}}
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
      <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 heritage}}
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
      <span class="roll-dialog-label">Utiliser 1 point d'Heritage ? ({{heritage}})</span>
 | 
			
		||||
      <input type="checkbox" class="item-field-label-short" id="useHeritage" {{checked useHeritage}}/>
 | 
			
		||||
    </div>
 | 
			
		||||
    {{/if}}
 | 
			
		||||
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
@@ -107,6 +151,11 @@
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    {{#if cacheDifficulte}}
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
      <span class="roll-dialog-label">Difficulté Cachée/Inconnue</span>
 | 
			
		||||
    </div>
 | 
			
		||||
    {{else}}
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
      <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" >
 | 
			
		||||
@@ -117,6 +166,7 @@
 | 
			
		||||
        {{/select}}
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
    {{/if}}
 | 
			
		||||
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user