Fix #29 - Stat selection
This commit is contained in:
parent
109ce4f192
commit
50f4339454
@ -204,11 +204,27 @@ export class PegasusActorCreate {
|
||||
this.actor.addIncSpec(spec, 1)
|
||||
this.nbGlobalSpec--;
|
||||
if (this.nbGlobalSpec == 0) {
|
||||
this.showCharacterEnd()
|
||||
this.nbGlobalStat = 5
|
||||
this.showGlobalStat()
|
||||
//this.showCharacterEnd()
|
||||
} else {
|
||||
this.showGlobalSpec()
|
||||
}
|
||||
}
|
||||
|
||||
if (step == 'select-global-stat') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget))
|
||||
let statKey = $(event.currentTarget).data("stat-key")
|
||||
this.actor.valueStat(statKey, 1)
|
||||
this.nbGlobalStat--
|
||||
if (this.nbGlobalStat == 0) {
|
||||
this.showCharacterEnd()
|
||||
} else {
|
||||
this.showGlobalStat()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -241,6 +257,9 @@ export class PegasusActorCreate {
|
||||
if (step == 'select-role-perk') {
|
||||
itemData = this.rolePerks.find(item => item._id == itemId);
|
||||
}
|
||||
if (step == 'select-global-spec') {
|
||||
itemData = this.specs.find(item => item._id == itemId);
|
||||
}
|
||||
if (itemData) {
|
||||
let item = await Item.create(itemData, { temporary: true });
|
||||
new PegasusItemSheet(item).render(true);
|
||||
@ -416,6 +435,19 @@ export class PegasusActorCreate {
|
||||
this.renderChatMessage(formData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async showGlobalStat() {
|
||||
let formData = this.createFormData("select-global-stat")
|
||||
formData.stats = {}
|
||||
for (let key in this.actor.system.statistics) {
|
||||
let stat = this.actor.system.statistics[key]
|
||||
if (stat.level < 5) {
|
||||
formData.stats[key] = duplicate(stat)
|
||||
}
|
||||
}
|
||||
this.renderChatMessage(formData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async showCharacterEnd() {
|
||||
await this.actor.computeNRGHealth()
|
||||
|
@ -147,6 +147,19 @@
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq step "select-global-stat")}}
|
||||
<div>Now select a Statistic at +1DT.
|
||||
</div>
|
||||
<table class="table-create-actor">
|
||||
{{#each stats as |stat key|}}
|
||||
<tr>
|
||||
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-stat-key="{{key}}">{{stat.label}}</a></td>
|
||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-stat-key="{{key}}" >Select it !</a></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq step "character-end")}}
|
||||
<div>Follow the next steps from the rulebook page 50 !. You can now spend 150 CDPs to customise your character.
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user