Enhance progression rolls, damage rolls and other fixes
Some checks failed
Release Creation / build (release) Failing after 56s
Some checks failed
Release Creation / build (release) Failing after 56s
This commit is contained in:
@ -42,10 +42,10 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
recovery: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
violence: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min:3, max:3}),
|
||||
helplessness: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min:3, max:3 }),
|
||||
violence: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min: 3, max: 3 }),
|
||||
helplessness: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min: 3, max: 3 }),
|
||||
breakingPoint: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
insanity: new fields.StringField({ required: true, nullable: false, initial: "none", choices:SYSTEM.INSANITY }),
|
||||
insanity: new fields.StringField({ required: true, nullable: false, initial: "none", choices: SYSTEM.INSANITY }),
|
||||
})
|
||||
|
||||
schema.damageBonus = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
@ -59,7 +59,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
currentStowed: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
storage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
currentStorage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||
checks: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min:3, max:3 }),
|
||||
checks: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min: 3, max: 3 }),
|
||||
nbValidChecks: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
})
|
||||
|
||||
@ -72,7 +72,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
birthplace: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
||||
eyes: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
||||
hair: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
||||
harshness: new fields.StringField({ required: true, nullable: false, initial: "normal", choices:SYSTEM.HARSHNESS }),
|
||||
harshness: new fields.StringField({ required: true, nullable: false, initial: "normal", choices: SYSTEM.HARSHNESS }),
|
||||
adaptedToViolence: new fields.BooleanField({ required: true, initial: false }),
|
||||
adaptedToHelplessness: new fields.BooleanField({ required: true, initial: false })
|
||||
})
|
||||
@ -87,14 +87,14 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
super.prepareDerivedData();
|
||||
|
||||
let updates = {}
|
||||
if ( this.wp.max !== this.characteristics.pow.value) {
|
||||
if (this.wp.max !== this.characteristics.pow.value) {
|
||||
updates[`system.wp.max`] = this.characteristics.pow.value
|
||||
}
|
||||
let hpMax = Math.round((this.characteristics.con.value + this.characteristics.str.value) / 2)
|
||||
if ( this.hp.max !== hpMax) {
|
||||
if (this.hp.max !== hpMax) {
|
||||
updates[`system.hp.max`] = hpMax
|
||||
}
|
||||
|
||||
|
||||
// Get Unnatural skill for MAX SAN
|
||||
let unnatural = this.parent.items.find(i => i.type === "skill" && i.name.toLowerCase() === game.i18n.localize("CTHULHUETERNAL.Skill.Unnatural").toLowerCase())
|
||||
let minus = 0
|
||||
@ -102,7 +102,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
minus = unnatural.system.skillTotal
|
||||
}
|
||||
let maxSan = Math.max(99 - minus, 0)
|
||||
if ( this.san.max !== maxSan) {
|
||||
if (this.san.max !== maxSan) {
|
||||
updates[`system.san.max`] = maxSan
|
||||
}
|
||||
|
||||
@ -110,8 +110,8 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
if (recoverySan > this.san.max) {
|
||||
recoverySan = this.san.max
|
||||
}
|
||||
if ( this.san.recovery !== recoverySan) {
|
||||
updates[`system.san.recovery`] = recoverySan
|
||||
if (this.san.recovery !== recoverySan) {
|
||||
updates[`system.san.recovery`] = recoverySan
|
||||
}
|
||||
|
||||
let dmgBonus = 0
|
||||
@ -126,7 +126,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
} else if (this.characteristics.str.value <= 20) {
|
||||
dmgBonus = 2
|
||||
}
|
||||
if ( this.damageBonus !== dmgBonus) {
|
||||
if (this.damageBonus !== dmgBonus) {
|
||||
updates[`system.damageBonus`] = dmgBonus
|
||||
}
|
||||
|
||||
@ -144,9 +144,9 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
if (this.resources.permanentRating < 0) {
|
||||
updates[`system.resources.permanentRating`] = 0
|
||||
}
|
||||
|
||||
|
||||
let resourceIndex = Math.max(Math.min(this.resources.permanentRating, 20), 0)
|
||||
let breakdown = SYSTEM.RESOURCE_BREAKDOWN[resourceIndex]
|
||||
let breakdown = SYSTEM.RESOURCE_BREAKDOWN[resourceIndex]
|
||||
if (this.resources.hand !== breakdown.hand) {
|
||||
updates[`system.resources.hand`] = breakdown.hand
|
||||
}
|
||||
@ -159,7 +159,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
if (this.resources.nbValidChecks !== breakdown.checks) {
|
||||
updates[`system.resources.nbValidChecks`] = breakdown.checks
|
||||
}
|
||||
|
||||
|
||||
if (Object.keys(updates).length > 0) {
|
||||
this.parent.update(updates)
|
||||
}
|
||||
@ -173,14 +173,14 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
return this.wp.value === 0
|
||||
}
|
||||
|
||||
isExhausted() {
|
||||
isExhausted() {
|
||||
return this.wp.exhausted
|
||||
}
|
||||
|
||||
modifyWP(value) {
|
||||
let updates = {}
|
||||
let wp = Math.max(Math.min(this.wp.value + value, this.wp.max), 0)
|
||||
if ( this.wp.value !== wp) {
|
||||
if (this.wp.value !== wp) {
|
||||
updates[`system.wp.value`] = wp
|
||||
}
|
||||
if (Object.keys(updates).length > 0) {
|
||||
@ -191,14 +191,14 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
setBP() {
|
||||
let updates = {}
|
||||
let bp = Math.max(this.san.value - this.characteristics.pow.value, 0)
|
||||
if ( this.san.breakingPoint !== bp) {
|
||||
if (this.san.breakingPoint !== bp) {
|
||||
updates[`system.san.breakingPoint`] = bp
|
||||
}
|
||||
if (Object.keys(updates).length > 0) {
|
||||
this.parent.update(updates)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** */
|
||||
/**
|
||||
* Rolls a dice for a character.
|
||||
@ -220,10 +220,12 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
hasTarget,
|
||||
previousResultType: rollItem.resultType,
|
||||
target: opponentTarget
|
||||
})
|
||||
if (!roll) return null
|
||||
|
||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user