Fix #24 : Add SAN rolls

This commit is contained in:
LeRatierBretonnien 2025-01-07 21:38:50 +01:00
parent dfe4aa0c56
commit 2c3a92994a
11 changed files with 230 additions and 58 deletions

3
.gitignore vendored
View File

@ -6,6 +6,3 @@ styles/*.css
# Node Modules
node_modules/
# Foundry VTT
packs/*

View File

@ -304,20 +304,61 @@ i.fvtt-cthulhu-eternal {
font-size: calc(var(--font-size-standard) * 1.4);
width: 400px;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san {
align-content: flex-start;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san input {
min-width: 2.2rem;
max-width: 2.2rem;
margin-bottom: 4px;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san select {
min-width: 6rem;
max-width: 6rem;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .rollable:hover,
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .rollable:focus {
text-shadow: 0 0 8px var(--color-shadow-primary);
cursor: pointer;
font-size: 0.9rem;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .san-checkbox {
min-width: 1rem;
max-width: 1rem;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .label-field {
flex-grow: 0;
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .label-short-field {
font-size: 0.9rem;
max-width: 3rem;
min-width: 3rem;
flex-grow: 1;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .label-recovery {
margin-left: 4px;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .label-field {
font-size: 0.9rem;
max-width: 6rem;
min-width: 6rem;
flex-grow: 1;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .label-bp {
flex-grow: 1;
max-width: 3rem;
min-width: 3rem;
margin-left: 4px;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .label-insanity {
flex-grow: 1;
margin-left: 4px;
max-width: 8rem;
min-width: 8rem;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .spacing {
margin-left: 4px;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .d100 {
flex: 0;
}
.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .willpower input {
min-width: 2.4rem;
max-width: 2.4rem;
@ -422,6 +463,14 @@ i.fvtt-cthulhu-eternal {
.fvtt-cthulhu-eternal .protagonist-biography .field-label {
margin-left: 8px;
}
.fvtt-cthulhu-eternal .protagonist-biography .adapted {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
.fvtt-cthulhu-eternal .protagonist-biography .adapted label {
min-width: 20rem;
}
.fvtt-cthulhu-eternal .protagonist-biography .features,
.fvtt-cthulhu-eternal .protagonist-biography .biodata {
display: grid;

View File

@ -38,6 +38,12 @@
"feature": {
"label": "Feature"
},
"adaptedToViolence": {
"label": "Adapted to violence"
},
"adaptedToHelplessness": {
"label": "Adapted to helplessness"
},
"harshness": {
"label": "Harshness"
},
@ -86,6 +92,12 @@
}
}
},
"Insanity": {
"None": "None",
"Flee": "Flee",
"Submit": "Submit",
"Struggle": "Struggle"
},
"Skill": {
"Unnatural": "Unnatural",
"Melee": "Melee Weapons",
@ -262,9 +274,13 @@
"veryHarsh": "Very Harsh"
},
"Label": {
"sanBPShort": "BP",
"tempInsanity": "Temp. Insanity",
"distinguishingFeatures": "Distinguishing Features",
"titleSkill": "Skill",
"titleWeapon": "Weapon",
"titleSkill": "Skill Roll",
"titleWeapon": "Weapon Roll",
"titleCharacteristic": "Characteristic Roll",
"titleSAN": "SAN Roll",
"biodata": "Biodata",
"skill": "Skill",
"modifier": "Modifier",
@ -316,6 +332,7 @@
"criticalSuccess": "Critical Success",
"criticalFailure": "Critical Failure",
"Characteristic": "Characteristic",
"characteristic": "Characteristic",
"targetScore": "Target Score",
"gears": "Gears",
"armors": "Armors",

View File

@ -207,6 +207,11 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
li = $(event.currentTarget).parents(".item");
item = this.actor.items.get(li.data("item-id"));
break
case "san":
item = foundry.utils.duplicate(this.actor.system.san)
item.name = game.i18n.localize("CTHULHUETERNAL.Label.SAN")
item.targetScore = item.value
break;
default:
throw new Error(`Unknown roll type ${rollType}`)
}

View File

@ -34,6 +34,13 @@ export const AVAILABLE_SETTINGS = {
postapo: "CTHULHUETERNAL.Settings.PostApo"
}
export const INSANITY = {
"none": "CTHULHUETERNAL.Insanity.None",
"flee": "CTHULHUETERNAL.Insanity.Flee",
"struggle": "CTHULHUETERNAL.Insanity.Struggle",
"submit": "CTHULHUETERNAL.Insanity.Submit"
}
export const ERA_CSS = {
jazz: { primaryFont: "RozhaOne", secondaryFont: "RozhaOne", titleFont: "Broadway", imgFilter: "brightness(0) saturate(100%) invert(52%) sepia(9%) saturate(2368%) hue-rotate(360deg) brightness(86%) contrast(84%)" },
modern: { primaryFont: "Georama", secondaryFont: "Georama", titleFont: "Georama", imgFilter: "brightness(0) saturate(100%) invert(92%) sepia(11%) saturate(1214%) hue-rotate(51deg) brightness(93%) contrast(86%)" },
@ -181,5 +188,6 @@ export const SYSTEM = {
RESOURCE_RATING,
MENTAL_ILLNESS_CURE_SKILL,
ERA_CSS,
INSANITY,
ASCII
}

View File

@ -100,6 +100,7 @@ export default class CthulhuEternalRoll extends Roll {
console.log(options.rollItem)
options.initialScore = options.rollItem.system.computeScore()
break
case "san":
case "char":
options.initialScore = options.rollItem.targetScore
break
@ -269,6 +270,10 @@ export default class CthulhuEternalRoll extends Roll {
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleSkill")}`
case "weapon":
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleWeapon")}`
case "char":
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleCharacteristic")}`
case "san":
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleSAN")}`
default:
return game.i18n.localize("CTHULHUETERNAL.Label.titleStandard")
}

View File

@ -44,7 +44,8 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
recovery: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
violence: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min:3, max:3}),
helplessness: new fields.ArrayField(new fields.BooleanField(), { required: true, initial: [false, false, false], min:3, max:3 }),
breakingPoint: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
breakingPoint: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
insanity: new fields.StringField({ required: true, nullable: false, initial: "none", choices:SYSTEM.INSANITY }),
})
schema.damageBonus = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
@ -66,6 +67,8 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
eyes: new fields.StringField({ required: true, nullable: false, initial: "" }),
hair: new fields.StringField({ required: true, nullable: false, initial: "" }),
harshness: new fields.StringField({ required: true, nullable: false, initial: "normal", choices:SYSTEM.HARSHNESS }),
adaptedToViolence: new fields.BooleanField({ required: true, initial: false }),
adaptedToHelplessness: new fields.BooleanField({ required: true, initial: false })
})
return schema

View File

@ -67,20 +67,59 @@
}
}
.san {
align-content: flex-start;
input {
min-width: 2.2rem;
max-width: 2.2rem;
margin-bottom: 4px;
}
select {
min-width: 6rem;
max-width: 6rem;
}
.rollable:hover,
.rollable:focus {
text-shadow: 0 0 8px var(--color-shadow-primary);
cursor: pointer;
font-size: 0.9rem;
}
.san-checkbox {
min-width: 1rem;
max-width: 1rem;
}
.label-field {
flex-grow: 0;
.label-short-field {
font-size: 0.9rem;
max-width: 3rem;
min-width: 3rem;
flex-grow: 1;
}
.label-recovery {
margin-left: 4px;
}
.label-field {
font-size: 0.9rem;
max-width: 6rem;
min-width: 6rem;
flex-grow: 1;
}
.label-bp {
flex-grow: 1;
max-width: 3rem;
min-width: 3rem;
margin-left: 4px;
}
.label-insanity {
flex-grow: 1;
margin-left: 4px;
max-width: 8rem;
min-width: 8rem;
}
.spacing {
margin-left: 4px;
}
.d100 {
flex: 0;
}
}
.willpower {
input {
@ -205,6 +244,15 @@
margin-left: 8px;
}
.adapted {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
label {
min-width: 20rem;
}
}
.features,
.biodata {
display: grid;

View File

@ -2,6 +2,10 @@
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.biodata"}}</legend>
<div class="adapted">
{{formField systemFields.biodata.fields.adaptedToViolence value=system.biodata.adaptedToViolence name="system.biodata.adaptedToViolence" localize=true}}
{{formField systemFields.biodata.fields.adaptedToHelplessness value=system.biodata.adaptedToHelplessness name="system.biodata.adaptedToHelplessness" localize=true}}
</div>
<div class="biodata">
{{formField systemFields.biodata.fields.harshness value=system.biodata.harshness name="system.biodata.harshness" localize=true}}
{{formField systemFields.biodata.fields.age value=system.biodata.age name="system.biodata.age" localize=true classes="field-label"}}

View File

@ -2,7 +2,9 @@
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.weapons"}}{{#if isEditMode}}
<a class="action" data-tooltip="{{localize "CTHULHUETERNAL.Tooltip.addWeapon"}}" data-tooltip-direction="UP"><i class="fas fa-plus" data-action="createWeapon"></i></a>{{/if}}</legend>
<a class="action" data-tooltip="{{localize " CTHULHUETERNAL.Tooltip.addWeapon"}}" data-tooltip-direction="UP"><i
class="fas fa-plus" data-action="createWeapon"></i></a>{{/if}}
</legend>
<div class="weapons">
{{#each weapons as |item|}}
{{!log 'weapon' this}}
@ -11,10 +13,14 @@
<div class="name rollable" data-roll-type="weapon" data-tooltip="{{{item.system.description}}}">
{{item.name}}
</div>
<a class="damage rollable" data-item-id="{{item.id}}" data-action="roll" data-roll-type="damage" data-roll-value="{{item.system.damage}}">{{localize "CTHULHUETERNAL.Label.damageShort"}} : {{item.system.damage}}</a>
<a class="damage rollable" data-item-id="{{item.id}}" data-action="roll" data-roll-type="damage"
data-roll-value="{{item.system.damage}}">{{localize "CTHULHUETERNAL.Label.damageShort"}} :
{{item.system.damage}}</a>
<div class="controls">
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
</div>
</div>
{{/each}}
@ -23,7 +29,9 @@
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.armors"}}{{#if isEditMode}}
<a class="action" data-tooltip="{{localize "CTHULHUETERNAL.Tooltip.addArmor"}}" data-tooltip-direction="UP"><i class="fas fa-plus" data-action="createArmor"></i></a>{{/if}}</legend>
<a class="action" data-tooltip="{{localize " CTHULHUETERNAL.Tooltip.addArmor"}}" data-tooltip-direction="UP"><i
class="fas fa-plus" data-action="createArmor"></i></a>{{/if}}
</legend>
<div class="armors">
{{#each armors as |item|}}
{{!log 'armor' this}}
@ -34,8 +42,10 @@
</div>
<span class="protection">{{localize "CTHULHUETERNAL.Label.armor"}} : {{item.system.protection}}</span>
<div class="controls">
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
</div>
</div>
{{/each}}
@ -44,7 +54,9 @@
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.gears"}}{{#if isEditMode}}
<a class="action" data-tooltip="{{localize "CTHULHUETERNAL.Tooltip.addGear"}}" data-tooltip-direction="UP"><i class="fas fa-plus" data-action="createGear"></i></a>{{/if}}</legend>
<a class="action" data-tooltip="{{localize " CTHULHUETERNAL.Tooltip.addGear"}}" data-tooltip-direction="UP"><i
class="fas fa-plus" data-action="createGear"></i></a>{{/if}}
</legend>
<div class="gears">
{{#each gears as |item|}}
{{!log 'armor' this}}
@ -54,8 +66,10 @@
{{item.name}}
</div>
<div class="controls">
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
</div>
</div>
{{/each}}

View File

@ -32,29 +32,51 @@
<fieldset class="san">
<legend>{{localize "CTHULHUETERNAL.Label.SAN"}}</legend>
<div class="flexrow">
<span class="label-field">{{localize "CTHULHUETERNAL.Label.current"}}</span>
{{formField systemFields.san.fields.value value=system.san.value}}
<span class="label-field">{{localize "CTHULHUETERNAL.Label.max"}}</span>
{{formField systemFields.san.fields.max value=system.san.max rootId=partId disabled=true}}
<span class="label-field">{{localize "CTHULHUETERNAL.Label.recovery"}}</span>
{{formField systemFields.san.fields.recovery value=system.san.recovery disabled=true}}
<span class="label-field" data-tooltip='{{localize "CTHULHUETERNAL.Tooltip.sanBP"}}'>{{localize
"CTHULHUETERNAL.Label.breakingPoint"}}</span>
{{formField systemFields.san.fields.breakingPoint value=system.san.breakingPoint disabled=true}}
<img src="systems/fvtt-cthulhu-eternal/assets/ui/d100.svg" class="d100" />
<label class="label-field rollable" data-roll-type="san" >{{localize "CTHULHUETERNAL.Label.current"}}</label>
{{formInput systemFields.san.fields.value value=system.san.value}}
<span class="label-field label-recovery">{{localize "CTHULHUETERNAL.Label.recovery"}}</span>
{{formInput systemFields.san.fields.recovery value=system.san.recovery disabled=true}}
<span class="label-bp" data-tooltip='{{localize "CTHULHUETERNAL.Tooltip.sanBPShort"}}'>{{localize
"CTHULHUETERNAL.Label.sanBPShort"}}</span>
{{formInput systemFields.san.fields.breakingPoint value=system.san.breakingPoint disabled=true}}
</div>
<div class="flexrow">
<div class="flexrow">
<span class="label-short-field">{{localize "CTHULHUETERNAL.Label.max"}}</span>
{{formInput systemFields.san.fields.max value=system.san.max rootId=partId disabled=true}}
</div>
<span class="label-insanity" >
{{localize "CTHULHUETERNAL.Label.tempInsanity"}}
</span>
{{formInput systemFields.san.fields.insanity value=system.san.insanity localize=true}}
</div>
<div class="flexrow">
{{localize "CTHULHUETERNAL.Label.violence"}}
<span class="label-field">{{localize "CTHULHUETERNAL.Label.violence"}}</span>
{{#each system.san.violence as |violence idx|}}
<input class="san-checkbox" type="checkbox" data-action="updateCheckboxArray" data-index="{{@index}}"
data-name="violence" {{#if violence}} checked {{/if}}>
{{/each}}
<span class="spacing"></span>
{{localize "CTHULHUETERNAL.Label.helplessness"}}
<span class="label-field">{{localize "CTHULHUETERNAL.Label.helplessness"}}</span>
{{#each system.san.helplessness as |helplessness idx|}}
<input class="san-checkbox" type="checkbox" data-action="updateCheckboxArray" data-index="{{@index}}"
data-name="helplessness" {{#if helplessness}} checked {{/if}}>
{{/each}}
</div>
</fieldset>
<fieldset class="willpower">