Fixes around D30 managemen
This commit is contained in:
@@ -250,6 +250,7 @@ Hooks.on(hookName, (message, html, data) => {
|
||||
const attackWeaponId = message.rolls[0]?.rollTarget?.weapon?.id || message.rolls[0]?.rollTarget?.weapon?._id
|
||||
const attackRollType = message.rolls[0]?.type
|
||||
const attackRollKey = message.rolls[0]?.rollTarget?.rollKey
|
||||
console.log(`[LF] request-defense-btn | attackRollType=${attackRollType} defender=${defenderName} defenderType=${combatant.actor?.type}`)
|
||||
const attackD30result = message.rolls[0]?.options?.D30result || null
|
||||
const attackD30message = message.rolls[0]?.options?.D30message || null
|
||||
const attackRerollContext = {
|
||||
@@ -294,10 +295,14 @@ Hooks.on(hookName, (message, html, data) => {
|
||||
const attacker = game.actors.get(attackerId)
|
||||
const attackerOwners = attacker ? game.users.filter(u => attacker.testUserPermission(u, "OWNER")).map(u => u.id) : []
|
||||
|
||||
// Monsters always need their owner (usually the GM) to roll a save/defense,
|
||||
// even if that owner also controls the attacker. Only skip for same-player PC-vs-PC.
|
||||
const defenderIsMonster = combatant.actor?.type === "monster"
|
||||
|
||||
let messageSent = false
|
||||
owners.forEach(owner => {
|
||||
// Ne pas afficher le dialogue à l'attaquant lui-même s'il contrôle aussi le défenseur
|
||||
if (attackerOwners.includes(owner.id) && owner.id === game.user.id) {
|
||||
// Don't let a player be both attacker and defender for their own PC, unless defending a monster.
|
||||
if (attackerOwners.includes(owner.id) && owner.id === game.user.id && !defenderIsMonster) {
|
||||
// Ne rien faire - on ne veut pas que l'attaquant se défende contre lui-même
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user