New v5 fixes

This commit is contained in:
sladecraven 2022-07-21 22:52:17 +02:00
parent aa4409be28
commit e7f5a17096
6 changed files with 50 additions and 29 deletions

View File

@ -809,11 +809,12 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async cleanupPerksIfTrauma() { async cleanupPerksIfTrauma() {
if ( this.getTraumaState == "severetrauma") { if ( this.getTraumaState() == "severetrauma") {
for (let perk of this.data.items) { for (let perk of this.data.items) {
if (perk.type == "perk") { if (perk.type == "perk") {
this.cleanPerkEffects(perk.id) this.cleanPerkEffects(perk.id)
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.used1': false, 'data.used2': false, 'data.used3': false }]) this.updateEmbeddedDocuments('Item', [{ _id: perk.id, 'data.status': "ready", 'data.used1': false, 'data.used2': false, 'data.used3': false }])
ChatMessage.create({ content: `Perk ${perk.name} has been deactivated due to Severe Trauma state !` } )
} }
} }
} }
@ -835,6 +836,7 @@ export class PegasusActor extends Actor {
} }
chatData.content = `<div>${this.name} is suffering from Severe Trauma and cannot use Perks at this time.</div` chatData.content = `<div>${this.name} is suffering from Severe Trauma and cannot use Perks at this time.</div`
ChatMessage.create(chatData) ChatMessage.create(chatData)
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.status': "ready", 'data.used1': false, 'data.used2': false, 'data.used3': false }])
return return
} }
@ -1026,6 +1028,17 @@ export class PegasusActor extends Actor {
updates['data.mr.value'] = mrLevel updates['data.mr.value'] = mrLevel
} }
let moralitythreshold = Number(PegasusUtility.getDiceValue(this.data.data.statistics.foc.value)) + Number(this.data.data.statistics.foc.mod)
moralitythreshold = (moralitythreshold < 1) ? 1 : moralitythreshold;
if (moralitythreshold != this.data.data.biodata.moralitythreshold) {
updates['data.biodata.moralitythreshold'] = moralitythreshold
}
if (!this.warnMorality && this.data.data.biodata.morality >= moralitythreshold-2) {
ChatMessage.create( {content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!"} )
this.warnMorality = true
}
let race = this.getRace() let race = this.getRace()
if (race && race.name && (race.name != this.data.data.biodata.racename)) { if (race && race.name && (race.name != this.data.data.biodata.racename)) {
updates['data.biodata.racename'] = race.name updates['data.biodata.racename'] = race.name
@ -1232,6 +1245,9 @@ export class PegasusActor extends Actor {
if (overCapacity > 0) { if (overCapacity > 0) {
effectsList.push({ label: "Encumbrance Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: overCapacity }) effectsList.push({ label: "Encumbrance Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: overCapacity })
} }
if (this.data.data.biodata.morality <= 0) {
effectsList.push({ label: "Morality Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 3 })
}
let effects = this.data.items.filter(item => item.type == 'effect') let effects = this.data.items.filter(item => item.type == 'effect')
for (let effect of effects) { for (let effect of effects) {
effect = duplicate(effect) effect = duplicate(effect)

View File

@ -729,9 +729,6 @@ export class PegasusUtility {
let diceFormulaTab = [] let diceFormulaTab = []
for (let dice of rollData.dicePool) { for (let dice of rollData.dicePool) {
let level = dice.level let level = dice.level
if (dice.name == "stat") {
level += rollData.statLevelBonus
}
diceFormulaTab.push(this.getFoundryDiceFromLevel(level)) diceFormulaTab.push(this.getFoundryDiceFromLevel(level))
} }
let diceFormula = '{' + diceFormulaTab.join(', ') + '}kh + ' + (rollData.stat?.mod || 0) let diceFormula = '{' + diceFormulaTab.join(', ') + '}kh + ' + (rollData.stat?.mod || 0)

View File

@ -180,9 +180,9 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"templateVersion": 95, "templateVersion": 96,
"title": "Pegasus RPG", "title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.6.2", "version": "0.6.3",
"background" : "./images/ui/pegasus_welcome_page.webp" "background" : "./images/ui/pegasus_welcome_page.webp"
} }

View File

@ -30,7 +30,7 @@
"gmnotes": "", "gmnotes": "",
"racename": "", "racename": "",
"rolename": "", "rolename": "",
"corruption": 0, "morality": 5,
"moralitythreshold": 0 "moralitythreshold": 0
} }
}, },

View File

@ -221,6 +221,9 @@
<span class="item-field-label-long"> <span class="item-field-label-long">
{{#if (eq @root.traumaState "severetrauma")}}
Disabled
{{else}}
<select class="perk-status" type="text" value="{{perk.data.status}}" data-dtype="String"> <select class="perk-status" type="text" value="{{perk.data.status}}" data-dtype="String">
{{#select perk.data.status}} {{#select perk.data.status}}
<option value="ready">Ready</option> <option value="ready">Ready</option>
@ -229,6 +232,7 @@
<option value="round1">1 Round left</option> <option value="round1">1 Round left</option>
{{/select}} {{/select}}
</select> </select>
{{/if}}
</span> </span>
{{#if (ne perk.data.status "ready")}} {{#if (ne perk.data.status "ready")}}
@ -1003,8 +1007,12 @@
<input type="text" class="" name="data.biodata.cdp" value="{{data.biodata.cdp}}" data-dtype="Number" /> <input type="text" class="" name="data.biodata.cdp" value="{{data.biodata.cdp}}" data-dtype="Number" />
</li> </li>
<li class="flexrow"> <li class="flexrow">
<label class="short-label">Corruption : </label> <label class="short-label">Morality : </label>
<input type="text" class="" name="data.biodata.corruption" value="{{data.biodata.corruption}}" data-dtype="Number" /> <input type="text" class="" name="data.biodata.morality" value="{{data.biodata.morality}}" data-dtype="Number" />
</li>
<li class="flexrow">
<label class="short-label">Morality threshold : </label>
<input type="text" class="" name="data.biodata.moralitythreshold" value="{{data.biodata.moralitythreshold}}" disabled data-dtype="Number" />
</li> </li>
<li class="flexrow"> <li class="flexrow">
<label class="short-label">Hero Level (max) : </label> <label class="short-label">Hero Level (max) : </label>

View File

@ -38,8 +38,6 @@
</select> </select>
<span class="small-label">&nbsp;</span> <span class="small-label">&nbsp;</span>
</div> </div>
{{/if}}
<div class="flexrow"> <div class="flexrow">
<span class="roll-dialog-label">Spec Dice : </span> <span class="roll-dialog-label">Spec Dice : </span>
<select class="roll-dialog-label" id="specDicesLevel" type="text" name="specDicesLevel" <select class="roll-dialog-label" id="specDicesLevel" type="text" name="specDicesLevel"
@ -52,6 +50,8 @@
</div> </div>
{{/if}} {{/if}}
{{/if}}
<!-- <!--
{{#if isDamage}} {{#if isDamage}}
<div class="flexrow"> <div class="flexrow">