Gestion des progression
This commit is contained in:
parent
a100da7cd9
commit
634feabb75
@ -124,10 +124,21 @@ export class Imperium5Actor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
incDecKarma( value ) {
|
transferToSource( nbSuccess) {
|
||||||
let karma = duplicate(this.system.karma)
|
let karma = duplicate(this.system.karma)
|
||||||
karma.value += value
|
karma.source += Number(nbSuccess)
|
||||||
|
let nbKarma = Math.floor(karma.source / 3)
|
||||||
|
karma.value += nbKarma
|
||||||
|
karma.source -= nbKarma*3
|
||||||
|
this.update( { 'system.karma': karma})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
decOneKarma( ) {
|
||||||
|
let karma = duplicate(this.system.karma)
|
||||||
|
karma.value--
|
||||||
karma.value = Math.max(karma.value, 0)
|
karma.value = Math.max(karma.value, 0)
|
||||||
|
karma.xp++
|
||||||
this.update( { 'system.karma': karma})
|
this.update( { 'system.karma': karma})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,18 @@ export class Imperium5Utility {
|
|||||||
Handlebars.registerHelper('exists', function (val) {
|
Handlebars.registerHelper('exists', function (val) {
|
||||||
return val != null && val != undefined;
|
return val != null && val != undefined;
|
||||||
})
|
})
|
||||||
|
Handlebars.registerHelper('for', function (from, to, incr, block) {
|
||||||
|
var accum = '';
|
||||||
|
for (var i = from; i < to; i += incr)
|
||||||
|
accum += block.fn(i);
|
||||||
|
return accum;
|
||||||
|
})
|
||||||
|
Handlebars.registerHelper('times', function(n, block) {
|
||||||
|
var accum = '';
|
||||||
|
for(var i = 1; i <= n; ++i)
|
||||||
|
accum += block.fn(i);
|
||||||
|
return accum;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -123,6 +135,14 @@ export class Imperium5Utility {
|
|||||||
rollData.previousMessageId = Imperium5Utility.findChatMessageId(event.currentTarget)
|
rollData.previousMessageId = Imperium5Utility.findChatMessageId(event.currentTarget)
|
||||||
this.applySingularite(rollData, resultIndex)
|
this.applySingularite(rollData, resultIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
html.on("change", '.transfer-success', event => {
|
||||||
|
let nbSuccess = event.currentTarget.value
|
||||||
|
let rollData = this.getRollDataFromMessage(event)
|
||||||
|
rollData.previousMessageId = Imperium5Utility.findChatMessageId(event.currentTarget)
|
||||||
|
this.applySuccessTransfer(rollData, nbSuccess)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -341,11 +361,11 @@ export class Imperium5Utility {
|
|||||||
let actor = game.actors.get(rollData.actorId)
|
let actor = game.actors.get(rollData.actorId)
|
||||||
rollData.nbKarma = 0
|
rollData.nbKarma = 0
|
||||||
if (rollData.useKarma) {
|
if (rollData.useKarma) {
|
||||||
actor.incDecKarma(-1)
|
actor.decOneKarma()
|
||||||
rollData.nbKarma++
|
rollData.nbKarma++
|
||||||
}
|
}
|
||||||
if (rollData.usedCapacite != "none") {
|
if (rollData.usedCapacite != "none") {
|
||||||
actor.incDecKarma(-1)
|
actor.decOneKarma()
|
||||||
rollData.nbKarma++
|
rollData.nbKarma++
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,6 +385,7 @@ export class Imperium5Utility {
|
|||||||
rollData.resultsPC = duplicate(myRoll.terms[0].results)
|
rollData.resultsPC = duplicate(myRoll.terms[0].results)
|
||||||
// Calcul réussites
|
// Calcul réussites
|
||||||
this.computeReussites(rollData)
|
this.computeReussites(rollData)
|
||||||
|
rollData.realSuccessPC = rollData.successPC // To manage source transfer
|
||||||
|
|
||||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||||
content: await renderTemplate(`systems/fvtt-imperium5/templates/chat-generic-result.html`, rollData)
|
content: await renderTemplate(`systems/fvtt-imperium5/templates/chat-generic-result.html`, rollData)
|
||||||
@ -401,6 +422,21 @@ export class Imperium5Utility {
|
|||||||
content: await renderTemplate(`systems/fvtt-imperium5/templates/chat-generic-result.html`, rollData)
|
content: await renderTemplate(`systems/fvtt-imperium5/templates/chat-generic-result.html`, rollData)
|
||||||
})
|
})
|
||||||
msg.setFlag("world", "imperium5-roll-data", rollData)
|
msg.setFlag("world", "imperium5-roll-data", rollData)
|
||||||
|
this.removeChatMessageId(rollData.previousMessageId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------- ------------------- */
|
||||||
|
static async applySuccessTransfer(rollData, nbSuccess) {
|
||||||
|
let actor = game.actors.get(rollData.actorId)
|
||||||
|
actor.transferToSource( nbSuccess)
|
||||||
|
rollData.realSuccessPC -= nbSuccess
|
||||||
|
rollData.sourceTransfer = nbSuccess
|
||||||
|
rollData.nbUnitesNarration = Math.max(rollData.realSuccessPC - 1, 0)
|
||||||
|
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||||
|
content: await renderTemplate(`systems/fvtt-imperium5/templates/chat-generic-result.html`, rollData)
|
||||||
|
})
|
||||||
|
msg.setFlag("world", "imperium5-roll-data", rollData)
|
||||||
|
this.removeChatMessageId(rollData.previousMessageId)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------- ------------------- */
|
/* ------------------------- ------------------- */
|
||||||
@ -530,6 +566,7 @@ export class Imperium5Utility {
|
|||||||
useKarma: false,
|
useKarma: false,
|
||||||
usedCapacite: "none",
|
usedCapacite: "none",
|
||||||
seuil: 2,
|
seuil: 2,
|
||||||
|
nbSuccessSource: 0,
|
||||||
useSingularites: game.settings.get("fvtt-imperium5", "use-singularite"),
|
useSingularites: game.settings.get("fvtt-imperium5", "use-singularite"),
|
||||||
useEntropieReussite: game.settings.get("fvtt-imperium5", "use-entropie-reussite")
|
useEntropieReussite: game.settings.get("fvtt-imperium5", "use-entropie-reussite")
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"flags": {}
|
"flags": {}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": "10.0.5",
|
"version": "10.0.6",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10",
|
"verified": "10",
|
||||||
@ -67,5 +67,5 @@
|
|||||||
"background": "images/ui/imperium5_welcome_page.webp",
|
"background": "images/ui/imperium5_welcome_page.webp",
|
||||||
"url": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5",
|
"url": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5",
|
||||||
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5/raw/branch/master/system.json",
|
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5/raw/branch/master/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5/archive/fvtt-imperium5-v10.0.5.zip"
|
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5/archive/fvtt-imperium5-v10.0.6.zip"
|
||||||
}
|
}
|
@ -46,18 +46,33 @@
|
|||||||
<li>Seuil : {{seuil}}
|
<li>Seuil : {{seuil}}
|
||||||
{{#if (count paradigmes)}}
|
{{#if (count paradigmes)}}
|
||||||
<select class="common-button select-apply-paradigme" type="text" value="{{selectedParadigme}}" data-dtype="String">
|
<select class="common-button select-apply-paradigme" type="text" value="{{selectedParadigme}}" data-dtype="String">
|
||||||
{{#select selectedParadigme}}
|
{{#select selectedParadigme}}
|
||||||
<option value="none">Pas de paradigme</option>
|
<option value="none">Pas de paradigme</option>
|
||||||
{{#each paradigmes as |para key|}}
|
{{#each paradigmes as |para key|}}
|
||||||
<option value="{{para.key}}">{{para.label}} ({{para.value}})</option>
|
<option value="{{para.key}}">{{para.label}} ({{para.value}})</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>Succés : {{successPC}}</li>
|
<li>Succés : {{realSuccessPC}}
|
||||||
|
{{#if realSuccessPC}}
|
||||||
|
<select class="common-button transfer-success" type="text" value="{{nbSuccessSource}}" data-dtype="Number">
|
||||||
|
{{#select nbSuccessSource}}
|
||||||
|
<option value="none">0 succès -> Source</option>
|
||||||
|
{{#times realSuccessPC}}
|
||||||
|
<option value="{{this}}">{{this}} succès -> Source</option>
|
||||||
|
{{/times}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
{{/if}}
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{{#if sourceTransfer}}
|
||||||
|
<li>Succés transférés à la Source : {{sourceTransfer}}</li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<li>Succés de Réalité : {{successGM}}</li>
|
<li>Succés de Réalité : {{successGM}}</li>
|
||||||
|
|
||||||
<li>Unités de narration : {{nbUnitesNarration}}</li>
|
<li>Unités de narration : {{nbUnitesNarration}}</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user