Fixes dices issues

This commit is contained in:
sladecraven 2022-08-02 23:33:43 +02:00
parent 277cf7075c
commit 487e00474c
4 changed files with 75 additions and 18 deletions

View File

@ -271,17 +271,22 @@ export class CrucibleUtility {
let actor = game.actors.get(rollData.actorId)
// stat => 0
let diceFormula = String(rollData.ability.value) + "d6cs>=5"
// skill => 2
// feat => 4
// bonus => 6
if (rollData.skill) {
let level = rollData.skill.data.level
if (level == 0 && rollData.skill.data.isfeatdie ) {
rollData.hasSLBonus = true
level += 2
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"
if (rollData.skill.data.skilltype == "complex" && rollData.skill.data.level == 0) {
rollData.complexSkillDisadvantage = true
rollData.rollAdvantage = "roll-disadvantage"
@ -290,32 +295,49 @@ export class CrucibleUtility {
if (rollData.skill.data.level > 0 && rollData.skill.data.isfeatdie) {
rollData.hasFeatDie = true
diceFormula += "+ 1d10cs>=5"
} else {
diceFormula += `+ 0d10cs>=5`
}
if (rollData.skill.data.bonusdice != "none") {
rollData.hasBonusDice = rollData.skill.data.bonusdice
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") {
diceFormula += "+ 1d10cs>=5"
advFormula = "+ 1d8cs>=5"
}
if(rollData.advantage == "advantage2") {
diceFormula += "+ 2d10cs>=5"
advFormula = "+ 2d8cs>=5"
}
diceFormula += advFormula
// disadvantage => 10
let disFormula = "- 0d8cs>=5"
if(rollData.disadvantage == "disadvantage1") {
diceFormula += "- 1d10cs>=5"
disFormula = "- 1d8cs>=5"
}
if(rollData.disadvantage == "disadvantage2") {
diceFormula += "- 2d10cs>=5"
disFormula = "- 2d8cs>=5"
}
diceFormula += disFormula
// armor => 12
let skillArmorPenalty = 0
for (let armor of rollData.armors) {
skillArmorPenalty += armor.data.skillpenalty
}
if (skillArmorPenalty > 0 ) {
if (rollData.skill && rollData.skill.data.armorpenalty && skillArmorPenalty > 0 ) {
rollData.skillArmorPenalty = skillArmorPenalty
diceFormula += `- ${skillArmorPenalty}d10cs>=5`
diceFormula += `- ${skillArmorPenalty}d8cs>=5`
} else {
diceFormula += `- 0d8cs>=5`
}
// Performs roll

View File

@ -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":"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":{}}
{"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":"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.&nbsp; 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":"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":{}}
{"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"}

View File

@ -213,6 +213,6 @@
"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",
"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"
}

View File

@ -19,27 +19,50 @@
<div>
<ul>
{{#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}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if skill}}
<li>Skill : {{skill.name}} - {{skill.data.level}}d8
{{#if featSL}}
- with Feat SL +{{featSL}}
{{/if}}
&nbsp;({{#each roll.terms.2.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if (eq advantage "advantage1")}}
<li>1 Advantage Die !</li>
<li>1 Advantage Die !
&nbsp;({{#each roll.terms.8.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if (eq advantage "advantage2")}}
<li>2 Advantage Dice !</li>
<li>2 Advantage Dice !
&nbsp;({{#each roll.terms.8.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if (eq advantage "disadvantage1")}}
<li>1 Disadvantage Die !</li>
<li>1 Disadvantage Die !
&nbsp;({{#each roll.terms.10.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if (eq advantage "disadvantage2")}}
<li>2 Disadvantage Dice !</li>
<li>2 Disadvantage Dice !
&nbsp;({{#each roll.terms.10.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if (eq rollAdvantage "roll-advantage")}}
<li>Roll with Advantage !</li>
@ -49,11 +72,19 @@
{{/if}}
{{#if skillArmorPenalty}}
<li>Armor Penalty : {{skillArmorPenalty}} Disadvantage Dice </li>
<li>Armor Penalty : {{skillArmorPenalty}} Disadvantage Dice
&nbsp;({{#each roll.terms.12.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if hasBonusDice}}
<li>Skill bonus dice : {{hasBonusDice}} </li>
<li>Skill bonus dice : {{hasBonusDice}}
&nbsp;({{#each roll.terms.6.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
{{#if complexSkillDisadvantage}}
@ -61,7 +92,11 @@
{{/if}}
{{#if (ne featDieName "none")}}
<li>Feature Die : d10 ({{featDieName}})</li>
<li>Feature Die : d10 ({{featDieName}})
&nbsp;({{#each roll.terms.4.results as |die idx|}}
{{die.result}}&nbsp;
{{/each}})
</li>
{{/if}}
<li><strong>Number of successes</strong> {{nbSuccess}} </li>