Nombreuses corrections sur les fiches settlement/NPC
This commit is contained in:
42
module/models/npcattack.mjs
Normal file
42
module/models/npcattack.mjs
Normal file
@@ -0,0 +1,42 @@
|
||||
import { SYSTEM } from "../config/system.mjs"
|
||||
|
||||
export default class OathHammerNpcAttack extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields
|
||||
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||
const schema = {}
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
// Flat damage dice pool (no Might)
|
||||
schema.damageDice = new fields.NumberField({
|
||||
...requiredInteger, initial: 1, min: 0, max: 20
|
||||
})
|
||||
|
||||
// Dice color: white (4+), red (3+), black (2+)
|
||||
schema.colorDiceType = new fields.StringField({
|
||||
required: true, initial: "white", choices: SYSTEM.DICE_COLOR_TYPES
|
||||
})
|
||||
|
||||
// AP (Armor Penetration): penalty imposed on armor rolls
|
||||
schema.ap = new fields.NumberField({
|
||||
...requiredInteger, initial: 0, min: 0, max: 16
|
||||
})
|
||||
|
||||
return schema
|
||||
}
|
||||
|
||||
static LOCALIZATION_PREFIXES = ["OATHHAMMER.NpcAttack"]
|
||||
|
||||
get threshold() {
|
||||
return this.colorDiceType === "black" ? 2 : this.colorDiceType === "red" ? 3 : 4
|
||||
}
|
||||
|
||||
get colorEmoji() {
|
||||
return this.colorDiceType === "black" ? "⬛" : this.colorDiceType === "red" ? "🔴" : "⬜"
|
||||
}
|
||||
|
||||
get damageLabel() {
|
||||
return `${this.colorEmoji} ${this.damageDice}d (${this.threshold}+)`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user