Fix weapon sheet
This commit is contained in:
@@ -17,8 +17,7 @@ export default class OathHammerAmmunition extends foundry.abstract.TypeDataModel
|
||||
// Quantity of individual arrows/bolts in this stack
|
||||
schema.quantity = new fields.NumberField({ ...requiredInteger, initial: 20, min: 0 })
|
||||
|
||||
// Rarity: DV for Fortune check when purchasing; 0 = always available
|
||||
schema.rarity = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 6 })
|
||||
schema.rarity = new fields.StringField({ required: true, initial: "common", choices: SYSTEM.RARITY_CHOICES })
|
||||
|
||||
schema.cost = new fields.NumberField({ required: true, nullable: false, initial: 0, min: 0 })
|
||||
schema.currency = new fields.StringField({ required: true, initial: "sp", choices: SYSTEM.CURRENCY_CHOICES })
|
||||
@@ -26,5 +25,13 @@ export default class OathHammerAmmunition extends foundry.abstract.TypeDataModel
|
||||
return schema
|
||||
}
|
||||
|
||||
static migrateData(source) {
|
||||
if (typeof source.rarity === "number") {
|
||||
const map = { 0: "common", 1: "uncommon", 2: "rare", 3: "very-rare", 4: "legendary", 5: "legendary", 6: "legendary" }
|
||||
source.rarity = map[source.rarity] ?? "common"
|
||||
}
|
||||
return super.migrateData(source)
|
||||
}
|
||||
|
||||
static LOCALIZATION_PREFIXES = ["OATHHAMMER.Ammunition"]
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@ export default class OathHammerArmor extends foundry.abstract.TypeDataModel {
|
||||
new fields.StringField({ choices: SYSTEM.ARMOR_TRAITS })
|
||||
)
|
||||
|
||||
// Rarity: DV for Fortune check when purchasing; 0 = always available
|
||||
schema.rarity = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 6 })
|
||||
schema.rarity = new fields.StringField({ required: true, initial: "common", choices: SYSTEM.RARITY_CHOICES })
|
||||
|
||||
schema.equipped = new fields.BooleanField({ initial: false })
|
||||
schema.cost = new fields.NumberField({ required: true, nullable: false, initial: 0, min: 0 })
|
||||
@@ -45,5 +44,13 @@ export default class OathHammerArmor extends foundry.abstract.TypeDataModel {
|
||||
return schema
|
||||
}
|
||||
|
||||
static migrateData(source) {
|
||||
if (typeof source.rarity === "number") {
|
||||
const map = { 0: "common", 1: "uncommon", 2: "rare", 3: "very-rare", 4: "legendary", 5: "legendary", 6: "legendary" }
|
||||
source.rarity = map[source.rarity] ?? "common"
|
||||
}
|
||||
return super.migrateData(source)
|
||||
}
|
||||
|
||||
static LOCALIZATION_PREFIXES = ["OATHHAMMER.Armor"]
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ export default class OathHammerEquipment extends foundry.abstract.TypeDataModel
|
||||
// Item slots occupied when carried. 0 = small item (no slots).
|
||||
schema.slots = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
|
||||
// Rarity: DV for Fortune check when purchasing; 0 = always available
|
||||
schema.rarity = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 6 })
|
||||
schema.rarity = new fields.StringField({ required: true, initial: "common", choices: SYSTEM.RARITY_CHOICES })
|
||||
|
||||
// Light radius in feet — only relevant for light-source items (Candle/Lamp/Lantern/Torch)
|
||||
schema.lightRadius = new fields.NumberField({ required: false, nullable: true, initial: null, min: 0 })
|
||||
@@ -28,5 +27,13 @@ export default class OathHammerEquipment extends foundry.abstract.TypeDataModel
|
||||
return schema
|
||||
}
|
||||
|
||||
static migrateData(source) {
|
||||
if (typeof source.rarity === "number") {
|
||||
const map = { 0: "common", 1: "uncommon", 2: "rare", 3: "very-rare", 4: "legendary", 5: "legendary", 6: "legendary" }
|
||||
source.rarity = map[source.rarity] ?? "common"
|
||||
}
|
||||
return super.migrateData(source)
|
||||
}
|
||||
|
||||
static LOCALIZATION_PREFIXES = ["OATHHAMMER.Equipment"]
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@ export default class OathHammerWeapon extends foundry.abstract.TypeDataModel {
|
||||
// Item slots (when stowed; 0 = does not occupy slots)
|
||||
schema.slots = new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 })
|
||||
|
||||
// Rarity (DV for Fortune check to find item for sale)
|
||||
schema.rarity = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 5 })
|
||||
schema.rarity = new fields.StringField({ required: true, initial: "common", choices: SYSTEM.RARITY_CHOICES })
|
||||
|
||||
schema.equipped = new fields.BooleanField({ required: true, initial: false })
|
||||
schema.cost = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
@@ -61,6 +60,14 @@ export default class OathHammerWeapon extends foundry.abstract.TypeDataModel {
|
||||
|
||||
static LOCALIZATION_PREFIXES = ["OATHHAMMER.Weapon"]
|
||||
|
||||
static migrateData(source) {
|
||||
if (typeof source.rarity === "number") {
|
||||
const map = { 0: "common", 1: "uncommon", 2: "rare", 3: "very-rare", 4: "legendary", 5: "legendary", 6: "legendary" }
|
||||
source.rarity = map[source.rarity] ?? "common"
|
||||
}
|
||||
return super.migrateData(source)
|
||||
}
|
||||
|
||||
/**
|
||||
* Human-readable damage formula for display, e.g. "M+2", "M-1", "6"
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user