Fixes dices issues
This commit is contained in:
parent
277cf7075c
commit
487e00474c
@ -271,17 +271,22 @@ export class CrucibleUtility {
|
|||||||
|
|
||||||
let actor = game.actors.get(rollData.actorId)
|
let actor = game.actors.get(rollData.actorId)
|
||||||
|
|
||||||
|
// stat => 0
|
||||||
let diceFormula = String(rollData.ability.value) + "d6cs>=5"
|
let diceFormula = String(rollData.ability.value) + "d6cs>=5"
|
||||||
|
|
||||||
|
// skill => 2
|
||||||
|
// feat => 4
|
||||||
|
// bonus => 6
|
||||||
if (rollData.skill) {
|
if (rollData.skill) {
|
||||||
let level = rollData.skill.data.level
|
let level = rollData.skill.data.level
|
||||||
if (level == 0 && rollData.skill.data.isfeatdie ) {
|
if (level == 0 && rollData.skill.data.isfeatdie ) {
|
||||||
rollData.hasSLBonus = true
|
rollData.hasSLBonus = true
|
||||||
level += 2
|
level += 2
|
||||||
if (level > 7) { level = 7}
|
if (level > 7) { level = 7}
|
||||||
rollData.skill.data.skilldice = __skillLevel2Dice[level]
|
|
||||||
}
|
}
|
||||||
|
rollData.skill.data.skilldice = __skillLevel2Dice[level]
|
||||||
diceFormula += "+" + String(rollData.skill.data.skilldice) + "cs>=5"
|
diceFormula += "+" + String(rollData.skill.data.skilldice) + "cs>=5"
|
||||||
|
|
||||||
if (rollData.skill.data.skilltype == "complex" && rollData.skill.data.level == 0) {
|
if (rollData.skill.data.skilltype == "complex" && rollData.skill.data.level == 0) {
|
||||||
rollData.complexSkillDisadvantage = true
|
rollData.complexSkillDisadvantage = true
|
||||||
rollData.rollAdvantage = "roll-disadvantage"
|
rollData.rollAdvantage = "roll-disadvantage"
|
||||||
@ -290,32 +295,49 @@ export class CrucibleUtility {
|
|||||||
if (rollData.skill.data.level > 0 && rollData.skill.data.isfeatdie) {
|
if (rollData.skill.data.level > 0 && rollData.skill.data.isfeatdie) {
|
||||||
rollData.hasFeatDie = true
|
rollData.hasFeatDie = true
|
||||||
diceFormula += "+ 1d10cs>=5"
|
diceFormula += "+ 1d10cs>=5"
|
||||||
|
} else {
|
||||||
|
diceFormula += `+ 0d10cs>=5`
|
||||||
}
|
}
|
||||||
if (rollData.skill.data.bonusdice != "none") {
|
if (rollData.skill.data.bonusdice != "none") {
|
||||||
rollData.hasBonusDice = rollData.skill.data.bonusdice
|
rollData.hasBonusDice = rollData.skill.data.bonusdice
|
||||||
diceFormula += `+ ${rollData.hasBonusDice}cs>=5`
|
diceFormula += `+ ${rollData.hasBonusDice}cs>=5`
|
||||||
|
} else {
|
||||||
|
diceFormula += `+ 0d6cs>=5`
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
diceFormula += `+ 0d8cs=>5 + 0d10cs>=5 + 0d6cs>=5`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// advantage => 8
|
||||||
|
let advFormula = "+ 0d8cs>=5"
|
||||||
if(rollData.advantage == "advantage1") {
|
if(rollData.advantage == "advantage1") {
|
||||||
diceFormula += "+ 1d10cs>=5"
|
advFormula = "+ 1d8cs>=5"
|
||||||
}
|
}
|
||||||
if(rollData.advantage == "advantage2") {
|
if(rollData.advantage == "advantage2") {
|
||||||
diceFormula += "+ 2d10cs>=5"
|
advFormula = "+ 2d8cs>=5"
|
||||||
}
|
}
|
||||||
|
diceFormula += advFormula
|
||||||
|
|
||||||
|
// disadvantage => 10
|
||||||
|
let disFormula = "- 0d8cs>=5"
|
||||||
if(rollData.disadvantage == "disadvantage1") {
|
if(rollData.disadvantage == "disadvantage1") {
|
||||||
diceFormula += "- 1d10cs>=5"
|
disFormula = "- 1d8cs>=5"
|
||||||
}
|
}
|
||||||
if(rollData.disadvantage == "disadvantage2") {
|
if(rollData.disadvantage == "disadvantage2") {
|
||||||
diceFormula += "- 2d10cs>=5"
|
disFormula = "- 2d8cs>=5"
|
||||||
}
|
}
|
||||||
|
diceFormula += disFormula
|
||||||
|
|
||||||
|
// armor => 12
|
||||||
let skillArmorPenalty = 0
|
let skillArmorPenalty = 0
|
||||||
for (let armor of rollData.armors) {
|
for (let armor of rollData.armors) {
|
||||||
skillArmorPenalty += armor.data.skillpenalty
|
skillArmorPenalty += armor.data.skillpenalty
|
||||||
}
|
}
|
||||||
if (skillArmorPenalty > 0 ) {
|
if (rollData.skill && rollData.skill.data.armorpenalty && skillArmorPenalty > 0 ) {
|
||||||
rollData.skillArmorPenalty = skillArmorPenalty
|
rollData.skillArmorPenalty = skillArmorPenalty
|
||||||
diceFormula += `- ${skillArmorPenalty}d10cs>=5`
|
diceFormula += `- ${skillArmorPenalty}d8cs>=5`
|
||||||
|
} else {
|
||||||
|
diceFormula += `- 0d8cs>=5`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Performs roll
|
// Performs roll
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
{"_id":"Y4o571K5DQseDaGT","name":"Swim","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Swim.webp","data":{"ability":"str","armorpenalty":true,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Kick you feet and don't forget to breathe!</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"Y4o571K5DQseDaGT","name":"Swim","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Swim.webp","data":{"ability":"str","armorpenalty":true,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Kick you feet and don't forget to breathe!</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
{"_id":"ZfIwXZwaBKaVoYbG","name":"Athletics","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Athletics.png","data":{"ability":"agi","armorpenalty":true,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Your ability to run, jump, and climb; a measure of your physical coordination.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"ZfIwXZwaBKaVoYbG","name":"Athletics","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Athletics.png","data":{"ability":"agi","armorpenalty":true,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Your ability to run, jump, and climb; a measure of your physical coordination.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
{"_id":"cc74gHSQK4hRR8Vj","name":"Brawn","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Brawn.png","data":{"ability":"str","armorpenalty":false,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>A combination of your Size and Strength.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"cc74gHSQK4hRR8Vj","name":"Brawn","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Brawn.png","data":{"ability":"str","armorpenalty":false,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>A combination of your Size and Strength.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
|
{"name":"Axe (Copy)","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/icon_skill.webp","data":{"ability":"agi","armorpenalty":false,"isproficient":true,"isweaponskill":true,"isfeatdie":false,"islore":false,"skilltype":"complex","isinnate":false,"bonusdice":"none","background":0,"basic":0,"class":0,"exp":0,"explevel":0,"description":"","level":2},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{"core":{"sourceId":"Item.Cnw8keaxD1SI3vun"}},"_id":"fJjXMpUILcN983XV"}
|
||||||
{"_id":"fegRI4Vsyr0Us1Ga","name":"Research","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Research.webp","data":{"ability":"int","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Give me a moment to look that up....</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"fegRI4Vsyr0Us1Ga","name":"Research","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Research.webp","data":{"ability":"int","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Give me a moment to look that up....</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
{"_id":"i8eeE2I9vv2kHwdJ","name":"Shadow Lore","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Shadow%20Lore.webp","data":{"ability":"int","armorpenalty":true,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>You can cast Shadow Lore spells.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"i8eeE2I9vv2kHwdJ","name":"Shadow Lore","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Shadow%20Lore.webp","data":{"ability":"int","armorpenalty":true,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>You can cast Shadow Lore spells.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
{"_id":"lfB80K2lFSzQH442","name":"Intuition","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Intuition.png","data":{"ability":"wit","armorpenalty":false,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>I see what you did there. I think you're up to something....</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"lfB80K2lFSzQH442","name":"Intuition","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Intuition.png","data":{"ability":"wit","armorpenalty":false,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>I see what you did there. I think you're up to something....</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
@ -23,4 +24,3 @@
|
|||||||
{"_id":"s2AAQviLttcHul3X","name":"Charm","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Charm.png","data":{"ability":"cha","armorpenalty":false,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Getting someone to do what you want because they want to do it.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"s2AAQviLttcHul3X","name":"Charm","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Charm.png","data":{"ability":"cha","armorpenalty":false,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Getting someone to do what you want because they want to do it.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
{"_id":"xlYUHAUSfQrsjQoi","name":"Survival","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Survival.webp","data":{"ability":"wit","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Help me set this snare and we'll eat like kings in the morning.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"xlYUHAUSfQrsjQoi","name":"Survival","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Survival.webp","data":{"ability":"wit","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Help me set this snare and we'll eat like kings in the morning.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
{"_id":"yAhtkgqf7pKyjJTA","name":"Poison Use","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Poison%20Use.webp","data":{"ability":"dex","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Let me apply this to my blade.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
{"_id":"yAhtkgqf7pKyjJTA","name":"Poison Use","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Poison%20Use.webp","data":{"ability":"dex","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"<p>Let me apply this to my blade.</p>"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
|
||||||
{"name":"Axe (Copy)","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/icon_skill.webp","data":{"ability":"agi","armorpenalty":false,"isproficient":true,"isweaponskill":true,"isfeatdie":false,"islore":false,"skilltype":"complex","isinnate":false,"bonusdice":"none","background":0,"basic":0,"class":0,"exp":0,"explevel":0,"description":"","level":2},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{"core":{"sourceId":"Item.Cnw8keaxD1SI3vun"}},"_id":"fJjXMpUILcN983XV"}
|
|
||||||
|
@ -213,6 +213,6 @@
|
|||||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v0.1.17.zip",
|
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v0.1.17.zip",
|
||||||
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
|
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
|
||||||
"version": "0.1.17",
|
"version": "0.1.18",
|
||||||
"background" : "./images/ui/crucible_welcome_page.webp"
|
"background" : "./images/ui/crucible_welcome_page.webp"
|
||||||
}
|
}
|
||||||
|
@ -19,27 +19,50 @@
|
|||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
{{#if ability}}
|
{{#if ability}}
|
||||||
<li>Ability : {{ability.label}} - {{ability.value}}d6</li>
|
<li>Ability : {{ability.label}} - {{ability.value}}d6
|
||||||
|
({{#each roll.terms.0.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if skill}}
|
{{#if skill}}
|
||||||
<li>Skill : {{skill.name}} - {{skill.data.level}}d8
|
<li>Skill : {{skill.name}} - {{skill.data.level}}d8
|
||||||
{{#if featSL}}
|
{{#if featSL}}
|
||||||
- with Feat SL +{{featSL}}
|
- with Feat SL +{{featSL}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
({{#each roll.terms.2.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (eq advantage "advantage1")}}
|
{{#if (eq advantage "advantage1")}}
|
||||||
<li>1 Advantage Die !</li>
|
<li>1 Advantage Die !
|
||||||
|
({{#each roll.terms.8.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq advantage "advantage2")}}
|
{{#if (eq advantage "advantage2")}}
|
||||||
<li>2 Advantage Dice !</li>
|
<li>2 Advantage Dice !
|
||||||
|
({{#each roll.terms.8.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq advantage "disadvantage1")}}
|
{{#if (eq advantage "disadvantage1")}}
|
||||||
<li>1 Disadvantage Die !</li>
|
<li>1 Disadvantage Die !
|
||||||
|
({{#each roll.terms.10.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq advantage "disadvantage2")}}
|
{{#if (eq advantage "disadvantage2")}}
|
||||||
<li>2 Disadvantage Dice !</li>
|
<li>2 Disadvantage Dice !
|
||||||
|
({{#each roll.terms.10.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq rollAdvantage "roll-advantage")}}
|
{{#if (eq rollAdvantage "roll-advantage")}}
|
||||||
<li>Roll with Advantage !</li>
|
<li>Roll with Advantage !</li>
|
||||||
@ -49,11 +72,19 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if skillArmorPenalty}}
|
{{#if skillArmorPenalty}}
|
||||||
<li>Armor Penalty : {{skillArmorPenalty}} Disadvantage Dice </li>
|
<li>Armor Penalty : {{skillArmorPenalty}} Disadvantage Dice
|
||||||
|
({{#each roll.terms.12.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if hasBonusDice}}
|
{{#if hasBonusDice}}
|
||||||
<li>Skill bonus dice : {{hasBonusDice}} </li>
|
<li>Skill bonus dice : {{hasBonusDice}}
|
||||||
|
({{#each roll.terms.6.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if complexSkillDisadvantage}}
|
{{#if complexSkillDisadvantage}}
|
||||||
@ -61,7 +92,11 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (ne featDieName "none")}}
|
{{#if (ne featDieName "none")}}
|
||||||
<li>Feature Die : d10 ({{featDieName}})</li>
|
<li>Feature Die : d10 ({{featDieName}})
|
||||||
|
({{#each roll.terms.4.results as |die idx|}}
|
||||||
|
{{die.result}}
|
||||||
|
{{/each}})
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<li><strong>Number of successes</strong> {{nbSuccess}} </li>
|
<li><strong>Number of successes</strong> {{nbSuccess}} </li>
|
||||||
|
Loading…
Reference in New Issue
Block a user