Nouvelle incarnation de l'archétype

This commit is contained in:
Vincent Vandemeulebrouck 2023-06-20 23:20:44 +02:00
parent e1e45a83be
commit 0e3d721fc7
6 changed files with 54 additions and 8 deletions

View File

@ -1,8 +1,9 @@
# v11.0
## v11.0.9 - Les premiers pieds de Werther de Zloth
- réorganisation des règles optionelles
- bouton pour accéder au mode de saisie de l'archétype en vue détaillée
## v11.0.9 - Les Souvenirs de Khrachtchoum le Problémeux
- mode de saisie de l'archétype en vue détaillée
- création une nouvelle incarnation depuis l'archétype
- réorganisation de la fenêtre de sélection des règles optionelles
- correction de l'affichage du types dans les fenêtres d'objets
## v11.0.8 - la poigne de Sémolosse

View File

@ -364,6 +364,9 @@ export class RdDActorSheet extends RdDBaseActorSheet {
this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
});
}
this.html.find('.nouvelle-incarnation').click(async event => {
this.actor.nouvelleIncarnation();
});
this.html.find('.show-hide-competences').click(async event => {
this.options.showCompNiveauBase = !this.options.showCompNiveauBase;

View File

@ -1395,9 +1395,9 @@ export class RdDActor extends RdDBaseActor {
await this.deleteEmbeddedDocuments('Item', obsoletes);
}
async $finDeRoundEmpoignade(){
async $finDeRoundEmpoignade() {
const immobilisations = this.itemTypes[TYPES.empoignade].filter(it => it.system.pointsemp >= 2 && it.system.empoigneurid == this.id);
immobilisations.forEach(emp => RdDEmpoignade.onImmobilisation(this,
immobilisations.forEach(emp => RdDEmpoignade.onImmobilisation(this,
game.actors.get(emp.system.empoigneid),
emp
))
@ -3830,5 +3830,39 @@ export class RdDActor extends RdDBaseActor {
content: `${this.name} a reçu un/une ${item.type}: ${item.name}, qui ${manualMessage ? "n'est pas" : "est"} géré(e) automatiquement. ${manualMessage ? manualMessage : ''}`
});
}
async nouvelleIncarnation() {
let incarnation = this.toObject();
incarnation.items = Array.from(this.items.filter(it => it.type == TYPES.competence),
it => {
it = it.toObject();
it.id = undefined;
it.system.niveau = it.system.base;
it.system.niveau_archetype = Math.max(it.system.niveau + (it.system.xp > 0 ? 1 : 0), it.system.niveau_archetype);
it.system.xp = 0;
it.system.xp_sort = 0;
it.system.default_diffLibre = 0;
return it;
});
incarnation.name = 'Réincarnation de ' + incarnation.name
incarnation.system = {
carac: duplicate(this.system.carac),
heure: RdDTimestamp.defHeure(await RdDDice.rollTotal("1dh", { rollMode: "selfroll", showDice: SHOW_DICE })).key,
age: 18,
biographie: '',
notes: '',
experiencelog: [],
'compteurs.experience.value': 3000,
'reve.seuil.value': this.system.carac.reve.value,
'reve.reve.value': this.system.carac.reve.value,
subacteurs: { suivants: [], montures: [], vehicules: [] },
}
incarnation = await RdDBaseActor.create(incarnation);
await incarnation.deleteEmbeddedDocuments('ActiveEffect', incarnation.getEmbeddedCollection("ActiveEffect").map(it => it.id));
await incarnation.remiseANeuf();
incarnation.sheet.render(true);
}
}

View File

@ -156,7 +156,9 @@ export class RdDTimestamp {
fields.minute.change(async (event) => await onChangeTimestamp(fields, path));
}
static defHeure(heure) {
return DEFINITION_HEURES.find(it => (it.heure) == heure % RDD_HEURES_PAR_JOUR);
}
static findHeure(heure) {
heure = Grammar.toLowerCaseNoAccentNoSpace(heure);
let parHeureOuLabel = DEFINITION_HEURES.filter(it => (it.heure) == parseInt(heure) % RDD_HEURES_PAR_JOUR || Grammar.toLowerCaseNoAccentNoSpace(it.label) == heure);

View File

@ -70,9 +70,9 @@
{{#if options.vueDetaillee}}
  
{{#if @root.options.vueArchetype}}
<a class="competence-archetype toggle-archetype chat-card-button-pushed">Sortie archétype</a>
<a class="competence-archetype toggle-archetype chat-card-button-pushed"><i class="fa-solid fa-up-right-from-square"></i>Incarnation</a>
{{else}}
<a class="competence-archetype toggle-archetype chat-card-button">Edit. archétype</a>
<a class="competence-archetype toggle-archetype chat-card-button"><i class="fa-solid fa-people-line"></i>Archétype</a>
{{/if}}
{{/if}}
</span>

View File

@ -1,5 +1,11 @@
<div>
<ul class="item-list">
{{#if @root.options.isGM}}
<li>
<a class="nouvelle-incarnation chat-card-button"><i class="fa-solid fa-person-circle-plus"></i> Nouvelle incarnation</a>
</li>
{{/if}}
<li><hr></li>
<li>Niveaux d'archétype</li>
{{#if calc.comptageArchetype}}
{{#each calc.comptageArchetype as |archetype|}}