Add new compendiums
This commit is contained in:
parent
3957a6aa9f
commit
39c0e8c30a
@ -380,6 +380,31 @@ export class CrucibleActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incrementSkillExp(skillId, inc) {
|
||||
let skill = this.data.items.get(skillId)
|
||||
if (skill) {
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: skill.id, 'data.exp': skill.data.data.exp + inc }])
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${this.name} has gained 1 exp in the skill ${skill.name} (exp = ${skill.data.data.exp}}</div`
|
||||
}
|
||||
ChatMessage.create(chatData)
|
||||
if (skill.data.data.exp >= 25) {
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: skill.id, 'data.exp': 0, 'data.level': skill.data.data.level + 1 }])
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${this.name} has gained 1 SL in the skill ${skill.name} (new SL : ${skill.data.data.level} ) !</div`
|
||||
}
|
||||
ChatMessage.create(chatData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incDecQuantity(objetId, incDec = 0) {
|
||||
let objetQ = this.data.items.get(objetId)
|
||||
@ -411,7 +436,8 @@ export class CrucibleActor extends Actor {
|
||||
rollData.featsDie = this.getFeatsWithDie()
|
||||
rollData.featsSL = this.getFeatsWithSL()
|
||||
rollData.featDieName = "none"
|
||||
rollData.featSLName = "none"
|
||||
rollData.featSLName = "none"
|
||||
rollData.rollAdvantage = false
|
||||
|
||||
if (abilityKey) {
|
||||
rollData.ability = this.getAbility(abilityKey)
|
||||
|
@ -70,6 +70,10 @@ export class CrucibleRollDialog extends Dialog {
|
||||
this.rollData.advantage = "disadvantage"
|
||||
this.refreshDialog()
|
||||
})
|
||||
html.find('#roll-with-advantage-clicked').change((event) => {
|
||||
this.rollData.rollAdvantage = !this.rollData.rollAdvantage
|
||||
this.refreshDialog()
|
||||
})
|
||||
html.find('#featDieName').change((event) => {
|
||||
this.rollData.featDieName = event.currentTarget.value
|
||||
})
|
||||
|
@ -287,9 +287,24 @@ export class CrucibleUtility {
|
||||
if (!myRoll) { // New rolls only of no rerolls
|
||||
myRoll = new Roll(diceFormula).roll({ async: false })
|
||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
rollData.roll = myRoll
|
||||
}
|
||||
rollData.roll = myRoll
|
||||
rollData.nbSuccess = myRoll.total
|
||||
if (rollData.rollAdvantage) {
|
||||
let myRoll2 = new Roll(diceFormula).roll({ async: false })
|
||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
if ( myRoll2.total > rollData.nbSuccess) {
|
||||
rollData.roll = myRoll2
|
||||
rollData.nbSuccess = myRoll2.total
|
||||
}
|
||||
}
|
||||
// Manage exp
|
||||
if (rollData.skill) {
|
||||
let nbSkillSuccess = rollData.roll.terms[2].total
|
||||
if ( nbSkillSuccess == 0 || nbSkillSuccess == rollData.skill.data.level) {
|
||||
actor.incrementSkillExp(rollData.skill._id, 1)
|
||||
}
|
||||
}
|
||||
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-generic-result.html`, rollData)
|
||||
|
@ -15,5 +15,10 @@
|
||||
<input type="checkbox" id="disadvantage-clicked" class="disadvantage-clicked" {{#if (eq advantage "disadvantage")}} checked {{/if}} /></label>
|
||||
<label class="generic-label">Disadvantage ?</label>
|
||||
</li>
|
||||
<li class="flex-group-left">
|
||||
<label class="ability-value checkbox">
|
||||
<input type="checkbox" id="roll-with-advantage-clicked" class="roll-with-advantage-clicked" {{#if rollAdvantage}} checked {{/if}} /></label>
|
||||
<label class="generic-label">Roll With Advantage ?</label>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user