Add resources management

This commit is contained in:
LeRatierBretonnien 2025-01-08 12:46:36 +01:00
parent adb4923d00
commit fa7d3ecfca
13 changed files with 162 additions and 59 deletions

View File

@ -176,10 +176,10 @@ i.fvtt-cthulhu-eternal {
}
.fvtt-cthulhu-eternal .protagonist-sheet-common label {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1.2);
font-size: calc(var(--font-size-standard) * 1);
}
.fvtt-cthulhu-eternal .item-sheet-common .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .item-sheet-common label {
font-family: var(--font-secondary);
@ -220,7 +220,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .protagonist-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -228,8 +228,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .protagonist-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .protagonist-content .form-fields input,
.fvtt-cthulhu-eternal .protagonist-content .form-fields select {
@ -248,7 +248,7 @@ i.fvtt-cthulhu-eternal {
}
.fvtt-cthulhu-eternal .protagonist-content label {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1.2);
font-size: calc(var(--font-size-standard) * 1);
}
.fvtt-cthulhu-eternal .sheet-tabs {
background-color: var(--color-light-1);
@ -477,6 +477,14 @@ i.fvtt-cthulhu-eternal {
.fvtt-cthulhu-eternal .protagonist-biography .adapted label {
min-width: 20rem;
}
.fvtt-cthulhu-eternal .protagonist-biography .resources {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.fvtt-cthulhu-eternal .protagonist-biography .resources label {
min-width: 12rem;
}
.fvtt-cthulhu-eternal .protagonist-biography .features,
.fvtt-cthulhu-eternal .protagonist-biography .biodata {
display: grid;
@ -789,7 +797,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .skill-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -797,8 +805,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .skill-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .skill-content .form-fields input,
.fvtt-cthulhu-eternal .skill-content .form-fields select {
@ -816,7 +824,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .skill-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .skill-content label {
font-family: var(--font-secondary);
@ -879,7 +887,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .injury-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -887,8 +895,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .injury-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .injury-content .form-fields input,
.fvtt-cthulhu-eternal .injury-content .form-fields select {
@ -906,7 +914,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .injury-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .injury-content label {
font-family: var(--font-secondary);
@ -969,7 +977,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .weapon-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -977,8 +985,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .weapon-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .weapon-content .form-fields input,
.fvtt-cthulhu-eternal .weapon-content .form-fields select {
@ -996,7 +1004,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .weapon-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .weapon-content label {
font-family: var(--font-secondary);
@ -1051,7 +1059,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .armor-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -1059,8 +1067,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .armor-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .armor-content .form-fields input,
.fvtt-cthulhu-eternal .armor-content .form-fields select {
@ -1078,7 +1086,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .armor-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .armor-content label {
font-family: var(--font-secondary);
@ -1133,7 +1141,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .motivation-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -1141,8 +1149,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .motivation-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .motivation-content .form-fields input,
.fvtt-cthulhu-eternal .motivation-content .form-fields select {
@ -1160,7 +1168,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .motivation-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .motivation-content label {
font-family: var(--font-secondary);
@ -1215,7 +1223,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .mentaldisorder-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -1223,8 +1231,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .mentaldisorder-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .mentaldisorder-content .form-fields input,
.fvtt-cthulhu-eternal .mentaldisorder-content .form-fields select {
@ -1242,7 +1250,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .mentaldisorder-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .mentaldisorder-content label {
font-family: var(--font-secondary);
@ -1297,7 +1305,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .bond-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -1305,8 +1313,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .bond-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .bond-content .form-fields input,
.fvtt-cthulhu-eternal .bond-content .form-fields select {
@ -1324,7 +1332,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .bond-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .bond-content label {
font-family: var(--font-secondary);
@ -1395,7 +1403,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .gear-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -1403,8 +1411,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .gear-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .gear-content .form-fields input,
.fvtt-cthulhu-eternal .gear-content .form-fields select {
@ -1422,7 +1430,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .gear-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .gear-content label {
font-family: var(--font-secondary);
@ -1477,7 +1485,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .arcane-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -1485,8 +1493,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .arcane-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .arcane-content .form-fields input,
.fvtt-cthulhu-eternal .arcane-content .form-fields select {
@ -1504,7 +1512,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .arcane-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .arcane-content label {
font-family: var(--font-secondary);
@ -1559,7 +1567,7 @@ i.fvtt-cthulhu-eternal {
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .archetype-content input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -1567,8 +1575,8 @@ i.fvtt-cthulhu-eternal {
border: none;
}
.fvtt-cthulhu-eternal .archetype-content fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .archetype-content .form-fields input,
.fvtt-cthulhu-eternal .archetype-content .form-fields select {
@ -1586,7 +1594,7 @@ i.fvtt-cthulhu-eternal {
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .archetype-content .form-fields {
padding-top: 5px;
padding-top: 4px;
}
.fvtt-cthulhu-eternal .archetype-content label {
font-family: var(--font-secondary);

View File

@ -34,6 +34,20 @@
},
"Protagonist": {
"FIELDS": {
"resources": {
"permanentRating": {
"label": "Permanent Rating"
},
"hand": {
"label": "Hand"
},
"stowed": {
"label": "Stowed"
},
"storage": {
"label": "Storage"
}
},
"biodata": {
"feature": {
"label": "Feature"
@ -274,6 +288,8 @@
"veryHarsh": "Very Harsh"
},
"Label": {
"resources": "Resources",
"resourceChecks": "Resource Checks",
"sanBPShort": "BP",
"tempInsanity": "Temp. Insanity",
"distinguishingFeatures": "Distinguishing Features",

View File

@ -89,6 +89,30 @@ export const RESOURCE_RATING = {
}
}
export const RESOURCE_BREAKDOWN = [
{ value: 0, hand: 0, stowed: 0, storage: 0, checks: 0},
{ value: 1, hand: 1, stowed: 0, storage: 0, checks: 1},
{ value: 2, hand: 2, stowed: 0, storage: 0, checks: 1},
{ value: 3, hand: 3, stowed: 0, storage: 0, checks: 1},
{ value: 4, hand: 4, stowed: 0, storage: 0, checks: 1},
{ value: 5, hand: 5, stowed: 0, storage: 0, checks: 1},
{ value: 6, hand: 6, stowed: 0, storage: 0, checks: 1},
{ value: 7, hand: 6, stowed: 1, storage: 0, checks: 2},
{ value: 8, hand: 6, stowed: 2, storage: 0, checks: 2},
{ value: 9, hand: 6, stowed: 3, storage: 0, checks: 2},
{ value: 10, hand: 6, stowed: 4, storage: 0, checks: 2},
{ value: 11, hand: 6, stowed: 5, storage: 0, checks: 2},
{ value: 12, hand: 6, stowed: 6, storage: 0, checks: 2},
{ value: 13, hand: 6, stowed: 6, storage: 1, checks: 3},
{ value: 14, hand: 6, stowed: 6, storage: 2, checks: 3},
{ value: 15, hand: 6, stowed: 6, storage: 3, checks: 3},
{ value: 16, hand: 6, stowed: 6, storage: 4, checks: 3},
{ value: 17, hand: 6, stowed: 6, storage: 5, checks: 3},
{ value: 18, hand: 6, stowed: 6, storage: 6, checks: 3},
{ value: 19, hand: 6, stowed: 6, storage: 7, checks: 3},
{ value: 20, hand: 6, stowed: 6, storage: 8, checks: 3}
]
export const MENTAL_ILLNESS_CURE_SKILL = {
jazz: "CTHULHUETERNAL.Skill.Psychoanalyze",
modern: "CTHULHUETERNAL.Skill.Psychoanalyze",
@ -189,5 +213,6 @@ export const SYSTEM = {
MENTAL_ILLNESS_CURE_SKILL,
ERA_CSS,
INSANITY,
RESOURCE_BREAKDOWN,
ASCII
}

View File

@ -51,10 +51,16 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
schema.damageBonus = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
schema.resources = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }), // Unused but kept for compatibility
permanentRating: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
hand: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
currentHand: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
stowed: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
storage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
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 }),
nbValidChecks: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.biodata = new fields.SchemaField({
@ -140,6 +146,22 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
updates[`system.hp.value`] = this.hp.max
}
if ( this.resources.permanentRating <= 20) {
let breakdown = SYSTEM.RESOURCE_BREAKDOWN[this.resources.permanentRating]
if (this.resources.hand !== breakdown.hand) {
updates[`system.resources.hand`] = breakdown.hand
}
if (this.resources.stowed !== breakdown.stowed) {
updates[`system.resources.stowed`] = breakdown.stowed
}
if (this.resources.storage !== breakdown.storage) {
updates[`system.resources.storage`] = breakdown.storage
}
if (this.resources.nbValidChecks !== breakdown.checks) {
updates[`system.resources.nbValidChecks`] = breakdown.checks
}
}
if (Object.keys(updates).length > 0) {
this.parent.update(updates)
}
@ -157,7 +179,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
isExhausted() {
return this.wp.exhausted
}
/** */
/**
* Rolls a dice for a character.

0
packs/skills/000030.log Normal file
View File

BIN
packs/skills/CURRENT (Stored with Git LFS)

Binary file not shown.

BIN
packs/skills/LOG (Stored with Git LFS)

Binary file not shown.

BIN
packs/skills/LOG.old (Stored with Git LFS)

Binary file not shown.

BIN
packs/skills/MANIFEST-000028 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -21,7 +21,7 @@
}
input[name="name"] {
height: 50px;
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
@ -30,8 +30,8 @@
}
fieldset {
margin-bottom: 5px;
border-radius: 5px;
margin-bottom: 4px;
border-radius: 4px;
}
.form-fields {
@ -57,13 +57,13 @@
.protagonist-sheet-common {
label {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1.2);
font-size: calc(var(--font-size-standard) * 1.0);
}
}
.item-sheet-common {
.form-fields {
padding-top: 5px;
padding-top: 4px;
}
label {

View File

@ -256,6 +256,15 @@
min-width: 20rem;
}
}
.resources {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
label {
min-width: 12rem;
}
}
.features,
.biodata {

View File

@ -1,5 +1,22 @@
<section class="tab protagonist-{{tab.id}} {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.resources"}}</legend>
<div class="resources">
{{formField systemFields.resources.fields.permanentRating value=system.resources.permanentRating name="system.resources.permanentRating" localize=true}}
{{formField systemFields.resources.fields.hand value=system.resources.hand name="system.resources.hand" localize=true disabled=true}}
{{formField systemFields.resources.fields.stowed value=system.resources.stowed name="system.resources.stowed" localize=true disabled=true}}
{{formField systemFields.resources.fields.storage value=system.resources.storage name="system.resources.storage" localize=true disabled=true}}
<div>
<span class="label-field">{{localize "CTHULHUETERNAL.Label.resourceChecks"}}</span>
{{#each system.resources.checks as |check idx|}}
<input class="san-checkbox" type="checkbox" data-action="updateCheckResource" data-index="{{@index}}"
data-name="checks" {{#if check}} checked {{/if}} {{#if (gte @index @root.system.resources.nbValidChecks)}} disabled {{/if}}>
{{/each}}
</div>
</div>
</fieldset>
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.biodata"}}</legend>
<div class="adapted">

View File

@ -15,9 +15,12 @@
</div>
{{formField systemFields.isAdversary value=system.isAdversary}}
{{formField systemFields.diceEvolved value=system.diceEvolved}}
{{#if system.diceEvolved}}
<!-- {{#if system.diceEvolved}}
{{formField systemFields.rollFailed value=system.rollFailed}}
{{/if}}
-->
</fieldset>