Initial release
This commit is contained in:
@@ -198,15 +198,9 @@ export class MaleficesActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getInitiativeScore(combatId, combatantId) {
|
||||
if (this.type == 'character') {
|
||||
let init = this.getFlag("world", "initiative" )
|
||||
console.log("INIT", init)
|
||||
if (!init || init == -1) {
|
||||
ChatMessage.create( { content: "Roll your initiative for this combat"} )
|
||||
}
|
||||
return init
|
||||
}
|
||||
return -1;
|
||||
let init = Math.floor(this.system.attributs.physique.value+this.system.attributs.habilete.value)
|
||||
let subvalue = new Roll("1d20").roll({async: false})
|
||||
return init + (subvalue / 100)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -268,6 +262,12 @@ export class MaleficesActor extends Actor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getAtttributImage( attrKey) {
|
||||
return `systems/fvtt-malefices/images/icons/${attrKey}.webp`
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCommonRollData() {
|
||||
|
||||
@@ -276,50 +276,54 @@ export class MaleficesActor extends Actor {
|
||||
rollData.actorImg = this.img
|
||||
rollData.actorId = this.id
|
||||
rollData.img = this.img
|
||||
rollData.phyMalus = this.getPhysiqueMalus()
|
||||
|
||||
console.log("ROLLDATA", rollData)
|
||||
|
||||
return rollData
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getPhysiqueMalus() {
|
||||
if ( this.system.attributs.constitution.value <= 8) {
|
||||
return -(9 - this.system.attributs.constitution.value)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollAtribut(attrKey, skillKey) {
|
||||
let attr = this.system.attributes[attrKey]
|
||||
let skill = attr.skills[skillKey]
|
||||
if (skill) {
|
||||
skill = duplicate(skill)
|
||||
skill.name = MaleficesUtility.upperFirst(skillKey)
|
||||
skill.attr = duplicate(attr)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "skill"
|
||||
rollMode.skillKey = skillKey
|
||||
rollData.skill = skill
|
||||
rollData.title = "Roll Skill " + skill.name
|
||||
rollData.img = skill.img
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
rollAttribut(attrKey) {
|
||||
let attr = this.system.attributs[attrKey]
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.attr = duplicate(attr)
|
||||
rollData.mode = "attribut"
|
||||
rollData.title = attr.label
|
||||
rollData.img = this.getAtttributImage(attrKey)
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(weaponId) {
|
||||
let weapon = this.items.get(weaponId)
|
||||
if (weapon) {
|
||||
weapon = duplicate(weapon)
|
||||
this.prepareWeapon(weapon)
|
||||
let arme = this.items.get(weaponId)
|
||||
if (arme) {
|
||||
arme = duplicate(arme)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.modifier = this.system.bonus[weapon.system.weapontype]
|
||||
rollData.mode = "weapon"
|
||||
rollData.weapon = weapon
|
||||
rollData.img = weapon.img
|
||||
if (arme.system.armetype == "mainsnues" || arme.system.armetype == "epee") {
|
||||
rollData.attr = { label: "(Physique+Habilité)/2", value: Math.floor( (this.getPhysiqueMalus()+this.system.attributs.physique+this.system.attributs.habilite) / 2) }
|
||||
} else {
|
||||
rollData.attr = duplicate(this.system.attributs.habilite)
|
||||
}
|
||||
rollData.mode = "arme"
|
||||
rollData.arme = arme
|
||||
rollData.img = arme.img
|
||||
rollData.title = arme.name
|
||||
this.startRoll(rollData)
|
||||
} else {
|
||||
ui.notifications.warn("Unable to find the relevant weapon ")
|
||||
ui.notifications.warn("Impossible de trouver l'arme concernée ")
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async startRoll(rollData) {
|
||||
this.syncRoll(rollData)
|
||||
let rollDialog = await MaleficesRollDialog.create(this, rollData)
|
||||
rollDialog.render(true)
|
||||
}
|
||||
|
Reference in New Issue
Block a user