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",
"notes": "Notes",
"bio": "Bio",
"bionotes": "Bio&Notes",
"skills": "Skills",
"traits": "Traits",
"equipment": "Equipment",
@ -93,7 +94,10 @@
"impactLevel": "Impact level",
"impactphysical": "Physical",
"impactmental": "Mental",
"impactsocial": "Social"
"impactsocial": "Social",
"impactmalus": "Impact Malus",
"ongoingconfront": "Ongoing confrontation",
"confront":"Confrontation"
}
}
}

View File

@ -39,6 +39,7 @@
"coin": "Sous",
"notes": "Notes",
"bio": "Bio",
"bionotes": "Bio&Notes",
"skills": "Compétences",
"traits": "Traits",
"equipment": "Equipement",
@ -93,7 +94,10 @@
"impactLevel": "Niveau d'impact",
"impactphysical": "Physique",
"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,
skills: this.actor.prepareSkills(),
traits: this.actor.getRollTraits(),
confrontations: this.actor.getConfrontations(),
ideal: this.actor.getIdeal(),
spleen: this.actor.getSpleen(),
impacts: this.object.getImpacts(),
config: duplicate(game.system.ecryme.config),
weapons: this.actor.getWeapons(),
impactsMalus: this.actor.getImpactsMalus(),
archetype: duplicate(this.actor.getArchetype()),
equipements: duplicate(this.actor.getEquipements()),
equipements: this.actor.getEquipements(),
subActors: duplicate(this.actor.getSubActors()),
description: await TextEditor.enrichHTML(this.object.system.description, { 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;
}
/* -------------------------------------------- */
getConfrontations() {
return this.items.filter(it => it.type == "confrontation")
}
getRollTraits() {
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})
}
/* -------------------------------------------- */
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() {
this.getFlag("world", "initiative", -1)
@ -327,12 +346,16 @@ export class EcrymeActor extends Actor {
getCommonSkill(categKey, skillKey) {
let skill = this.system.skills[categKey].skilllist[skillKey]
let rollData = this.getCommonRollData()
skill = duplicate(skill)
skill.categKey = categKey
skill.skillKey = skillKey
skill.spec = this.getSpecializations(skillKey)
rollData.skill = skill
rollData.img = skill.img
rollData.impactMalus = this.getImpactMalus(categKey)
return rollData
}

View File

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

View File

@ -1206,7 +1206,17 @@ ul, li {
border-color: #000000;
border-radius: 6px;
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 {

View File

@ -1186,6 +1186,17 @@ ul, li {
border-color: #000000;
border-radius: 6px;
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 {

View File

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

View File

@ -39,15 +39,6 @@
</ul>
</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>
@ -59,9 +50,9 @@
<nav class="sheet-tabs tabs" data-group="primary">
<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="confrontation">{{localize "ECRY.ui.confrontation"}}</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="notes">{{localize "ECRY.ui.notes"}}</a>
<a class="item" data-tab="biodata">{{localize "ECRY.ui.bionotes"}}</a>
</nav>
{{!-- Sheet Body --}}
@ -77,8 +68,8 @@
<div>
<ul class="stat-list alternate-list item-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header title-center">
<h3><label class="items-title-text">{{localize category.name}}</label></h3>
<span class="item-name-label-header impact-title">
<h3><label class="items-title-text">{{localize category.name}} ({{valueAtIndex @root.impactsMalus categkey}})</label></h3>
</span>
</li>
{{#each category.skilllist as |skill skillkey|}}
@ -159,6 +150,40 @@
</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 --}}
<div class="tab equipment" data-group="primary" data-tab="equipment">
@ -304,9 +329,7 @@
</ul>
</div>
</div>
</div>
<div class="tab notes" data-group="primary" data-tab="notes">
<hr>
<span class="item-name-label-header items-title-bg">
<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}}
</div>
<hr>
</article>
</div>
</div>
</section>
</form>

View File

@ -1,6 +1,9 @@
<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>
{{#each impacts as |value key|}}
<li class="flexrow" data-impact-type="{{../impacttype}}">

View File

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

View File

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