Ajout des impacts

This commit is contained in:
LeRatierBretonnien 2023-05-31 09:16:30 +02:00
parent 688d67751c
commit 8800c32e8c
12 changed files with 131 additions and 27 deletions

View File

@ -39,6 +39,7 @@
"coin": "Coin", "coin": "Coin",
"notes": "Notes", "notes": "Notes",
"bio": "Bio", "bio": "Bio",
"bionotes": "Bio&Notes",
"skills": "Skills", "skills": "Skills",
"traits": "Traits", "traits": "Traits",
"equipment": "Equipment", "equipment": "Equipment",
@ -93,7 +94,10 @@
"impactLevel": "Impact level", "impactLevel": "Impact level",
"impactphysical": "Physical", "impactphysical": "Physical",
"impactmental": "Mental", "impactmental": "Mental",
"impactsocial": "Social" "impactsocial": "Social",
"impactmalus": "Impact Malus",
"ongoingconfront": "Ongoing confrontation",
"confront":"Confrontation"
} }
} }
} }

View File

@ -39,6 +39,7 @@
"coin": "Sous", "coin": "Sous",
"notes": "Notes", "notes": "Notes",
"bio": "Bio", "bio": "Bio",
"bionotes": "Bio&Notes",
"skills": "Compétences", "skills": "Compétences",
"traits": "Traits", "traits": "Traits",
"equipment": "Equipement", "equipment": "Equipement",
@ -93,7 +94,10 @@
"impactLevel": "Niveau d'impact", "impactLevel": "Niveau d'impact",
"impactphysical": "Physique", "impactphysical": "Physique",
"impactmental": "Mental", "impactmental": "Mental",
"impactsocial": "Social" "impactsocial": "Social",
"impactmalus": "Malus d'Impact",
"ongoingconfront": "Confrontations en cours",
"confront":"Confrontation"
} }
} }
} }

View File

@ -37,13 +37,15 @@ export class EcrymeActorSheet extends ActorSheet {
limited: this.object.limited, limited: this.object.limited,
skills: this.actor.prepareSkills(), skills: this.actor.prepareSkills(),
traits: this.actor.getRollTraits(), traits: this.actor.getRollTraits(),
confrontations: this.actor.getConfrontations(),
ideal: this.actor.getIdeal(), ideal: this.actor.getIdeal(),
spleen: this.actor.getSpleen(), spleen: this.actor.getSpleen(),
impacts: this.object.getImpacts(), impacts: this.object.getImpacts(),
config: duplicate(game.system.ecryme.config), config: duplicate(game.system.ecryme.config),
weapons: this.actor.getWeapons(), weapons: this.actor.getWeapons(),
impactsMalus: this.actor.getImpactsMalus(),
archetype: duplicate(this.actor.getArchetype()), archetype: duplicate(this.actor.getArchetype()),
equipements: duplicate(this.actor.getEquipements()), equipements: this.actor.getEquipements(),
subActors: duplicate(this.actor.getSubActors()), subActors: duplicate(this.actor.getSubActors()),
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }), description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }), notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }),

View File

@ -90,6 +90,9 @@ export class EcrymeActor extends Actor {
return comp; return comp;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getConfrontations() {
return this.items.filter(it => it.type == "confrontation")
}
getRollTraits() { getRollTraits() {
return this.items.filter(it => it.type == "trait" && it.system.traitype == "normal") return this.items.filter(it => it.type == "trait" && it.system.traitype == "normal")
} }
@ -240,6 +243,22 @@ export class EcrymeActor extends Actor {
this.update({ [`system.impacts.${impactType}.${impactLevel}`]: newImpact}) this.update({ [`system.impacts.${impactType}.${impactLevel}`]: newImpact})
} }
/* -------------------------------------------- */
getImpactMalus(impactKey) {
let impacts = this.system.impacts[impactKey]
return - ((impacts.serious*2) + (impacts.major*4))
}
/* -------------------------------------------- */
getImpactsMalus() {
let impactsMalus = {
physical: this.getImpactMalus("physical"),
mental: this.getImpactMalus("mental"),
social: this.getImpactMalus("social")
}
return impactsMalus
}
/* -------------------------------------------- */ /* -------------------------------------------- */
clearInitiative() { clearInitiative() {
this.getFlag("world", "initiative", -1) this.getFlag("world", "initiative", -1)
@ -327,12 +346,16 @@ export class EcrymeActor extends Actor {
getCommonSkill(categKey, skillKey) { getCommonSkill(categKey, skillKey) {
let skill = this.system.skills[categKey].skilllist[skillKey] let skill = this.system.skills[categKey].skilllist[skillKey]
let rollData = this.getCommonRollData() let rollData = this.getCommonRollData()
skill = duplicate(skill) skill = duplicate(skill)
skill.categKey = categKey skill.categKey = categKey
skill.skillKey = skillKey skill.skillKey = skillKey
skill.spec = this.getSpecializations(skillKey) skill.spec = this.getSpecializations(skillKey)
rollData.skill = skill rollData.skill = skill
rollData.img = skill.img rollData.img = skill.img
rollData.impactMalus = this.getImpactMalus(categKey)
return rollData return rollData
} }

View File

@ -47,6 +47,9 @@ export class EcrymeUtility {
Handlebars.registerHelper('add', function (a, b) { Handlebars.registerHelper('add', function (a, b) {
return parseInt(a) + parseInt(b); return parseInt(a) + parseInt(b);
}) })
Handlebars.registerHelper('valueAtIndex', function (arr, idx) {
return arr[idx];
})
Handlebars.registerHelper('for', function (from, to, incr, block) { Handlebars.registerHelper('for', function (from, to, incr, block) {
var accum = ''; var accum = '';
for (var i = from; i <= to; i += incr) for (var i = from; i <= to; i += incr)
@ -354,6 +357,7 @@ export class EcrymeUtility {
} }
diceFormula += "+" + rollData.bonusMalusTraits diceFormula += "+" + rollData.bonusMalusTraits
diceFormula += "+" + rollData.bonusMalusPerso diceFormula += "+" + rollData.bonusMalusPerso
diceFormula += "+" + rollData.impactMalus
rollData.diceFormula = diceFormula rollData.diceFormula = diceFormula
return diceFormula return diceFormula
} }
@ -509,6 +513,7 @@ export class EcrymeUtility {
difficulty: "-", difficulty: "-",
useSpleen: false, useSpleen: false,
useIdeal: false, useIdeal: false,
impactMalus: 0,
config: duplicate(game.system.ecryme.config) config: duplicate(game.system.ecryme.config)
} }
EcrymeUtility.updateWithTarget(rollData) EcrymeUtility.updateWithTarget(rollData)

View File

@ -1206,7 +1206,17 @@ ul, li {
border-color: #000000; border-color: #000000;
border-radius: 6px; border-radius: 6px;
border: 2px ridge #443307; border: 2px ridge #443307;
margin: 2px; margin: 4px;
padding: 4px;
}
.impact-title {
font-size: bold;
display: flex;
align-items: center;
justify-content: center;
margin-left: auto;
margin-right: auto;
text-align: center;
} }
.items-title-text { .items-title-text {

View File

@ -1186,6 +1186,17 @@ ul, li {
border-color: #000000; border-color: #000000;
border-radius: 6px; border-radius: 6px;
border: 2px ridge #443307; border: 2px ridge #443307;
margin: 4px;
padding: 4px;
}
.impact-title {
font-size: bold;
display: flex;
align-items: center;
justify-content: center;
margin-left: auto;
margin-right: auto;
text-align: center;
} }
.items-title-text { .items-title-text {

View File

@ -157,7 +157,8 @@
"specialization", "specialization",
"annency", "annency",
"boheme", "boheme",
"contact" "contact",
"confrontation"
], ],
"templates": { "templates": {
"common": { "common": {
@ -169,6 +170,16 @@
"costunit": "" "costunit": ""
} }
}, },
"confrontation": {
"templates": [
"common"
],
"attackerId": "",
"defenserId": "",
"rolllist": [],
"bonusexecution": 0,
"bonuspreservation": 0
},
"equipment": { "equipment": {
"templates": [ "templates": [
"common", "common",

View File

@ -39,15 +39,6 @@
</ul> </ul>
</div> </div>
<div class="flexrow">
{{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.physical
impacttype="physical"}}
{{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.mental
impacttype="mental"}}
{{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.social
impacttype="social"}}
</div>
</div> </div>
</div> </div>
</div> </div>
@ -59,9 +50,9 @@
<nav class="sheet-tabs tabs" data-group="primary"> <nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="competences">{{localize "ECRY.ui.skills"}}</a> <a class="item" data-tab="competences">{{localize "ECRY.ui.skills"}}</a>
<a class="item" data-tab="traits">{{localize "ECRY.ui.traits"}}</a> <a class="item" data-tab="traits">{{localize "ECRY.ui.traits"}}</a>
<a class="item" data-tab="confrontation">{{localize "ECRY.ui.confrontation"}}</a>
<a class="item" data-tab="equipements">{{localize "ECRY.ui.equipment"}}</a> <a class="item" data-tab="equipements">{{localize "ECRY.ui.equipment"}}</a>
<a class="item" data-tab="biodata">{{localize "ECRY.ui.bio"}}</a> <a class="item" data-tab="biodata">{{localize "ECRY.ui.bionotes"}}</a>
<a class="item" data-tab="notes">{{localize "ECRY.ui.notes"}}</a>
</nav> </nav>
{{!-- Sheet Body --}} {{!-- Sheet Body --}}
@ -77,8 +68,8 @@
<div> <div>
<ul class="stat-list alternate-list item-list"> <ul class="stat-list alternate-list item-list">
<li class="item flexrow list-item items-title-bg"> <li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header title-center"> <span class="item-name-label-header impact-title">
<h3><label class="items-title-text">{{localize category.name}}</label></h3> <h3><label class="items-title-text">{{localize category.name}} ({{valueAtIndex @root.impactsMalus categkey}})</label></h3>
</span> </span>
</li> </li>
{{#each category.skilllist as |skill skillkey|}} {{#each category.skilllist as |skill skillkey|}}
@ -159,6 +150,40 @@
</div> </div>
<div class="tab confrontation" data-group="primary" data-tab="confrontation">
<div class="flexrow">
{{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.physical
impacttype="physical" impactMalus=impactsMalus.physical}}
{{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.mental
impacttype="mental" impactMalus=impactsMalus.mental}}
{{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.social
impacttype="social" impactMalus=impactsMalus.social}}
</div>
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header-long2">
<h3><label class="item-name-label-header-long2">{{localize "ECRY.ui.ongoingconfront"}}</label></h3>
</span>
</li>
{{#each confrontations as |confront key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{confront._id}}">
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
src="{{confront.img}}" /></a>
<span class="item-name-label-long2">{{confront.name}}</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete confrontation"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
{{!-- Equipement Tab --}} {{!-- Equipement Tab --}}
<div class="tab equipment" data-group="primary" data-tab="equipment"> <div class="tab equipment" data-group="primary" data-tab="equipment">
@ -304,9 +329,7 @@
</ul> </ul>
</div> </div>
</div> </div>
</div>
<div class="tab notes" data-group="primary" data-tab="notes">
<hr> <hr>
<span class="item-name-label-header items-title-bg"> <span class="item-name-label-header items-title-bg">
<h3><label class="items-title-text">Background</label></h3> <h3><label class="items-title-text">Background</label></h3>
@ -323,9 +346,9 @@
{{editor notes target="system.biodata.notes" button=true owner=owner editable=editable}} {{editor notes target="system.biodata.notes" button=true owner=owner editable=editable}}
</div> </div>
<hr> <hr>
</article>
</div>
</div> </div>
</section> </section>
</form> </form>

View File

@ -1,6 +1,9 @@
<div class="impact-box"> <div class="impact-box">
<span class="item-field-label-medium"><label>{{localize (concat "ECRY.ui.impact" impacttype)}}</label></span> <div class="impact-title">
<label class="items-title-text">{{localize (concat "ECRY.ui.impact" impacttype)}} ({{impactMalus}})</label>
</div>
<ul> <ul>
{{#each impacts as |value key|}} {{#each impacts as |value key|}}
<li class="flexrow" data-impact-type="{{../impacttype}}"> <li class="flexrow" data-impact-type="{{../impacttype}}">

View File

@ -25,9 +25,12 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if impactMalus}}
<li>{{localize "ECRY.ui.impactmalus"}}: {{impactMalus}} </li>
{{/if}}
{{#if skillTranscendence}} {{#if skillTranscendence}}
<li>{{localize "ECRY.ui.skilltranscendence"}}: {{skillTranscendence}} </li> <li>{{localize "ECRY.ui.skilltranscendence"}}: {{skillTranscendence}} </li>
{{/if}} {{/if}}
{{#if traitsBonusList}} {{#if traitsBonusList}}

View File

@ -1,11 +1,16 @@
{{#if skill}} {{#if skill}}
<div class="flexrow"> <div class="flexrow">
<span class="roll-dialog-label">{{localize skill.name}} : </span> <span class="roll-dialog-label">{{localize skill.name}} : </span>
<span class="roll-dialog-label"> <span class="roll-dialog-label">{{skill.value}}</span>
{{skill.value}}
</span>
</div> </div>
{{#if impactMalus}}
<div class="flexrow">
<span class="roll-dialog-label">{{localize "ECRY.ui.impactmalus"}} : </span>
<span class="roll-dialog-label">{{impactMalus}}</span>
</div>
{{/if}}
<div class="flexrow"> <div class="flexrow">
<span class="roll-dialog-label">{{localize "ECRY.ui.skilltranscendence"}} : </span> <span class="roll-dialog-label">{{localize "ECRY.ui.skilltranscendence"}} : </span>
<select class="" id="roll-select-transcendence" data-type="Number"> <select class="" id="roll-select-transcendence" data-type="Number">