New v5 fixes
This commit is contained in:
		@@ -809,11 +809,12 @@ export class PegasusActor extends Actor {
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async cleanupPerksIfTrauma() {
 | 
			
		||||
    if ( this.getTraumaState == "severetrauma") {
 | 
			
		||||
    if ( this.getTraumaState() == "severetrauma") {
 | 
			
		||||
      for (let perk of this.data.items) {
 | 
			
		||||
        if (perk.type == "perk") {
 | 
			
		||||
          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`
 | 
			
		||||
        ChatMessage.create(chatData)
 | 
			
		||||
        this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.status': "ready", 'data.used1': false, 'data.used2': false, 'data.used3': false }])
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@@ -1026,6 +1028,17 @@ export class PegasusActor extends Actor {
 | 
			
		||||
        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()
 | 
			
		||||
      if (race && race.name && (race.name != this.data.data.biodata.racename)) {
 | 
			
		||||
        updates['data.biodata.racename'] = race.name
 | 
			
		||||
@@ -1232,6 +1245,9 @@ export class PegasusActor extends Actor {
 | 
			
		||||
    if (overCapacity > 0) {
 | 
			
		||||
      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')
 | 
			
		||||
    for (let effect of effects) {
 | 
			
		||||
      effect = duplicate(effect)
 | 
			
		||||
 
 | 
			
		||||
@@ -729,9 +729,6 @@ export class PegasusUtility {
 | 
			
		||||
    let diceFormulaTab = []
 | 
			
		||||
    for (let dice of rollData.dicePool) {
 | 
			
		||||
      let level = dice.level
 | 
			
		||||
      if (dice.name == "stat") {
 | 
			
		||||
        level += rollData.statLevelBonus
 | 
			
		||||
      }
 | 
			
		||||
      diceFormulaTab.push(this.getFoundryDiceFromLevel(level))
 | 
			
		||||
    }
 | 
			
		||||
    let diceFormula = '{' + diceFormulaTab.join(', ') + '}kh + ' + (rollData.stat?.mod || 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -180,9 +180,9 @@
 | 
			
		||||
  "styles": [
 | 
			
		||||
    "styles/simple.css"
 | 
			
		||||
  ],
 | 
			
		||||
  "templateVersion": 95,
 | 
			
		||||
  "templateVersion": 96,
 | 
			
		||||
  "title": "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"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
          "gmnotes": "",
 | 
			
		||||
          "racename": "",
 | 
			
		||||
          "rolename": "",
 | 
			
		||||
          "corruption": 0,
 | 
			
		||||
          "morality": 5,
 | 
			
		||||
          "moralitythreshold": 0
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
 
 | 
			
		||||
@@ -221,6 +221,9 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
              <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 perk.data.status}}
 | 
			
		||||
                    <option value="ready">Ready</option>
 | 
			
		||||
@@ -229,6 +232,7 @@
 | 
			
		||||
                    <option value="round1">1 Round left</option>
 | 
			
		||||
                    {{/select}}
 | 
			
		||||
                  </select>
 | 
			
		||||
                {{/if}}
 | 
			
		||||
              </span>
 | 
			
		||||
 | 
			
		||||
              {{#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" />
 | 
			
		||||
        </li>
 | 
			
		||||
        <li class="flexrow">
 | 
			
		||||
          <label class="short-label">Corruption : </label>
 | 
			
		||||
          <input type="text" class="" name="data.biodata.corruption" value="{{data.biodata.corruption}}" data-dtype="Number" />
 | 
			
		||||
          <label class="short-label">Morality : </label>
 | 
			
		||||
          <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 class="flexrow">
 | 
			
		||||
          <label class="short-label">Hero Level (max) : </label>
 | 
			
		||||
 
 | 
			
		||||
@@ -38,8 +38,6 @@
 | 
			
		||||
          </select>
 | 
			
		||||
          <span class="small-label"> </span>
 | 
			
		||||
        </div>
 | 
			
		||||
        {{/if}}
 | 
			
		||||
 | 
			
		||||
        <div class="flexrow">
 | 
			
		||||
          <span class="roll-dialog-label">Spec Dice : </span>
 | 
			
		||||
          <select class="roll-dialog-label" id="specDicesLevel" type="text" name="specDicesLevel"
 | 
			
		||||
@@ -52,6 +50,8 @@
 | 
			
		||||
        </div>
 | 
			
		||||
        {{/if}}
 | 
			
		||||
 | 
			
		||||
      {{/if}}
 | 
			
		||||
 | 
			
		||||
      <!--
 | 
			
		||||
      {{#if isDamage}}
 | 
			
		||||
      <div class="flexrow">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user