Fix #112 shield/armors for arc

This commit is contained in:
sladecraven 2022-10-06 18:48:45 +02:00
parent 571d015c28
commit 329b7839da
4 changed files with 39 additions and 9 deletions

View File

@ -2531,8 +2531,13 @@ export class PegasusActor extends Actor {
for (let loc of __LocationsArmour) {
let arcKey = loc + "arc"
let arc = duplicate(this.system.arcs[arcKey])
if (level != Number(arc.shieldlevel)) {
arc.shieldlevel = level
if (level != Number(arc.maxshieldlevel)) {
let lvChanged = level - arc.maxshieldlevel
arc.maxshieldlevel = level
arc.shieldlevel += lvChanged
if ( arc.shieldlevel <= 0 || arc.shieldlevel > level) {
arc.shieldlevel = level
}
setTimeout(shift, this.update({ [`system.arcs.${arcKey}`]: arc }))
shift += 200
}
@ -2549,8 +2554,13 @@ export class PegasusActor extends Actor {
level += Number(armour.system.armourdicevalue)
}
}
if (level != Number(arc.armourlevel)) {
arc.armourlevel = level
if (level != Number(arc.maxarmourlevel)) {
let lvChanged = level - arc.maxarmourlevel
arc.maxarmourlevel = level
arc.armourlevel += lvChanged
if ( arc.armourlevel <= 0 || arc.armourlevel > arc.maxarmourlevel) {
arc.armourlevel = level
}
setTimeout(500, this.update({ [`system.arcs.${arcKey}`]: arc }))
}
}

View File

@ -253,7 +253,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.1.3",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.3.zip",
"version": "10.1.4",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.4.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -310,6 +310,8 @@
"topspeed": "",
"shieldlevel": 0,
"armourlevel": 0,
"maxshieldlevel": 0,
"maxarmourlevel": 0,
"is3D": false
},
"reararc": {
@ -317,13 +319,17 @@
"topspeed": "",
"shieldlevel": 0,
"armourlevel": 0,
"is3D": false
"maxshieldlevel": 0,
"maxarmourlevel": 0,
"is3D": false
},
"rightarc": {
"label": "Right Arc",
"topspeed": "",
"shieldlevel": 0,
"armourlevel": 0,
"maxshieldlevel": 0,
"maxarmourlevel": 0,
"is3D": false
},
"leftarc": {
@ -331,6 +337,8 @@
"topspeed": "",
"shieldlevel": 0,
"armourlevel": 0,
"maxshieldlevel": 0,
"maxarmourlevel": 0,
"is3D": false
},
"toparc": {
@ -338,6 +346,8 @@
"topspeed": "",
"shieldlevel": 0,
"armourlevel": 0,
"maxshieldlevel": 0,
"maxarmourlevel": 0,
"is3D": true
},
"bottomarc": {
@ -345,6 +355,8 @@
"topspeed": "",
"shieldlevel": 0,
"armourlevel": 0,
"maxshieldlevel": 0,
"maxarmourlevel": 0,
"is3D": true
}
}

View File

@ -9,9 +9,15 @@
<span class="item-field-label-long">
<label class="short-label">Shield</label>
</span>
<span class="item-field-label-short">
<label class="short-label">Max</label>
</span>
<span class="item-field-label-long">
<label class="short-label">Armour</label>
</span>
<span class="item-field-label-short">
<label class="short-label">Max</label>
</span>
</li>
<li class="item flexrow list-item list-item-shadow" data-arc-name="{{idx}}">
@ -31,16 +37,18 @@
{{#select arc.shieldlevel}}
{{{@root.optionsDiceList}}}
{{/select}}
</select>
</select>
</span>
<span class="item-field-label-short"><label class="short-label">{{getDice arc.maxshieldlevel}}</label></span>
<span class="item-field-label-long">
<select type="text" name="system.arcs.{{idx}}.armourlevel" value="{{arc.armourlevel}}" data-dtype="Number">
{{#select arc.armourlevel}}
{{{@root.optionsDiceList}}}
{{/select}}
</select>
</select>
</span>
<span class="item-field-label-short"><label class="short-label">{{getDice arc.maxarmourlevel}}</label></span>
</li>
</ul>