Fix ranged defense + HTH attacks
This commit is contained in:
@@ -302,6 +302,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
dice = options.rollTarget.damageDice
|
||||
dice = dice.replace("E", "")
|
||||
baseFormula = dice
|
||||
if (options.rollTarget.noExplode) hasMaxValue = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
||||
painDamage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
})
|
||||
|
||||
const attackField = (label) => {
|
||||
const attackField = (label, initialNoExplode = false) => {
|
||||
const schema = {
|
||||
key: new fields.StringField({ required: true, nullable: false, initial: `attack${label}` }),
|
||||
name: new fields.StringField({ required: true, nullable: false, initial: `Attack ${label}` }),
|
||||
@@ -74,6 +74,8 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
||||
damageDice: new fields.StringField({ required: true, nullable: false, initial: "1D6" }),
|
||||
damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
enabled: new fields.BooleanField({ initial: true, required: true, nullable: false }),
|
||||
range: new fields.StringField({ required: false, nullable: true, initial: "" }),
|
||||
noExplode: new fields.BooleanField({ initial: initialNoExplode, required: true, nullable: false }),
|
||||
}
|
||||
return new fields.SchemaField(schema, { label })
|
||||
}
|
||||
@@ -123,8 +125,8 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
||||
shieldDefenseDice: new fields.StringField({ required: true, nullable: false, initial: "d4" })
|
||||
})
|
||||
schema.combatHTH = new fields.SchemaField({
|
||||
attack1: attackField("1"),
|
||||
attack2: attackField("2")
|
||||
attack1: attackField("1", true),
|
||||
attack2: attackField("2", true)
|
||||
})
|
||||
|
||||
schema.attackMode = new fields.StringField({
|
||||
|
||||
+32
-1
@@ -334,7 +334,7 @@ export default class LethalFantasyUtils {
|
||||
|
||||
// Afficher le dialogue
|
||||
const result = await foundry.applications.api.DialogV2.wait({
|
||||
window: { title: "Defense Roll" },
|
||||
window: { title: msg.isRanged ? "Ranged Defense Roll" : "Defense Roll" },
|
||||
classes: ["lethalfantasy"],
|
||||
content,
|
||||
buttons: [
|
||||
@@ -375,6 +375,37 @@ export default class LethalFantasyUtils {
|
||||
return
|
||||
}
|
||||
|
||||
// Pour les personnages, récupérer les armes équipées
|
||||
// Si l'attaque est une attaque à distance, utiliser le dialogue de défense à distance
|
||||
if (msg.isRanged) {
|
||||
const { default: LethalFantasyRoll } = await import("./documents/roll.mjs")
|
||||
const roll = await LethalFantasyRoll.promptRangedDefense({
|
||||
actorId: defender.id,
|
||||
actorName: defender.name,
|
||||
actorImage: defender.img,
|
||||
})
|
||||
if (roll) {
|
||||
game.lethalFantasy = game.lethalFantasy || {}
|
||||
game.lethalFantasy.nextDefenseData = {
|
||||
attackerId,
|
||||
attackRoll,
|
||||
attackerName,
|
||||
defenderName,
|
||||
attackWeaponId,
|
||||
attackRollType,
|
||||
attackRollKey,
|
||||
attackD30result,
|
||||
attackD30message,
|
||||
attackRerollContext,
|
||||
defenderId: defender.id,
|
||||
defenderTokenId,
|
||||
isRanged: true
|
||||
}
|
||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Pour les personnages, récupérer les armes équipées
|
||||
const equippedWeapons = defender.items.filter(i =>
|
||||
i.type === "weapon" && i.system.equipped === true
|
||||
|
||||
Reference in New Issue
Block a user