Adds senses and passive perception.
Also makes modifier calculations return Int instead of Int64.
This commit is contained in:
@@ -625,7 +625,7 @@ public class Monster: NSManagedObject {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: OTHER
|
||||
// MARK: Immunities, Resistances, and Vulnerabilities
|
||||
|
||||
var damageVulnerabilitiesDescription: String {
|
||||
get {
|
||||
@@ -656,6 +656,40 @@ public class Monster: NSManagedObject {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: OTHER
|
||||
|
||||
var passivePerception: Int {
|
||||
get {
|
||||
let perceptionSkill = skillsArray.first(where: {
|
||||
StringHelper.safeEqualsIgnoreCase($0.name, "Perception")
|
||||
})
|
||||
if (perceptionSkill == nil) {
|
||||
return wisdomModifier
|
||||
} else if (perceptionSkill?.wrappedProficiency == ProficiencyType.expertise) {
|
||||
return wisdomModifier + proficiencyBonus + proficiencyBonus
|
||||
} else if (perceptionSkill?.wrappedProficiency == ProficiencyType.proficient) {
|
||||
return wisdomModifier + proficiencyBonus
|
||||
} else {
|
||||
return wisdomModifier
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sensesDescription: String {
|
||||
get {
|
||||
var modifiedSenses = self.senses?.sorted() ?? []
|
||||
let hasPassivePerceptionSense = modifiedSenses.contains(where: {
|
||||
$0.starts(with: "passive Perception")
|
||||
})
|
||||
if (!hasPassivePerceptionSense) {
|
||||
let calculatedPassivePerception = String(format: "passive Perception %+d", passivePerception)
|
||||
modifiedSenses.append(calculatedPassivePerception)
|
||||
}
|
||||
|
||||
return modifiedSenses.sorted().joined(separator: ", ")
|
||||
}
|
||||
}
|
||||
|
||||
var languagesArray: [String] {
|
||||
get {
|
||||
return ["Common", "Goblin"]
|
||||
|
||||
Reference in New Issue
Block a user