Add exchangee stuff

This commit is contained in:
2022-08-06 17:06:05 +02:00
parent 2517149ab4
commit 99c0b26f78
9 changed files with 202 additions and 62 deletions

View File

@ -554,6 +554,34 @@ export class CrucibleActor extends Actor {
}
}
/* -------------------------------------------- */
rollDefenseMelee(attackRollData) {
let weapon = this.data.items.get(attackRollData.defenseWeaponId)
if (weapon) {
weapon = duplicate(weapon)
let skill = this.data.items.find(item => item.name.toLowerCase() == weapon.data.skill.toLowerCase())
if (skill) {
skill = duplicate(skill)
CrucibleUtility.updateSkill(skill)
let abilityKey = skill.data.ability
let rollData = this.getCommonRollData(abilityKey)
rollData.defenderTokenId = undefined // Cleanup
rollData.mode = "weapondefense"
rollData.shield = this.getEquippedShield()
rollData.attackRollData = duplicate(attackRollData)
rollData.skill = skill
rollData.weapon = weapon
rollData.img = weapon.img
this.startRoll(rollData)
} else {
ui.notifications.warn("Unable to find the relevant skill for weapon " + weapon.name)
}
} else {
ui.notifications.warn("Weapon not found ! ")
}
}
/* -------------------------------------------- */
rollShieldDie() {
let shield = this.getEquippedShield()