Various enhancements
This commit is contained in:
parent
e0026adfcd
commit
f73af29949
@ -62,6 +62,9 @@ export class Avd12Actor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rebuildSkills() {
|
||||
let armorPenalties = Avd12Utility.getArmorPenalty( this.items.find( item => item.type == "armor") )
|
||||
let shieldPenalties = Avd12Utility.getArmorPenalty( this.items.find( item => item.type == "shield") )
|
||||
|
||||
for (let attrKey in this.system.attributes) {
|
||||
let attr = this.system.attributes[attrKey]
|
||||
for (let skillKey in attr.skills) {
|
||||
@ -72,10 +75,38 @@ export class Avd12Actor extends Actor {
|
||||
for (let trait of availableTraits) {
|
||||
skill.modifier += Number(trait.system.bonusvalue)
|
||||
}
|
||||
// Apply armor penalties
|
||||
if ( armorPenalties[skillKey]) {
|
||||
console.log("Found armor penalties : ", armorPenalties, skillKey)
|
||||
skill.modifier += Number(armorPenalties[skillKey])
|
||||
}
|
||||
// Apply shield penalties
|
||||
if ( shieldPenalties[skillKey]) {
|
||||
console.log("Found shield penalties : ", shieldPenalties, skillKey)
|
||||
skill.modifier += Number(shieldPenalties[skillKey])
|
||||
}
|
||||
// Process additionnal bonuses
|
||||
for(let item of this.items) {
|
||||
if (item.system.bonus && item.system.bonus[skillKey]) {
|
||||
skill.modifier += Number(item.system.bonus[skillKey].value)
|
||||
}
|
||||
}
|
||||
skill.finalvalue = skill.modifier + attr.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rebuildMitigations() {
|
||||
for (let mitiKey in this.system.mitigation) {
|
||||
let mitigation = this.system.mitigation[mitiKey]
|
||||
for(let item of this.items) {
|
||||
if (item.system.mitigation && item.system.mitigation[mitiKey]) {
|
||||
mitigation.value += Number(item.system.mitigation[mitiKey].value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareDerivedData() {
|
||||
@ -86,6 +117,7 @@ export class Avd12Actor extends Actor {
|
||||
this.computeHitPoints()
|
||||
|
||||
this.rebuildSkills()
|
||||
this.rebuildMitigations()
|
||||
}
|
||||
|
||||
super.prepareDerivedData();
|
||||
|
@ -11,7 +11,11 @@ const __focusRegenBond = { "bondnone": 6, "bondeasy": 8, "bondcommon": 12, "bond
|
||||
const __bonusSpellDamageBond = { "bondnone": 0, "bondeasy": 1, "bondcommon": 1, "bonduncommon": 1, "bondrare": 2, "bondlegendary": 2, "bondmythic": 3, "bonddivine": 4 }
|
||||
const __bonusSpellAttackBond = { "bondnone": 0, "bondeasy": 0, "bondcommon": 1, "bonduncommon": 1, "bondrare": 2, "bondlegendary": 2, "bondmythic": 3, "bonddivine": 4 }
|
||||
const __spellCost = { "beginner": 1, "novice": 2, "expert": 4, "master": 6, "grandmaster": 8 }
|
||||
const __armorPenalties = {"light": { block: -2, dodge: -1}, "medium": { dodge: -3, block: -2, castingtime: 1, stealth: -2, speed: -1,
|
||||
"heavy": { dodge: -4, block: -3, stealth: -3, castingtime: 2, speed: -3 }, "ultraheavy": { dodge: -5, block: -4, stealth: -5, castingtime: 2, speed: -3 },
|
||||
"lightshield": {dodge: -1, block: +1}, "heavyshield": {dodge: -2, block: 2, speed: -1, stealth: -1} }
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class Avd12Utility {
|
||||
@ -439,6 +443,15 @@ export class Avd12Utility {
|
||||
static getSpellCost(spell) {
|
||||
return __spellCost[spell.system.level]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getArmorPenalty( item ) {
|
||||
if (item && (item.type == "shield" || item.type == "armor")) {
|
||||
return __armorPenalties[item.system.category]
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
|
||||
let chatData = {
|
||||
|
@ -222,13 +222,14 @@ table {border: 1px solid #7a7971;}
|
||||
-webkit-box-flex: 0;
|
||||
-ms-flex: 0 0 128px;
|
||||
flex: 0 0 128px;
|
||||
width: 196px;
|
||||
width: 128px;
|
||||
height: auto;
|
||||
max-height:260px;
|
||||
max-height:160px;
|
||||
margin-top: 0px;
|
||||
margin-right: 10px;
|
||||
object-fit: cover;
|
||||
object-position: 50% 0;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.button-img {
|
||||
@ -1293,6 +1294,11 @@ ul, li {
|
||||
max-width: 6rem;
|
||||
min-width: 6rem;
|
||||
}
|
||||
.item-field-skill {
|
||||
flex-grow:1;
|
||||
max-width: 6.8rem;
|
||||
min-width: 6.8rem;
|
||||
}
|
||||
.item-field-label-long {
|
||||
margin-top: 4px;
|
||||
flex-grow:1;
|
||||
|
@ -457,6 +457,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"shield": {
|
||||
"category": "",
|
||||
"templates": [
|
||||
"commonitem"
|
||||
],
|
||||
|
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
{{#each attr.skills as |skill skillKey|}}
|
||||
<div class="flexrow">
|
||||
<span class="item-field-label-medium skill-label"><a class="roll-skill" data-attr-key="{{attrKey}}" data-skill-key="{{skillKey}}">{{upperFirst skillKey}} {{skill.finalvalue}}<i class="fa-solid fa-dice-d12"></i></a></span>
|
||||
<span class="item-field-skill skill-label"><a class="roll-skill" data-attr-key="{{attrKey}}" data-skill-key="{{skillKey}}"><i class="fa-solid fa-dice-d12"></i> {{upperFirst skillKey}} {{skill.finalvalue}}</a></span>
|
||||
<input type="checkbox" class="skill-good-checkbox" name="system.attributes.{{attrKey}}.skills.{{skillKey}}.good" {{checked skill.good}} />
|
||||
</div>
|
||||
{{/each}}
|
||||
@ -69,20 +69,6 @@
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="item flexrow list-item">
|
||||
<span class="item-name-label-header-short">Focus Regen</span>
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focusregen}}" data-dtype="Number" disabled/>
|
||||
|
||||
|
||||
<span class="item-name-label-header-short"> </span>
|
||||
|
||||
<span class="item-name-label-header-short">Focus Points</span>
|
||||
<input type="text" class="item-field-label-short" name="system.focus.currentfocuspoints" value="{{system.focus.currentfocuspoints}}" data-dtype="Number"/> /
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focuspoints}}" data-dtype="Number" disabled/>
|
||||
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="grid-2col">
|
||||
@ -156,6 +142,22 @@
|
||||
|
||||
<div class="flexcol">
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item">
|
||||
<span class="item-name-label-header-short">Focus Regen</span>
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focusregen}}" data-dtype="Number" disabled/>
|
||||
|
||||
|
||||
<span class="item-name-label-header-short"> </span>
|
||||
|
||||
<span class="item-name-label-header-short">Focus Points</span>
|
||||
<input type="text" class="item-field-label-short" name="system.focus.currentfocuspoints" value="{{system.focus.currentfocuspoints}}" data-dtype="Number"/> /
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focuspoints}}" data-dtype="Number" disabled/>
|
||||
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
@ -174,7 +176,7 @@
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{spell.img}}" /></a>
|
||||
<span class="item-name-label">
|
||||
<a class="roll-spell">{{spell.name}} <i class="fa-solid fa-dice-d12"></i></a>
|
||||
<a class="roll-spell"><i class="fa-solid fa-dice-d12"> </i>{{spell.name}}</a>
|
||||
</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.spelltype}}</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.level}}</span>
|
||||
|
@ -21,6 +21,15 @@
|
||||
|
||||
{{> systems/fvtt-avd12/templates/items/partial-common-item-fields.hbs}}
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Shield type</label>
|
||||
<select class="item-field-label-long" type="text" name="system.category" value="{{system.category}}" data-dtype="String">
|
||||
{{#select system.category}}
|
||||
{{> systems/fvtt-avd12/templates/items/partial-options-shield-types.hbs}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Equipped</label>
|
||||
<input type="checkbox" class="item-field-label-short" name="system.equipped" {{checked system.equipped}} />
|
||||
|
2
templates/items/partial-options-shield-types.hbs
Normal file
2
templates/items/partial-options-shield-types.hbs
Normal file
@ -0,0 +1,2 @@
|
||||
<option value="lightshield">Light Shield</option>
|
||||
<option value="heavyshield">Heavy Shield</option>
|
Reference in New Issue
Block a user