Corrections diverses autout du combat
This commit is contained in:
@@ -112,6 +112,7 @@ export default class CelestopolNPC extends foundry.abstract.TypeDataModel {
|
||||
|
||||
return CelestopolRoll.prompt({
|
||||
actorId: this.parent.id,
|
||||
actorUuid: this.parent.uuid,
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
statId,
|
||||
@@ -127,4 +128,95 @@ export default class CelestopolNPC extends foundry.abstract.TypeDataModel {
|
||||
async rollResistance(statId) {
|
||||
return this.roll(statId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Collecte les cibles protagonistes de la scène active pour les jets de combat PNJ.
|
||||
* @returns {Array<{id:string, name:string, corps:number}>}
|
||||
*/
|
||||
_getCombatTargets() {
|
||||
const toEntry = actor => ({
|
||||
id: actor.id,
|
||||
uuid: actor.uuid,
|
||||
name: actor.name,
|
||||
corps: actor.system.stats?.corps?.res ?? 0,
|
||||
})
|
||||
const sceneTokens = canvas?.scene?.isView ? (canvas.tokens?.placeables ?? []) : []
|
||||
return [...new Map(sceneTokens
|
||||
.filter(t => t.actor?.type === "character" && t.actor.id !== this.parent.id)
|
||||
.map(t => {
|
||||
const actor = t.actor
|
||||
return [actor.id, toEntry(actor)]
|
||||
})).values()]
|
||||
}
|
||||
|
||||
/**
|
||||
* Lance une attaque PNJ avec une arme.
|
||||
* Le test utilise le domaine Corps et transmet explicitement les dégâts de l'arme.
|
||||
* @param {string} itemId
|
||||
* @returns {Promise<import("../documents/roll.mjs").CelestopolRoll|null>}
|
||||
*/
|
||||
async rollAttack(itemId) {
|
||||
const { CelestopolRoll } = await import("../documents/roll.mjs")
|
||||
const item = this.parent.items.get(itemId)
|
||||
if (!item || item.type !== "weapon") return null
|
||||
|
||||
return CelestopolRoll.prompt({
|
||||
actorId: this.parent.id,
|
||||
actorUuid: this.parent.uuid,
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
statId: "corps",
|
||||
skillId: null,
|
||||
statLabel: SYSTEM.STATS.corps.label,
|
||||
skillLabel: "CELESTOPOL.Combat.attack",
|
||||
skillValue: this.stats.corps.res,
|
||||
woundMalus: this.getWoundMalus(),
|
||||
armorMalus: this.getArmorMalusForRoll("corps"),
|
||||
woundLevel: this.blessures.lvl,
|
||||
rollMoonDie: false,
|
||||
destGaugeFull: false,
|
||||
fortuneValue: 0,
|
||||
isCombat: true,
|
||||
isRangedDefense: false,
|
||||
weaponType: item.system.type,
|
||||
weaponName: item.name,
|
||||
weaponDegats: item.system.degats,
|
||||
availableTargets: this._getCombatTargets(),
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Lance un jet de tir/esquive PNJ avec une arme à distance.
|
||||
* @param {string} itemId
|
||||
* @returns {Promise<import("../documents/roll.mjs").CelestopolRoll|null>}
|
||||
*/
|
||||
async rollRangedDefense(itemId) {
|
||||
const { CelestopolRoll } = await import("../documents/roll.mjs")
|
||||
const item = this.parent.items.get(itemId)
|
||||
if (!item || item.type !== "weapon" || item.system.type !== "distance") return null
|
||||
|
||||
return CelestopolRoll.prompt({
|
||||
actorId: this.parent.id,
|
||||
actorUuid: this.parent.uuid,
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
statId: "corps",
|
||||
skillId: null,
|
||||
statLabel: SYSTEM.STATS.corps.label,
|
||||
skillLabel: "CELESTOPOL.Combat.rangedDefenseTitle",
|
||||
skillValue: this.stats.corps.res,
|
||||
woundMalus: this.getWoundMalus(),
|
||||
armorMalus: this.getArmorMalusForRoll("corps"),
|
||||
woundLevel: this.blessures.lvl,
|
||||
rollMoonDie: false,
|
||||
destGaugeFull: false,
|
||||
fortuneValue: 0,
|
||||
isCombat: true,
|
||||
isRangedDefense: true,
|
||||
weaponType: "distance",
|
||||
weaponName: item.name,
|
||||
weaponDegats: item.system.degats,
|
||||
availableTargets: this._getCombatTargets(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user